Location: PHPKode > scripts > PHP Online Invoice System > php-online-invoice-system/install.php
<?
/*
 * Exemplar Web hosting
 * http://www.exemplar.biz
 *
 * Title: PHP Online Invoice System
 * Version: 2.0
 * Author: Exemplar
 * Date: 01-01-2006
 *
*/
?>
<html>
<head>
<title>PHP Online Invoice System Installation Program</title>
<link rel="STYLESHEET" type="text/css" href="inc/style.css">
<script language="JavaScript">
<!--
  window.onerror = null;
	browserName=navigator.appName;
	version="";
	browserVer=parseInt(navigator.appVersion);

	if(browserName=="Netscape" && browserVer >=3) version ="n3";
	if(browserName=="Microsoft Internet Explorer" && browserVer >=4) version="n3";
	if (version=="n3")
	{
	<!-- BUTTON CODES GO HERE -->

        starttheinstallation_off=new Image(141, 60);
        starttheinstallation_off.src="images/starttheinstallation.png";
        starttheinstallation_over=new Image(141, 60);
        starttheinstallation_over.src="images/starttheinstallation_over.png";
        nextstep2_off=new Image(141, 60);
        nextstep2_off.src="images/nextstep_clicked.png";
        nextstep2_over=new Image(141, 60);
        nextstep2_over.src="images/nextstep_mouseover.png";

	}

	function ActiveOverImage(ImageName)
	{
		if (version == "n3")
		{
			imgActive = eval(ImageName + "_over.src");
			document [ImageName].src=imgActive;
		}
	}

	function InActiveImage(ImageName)
	{
		if (version == "n3")
		{
			imgInActive = eval(ImageName + "_off.src");
			document [ImageName].src = imgInActive;
		}
	}


//-->
</script>
</head>
<body leftmargin=10 topmargin=10 marginwidth=750 marginheight=0 background="images/bkglobe2.gif">
<?
include "inc/dbconnect.php";



?>
<table align="center" border="0" cellspacing="0" width="90%">
<tr><td width="100%"><div align="center">
<table border="0" cellspacing="0" width="100%" cellpadding="0">
<tr>
<td width="50%" height="20">&nbsp;<b><h1>PHP Online Invoice System Installation</h1></b></td>
<td width="50%" align="right"><b><font color="#000000"><? if ($step) { ?>Step <?=$step?> of 3<? } ?>&nbsp;&nbsp;</font></b></td>
</tr>
<tr><td width="100%" colspan="2" height="15"></td></tr>

