Location: PHPKode > projects > Comic Pub > comicpub/install_work.php
<?php

$install = $_POST['install']; 
global $install;

$message = array(); // this is the array of messages to be displayed on successful completion of installation
	
//test for mysql user name	
	if(!$install[uname]){
		die("No mySQL user name entered.");
	} else {
		$message[] = 'Using <i>\'' . $install[uname] . '\'</i> for mySQL user name.';
	}

//test for entered mysql password	
	if(!$install[upass]){
		die("No mySQL password entered.");
	} else {
		$message[] = 'Using mySQL password.';
	}

//localhost?
	if(!$install[host]){
		die("No host selected for mySQL host.");
	} else {
		$message[] = 'Using <i>\'' . $install[host] . '\'</i> for host.';
	}

//does entered mysql ish even work?
	if(!$link = @mysql_connect("$install[host]", "$install[uname]", "$install[upass]")){
		die("MySQL name & password not a valid combination. mysql said:<BR>\n" . mysql_error());
	} else {
		$message[] = "MySQL test Passed.";
	}
	
//test for databse table prefix	
	if(!$install[prefix]){
		$message[] = 'No prefix used';
	} else {
		$message[] = 'Using \'' . $install[prefix] . '\' as prefix for mySQL tables.';
	}

//check administrator password
	if(($install[adminpass] !== $install[adminpass_2]) || (!$install[adminpass] && $install[adminpass_2]) || $install[adminpass_2] == '' || $install[adminpass] == ''){
		die("Administrator passwords do not match or not entered.");
	} else {
		$message[] = 'Using administrator password';
	}

//check for admin name
	if(!$install[adminname]){
		die("No administrator name entered.");
	} else {
		$message[] = 'Using <i>\'' . $install[adminname] . '\'</i> as name.';
	}

//check paths
	if(!$install[poolpath]){
		die("No pool path selected");
	} else {
		$install[poolpath] = stripslashes($install[poolpath]); 	//remove slashes that will be put in because of directories
		$message[] = 'Using <i>\'' . $install[poolpath] . '\'</i> as pool path.';
	}
	if(!$install[homepath]){
		die("No home path selected");
	} else {
		$install[homepath] = stripslashes($install[homepath]); 	//remove slashes that will be put in because of directories
		$message[] = 'Using <i>\'' . $install[homepath] . '\'</i> as site path.';
	}
	
//absolute url? w00t done!
	if(!$install[absurl]){
		die("No absolute URL specified");
	} else {
		$message[] = 'Using <i>\'' . $install[absurl] . '\'</i> as absolute URL to site.';
	}

//absolute url? w00t done!
	if(!$install[viewing]){
		die("No viewing page specified");
	} else {
		$message[] = 'Using <i>\'' . $install[absurl] . '\'</i> as viewing page.';
	}
	
	echo "You are good to install. Here is a list of your current configuration:";
	
	$do = array();
	$do[] = '<?php';
	$do[] = '//list of variables';
	foreach($install as $in){
		$do[] = '
	}	
?>
Return current item: Comic Pub