How to install Laravel’s October CMS

Introduction of OctoberCMS:
Friends today i’m going to tell you about OctoberCMS, and how to install it. Here’s two way to download latest OctoberCMS Master files.1. via this link:- https://github.com/octobercms/october/archive/master.zip
Untitled-1
2. via this link:- https://github.com/octobercms/install/archive/master.zip
cms2
For installation, first download the master file of OctoberCMS  from the given above links and extract it. copy that extract folder in xampp/htdocs folder . now start the xampp server on your system, open the browser and type this path localhost/install-master/install.php , and it will show you the October system check page. you must remember one thing that your computer must have internet connection. This October system check page automatically will check the system configuration and it will pass green right marks with headings. if it is showing red cross marks in these headings then read headings and trying to solves them. Now click on agree & continue.
home
before we start with next page, we need to create database on our local server. now fill all details of your database then click on administrator, here create your profile and click on continue. now you will October packages page. here the first option is plugins , here you can choose plugins from the below list and add it.
plugins
now click on Use a project, here it will demand a project id for add project.
 project
 for the project id you have to create an account on http://octobercms.com/account/register and create project. when you complete your project then copy the project id from here and paste it.
 project-id
 now click on continue and it will start downloading programme files

 

 

 

 

 

 

Laravel installation

Introduction of Laravel:
Laravel is a web application framework with expressive, elegant syntax. Basically, a web framework makes it easier  for you to develop your application. Most sites have a common set of functionality (like handling sessions, data validation, etc) and a framework is  that prevents you from re-writing this each time. For start with laravel..first we need to install composer in our system. We can download it from this link:-  getcomposer.org
composer-download
Download and install Composer-Setup.exe  for windows. During the composer installation we must pay attention on this shell menus as showing following screenshot.
composer-alert
when the composer has installed. After it there is two way to install laravel.1. First via laravel installer, In this method we need to download Laravel Installer PHAR archive file. After download, Copy laravel.phar in your specified folder xampp/htdocs/laravel .For first time use, open cmd and type the following command :-php  xampp/htdocs/laravel/laravel.phar new test_laravel .  test_laravel is the project name that you want to create. This will make a test_laravel folder in your specified location:-  xampp/htdocs/laravel Now you can work with laravel.

2. In the second method, we need to download Laravel latest version from this link  http://laravel.com/docs/installation 

laravel-download
when download has completed, extract it and paste all the contents  in specific directory  xampp/htdocs/laravel when you have done all the steps then run xampp server or start Apache & MySQL  and go to your  browser and set this path :-localhost/laravel/public
laravel-complete
 if  you will see this page on your browser, it means you have properly done your laravel installation. Now you can work with laravel.

Deny Proxy Server via .htaccess

If you put this in your .htaccess file. you will disable the Proxy access

RewriteCond %{HTTP:VIA} !^$ [OR]
RewriteCond %{HTTP:FORWARDED} !^$ [OR]
RewriteCond %{HTTP:USERAGENT_VIA} !^$ [OR]
RewriteCond %{HTTP:X_FORWARDED_FOR} !^$ [OR]
RewriteCond %{HTTP:PROXY_CONNECTION} !^$ [OR]
RewriteCond %{HTTP:XPROXY_CONNECTION} !^$ [OR]
RewriteCond %{HTTP:HTTP_PC_REMOTE_ADDR} !^$ [OR]
RewriteCond %{HTTP:HTTP_CLIENT_IP} !^$
RewriteRule ^(.*)$ – [F]

All Browser Shadow Effect in DIV

Here is code that display shadow effect of all browser.
I tested in Firefox, Crome, Safari, IE7

<div style=”position:absolute;width:240px;height:160px;background:#f6dd28;
-moz-box-shadow:2px 2px 2px #c1c1c1;-webkit-box-shadow:2px 2px 2px #c1c1c1;box-shadow:2px 2px 2px #c1c1c1;
filter:progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color=’#c1c1c1′, Positive=’true’)”></div>

