Location: PHPKode > projects > Prsaar Social Networking Platform > PrsaarColour-0.7.alpha.6.3/pr-inside/install/checkfirst.php
<?php
	// check if config.php exists
	if(empty($Step)) //only when step is not defined
	{
		if(file_exists('./pr-config/config.php'))
		{
			require_once('./pr-config/config.php');
			$Step = 'check_connection';
		}
		else
			$Step = 'start';
	}
	
	//check database connection
	if($Step === 'check_connection')
	{
		if(@mysql_connect(PR_DATABASE_HOST, PR_DATABASE_USER, PR_DATABASE_PASSWORD))
		{
			if(@mysql_select_db(PR_DATABASE_NAME)) //doesn't produces error even without @ !
				$Step = 'check_url';
			else
			{
				$InstallError['database'] = true;
				$Step = 'start';
			}
		}
		else
		{
			$InstallError['connect'] = true;
			$Step = 'start';
		}
	}
	
	if($Step === 'check_url')
	{
		$PrsaarURL = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
		$QMark = strpos($PrsaarURL, '?'); //if there is some 'get' data
		if(!empty($QMark)) 
			$PrsaarURL = substr($PrsaarURL, 0, $QMark);
		$Exclude = strrpos($PrsaarURL, '/');
		if(!empty($Exclude)) 
			$PrsaarURL = substr($PrsaarURL, 0, $Exclude+1);
		if(trim(PR_URL) !== $PrsaarURL)
		{
			if(isset($_POST['url']) && ($_POST['url'] === 'ignore'))
			{
				$Step = 'install';
			}
			else
			{
				$InstallError['url'] = true;
				$Step = 'start';
			}
		}
		else
			$Step = 'install';
	}
?>
Return current item: Prsaar Social Networking Platform