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
+102
@@ -0,0 +1,102 @@
|
||||
<?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.
|
||||
$first_name_value='';
|
||||
$last_name_value='';
|
||||
$username_value='';
|
||||
$type_value='';
|
||||
$password_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->updateUser");
|
||||
if(isset($_GET['id']))
|
||||
{
|
||||
$id=$_GET['id'];
|
||||
$tablename = "$cfg_tableprefix".'users';
|
||||
$result = mysql_query("SELECT * FROM $tablename WHERE id=\"$id\"",$dbf->conn);
|
||||
|
||||
$row = mysql_fetch_assoc($result);
|
||||
$first_name_value=$row['first_name'];
|
||||
$last_name_value=$row['last_name'];
|
||||
$username_value=$row['username'];
|
||||
$password_value="*notchanged*";
|
||||
$type_value=$row['type'];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$display->displayTitle("$lang->addUser");
|
||||
|
||||
}
|
||||
//creates a form object
|
||||
$f1=new form('process_form_users.php','POST','users','415',$cfg_theme,$lang);
|
||||
|
||||
//creates form parts.
|
||||
$f1->createInputField("<b>$lang->firstName:</b>",'text','first_name',"$first_name_value",'24','180');
|
||||
$f1->createInputField("<b>$lang->lastName:</b>",'text','last_name',"$last_name_value",'24','180');
|
||||
$f1->createInputField("<b>$lang->username:</b><i>($lang->usedInLogin)</i>",'text','username',"$username_value",'24','180');
|
||||
|
||||
$option_values=array("$type_value",'Admin','Sales Clerk', 'Report Viewer');
|
||||
$option_titles=array("$type_value","$lang->admin","$lang->salesClerk", "$lang->reportViewer");
|
||||
$f1->createSelectField("<b>$lang->type:</b> ",'type',$option_values,$option_titles,'180');
|
||||
|
||||
$f1->createInputField("<b>$lang->password:</b>",'password','password',"$password_value",'24','180');
|
||||
$f1->createInputField("<b>$lang->confirmPassword:</b>",'password','cpassword',"$password_value",'24','180');
|
||||
|
||||
//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
+43
@@ -0,0 +1,43 @@
|
||||
<?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/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();
|
||||
}
|
||||
|
||||
$display->displayTitle("$lang->users");
|
||||
$dbf->closeDBlink();
|
||||
|
||||
?>
|
||||
<ul>
|
||||
<li><a href="form_users.php?action=insert"><?php echo "$lang->createUser"; ?> </a>
|
||||
<li><a href="manage_users.php"><?php echo "$lang->manageUsers"; ?></a>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Executable
+65
@@ -0,0 +1,65 @@
|
||||
<?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->manageUsers");
|
||||
|
||||
$f1=new form('manage_users.php','POST','users','400',$cfg_theme,$lang);
|
||||
$f1->createInputField("<b>$lang->searchForUser</b>",'text','search','','24','300');
|
||||
$f1->endForm();
|
||||
|
||||
$tableheaders=array("$lang->rowID","$lang->lastName","$lang->firstName","$lang->username","$lang->password","$lang->type","$lang->updateUser","$lang->deleteUser");
|
||||
$tablefields=array('id','last_name','first_name','username','password','type');
|
||||
|
||||
|
||||
if(isset($_POST['search']))
|
||||
{
|
||||
$search=$_POST['search'];
|
||||
echo "<center>$lang->searchedForUser:<b> $search</b></center>";
|
||||
$display->displayManageTable("$cfg_tableprefix",'users',$tableheaders,$tablefields,'username',"$search",'last_name');
|
||||
}
|
||||
else
|
||||
{
|
||||
$display->displayManageTable("$cfg_tableprefix",'users',$tableheaders,$tablefields,'','','last_name');
|
||||
}
|
||||
|
||||
$dbf->closeDBlink();
|
||||
|
||||
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+140
@@ -0,0 +1,140 @@
|
||||
<?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".'users';
|
||||
$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['first_name']) and isset($_POST['last_name']) and isset($_POST['username'])
|
||||
and isset($_POST['password']) and isset($_POST['cpassword']) and isset($_POST['type'])
|
||||
and isset($_POST['id']) and isset($_POST['action']) )
|
||||
{
|
||||
|
||||
$action=$_POST['action'];
|
||||
$id = $_POST['id'];
|
||||
|
||||
//gets variables entered by user.
|
||||
$first_name = $_POST['first_name'];
|
||||
$last_name = $_POST['last_name'];
|
||||
$username = $_POST['username'];
|
||||
$password = $_POST['password'];
|
||||
$cpassword = $_POST['cpassword'];
|
||||
$type = $_POST['type'];
|
||||
|
||||
|
||||
//insure all fields are filled in.
|
||||
if($first_name=='' or $last_name=='' or $username=='' or $password=='' or $cpassword=='' or $type=='')
|
||||
{
|
||||
echo "$lang->forgottenFields";
|
||||
exit();
|
||||
}
|
||||
elseif($password!=$cpassword)
|
||||
{
|
||||
echo "$lang->passwordsDoNotMatch";
|
||||
exit();
|
||||
}
|
||||
elseif($action=='insert')
|
||||
{
|
||||
//encrypts password for new user and creates arrays to be used later.
|
||||
$password=md5($password);
|
||||
$field_names=array('first_name','last_name','username','password','type');
|
||||
$field_data=array("$first_name","$last_name","$username","$password","$type");
|
||||
|
||||
}
|
||||
elseif($password=="*notchanged*")
|
||||
{
|
||||
/*
|
||||
Does NOT encrypt password because user did not change their password, but other
|
||||
info might have changed and needs to be updated. Info stored in arrays.
|
||||
*/
|
||||
|
||||
$field_names=array('first_name','last_name','username','type');
|
||||
$field_data=array("$first_name","$last_name","$username","$type");
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
user did change password and the new password is encrypted. Stores
|
||||
info in arrays
|
||||
*/
|
||||
|
||||
$password=md5($password);
|
||||
$field_names=array('first_name','last_name','username','password','type');
|
||||
$field_data=array("$first_name","$last_name","$username","$password","$type");
|
||||
}
|
||||
}
|
||||
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_users.php"><?php echo "$lang->manageUsers"; ?>--></a>
|
||||
<br>
|
||||
<a href="form_users.php?action=insert"><?php echo "$lang->createUser"; ?>--></a>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+93
@@ -0,0 +1,93 @@
|
||||
<?php session_start();?>
|
||||
<html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
include ("../settings.php");
|
||||
include ("../classes/db_functions.php");
|
||||
include ("../language/$cfg_language");
|
||||
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,'Sales Clerk',$lang);
|
||||
$display=new display($dbf->conn,$cfg_theme,$cfg_currency_symbol,$lang);
|
||||
if(!$sec->isLoggedIn())
|
||||
{
|
||||
header ("location: ../login.php");
|
||||
exit();
|
||||
}
|
||||
|
||||
if($_POST[ID]){
|
||||
$userLogin = $_SESSION['session_user_id'];
|
||||
mysql_query("UPDATE users SET customerID='$_POST[ID]' WHERE id='$userLogin'");
|
||||
echo "<script>document.location.href='../index.php'</script>";
|
||||
}
|
||||
|
||||
$result = mysql_query("SELECT id,first_name,last_name FROM customers ORDER BY last_name ASC");
|
||||
$body.="
|
||||
<form name=oopen enctype=\"multipart/form-data\" method=\"POST\" action=\"user_customer_link.php\">
|
||||
<h5>It appears as though your bike tree user account has not been linked with a bike root member account.
|
||||
Please select your member account.</h5>
|
||||
<font face=\"Verdana\" size=\"2\">
|
||||
Users:
|
||||
<select name=\"ID\">";
|
||||
while($field = mysql_fetch_array($result)) { $body.="<option value=\"$field[id]\">$field[last_name], $field[first_name] </option>"; }
|
||||
$body.="
|
||||
</select>
|
||||
<br><br><br>
|
||||
</font>
|
||||
<input type=\"submit\" name=\"submit\" value=\"Ok!\">
|
||||
</form>
|
||||
";
|
||||
echo "$body";
|
||||
|
||||
/*//check to make sure it's a number
|
||||
if(!strval(floatval($_POST[openCount])) == strval($_POST[openCount])){
|
||||
echo "<script>document.location.href='openshop.php?error=2&count=$_POST[openCount]'</script>";
|
||||
exit();
|
||||
}
|
||||
|
||||
//check to make sure it was the administrator who counted
|
||||
if(!$_POST[counter]){
|
||||
echo "<script>document.location.href='openshop.php?error=1'</script>";
|
||||
exit();
|
||||
}
|
||||
|
||||
//$tablename = $cfg_tableprefix.'users';
|
||||
$userLoginName = $dbf->idToField($cfg_tableprefix.'users','username',$_SESSION['session_user_id']);
|
||||
|
||||
|
||||
$tablename="$cfg_tableprefix".'books';
|
||||
$field_names=null;
|
||||
$field_data=null;
|
||||
$today = date('Y-m-d');
|
||||
$field_names=array('date','event','user','ammount','data');
|
||||
$field_data=array("$today", "open", "$userLoginName","$_POST[openCount]","$_POST[mechID]");
|
||||
|
||||
|
||||
$dbf->insert($field_names,$field_data,$tablename,"");
|
||||
|
||||
$tablename="$cfg_tableprefix".'visits';
|
||||
$tdin = date('Y-m-d H:i:s');
|
||||
$field_names=array('userID','intime','activity');
|
||||
$adminID = $dbf->idToField($cfg_tableprefix.'users','customerID',$_SESSION['session_user_id']);
|
||||
$field_data=array("$adminID", "$tdin", "Administrator");
|
||||
$dbf->insert($field_names, $field_data, $tablename, "");
|
||||
|
||||
echo "<script>document.location.href='../home.php'</script>";*/
|
||||
|
||||
$dbf->closeDBlink();
|
||||
|
||||
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user