Location: PHPKode > projects > Simple Comments > comments/install.php
<title>Comments Page Installation</title>
<html>
<p align="center">
<b>Comments Page Installation</b><br><br>
<form method="post">
<p align="center">
Database Address:<br><input type="text" name="dbaddress" value="localhost"><br>
Username:<br><input type="text" name="dbuser"><br>
Password:<br><input type="password" name="dbpass"><br>
Database Name:<br><input type="text" name="dbname"><br><br>
<input type="hidden" name="install" value="1">
<input type="submit" value="Install">
<br><br>
</form> 
</html>

<?php

$dbaddress = @$_POST["dbaddress"];
$dbuser = @$_POST["dbuser"];
$dbpass = @$_POST["dbpass"];
$dbname = @$_POST["dbname"];
$install = $_POST['install'];

if ($install==1) {

$values = "\r\n";
$values .= "\$dbaddress=\"$dbaddress\";\r\n";
$values .= "\$dbuser=\"$dbuser\";\r\n";
$values .= "\$dbpass=\"$dbpass\";\r\n";
$values .= "\$dbname=\"$dbname\";\r\n";

$fp = @fopen("config.php", "w") or die("Couldn't find config.php");
fwrite($fp, "<?");
fwrite($fp, $values) or die("Couldn't write values to config.php");
fwrite($fp, "?>");

mysql_connect($dbaddress,$dbuser,$dbpass);
mysql_query("CREATE DATABASE $dbname");
@mysql_select_db($dbname) or die( "Unable to select database");
$query="CREATE TABLE comments (id int(6) NOT NULL auto_increment,name varchar(25) NULL,email varchar(25) NULL,timedate varchar(25) NULL,message text NULL,ip varchar(15) NULL,PRIMARY KEY (id),UNIQUE id (id),KEY id_2 (id))";
mysql_query($query);
$query="CREATE TABLE banip (id int(6) NOT NULL auto_increment,ip varchar(15) NULL,PRIMARY KEY (id),UNIQUE id (id),KEY id_2 (id))";
mysql_query($query);

mysql_close();
$path="install.php";
unlink($path); 
@fclose($fp);
?>
<p align="center">
Installation Complete.<br><br>
If you want to change the title and page name, edit header.php
<br><br><a href="./">Continue to comments page</a>
<?
}
Return current item: Simple Comments