You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

85 lines
1.7 KiB

<?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>