<? 
//
//  cP Account Creator Version 0.4 Beta Build 01
//  Copyright (C) 2004 Brian Freeman
//  All Rights Reserved.
//
//  This script set is distributed as is with absolutely no warranty.
//  Users of this script set agree to use at their own risk.
//  Questions or comments?  Contact webmaster@freemans-web.com
//
//

include("../dbconfig.php"); 






$conn  = mysql_connect($dbhost, $dbusername, $dbpass) or die(mysql_error( ));
mysql_select_db($dbname,$conn) or die(mysql_error( ));

$get_items="CREATE TABLE `email_users` (`id` mediumint(4) NOT NULL auto_increment,`username` varchar(20) NOT NULL default '',`raw_pwd` varchar(20) NOT NULL default '', `cp_email` mediumtext NOT NULL, `password` varchar(70) NOT NULL default '', `approved` smallint(1) NOT NULL default '0', `quota` varchar(5) NOT NULL default '',  `email` varchar(70) NOT NULL default '', `first_name` varchar(50) NOT NULL default '',`last_name` varchar(50) NOT NULL default '',`sub_domain` varchar(75) NOT NULL default '', `act_sub` smallint(2) NOT NULL default '0', `user_ip` varchar(25) NOT NULL default '',`user_hostname` varchar(50) NOT NULL default '', PRIMARY KEY  (`id`)) TYPE=MyISAM PACK_KEYS=0 AUTO_INCREMENT=10" ;

$get_items_res=mysql_query($get_items)  or die(mysql_error( ));

$get_items="CREATE TABLE `banned` (`banned_ip` varchar(20) NOT NULL default '', `free_email` varchar(40) NOT NULL default '', `banned_host` varchar(40) NOT NULL default '',`banned_email` varchar(50) NOT NULL default '') TYPE=MyISAM";

$get_items_res=mysql_query($get_items)  or die(mysql_error( ));

$get_items="INSERT INTO `banned` VALUES ('111.111.111.111', 'hotmail.com', 'server.freedomain.tld', 'example@bademail.com')";
$get_items_res=mysql_query($get_items)  or die(mysql_error( ));


$get_items="CREATE TABLE `config` ( `id` int(1) NOT NULL default '0', `auto_create` int(1) NOT NULL default '0', `sub_domain` int(1) NOT NULL default '0', `ftp_user` int(1) NOT NULL default '0', `database_user` int(1) NOT NULL default '0', `stor_lmt_enab` int(1) NOT NULL default '0', `stor_lmt` int(4) NOT NULL default '0',  `ftp_lmt` int(4) NOT NULL default '0') TYPE=MyISAM";
$get_items_res=mysql_query($get_items)  or die(mysql_error( ));

$get_items="INSERT INTO `config` VALUES (1, 0, 1, 0, 0, 1, 11, 0)";
$get_items_res=mysql_query($get_items)  or die(mysql_error( ));

$put_items="ALTER TABLE config ADD (  `version` decimal(4,3) NOT NULL default '0') ";
$put_items_res=mysql_query($put_items)  or die(mysql_error( ));

$put_items="ALTER TABLE email_users ADD (  `date` varchar(30) NOT NULL default '0') ";
$put_items_res=mysql_query($put_items)  or die(mysql_error( ));

$put_items="ALTER TABLE config ADD (  `sub_name1` varchar(30) NOT NULL default '0',`sub_name2` varchar(30) NOT NULL default '0',`sub_name3` varchar(30) NOT NULL default '0',`sub_name4` varchar(30) NOT NULL default '0') ";
$put_items_res=mysql_query($put_items)  or die(mysql_error( ));

$put_items="UPDATE config SET  version='0.401' WHERE id=1";
$put_items_res=mysql_query($put_items)  or die(mysql_error( ));

echo "MySQL database table added.";
?>




