<?php
/**********************************************
* Copyright (c) 2006 Roberto Toldo
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
* and associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all copies
* or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
***********************************************/
include ("config.php");
if($install==true && $admin_pass!="")
{
$db = mysql_connect($db_host, $db_user, $db_password);
if ($db == FALSE)
die ("Error, could not connect to database, check file config.php");
mysql_select_db($db_name, $db)
or die ("Error selecting db. Check file config.php");
$query = "CREATE TABLE RTGuestbook (id INT (5) UNSIGNED not null AUTO_INCREMENT, _author VARCHAR (50) not null, _mail VARCHAR (50), _date VARCHAR(10) , _text TEXT not null , PRIMARY KEY (id))";
mysql_query($query, $db)
or die ("Error, could not create table!");
$query = "CREATE TABLE RTGuestbook_auth (_password VARCHAR (100) not null)";
mysql_query($query, $db)
or die ("Error, could not create table!");
$enc = md5($admin_pass);
$query = "INSERT INTO RTGuestbook_auth (_password) VALUES ('$enc')";
mysql_query($query, $db)
or die ("Error, could not create entry!");
echo "Installation completed <br>";
echo "please delete this file... <br>";
echo "use admin.php if you want to change the admin password... <br>";
mysql_close($db);
}
?>
<form name="form1" method="post" action="">
<p>
<input type="password" name="admin_pass">
Admin Password</p>
<p>
<input type="hidden" name="install" value=true>
<input type="submit" name="submit" value="Submit">
</p>
</form>