First commit of biketree to github!

This commit is contained in:
Jonathan Rosenbaum
2017-09-05 03:39:54 +00:00
commit 8ca61d45eb
175 changed files with 24173 additions and 0 deletions
+100
View File
@@ -0,0 +1,100 @@
<?php session_start(); ?>
<html>
<head>
</head>
<body>
<?php
include ("../../settings.php");
include ("../../language/$cfg_language");
include ("../../classes/db_functions.php");
include ("../../classes/security_functions.php");
include ("../../classes/form.php");
include ("../../classes/display.php");
$lang=new language();
$dbf=new db_functions($cfg_server,$cfg_username,$cfg_password,$cfg_database,$cfg_tableprefix,$cfg_theme,$lang);
$sec=new security_functions($dbf,'Admin',$lang);
$display= new display($dbf->conn,$cfg_theme,$cfg_currency_symbol,$lang);
if(!$sec->isLoggedIn())
{
header ("location: ../../login.php");
exit();
}
//set default values, these will change if $action==update.
$supplier_value='';
$address_value='';
$phone_number_value='';
$contact_value='';
$email_value='';
$other_value='';
$id=-1;
//decides if the form will be used to update or add a user.
if(isset($_GET['action']))
{
$action=$_GET['action'];
}
else
{
$action="insert";
}
//if action is update, sets variables to what the current users data is.
if($action=="update")
{
$display->displayTitle("$lang->updateSupplier");
if(isset($_GET['id']))
{
$id=$_GET['id'];
$tablename = "$cfg_tableprefix".'suppliers';
$result = mysql_query("SELECT * FROM $tablename WHERE id=\"$id\"",$dbf->conn);
$row = mysql_fetch_assoc($result);
$supplier_value=$row['supplier'];
$address_value=$row['address'];
$phone_number_value=$row['phone_number'];
$contact_value=$row['contact'];
$email_value=$row['email'];
$other_value=$row['other'];
}
}
else
{
$display->displayTitle("$lang->addSupplier");
}
//creates a form object
$f1=new form('process_form_suppliers.php','POST','suppliers','300',$cfg_theme,$lang);
//creates form parts.
$f1->createInputField("<b>$lang->supplierName:</b>",'text','supplier',"$supplier_value",'24','150');
$f1->createInputField("<b>$lang->address:</b>",'text','address',"$address_value",'24','150');
$f1->createInputField("<b>$lang->phoneNumber:</b>",'text','phone_number',"$phone_number_value",'24','150');
$f1->createInputField("<b>$lang->contact:</b>",'text','contact',"$contact_value",'24','150');
$f1->createInputField("$lang->email: ",'text','email',"$email_value",'24','150');
$f1->createInputField("$lang->other: ",'text','other',"$other_value",'24','150');
//sends 2 hidden varibles needed for process_form_suppliers.php.
echo "
<input type='hidden' name='action' value='$action'>
<input type='hidden' name='id' value='$id'>";
$f1->endForm();
$dbf->closeDBlink();
?>
</body>
</html>
+67
View File
@@ -0,0 +1,67 @@
<?php session_start(); ?>
<html>
<head>
<SCRIPT LANGUAGE="Javascript">
<!---
function decision(message, url)
{
if(confirm(message) )
{
location.href = url;
}
}
// --->
</SCRIPT>
</head>
<body>
<?php
include ("../../settings.php");
include ("../../language/$cfg_language");
include ("../../classes/db_functions.php");
include ("../../classes/security_functions.php");
include ("../../classes/display.php");
include ("../../classes/form.php");
$lang=new language();
$dbf=new db_functions($cfg_server,$cfg_username,$cfg_password,$cfg_database,$cfg_tableprefix,$cfg_theme,$lang);
$sec=new security_functions($dbf,'Admin',$lang);
if(!$sec->isLoggedIn())
{
header ("location: ../../login.php");
exit();
}
$display=new display($dbf->conn,$cfg_theme,$cfg_currency_symbol,$lang);
$display->displayTitle("$lang->manageSuppliers");
$f1=new form('manage_suppliers.php','POST','suppliers','475',$cfg_theme,$lang);
$f1->createInputField("<b>$lang->searchForSupplier</b>",'text','search','','24','375');
$f1->endForm();
$tableheaders=array("$lang->rowID","$lang->supplierName","$lang->address","$lang->phoneNumber","$lang->contact","$lang->email","$lang->other","$lang->updateSupplier","$lang->deleteSupplier");
$tablefields=array('id','supplier','address','phone_number','contact','email','other');
if(isset($_POST['search']))
{
$search=$_POST['search'];
echo "<center>$lang->searchedForSupplier: <b>$search</b></center>";
$display->displayManageTable("$cfg_tableprefix",'suppliers',$tableheaders,$tablefields,'supplier',"$search",'supplier');
}
else
{
$display->displayManageTable("$cfg_tableprefix",'suppliers',$tableheaders,$tablefields,'','','supplier');
}
$dbf->closeDBlink();
?>
</body>
</html>
+111
View File
@@ -0,0 +1,111 @@
<?php session_start(); ?>
<html>
<head>
</head>
<body>
<?php
include ("../../settings.php");
include ("../../language/$cfg_language");
include ("../../classes/db_functions.php");
include ("../../classes/security_functions.php");
//creates 2 objects needed for this script.
$lang=new language();
$dbf=new db_functions($cfg_server,$cfg_username,$cfg_password,$cfg_database,$cfg_tableprefix,$cfg_theme,$lang);
$sec=new security_functions($dbf,'Admin',$lang);
//checks if user is logged in.
if(!$sec->isLoggedIn())
{
header ("location: ../../login.php");
exit ();
}
//variables needed globably in this file.
$tablename="$cfg_tableprefix".'suppliers';
$field_names=null;
$field_data=null;
$id=-1;
//checks to see if action is delete and an ID is specified. (only delete uses $_GET.)
if(isset($_GET['action']) and isset($_GET['id']))
{
$action=$_GET['action'];
$id=$_GET['id'];
}
//checks to make sure data is comming from form ($action is either delete or update)
elseif(isset($_POST['supplier']) and isset($_POST['address']) and isset($_POST['phone_number']) and isset($_POST['contact']) and isset($_POST['email']) and isset($_POST['other']) and isset($_POST['id']) and isset($_POST['action']) )
{
$action=$_POST['action'];
$id = $_POST['id'];
//gets variables entered by user.
$supplier = $_POST['supplier'];
$address = $_POST['address'];
$phone_number=$_POST['phone_number'];
$contact = $_POST['contact'];
$email = $_POST['email'];
$other = $_POST['other'];
//insure all fields are filled in.
if($supplier=='' or $address=='' or $phone_number=='' or $contact==='')
{
echo "$lang->forgottenFields";
exit();
}
else
{
$field_names=array('supplier','address','phone_number','contact','email','other');
$field_data=array("$supplier","$address","$phone_number","$contact","$email","$other");
}
}
else
{
//outputs error message because user did not use form to fill out data.
echo "$lang->mustUseForm";
exit();
}
switch ($action)
{
//finds out what action needs to be taken and preforms it by calling methods from dbf class.
case $action=="insert":
$dbf->insert($field_names,$field_data,$tablename,true);
break;
case $action=="update":
$dbf->update($field_names,$field_data,$tablename,$id,true);
break;
case $action=="delete":
$dbf->deleteRow($tablename,$id);
break;
default:
echo "$lang->noActionSpecified";
break;
}
$dbf->closeDBlink();
?>
<br>
<a href="manage_suppliers.php"><?php echo $lang->manageSuppliers ?>--></a>
<br>
<a href="form_suppliers.php?action=insert"><?php echo $lang->createSupplier ?>--></a>
</body>
</html>