<? 
//
//  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"); 
include("../config.php");


$get_items="SELECT * FROM config WHERE id=1";
$get_items_res=mysql_query($get_items)  or die(mysql_error( ));
	while ($items = mysql_fetch_array ($get_items_res)) {
                  $version=$items[version];
}


if(($ver==2.030)& ($version<0.401)){
$conn  = mysql_connect($dbhost, $dbusername, $dbpass) or die(mysql_error( ));
mysql_select_db($dbname,$conn) or die(mysql_error( ));

$put_items="ALTER TABLE config ADD (  `ftp_lmt` int(4) NOT NULL default '0') ";
$put_items_res=mysql_query($put_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="UPDATE config SET  version='0.401' WHERE id=1";
$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( ));

echo "Database upgraded to version 0.401";
}

if($version==2.041){
  // Future use
  echo "Database version is 0.401, upgrade not necessary.";
  }






?>




