<?
//// MySQL Connection Settings Start
include("config.php");
//// MySQL Connection Settings End
?>
<HTML>
<HEAD>
<TITLE>Installation</TITLE>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" WIDTH="700">
<TR>
<?php if($QUERY_STRING == ""): ?>
<B>First step:</B><BR>
</TD>
You need to make sure that your config.php file has been configured with the MySQL database connection information.
<P><A HREF="<?php echo $PHP_SELF; ?>?test_connection">Done with config.php, go to step 2</A>.
</TD></TR>
<?php elseif($QUERY_STRING == "test_connection"): ?>
<B>Second step:</B><BR>
Checking to make sure that your config.php file has the correct information, and that I am able to successfully access your MySQL database with the given connection information.
</TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="550">
<?php
$connection = mysql_connect("$server", "$db_user", "$db_pass");
$db = mysql_select_db("$database", $connection);
if($db == 0) {
echo "The script tried to connect to the MySQL database, <B>however</B> it was impossible to establish connection.\n";
echo "There are two cases why this happened. The first is that the MySQL server is not open. The second";
echo " case is that you haven't set config.php variables correctly. Please, check the variables again.\n";
echo "<P><A HREF=\"".$PHP_SELF."?test_connection\">Re-check MySQL connection.</A>\n";
echo "<P><A HREF=\"".$PHP_SELF."\">Go back to step 1.</A>\n";
}
else {
echo "The script tried to connect to the MySQL database and the attemp was successful!\n";
echo "<P>You can now head to the final step of the installation, which will create the nessecary tables in MySQL database.\n";
echo "<P><A HREF=\"".$PHP_SELF."?install\">Process with table creation and finish.</A>\n";
}
?>
</TD></TR>
<?php elseif($QUERY_STRING == "install"): ?>
<B>Final step:</B><BR>
Creation of tables.
</TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="550">
<?php
$connection = mysql_connect("$server", "$db_user", "$db_pass");
$db = mysql_select_db("$database", $connection);
$query = "CREATE TABLE adminmessages (
id int(11) NOT NULL auto_increment,
user text NOT NULL,
reason text NOT NULL,
deletedby text NOT NULL,
deletedon text NOT NULL,
warningnum text NOT NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;";
$query2 = "CREATE TABLE contactbook (
id int(11) NOT NULL auto_increment,
username text NOT NULL,
contactuser text NOT NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;";
$query3 = "CREATE TABLE login (
id int(11) NOT NULL auto_increment,
username varchar(250) NOT NULL default '',
password varchar(250) NOT NULL default '',
email varchar(250) NOT NULL default '',
fname varchar(250) NOT NULL default '',
sname varchar(250) NOT NULL default '',
country text NOT NULL,
city text NOT NULL,
interests text NOT NULL,
age text NOT NULL,
dobday text NOT NULL,
dobmonth text NOT NULL,
dobyear text NOT NULL,
iam text NOT NULL,
gender text NOT NULL,
school text NOT NULL,
status text NOT NULL,
aboutu text NOT NULL,
whyjoin text NOT NULL,
hobbies text NOT NULL,
children text NOT NULL,
memberstatus varchar(8) NOT NULL default 'Member',
warned varchar(9) NOT NULL default 'No (0/0)',
PRIMARY KEY (id)
) TYPE=MyISAM;";
$query4 = "CREATE TABLE usermessages (
id int(11) NOT NULL auto_increment,
nomer varchar(250) NOT NULL default '',
from varchar(150) NOT NULL default '',
to varchar(160) NOT NULL default '',
title text NOT NULL,
message text NOT NULL,
date varchar(240) NOT NULL default '',
new varchar(10) NOT NULL default '',
PRIMARY KEY (id)
) TYPE=MyISAM;";
echo "</TD></TR></TABLE></BODY></HTML>\n";
$result = mysql_query($query, $connection);
$result2 = mysql_query($query2, $connection);
$result3 = mysql_query($query3, $connection);
$result4 = mysql_query($query4, $connection);
?>
The installation attempt has been completed!
</TD></TR>
<?php endif; ?>
</TABLE>
</BODY>
</HTML>