Location: PHPKode > projects > PHP Simple FAQ > phpsimplefaq1.1beta/phpsimplefaq/install.php
<? 

// PHP Simple FAQ Install page v1.0
include "config.inc.php"; 
if ($create == "yes") 

	{
		if (($user_password != $user_password_check) || (!$user_name) || (!$user_email))
			
			{ 
				$error = "$password_check_error<br>";
				$create = "";
			}
		$user_md5 = md5($user_password);
		setcookie("php_simplefaq_email","$user_email",time()+6604800,"/","$absolute_url",0);
		setcookie("php_simplefaq_pass","$user_md5",time()+6604800,"/","$absolute_url",0);
		setcookie("php_simplefaq_name","$user_name",time()+6604800,"/","$absolute_url",0);
	}
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<head>
	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
	<title><? echo "$main_title $installation_lang"; ?></title>
	<link rel="stylesheet" type="text/css" href="main/style.css" />
</head>
<body>
<br>
<center>
<? echo "<font face=\"$font_face\" size=\"$font_size\" class=\"$font_class\"><b>PHP Simple FAQ $installation_lang</b></font>"; ?>
<br>
<br>
<table border="0" width="450" cellspacing="2" cellpadding="2">
	<tr valign="top" align="left">
		<td>
			<?
			
			if (!$create) 
				
				{
					echo "<font face=\"$font_face\" size=\"$font_size\" class=\"$font_class\">";
					if ($error) echo "<font color=\"red\">$error</font>\n";
					echo "$config_check_lang <b>config.inc.php</b>.<br>\n";
			?>
					<form action="install.php" method="post">
					<table border="0" width="450" cellspacing="2" cellpadding="2">
						<tr>
							<td width=150><? echo "<font face=\"$font_face\" size=\"$font_size\" class=\"$font_class\">$admin_name_lang:</font></td>"; ?>
							<td width=300><input type="text" name="user_name" size="30"></td>
						</tr>
						<tr>
							<td><? echo "<font face=\"$font_face\" size=\"$font_size\" class=\"$font_class\">$admin_password_lang:</font></td>"; ?>
							<td><input type="password" name="user_password" size="30"></td>
						</tr>
						<tr>
							<td><? echo "<font face=\"$font_face\" size=\"$font_size\" class=\"$font_class\">$admin_confirm_lang:</font></td>"; ?>
							<td><input type="password" name="user_password_check" size="30"></td>
						</tr>
						<tr>
							<td><? echo "<font face=\"$font_face\" size=\"$font_size\" class=\"$font_class\">$admin_email_lang:</font></td>"; ?>
							<td><input type="text" name="user_email" size="30"></td>
						</tr>
						<tr>
							<td>&nbsp;<input type="hidden" name="create" value="yes"></td>
							<td><input type="submit" name="Submit" value="<? echo "$install_button_lang"; ?>"></td>
						</tr>
					</table><br>
					</form>
			<?	
				}
				
			if ($create == "yes") 
				
				{
					// Create the Database
					$create_db_sql="CREATE DATABASE IF NOT EXISTS $database_name";
					mysql_query($create_db_sql, $connection);
					echo "<font face=\"$font_face\" size=\"$font_size\" class=\"$font_class\">";
					echo "$the_database_lang $database_name $has_been_lang<br><br>\n";
					mysql_close();
					
					// Table structure for table answers
					$answers_check="DROP TABLE IF EXISTS $answer_table";
					$sql_answers="
						CREATE TABLE $database_name.$answer_table (
						  answer_id smallint(4) NOT NULL auto_increment,
						  answer text NOT NULL,
						  answer_date date NOT NULL default '0000-00-00',
						  answer_user tinytext NOT NULL,
						  answer_rating tinyint(4) NOT NULL default '0',
						  answer_viewed tinyint(4) NOT NULL default '0',
						  q_id smallint(6) NOT NULL default '0',
						  PRIMARY KEY  (answer_id)
						) TYPE=MyISAM";
					$result1 = mysql_query($sql_answers, $connection);
					if ($result1) echo "$the_table_lang $answer_table $has_been_lang<br>\n";
					
					
					// Table structure for table categories
					$categories_check="DROP TABLE IF EXISTS $category_table";
					$sql_categories="
					CREATE TABLE $database_name.$category_table (
					  cat_id smallint(6) NOT NULL auto_increment,
					  category text NOT NULL,
					  faq_id tinyint(4) NOT NULL default '0',
					  category_creator tinyint(4) NOT NULL default '0',
					  PRIMARY KEY  (cat_id)
					) TYPE=MyISAM";
					$result2 = mysql_query($sql_categories, $connection);
					if ($result2) echo "$the_table_lang $category_table $has_been_lang<br>\n";
					
					
					// Table structure for table faq
					$faq_check="DROP TABLE IF EXISTS $faq_table";
					$sql_faq="
					CREATE TABLE $database_name.$faq_table (
					  faq_id tinyint(4) NOT NULL auto_increment,
					  faq_title text NOT NULL,
					  faq_creator tinyint(4) NOT NULL default '0',
					  PRIMARY KEY  (faq_id)
					) TYPE=MyISAM";
					$result3 = mysql_query($sql_faq, $connection);
					if ($result3) echo "$the_table_lang $faq_table $has_been_lang<br>\n";
					
					
					// Table structure for table questions
					$questions_check="DROP TABLE IF EXISTS $question_table";
					$sql_questions="
					CREATE TABLE $database_name.$question_table (
					  question_id int(11) NOT NULL auto_increment,
					  question text NOT NULL,
					  posted_by tinytext NOT NULL,
					  posted_date date NOT NULL default '0000-00-00',
					  rating tinyint(4) NOT NULL default '0',
					  been_seen tinyint(4) NOT NULL default '0',
					  cat_id tinyint(4) NOT NULL default '0',
					  PRIMARY KEY  (question_id)
					) TYPE=MyISAM";
					$result4 = mysql_query($sql_questions, $connection);
					if ($result4) echo "$the_table_lang $question_table $has_been_lang<br>\n";
					
					
					// Table structure for table users
					$users_check="DROP TABLE IF EXISTS $user_table";
					$sql_users="CREATE TABLE $database_name.$user_table (
					  user_id int(11) NOT NULL auto_increment,
					  user_name mediumtext NOT NULL,
					  user_email mediumtext NOT NULL,
					  user_admin tinytext NOT NULL,
					  user_password text NOT NULL,
					  PRIMARY KEY  (user_id)
					) TYPE=MyISAM";
					$result5 = mysql_query($sql_users, $connection);
					if ($result5) echo "$the_table_lang $user_table $has_been_lang<br><br>\n";
					
					
					// Add the administrator's information
					$user_admin = "Yes";
					$sql_admin = "INSERT INTO $database_name.$user_table
								  (user_name, user_email, user_admin, user_password)
								  VALUES
								  ('$user_name','$user_email','$user_admin','$user_md5')";
					mysql_query($sql_admin, $connection);
					
					
				}
			
			echo "$remove_lang<br>\n";
			if ($create) 
			
				{
					echo "$proceed_lang <a class=\"psf\" href=\"admin.php\">$admin_index</a>.";
				}
				
			echo "</font>";
			?>
		</td>
	</tr>
</table>
</body>
</html>
Return current item: PHP Simple FAQ