<?php
/**
* This script was made by MOD-Shadow of rmb-scripting.com
* DO NOT REMOVE
*/
session_start(); //allow sessions.
$step = (int)$_GET['step']; //current step for INT Only.
if (!$step || empty($step) || $step == '1') { //check if $step is nul or the step is 1
print "<p>
Welcome to the User System Installation script tutorial x] To begin, Click the link below.
<a href=\"install.php?step=2\">Database Information</a>
</p>"; //simple welcome mesage with link to step 2
exit(); //go no further
} //end welcome
if ($step == '2') { //database setup x]
if (!$_POST['db_setup']) { //form wasn't submitted
print "<h2>Database Setup</h2>
<form method=\"post\" action=\"$_SERVER[PHP_SELF]?step=2\">
<p>
<label>DB Host</label>
<input type=\"text\" name=\"host\" value=\"localhost\" size=\"15\" />
<label>DB Username</label>
<input type=\"text\" name=\"user\" value=\"root\" size=\"15\" />
<label>DB Password</label>
<input type=\"password\" name=\"pass\" value=\"\" size=\"15\" />
<label>DB Name</label>
<input type=\"text\" name=\"name\" value=\"\" size=\"15\" />
<input type=\"submit\" name=\"db_setup\" value=\"Submit Details\" />
</p>
</form>"; //echo the form x]
exit(); //go no further
} else { //it was x]
$host = $_POST['host']; //the DB Host
$user = $_POST['user']; //DB User
$pass = $_POST['pass']; //DB Pass
$name = $_POST['name']; //DB Name
$errors = array(); //array for errors x]
if (empty($host)) { //if host is empty
$errors[] = "You Must Enter A Host."; //our error
} //end host check
if (empty($user)) { //user check
$errors[] = "You Must Enter A Username"; //:O Invalid username!
} //end user check
if (empty($pass)) { //check password.
$errors[] = "You Must Enter a Password"; //the error
} //end pass check
if (empty($name)) { //database name check
$errors[] = "You Must Enter a Database Name"; //You Fail. O_o
} //end db name check
if (count($errors) > 0) { //if theres more then 0 errors
print "<h2>Errors Found!</h2>
<p>"; //error header
foreach ($errors as $err) { //foreach error
print $err . ''; //print them out
} //end loop
print "</p>"; //end paragraph x]
exit(); //go no further
} else { //YAY No Errors
$connect = @mysql_connect($host, $user, $pass); //test our information
if (!$connect) { //didnt work :(
$con_test = "<span style=\"color:red\">False</span>"; //our connect status
$cerror = true; //return a true for error
} else { //it worked!!!
$con_test = "<span style=\"color:green\">Green</span>"; //connect stats
$cerror = false; //returns false for error.
} //end error check
$dbtest = @mysql_select_db($name, $connect);
if (!$dbtest) { //didnt work :(
$db_test = "<span style=\"color:red\">False</span>"; //our db test status
$derror = true; //return a true for error
} else { //it worked!!!
$db_test = "<span style=\"color:green\">Green</span>"; //db test stats
$derror = false; //returns false for error.
} //end error check
print "<table>
<tr>
<td width=\"150\">
<strong>Connection Stats</strong>
</td>
<td width=\"150\">
$con_stats
</td>
</tr>
<tr>
<td width=\"150\">
<strong>DB Stats</strong>
</td>
<td width=\"150\">
$db_stats
</td>
</tr>
</table>"; //our stats in a nice table.
if ($cerror) { //if connect error
print "<h2>Connection Error</h2>
<p>
Connection failed. Please go back and check your details.
<a href=\"javascript:history.go(-1);\">Go Back</a>
</p>"; //lets tell them
exit(); //go no further
} //end connect error
if ($derror) { //dbtest error obviously going to be true if connect is true.
print "<h2>Database Error</h2>
<p>
Could not connect to database. Attempting to create.....
<a href=\"javascript:history.go(-1);\">Go Back</a>
</p>"; //tell them they made a boo boo
$create_db = @mysql_query("CREATE DATABASE `$name`");
if (!$create_db) {
print "<p>
Database Creation Failed.
</p>";
}
exit(); //go no further
} //end db test error.
if (!$cerror && !$derror) { //No Error found!!!!!!!!!!
$conf_handle = fopen('config.php', 'w+');
$data = "<?php
session_start(); //allows session
\$connect = @mysql_connect($host,$user,$pass);
\$db = @mysql_select_db(\$db,\$connect);
\$logged = @mysql_query(\"SELECT * FROM `members` WHERE `id` = '\$_SESSION[id]' AND `password` = '\$_SESSION[password]'\");
\$logged = @mysql_fetch_array(\$logged);
//some server details, don't edit!
\$host = \$_SERVER['HTTP_HOST'];
\$self = \$_SERVER['PHP_SELF'];
//change this to your site name
\$sitename = \"My Site\";
//Send emails or not (email activation). 1 = true, 0 = false
\$semail = \"1\";
?>";
$write = @fwrite($conf_handle, $data);
if ($write) {
print "<h2>Success</h2>
<p>
Config File Created! To continue the installation please click the link below.
<span style=\"color:red\">NOTICE: PLEASE CHMOD CONFIG FILE TO 0644</span>
<a href=\"install.php?step=3\">Setup Tables</a>
</p>";
exit(); //go no further.
} else {
print "<h2>Error</h2>
<p>
Config File Creation Failed. Please check and make sure your CHMOD Perms are 0777 before performing this step again.
<a href=\"javascript:history.go(-1);\">Go Back</a>
</p>";
exit(); //go no further
} //end write check
} //end no error check
} //end error check
} //end form submit check
} //end step check
if ($step == '3') {
require("config.php"); //require newly found config.php x]
$create_members = mysql_query("CREATE TABLE `members` (
`id` int(11) NOT NULL auto_increment,
`username` varchar(30) NOT NULL default '',
`password` varchar(255) NOT NULL default '',
`email` varchar(55) NOT NULL default '',
`location` varchar(40) NOT NULL default 'N/A',
`userlevel` int(3) NOT NULL default '1',
`age` int(3) NOT NULL,
`sex` varchar(40) NOT NULL default 'N/A',
PRIMARY KEY (`id`)
) TYPE=MyISAM;"); //create our members table...or...attempt to.....
$create_verification = mysql_query("CREATE TABLE `verification` (
`id` int(11) NOT NULL auto_increment,
`username` varchar(30) NOT NULL default '',
`code` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE = MYISAM;"); //attempt to create verification table
if(!$create_members){ //members check
$mem_stats = "<span style=\"color :red;\">False</span>"; //our stats
$merror = true; //OH NO
}else{ //no error
$mem_stats = "<span style=\"color:green;\">True</span>"; //GREEN!!!
$merror = false; //no error
} //end check
if(!$create_verification){ //error found
$pms_stats = "<span style=\"color:red;\">False</span>"; //red false
$verror = true; //true for error
}else{ //or not?
$pms_stats = "<span style=\"color:green;\">True</span>"; //its good to go
$verror = false; //no error
}
print "<table width=\"200\">
<tr>
<td width=\"150\">
<strong>Members</strong>
</td>
<td width=\"50\">
$mem_stats
</td>
</tr>
<tr>
<td width=\"150\">
<strong>Verification</strong>
</td>
<td width=\"50\">
$ver_stats
</td>
</tr>
</table>"; //nice table x]
if($merror){ //error in members
print "<p>
members Table Creation Failed!
Please Use <a href=\"https://$host:2082/3rdparty/phpMyAdmin/index.php\">phpMyAdmin</a> To Create the table.
</p>"; //tell them and give link to Cpanel.
exit(); //go no further
} //end members error
if($verror){ //verification error
print "<p>
verification Table Creation Failed!
Please Use <a href=\"https://$host:2082/3rdparty/phpMyAdmin/index.php\">phpMyAdmin</a> To Create the table.
</p>"; //give link to cpanel and such
exit(); //go no further
} //end verification error
if(!$merror && !$verror){ //no errors
print "<h2>Success</h2>
<p>
Tables Created!
<a href=\"install.php?step=4\">Admin Setup</a>
</p>"; //success!!!!
exit(); //go no further
}
} //end step check
if ($step == '4') { //step 4 YAYZZ
require("config.php"); //get config
if(!$_POST['admin_setup']){ //form not submitted
print "<form method=\"post\" action=\"$_SERVER[PHP_SELF]?step=4\">
<p>
<label>Admin Username</label>
<input type=\"text\" name=\"user\" size=\"15\" />
<label>Admin Password</label>
<input type=\"password=\" name=\"pass\" size=\"15\" />
<label>Admin Email</label>
<input type=\"text\" name=\"mail\" size=\"15\" />
<input type=\"submit\" name=\"admin_setup\" value=\"Save Admin\" />
</p>
</form>"; //submit form.
}else{ //form submitted
$username = $_POST['user']; //our username
$password = sha1(md5(md5(sha1(md5(sha1(sha1(md5($_POST['pass'])))))))); //secure pass
$email = $_POST['mail']; //the admin email
if(empty($username) || empty($password) || empty($email)){ //check for empty field
print "<h2>Error</h2>
<p>
You Must Fill Out All Fields!
</p>"; //give error
exit(); //go no further
}else{ //no error
$insert = mysql_query("INSERT INTO `members` (`username`,`password`,`email`,`userlevel`) VALUES ('$username','$password','$email','6');"); //insert admin data.
if($insert){ //check if error
print "<h2>Success</h2>
<p>
Admin User Setup!
<a href=\"install.php?step=5\">Finish</a>
</p>"; //no error found
exit(); //go no further
}else{ //insert failed.
print "<h2>Error</h2>
<p>
Error Returned: ".mysql_error()."
</p>"; //you have an error!!!
exit(); //go no further.
} //no error.
}//end error check
} //end form check
} //end step check
if ($step == '5') { //FINAL STEP WOOHOO
print "<h2>Complete!</h2>
<p>
Setup Complete! Please delete this file and CHMOD config.php back to 0644 so hackers can not attack your website.
</p>"; //give finished message
chmod("config.php", '0644'); //chmod the config to 0644 if not done already.
unlink("install.php"); //delete install file.
} //end step check x]
?>
Parse error: syntax error, unexpected ',', expecting ')' in /home/sites/sthelensclubberz.co.uk/public_html/config.php on line 5
any help would be brillant
$errors[] = "You Must Enter A Host."; //our error
} //end host check
if (empty($user)) { //user check
$errors[] = "You Must Enter A Username"; //:O Invalid username!
} //end user check
if (empty($pass)) { //check password.
$errors[] = "You Must Enter a Password"; //the error
} //end pass check
if (empty($name)) { //database name check
$errors[] = "You Must Enter a Database Name"; //You Fail. O_o
} //end db name check
i put my host in along with username and password and comes up with
Errors Found!
FractixPaulbigandbanginweb176-website
any help would be great
You should put up on the downloads so that people can download insteada copying n pasting :P
Best part of like a few script. thats why plus news one is better than the script itself :p
:(