<!--Use this script to set up Iloha tables for MySQL backend-->

<html>
<head></head>
<body>

<?php
$db = "databasename";
$dbuser = 'dbusername';

$dbhost = 'localhost';

$dbpass = 'dbpassword';

// connecting to MySQL
$conn = mysql_connect($dbhost,$dbuser,$dbpass) or

die("Could not connect to database");
echo "connected to database.<br>";

mysql_select_db($db) or
die ("Could not select database");
echo "selcted database $db.<br>";

// Careful! The mysql.php looks for a table named users, not Ilohausers.

$query1 = "CREATE TABLE Ilohausers (
id mediumint(9) NOT NULL auto_increment,
login varchar(50) NOT NULL,
host varchar(50) NOT NULL,
dateCreated int(12),
lastLogin int(12),
userLevel int(3),
PRIMARY KEY (id),
KEY id (id),
UNIQUE id_2 (id),
KEY login (login),
KEY host (host)
)";

$query2 = "CREATE TABLE contacts (
id mediumint(9) NOT NULL auto_increment,
owner mediumint(9) NOT NULL,
name text,
email text,
email2 text,
grp text,
aim text,
icq text,
phone text,
work text,
cell text,
address text,
url text,
comments text,
PRIMARY KEY (id),
KEY id (id),
KEY owner (owner)
)";

$query3 = "CREATE TABLE sessions (
sid varchar(64) NOT NULL,
login text,
password text,
host text,
path text,
dataID int,
port int,
userLevel int(3),
inTime int(12) NOT NULL,
lastSend int,
numSent int,
PRIMARY KEY sid (sid),
KEY inTime (inTime)
)";

$query4 = "CREATE TABLE colors (
id int NOT NULL,
tool_bg text,
tool_link text,
folder_bg text,
folder_link text,
main_bg text,
main_hilite text,
main_text text,
main_link text,
quotes text,
PRIMARY KEY id (id),
KEY id (id)
)";

$query5 = "CREATE TABLE prefs (
id int NOT NULL,
colorize_quotes char,
detect_links char,
view_max int,
show_size char,
save_sent char,
sent_box_name text,
delete_trash char,
trash_name text,
rootdir text,
user_name text,
email_address text,
signature1 text,
show_sig1 char,
lang text,
charset text,
sort_field text,
sort_order text,
list_folders char,
view_inside char,
timezone int,
html_in_frame char,
show_images_inline char,
PRIMARY KEY (id),
KEY id (id)
)";

$query6 = "CREATE TABLE user_log(
logTime datetime,
logTimeStamp int(12),
userID int,
account text,
action text,
comment text,
ip varchar(15)
)";

mysql_query ($query1) or
die (mysql_error());
echo "created table Ilohausers";
echo "<br>";

mysql_query ($query2) or
die (mysql_error());
echo "created table contacts";
echo "I hope that is what you wanted.";
echo "<br>";

mysql_query ($query3) or
die (mysql_error());
echo "created table sessions";
echo "<br>";

mysql_query ($query4) or
die (mysql_error());
echo "created table colors";
echo "<br>";

mysql_query ($query5) or
die (mysql_error());
echo "created table prefs";
echo "<br>";

mysql_query ($query6) or
die (mysql_error());
echo "created table user_log";
?>

</body>
</html>