<?php
/******************************************************************
* $Id: sm_install.php,v 1.7 2003/06/29 18:56:17 allowee Exp $
*
* Copyright (C) 2001-2003 PMS Dev Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* The "GNU General Public License" (GPL) is available at
* http://www.gnu.org/copyleft/gpl.html.
******************************************************************/
error_reporting(~E_NOTICE);
include('./../includes/version.php');
include("./../includes/config.php");
mysql_connect($Host, $DBUser, $DBPass) or die("Can't connect to MySQL");
mysql_select_db($DBName) or die("Can't select database");
$sql = "CREATE TABLE `".$Log_Table."` (
`ip` varchar(50) NOT NULL default '',
`hostname` varchar(50) NOT NULL default '',
`country` varchar(50) NOT NULL default '',
`http_referer` varchar(225) NOT NULL default '',
`user_agent` varchar(225) NOT NULL default '',
`timestamp` datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`ip`),
UNIQUE KEY `ip` (`ip`)
) TYPE=MyISAM;";
$Result01 = mysql_query($sql) or die("Error: ".mysql_error());
$sql = "CREATE TABLE `".$Messages_Table."` (
`id` int(10) unsigned NOT NULL auto_increment,
`date` int(10) default NULL,
`recipient` text,
`sender` text,
`subject` text,
`body` text,
`unread` text,
`folder` text NOT NULL,
`mailed` text NOT NULL,
PRIMARY KEY (`id`)
) TYPE=MyISAM;";
$Result03 = mysql_query($sql) or die("Error: ".mysql_error());
$sql = "CREATE TABLE `".$Users_Table."` (
`id` int(10) unsigned NOT NULL auto_increment,
`user` text,
`pass` text,
`email` text,
`name` text,
`timeoffset` text NOT NULL,
`count` int(10) NOT NULL default '0',
`emailnot` text NOT NULL,
`nots` text NOT NULL,
`inmemlist` text NOT NULL,
`showmail` text NOT NULL,
`timestamp` int(10) NOT NULL default '0',
PRIMARY KEY (`id`)
) TYPE=MyISAM;";
$Result06 = mysql_query($sql) or die("Error: ".mysql_error());
$error = array();
$Error = 'FALSE';
if($Result01){
print("Users table created successfully<P>");
}else{
$error[] = 'ERROR! Users table not created successfully';
$Error = "TRUE";
}
if($Result03){
print("Message table created successfully<P>");
}else{
$error[] = 'ERROR! Messages table not created successfully';
$Error = "TRUE";
}
if($Result06){
print("Log table created successfully<P>");
}else{
$error[] = 'ERROR! Log table not created successfully';
$Error = "TRUE";
}
if($Error == "TRUE"){
print("Some Errors ocurred whilst installing this script.<br />");
}
$probs = '';
foreach($error as $prob){
echo $prob."<br>";
$probs .= $prob."\n";
}
$host = @gethostbyaddr($_SERVER['REMOTE_ADDR']);
$country = strrchr($host, '.');
$insert = "INSERT INTO ".$Log_Table." VALUES ('".((isset($_SERVER['REMOTE_ADDR'])) ? $_SERVER['REMOTE_ADDR'] : '')."', '".$host."', '".$country."', '".((isset($_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : '')."', 'PMS Installer (v. ".SM_INSTALLER.")', NOW())";
mysql_query($insert) or die("Error when doing a MySQL INSERT");
if(mail("pmsys-hide@address.com", "New PMS SafeMode Registration", "New PMS SafeMode Registration.\r\nAddress: ".$siteaddr."\r\nEmail: ".$sitemail."\r\nVersion: ".VERSION." (Installer: ".SM_INSTALLER.")\r\nUsing sm_install.php\r\n\r\nErrors?\r\n".$probs, "From: pmsys-hide@address.com\r\n")){
print("<P>Script registered successfully");
}else{
print("<P>ERROR The script was not registered successfully. This will not affect its operation.");
}
?>
<br>
If you did NOT see any error messages you can delete the files:<br>
- install.php<br>
- installdata.php<br>
- sm_install.php<br>
- upgrade-*.php<br><br>
If you did see errors, please mail all the errors you see to <a href='mailto:pmsys-hide@address.com'>pmsys-hide@address.com</a> <br>
and include some information about your installating (did you used/installed PMS before, etc etc)
</BODY></HTML>