mirror of
https://github.com/fspc/biketree.git
synced 2026-09-16 14:31:36 -04:00
First commit of biketree to github!
This commit is contained in:
Executable
+85
@@ -0,0 +1,85 @@
|
||||
<?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.
|
||||
$brand_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->updateBrand");
|
||||
if(isset($_GET['id']))
|
||||
{
|
||||
$id=$_GET['id'];
|
||||
$tablename = "$cfg_tableprefix".'brands';
|
||||
$result = mysql_query("SELECT * FROM $tablename WHERE id=\"$id\"",$dbf->conn);
|
||||
|
||||
$row = mysql_fetch_assoc($result);
|
||||
$brand_value=$row['brand'];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$display->displayTitle("$lang->addBrand");
|
||||
|
||||
}
|
||||
//creates a form object
|
||||
$f1=new form('process_form_brands.php','POST','brands','300',$cfg_theme,$lang);
|
||||
|
||||
//creates form parts.
|
||||
$f1->createInputField("<b>$lang->brandName:</b>",'text','brand',"$brand_value",'24','150');
|
||||
|
||||
//sends 2 hidden varibles needed for process_form_users.php.
|
||||
echo "
|
||||
<input type='hidden' name='action' value='$action'>
|
||||
<input type='hidden' name='id' value='$id'>";
|
||||
$f1->endForm();
|
||||
|
||||
$dbf->closeDBlink();
|
||||
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
Executable
+68
@@ -0,0 +1,68 @@
|
||||
<?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->manageBrands");
|
||||
|
||||
$f1=new form('manage_brands.php','POST','brands','425',$cfg_theme,$lang);
|
||||
$f1->createInputField("<b>$lang->searchForBrand</b>",'text','search','','24','350');
|
||||
$f1->endForm();
|
||||
|
||||
$tableheaders=array("$lang->rowID","$lang->brandName","$lang->updateBrand","$lang->deleteBrand");
|
||||
$tablefields=array('id','brand');
|
||||
|
||||
if(isset($_POST['search']))
|
||||
{
|
||||
$search=$_POST['search'];
|
||||
echo "<center>$lang->searchedForBrand: <b>$search</b></center>";
|
||||
$display->displayManageTable("$cfg_tableprefix",'brands',$tableheaders,$tablefields,'brand',"$search",'brand');
|
||||
}
|
||||
else
|
||||
{
|
||||
$display->displayManageTable("$cfg_tableprefix",'brands',$tableheaders,$tablefields,'','','brand');
|
||||
}
|
||||
|
||||
|
||||
$dbf->closeDBlink();
|
||||
|
||||
|
||||
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+106
@@ -0,0 +1,106 @@
|
||||
<?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 3 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".'brands';
|
||||
$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['brand']) and isset($_POST['id']) and isset($_POST['action']) )
|
||||
{
|
||||
|
||||
$action=$_POST['action'];
|
||||
$id = $_POST['id'];
|
||||
|
||||
//gets variables entered by user.
|
||||
$brand = $_POST['brand'];
|
||||
|
||||
|
||||
//insure all fields are filled in.
|
||||
if($brand=='')
|
||||
{
|
||||
echo "$lang->forgottenFields";
|
||||
exit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$field_names=array('brand');
|
||||
$field_data=array("$brand");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
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_brands.php"><?php echo "$lang->manageBrands" ?>--></a>
|
||||
<br>
|
||||
<a href="form_brands.php?action=insert"><?php echo "$lang->createBrand" ?>--></a>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user