<?
if ($step == 2)
{
if($database == "" || $user == "" || $pass == ""){
echo "<h1 class=\"h1red\">You have not set up the inc/config.php file correctly</h1>";

}else{
?>

<tr><td width="100%" colspan="2"><div align="center"><table border="0" cellpadding="0" cellspacing="0" width="96%">
<tr><td width="100%"><b>Installation of Tables Into Database</b><br><br>
<?
echo "<font color=green>config.php OK</font><br>";
mysql_query("CREATE TABLE acctrecv (
  clientid int(5) NOT NULL default '0',
  invoiceid bigint(20) NOT NULL default '0',
  amt_recv decimal(6,2) NOT NULL default '0.00',
  recv_date date NOT NULL default '0000-00-00',
  comments varchar(255) NOT NULL default ''
)");
//Function mysql_is_table(mysql_host, mysql_user, mysql_password, database_name, table_name);

if (mysql_is_table('$hostname', '$user', '$pass', '$database', 'acctrecv')) {
    print '<font color=green>Yes the acctrecv table is present</font><br>';
} else {
    print '<font color=red>Nope, the table acctrecv is not present, check the config.php for correct database information.</font><br>';
}
mysql_query("CREATE TABLE admins (
   adminid tinyint(4) NOT NULL auto_increment,
   name varchar(50) NOT NULL,
   password varchar(50) NOT NULL,
   email varchar(255) NOT NULL,
   PRIMARY KEY (adminid)
)");
if (mysql_is_table('$hostname', '$user', '$pass', '$database', 'admins')) {
    print '<font color=green>Yes the admins table is present</font><br>';
} else {
    print '<font color=red>Nope, the table admins is not present, check the config.php for correct database information.</font><br>';
}
mysql_query("CREATE TABLE clients (
   clientid MEDIUMINT(4) NOT NULL auto_increment,
   name varchar(255) NOT NULL,
   first_name varchar(30) NULL,
   last_name varchar(30) NULL,
   password varchar(50) NOT NULL,
   comments varchar(255) NOT NULL,
   email varchar(255) NOT NULL,
   company varchar(255) NOT NULL,
   address varchar(255) NOT NULL,
   city varchar(255) NOT NULL,
   state varchar(255) NOT NULL,
   zip varchar(255) NOT NULL,
   night_phone_a char(3) default NULL,
   night_phone_b char(3) default NULL,
   night_phone_c varchar(4) default NULL,
   fax_phone_a char(3) default NULL,
   fax_phone_b char(3) default NULL,
   fax_phone_c varchar(4) default NULL,
   taxid varchar(15) default NULL,
   shiptoname varchar(50) default NULL,
   shiptoaddr varchar(50) default NULL,
   shiptocity varchar(50) default NULL,
   shiptostate varchar(50) default NULL,
   shiptozip varchar(50) default NULL,
   PRIMARY KEY (clientid)
)");
if (mysql_is_table('$hostname', '$user', '$pass', '$database', 'clients')) {
    print '<font color=green>Yes the clients table is present</font><br>';
} else {
    print '<font color=red>Nope, the table clients is not present, check the config.php for correct database information.</font><br>';
}
mysql_query("CREATE TABLE invoices (
   id int(8) NOT NULL auto_increment,
   clientid MEDIUMINT(4) NOT NULL,
   date date default NULL,
   bill_date date default NULL,
  due_date date default NULL,
  paid_date date default NULL,
  purchaseorder varchar(50) default NULL,
  serv1desc varchar(255) default NULL,
  serv1qty varchar(12) default NULL,
  serv1rate decimal(6,2) default '0.00',
  serv1amt decimal(6,2) default '0.00',
  serv2desc varchar(255) default NULL,
  serv2qty varchar(10) default NULL,
  serv2rate decimal(6,2) default '0.00',
  serv2amt decimal(6,2) default '0.00',
  serv3desc varchar(255) default NULL,
  serv3qty varchar(10) default NULL,
  serv3rate decimal(6,2) default '0.00',
  serv3amt decimal(6,2) default '0.00',
  serv4desc varchar(255) default NULL,
  serv4qty varchar(10) default NULL,
  serv4rate decimal(6,2) default '0.00',
  serv4amt decimal(6,2) default '0.00',
  serv5desc varchar(255) default NULL,
  serv5qty varchar(10) default NULL,
  serv5rate decimal(6,2) default '0.00',
  serv5amt decimal(6,2) default '0.00',
  serv6desc varchar(255) default NULL,
  serv6qty varchar(10) default NULL,
  serv6rate decimal(6,2) default '0.00',
  serv6amt decimal(6,2) default '0.00',
  serv7desc varchar(255) default NULL,
  serv7qty varchar(10) default NULL,
  serv7rate decimal(6,2) default '0.00',
  serv7amt decimal(6,2) default '0.00',
  serv8desc varchar(255) default NULL,
  serv8qty varchar(10) default NULL,
  serv8rate decimal(6,2) default '0.00',
  serv8amt decimal(6,2) default '0.00',
  serv9desc varchar(255) default NULL,
  serv9qty varchar(10) default NULL,
  serv9rate decimal(6,2) default '0.00',
  serv9amt decimal(6,2) default '0.00',
  serv10desc varchar(255) default NULL,
  serv10qty varchar(10) default NULL,
  serv10rate decimal(6,2) default '0.00',
  serv10amt decimal(6,2) default '0.00',
  serv1tax enum('yes','no') NOT NULL default 'no',
  serv2tax enum('yes','no') NOT NULL default 'no',
  serv3tax enum('yes','no') NOT NULL default 'no',
  serv4tax enum('yes','no') NOT NULL default 'no',
  serv5tax enum('yes','no') NOT NULL default 'no',
  serv6tax enum('yes','no') NOT NULL default 'no',
  serv7tax enum('yes','no') NOT NULL default 'no',
  serv8tax enum('yes','no') NOT NULL default 'no',
  serv9tax enum('yes','no') NOT NULL default 'no',
  serv10tax enum('yes','no') NOT NULL default 'no',
  shipping decimal(5,2) default '0.00',
  subtotal decimal(6,2) default '0.00',
  salestax decimal(6,2) default '0.00',
  misc decimal(6,2) default '0.00',
  note varchar(100) default NULL,
  total decimal(6,2) default '0.00',
   status enum('pending','paid') DEFAULT 'pending' NOT NULL,
   PRIMARY KEY (id)
)");
if (mysql_is_table('$hostname', '$user', '$pass', '$database', 'invoices')) {
    print '<font color=green>Yes the invoices table is present</font><br>';
    print '<font color=green>Tables were successfully created...<BR><BR> <a href="install.php?step=3" onMouseOver="ActiveOverImage(\'nextstep2\')" onMouseout="InActiveImage(\'nextstep2\')"><img src="images/nextstep_clicked.png" width="150" height="75" border="0" alt="Continue|to|Step|2" name="nextstep2"></a></font>';
} else {
    print '<font color=red>Nope, the table invoices is not present, check the config.php for correct database information.</font><br>';
    print '<font color=red>Tables were not successfully created... <a href="install.php"><b>Check Your Config.php settings</b></a></font>';
}

?>
<BR>
</tr></table></div></td></tr>

<?
}
}
elseif ($step == 3 and $created != 1)
{
?>
<tr><td width="100%" colspan="2"><div align="center"><table border="0" cellpadding="0" cellspacing="0" width="96%">
<tr><td width="100%"><b>Create An Administrative Username and Password</b><br><br>
<form method="POST" action="install.php">
<input type=hidden name=step value=3>
<input type=hidden name=created value=1>
<div><table border="0" cellpadding="2" cellspacing="1" width="50%">
<tr><td width="40%" align="right">Admin Username:&nbsp; </td>
<td width="60%"><input type="text" name="admin" size="20"></td></tr>
<tr><td width="40%" align="right">Admin Password:&nbsp; </td>
<td width="60%"><input type="text" name="pass" size="20"></td></tr>
<tr><td width="40%" align="right">Admin Email:&nbsp; </td>
<td width="60%"><input type="text" name="email" size="20"></td></tr>
<tr><td width="40%"></td><td width="60%"><input type="submit" name="submit" value="Create Admin"></td></form>
</tr></table></div>
    <p align="left"><BR>
<?

}
if ($submit and $created == 1)
{

$passwd = $_POST['pass'];
mysql_query ("insert into admins (name, password, email) values ('$admin', '$passwd', '$email')");
?>
     <font class="xtragreen"> Administration Username and password successfully created...</font>
      <br><br>

      <font class="xtralrgred">Delete the <u>install.php</u> file off the server and you're finished with the install.</font>
      <br>
      <br>
      <a href="index.php"><font class="xtrablue">[ Enter Online Invoice System Here ]</font></a>
    </div>
</tr></table></p></td></tr>

<?
exit;
}
elseif (!isset($step))
{
?>
<tr><td width="100%" colspan="2"><table border="0" cellpadding="0" cellspacing="0" align="center" width="90%">
<tr><td width="100%" Align="center"><p align="left"><font class="lrgBold">Before Installing This Program:</font><br>
<font class="medBold">1.) Make sure you have created your database (see install.txt).<br>
2.) Make sure your database connectivity settings are correct in (inc/config.php).</font><br>
<br>
<font class="lrgBold">This Program Will:</font><br>
<font class="medBold">1.) Automatically create the necessary tables and columns within your database.
<BR>
2.) Setup your main administrative username and password.</font>
<br><br><br><br>
<font class="medBold">If your database is created and your config.php settings are correct...</font><BR><BR>
<BR><a href="install.php?step=2" onMouseOver="ActiveOverImage('starttheinstallation')" onMouseout="InActiveImage('starttheinstallation')"><img src="images/starttheinstallation.png" width="150" height="75" border="0" alt="Start|The|Installation" name="starttheinstallation"></a></p></td>
</tr></table></td></tr>
<?

}
?>

<tr><td width="100%" colspan="2" height="15"></td></tr></table>

</body>
</html>
Return current item: PHP Online Invoice System