Location: PHPKode > projects > Exero CMS > upload/install/install.php
<?
/*========================================*\
| Exero CMS                                |
|==========================================|
|          http://ecms.getox.net           |
|https://sourceforge.net/projects/exerocms/|
|==========================================|
|     Exero CMS is released under the      |
|     GNU General Public License (GPL)     |
| opensource.org/licenses/gpl-license.php  |
\*========================================*/
// Include required files
require("resource/installcore.php");
require("core.php");
if($_POST['step'] >= "2") {
	$db->connect($database['server'],$database['username'],$database['password']);
	$db->selectdb($database['database']);
}

if(empty($_POST['step'])) {
	print_header('',$installinfo['appver']);
	print_form_header($_SERVER['PHP_SELF'],"POST");
	print_form_hiddenfield("step","1");

	print_table_header("Welcome","2");
	print_table_row("This script will install Exero CMS version ".$installinfo['appver'].", Next to install.");
	print_table_footer();

	print_stepinfo("0","Next","",1);

	print_form_footer();
	print_footer();
} else if($_POST['step'] == "1") {
	print_header('',$installinfo['appver']);
	print_form_header("install.php","POST");
	print_form_hiddenfield("step","2");
	
	$db->connect($database['server'],$database['username'],$database['password']);
	$db->selectdb($database['database']);
	
	print_table_header("Step 1 Complete","2");
	print_table_row("Step 1 is complete, You may continue to Step 2.");
	print_table_footer();
	
	print_stepinfo("1","Next Step","Step 1 / $installinfo[steps]<br />$stepinfo[1]");
	
	print_form_footer();
	print_footer();
} else if($_POST['step'] == "2") {
	require("resource/install_create_tables.php");
	print_header('',$instllinfo['appver']);
	print_form_header("install.php","POST");
	print_form_hiddenfield("step","3");
	
	$tablescreated = 0;
	foreach($table as $table) {
		$tablescreated++;
		$db->query($db_table[$tablescreated]);
		print("Table <code>".$table."</code> created...<br />");
	}
	print "<br />";

	print_stepinfo("2","Next Step","Step 2 / $installinfo[steps]<br />$stepinfo[2]");
	
	print_form_footer();
	print_footer();
} else if($_POST['step'] == "3") {
	require("resource/install_insert_data.php");
	print_header('',$installinfo['appver']);
	print_form_header("install.php","POST");
	print_form_hiddenfield("step","4");
	
	foreach($querys as $query) {
		$db->query($query);
	}
	print_table_header("Step 3 Complete","2");
	print_table_row("Step 3 is complete, You may continue to Step 4.");
	print_table_footer();

	print_stepinfo("3","Next Step","Step 3 / $installinfo[steps]<br />$stepinfo[3]");
	
	print_form_footer();
	print_footer();
} else if($_POST['step'] == "4") {
	print_header('',$installinfo['appver']);
	print_form_header("install.php","POST");
	print_form_hiddenfield("step","5");
	
	print_table_header("Site Settings","2");
	print_table_optiontitle("Site Name",'$ecms->settings[sitetitle]','2');
	print_form_textbox("Site Title","sitetitle","Exero CMS");
	print_table_optiontitle("Search Engine Optimization",'','2');
	print_form_yesno("SEO Friendly URLs","mod_rewrite",1);

	print_table_optiontitle("Cookie Domain",'$ecms->settings[cookiedomain]','2');
	print_form_textbox("The domain on which you want the cookie to have effect.<br>If you want this to affect all of example.com rather than just <strong>portal.example.com</strong>, enter <strong>.example.com</strong> here <strong>(note the 2 dots!!)</strong>. You can leave this setting blank.","cookiedomain","");
	print_table_optiontitle("Cookie Path",'$ecms->settings[cookiepath]','2');
	print_form_textbox("The path that the cookie is saved to.<br>If you run more than one copy of ecms on the same domain, it will be necessary to set this to the directory this copy is installed in. Otherwise, just leave it as / .<br><strong>Note: This must ALWAYS end with a forward slash.</strong>","cookiepath","/");
	print_table_footer();

	print_stepinfo("4","Next Step","Step 4 / $installinfo[steps]<br />$stepinfo[4]");
	
	print_form_footer();
	print_footer();
} else if($_POST['step'] == "5") {
	$db->query("UPDATE settings SET value='".$db->real_escape_string($_POST['sitetitle'])."' WHERE setting='sitetitle'");
	$db->query("UPDATE settings SET value='".$db->real_escape_string($_POST['cookiepath'])."' WHERE setting='cookiepath'");
	$db->query("UPDATE settings SET value='".$db->real_escape_string($_POST['cookiedomain'])."' WHERE setting='cookiedomain'");
	$db->query("UPDATE settings SET value='".$db->real_escape_string($_POST['mod_rewrite'])."' WHERE setting='mod_rewrite'");
	
	print_header('',$installinfo['appver']);
	print_form_header("install.php","POST");
	print_form_hiddenfield("step","6");
	
	print_table_header("User Account Info","2");
	print_table_optiontitle("Enter the details for the Administrators Account",'','2');
	print_form_textbox("Username","username","Admin");
	print_form_passbox("Password","password","");
	print_form_textbox("Email","email","you@".$_SERVER['HTTP_HOST']);
	print_table_footer();

	print_stepinfo("5","Next Step","Step 5 / $installinfo[steps]<br />$stepinfo[5]");
	
	print_form_footer();
	print_footer();
} else if($_POST['step'] == "6") {
	$db->query("INSERT INTO users VALUES('','".$db->real_escape_string($_POST['username'])."','".md5($_POST['password'])."','".$db->real_escape_string($_POST['email'])."','1','','Administrator','','','','','')");
	print_header('',$installinfo['appver']);
	
	print_table_header("Final Step","2");
	print_table_row("CHMOD the images/customavatars/ directory to 777.<br />After that delete this file (install/install.php) for safety.");
	print_table_footer();
	
	print_footer();
}
?>
Return current item: Exero CMS