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);

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
	<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" />
<? echo "<font face=\"$font_face\" size=\"$font_size\" class=\"$font_class\"><b>PHP Simple FAQ $installation_lang</b></font>"; ?>
<table border="0" width="450" cellspacing="2" cellpadding="2">
	<tr valign="top" align="left">
			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">
							<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>
							<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>
							<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>
							<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>
							<td>&nbsp;<input type="hidden" name="create" value="yes"></td>
							<td><input type="submit" name="Submit" value="<? echo "$install_button_lang"; ?>"></td>
			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";
					// Table structure for table answers
					$answers_check="DROP TABLE IF EXISTS $answer_table";
						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";
					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";
					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";
					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)
					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>";
Return current item: PHP Simple FAQ