Get visitors IP address with help of PHP

Function to get the IP


< ?php
function getIpAddr() {
	$ip = (empty($_SERVER['HTTP_CLIENT_IP']) ? 
			(empty($_SERVER['HTTP_X_FORWARDED_FOR']) ? 
				$_SERVER['REMOTE_ADDR'] : 
				$_SERVER['HTTP_X_FORWARDED_FOR']) : 
			$_SERVER['HTTP_CLIENT_IP']);
	if(strpos($ip, ",") > 0) {
		return strstr($ip, ',', true);
	} else {
		return $ip;
	}
}
?>

Get Browser Information with PHP Class

Here is class in PHP to get Browser Information

< ?php
class Browser{
    private $props    = array("Version" => "0.0.0", "Name" => "unknown", "Agent" => "unknown") ;
    public function __Construct()    {
        $browsers = array("firefox", "msie", "opera", "chrome", "safari",
                            "mozilla", "seamonkey",    "konqueror", "netscape",
                            "gecko", "navigator", "mosaic", "lynx", "amaya",
                            "omniweb", "avant", "camino", "flock", "aol");
        $this->Agent = strtolower($_SERVER['HTTP_USER_AGENT']);
        foreach($browsers as $browser) {
            if (preg_match("/($browser)[/ ]?([0-9.]*)/", $this->Agent, $match)) {
                $this->Name = $match[1] ;
                $this->Version = $match[2] ;
                break ;
            }
        }
    }
    public function __Get($name)  {
        if (!array_key_exists($name, $this->props)) {
            die ("No such property or function ". $name) ;
        }
        return $this->props[$name] ;
    }
    public function __Set($name, $val)    {
        if (!array_key_exists($name, $this->props)) {
            SimpleError("No such property or function.", "Failed to set $name", $this->props) ;
            die ;
        }
        $this->props[$name] = $val ;
    }
}
/* Usage of class */
$browser=new Browser;
echo $browser->Name;
?>

Get Apache Memory Usage by PHP

Here is function from where we can get memory usage of Apache

< ?php
function getApacheMemoryUsuage(){
$output=array();
$pid=getmypid();
if(substr(PHP_OS,0,3)=='WIN'){
	exec('tasklist',$output);
	foreach($output as $value){
		$ex=explode(" ",$value);
		$count_ex=count($ex);
		if(preg_match("/ ".$pid ." Console/",$value)){
			return($ex[$count_ex-2]*1024*1024);
		}
	}
} else{
	// Get Total Memory in System
	exec("cat /proc/meminfo | grep MemTotal",$rawTotalMem);
	$totalMemory=explode(":",$rawTotalMem[0]);
	$totalMem=(int)$totalMemory[1];

	exec("ps aux | grep $pid",$output);
	foreach($output as $value){
		$ex=explode(" ",$value);
		$count_ex=count($ex);
		if(preg_match("/apache2/",$value)){
			$processMemoryPer=(($totalMem*$ex[6])/(1024*100));
			return $processMemoryPer*1024;
		}
	}
}
}
?>

Convert Bytes to the Appropriate Format (Bytes, KB, MB, GB) in PHP

Here is function to convert bytes to the appropriate format

< ?php
function byteFormat($bytes,$unit="",$decimals=2){
$units=array('B'=>0,'KB'=>1,'MB'=>2,'GB'=>3,
	    'TB'=>4,'PB'=>5,'EB'=>6,'ZB'=>7,'YB'=>8);
$value=0;
if ($bytes>0) {
	if (!array_key_exists($unit,$units)){
		$pow=floor(log($bytes)/log(1024));
		$unit=array_search($pow,$units);
	}
	$value=($bytes/pow(1024,floor($units[$unit])));
}
if (!is_numeric($decimals) || $decimals<0){
	$decimals=2;
}
return sprintf('%.'.$decimals.'f '.$unit,$value);
}
?>