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
+76
View File
@@ -0,0 +1,76 @@
<?php session_start(); ?>
<html>
<head>
<link rel="stylesheet" href="form.css" type="text/css">
</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,'Sales Clerk',$lang);
$display=new display($dbf->conn,$cfg_theme,$cfg_currency_symbol,$lang);
if(!$sec->isLoggedIn())
{
header ("location: ../login.php");
exit();
}
$today = date("Y-m-d");
//$result = mysql_query("SELECT * FROM books");
$body.="</select>";
$tablename = $cfg_tableprefix.'users';
$userLoginName = $dbf->idToField($tablename,'username',$_SESSION['session_user_id']);
if(isset($_GET[error])){
$error = (int)$_GET[error];
$errorMsg = "";
switch($error){
case 1:
$errorMsg="ERROR: invalid username or password";
break;
case 2:
$errorMsg="ERROR: Not a valid ammount: [$_GET[count]]";
break;
}
}
if($errorMsg != ""){
$body.="<br><font color=\"red\">".$errorMsg."</font><br>";
}
$body.="
<h2>Close The Shop...</h2>
<form class=\"form\" name=closeform enctype=\"multipart/form-data\" method=\"POST\" action=\"verifyaction.php\">
<h5>Please count all cash, cheques, and coupons in the coin box</h5>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font face=\"Verdana\" size=\"2\">Closing Count: $
<input type=\"text\" name=\"ammount\" size=\"10\" value=\"$_GET[count]\">
<br>
Counted by:
<blockquote>Username: <input type=\"text\" name=\"username\" size=\"15\" value=\"$userLoginName\"><br>
Password: <input type=\"password\" name=\"password\" size=\"15\"></blockquote>
<br><br><br>
<input type=\"hidden\" name=\"action\" value=\"2\">
<input type=\"hidden\" name=\"data\" value=\"0\">
</font>
<input type=\"submit\" name=\"submit\" value=\"Process!\">
</form>
";
echo "$body";
// &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Counted by <b>$userLoginName</b>&nbsp;<input type=\"checkbox\" name=\"counter\">
$dbf->closeDBlink();
?>
</body>
</html>
+96
View File
@@ -0,0 +1,96 @@
<?php session_start(); ?>
<html>
<head>
<link rel="stylesheet" href="form.css" type="text/css">
</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,'Sales Clerk',$lang);
$display=new display($dbf->conn,$cfg_theme,$cfg_currency_symbol,$lang);
if(!$sec->isLoggedIn())
{
header ("location: ../login.php");
exit();
}
$today = date("Y-m-d");
//$result = mysql_query("SELECT * FROM books");
$body.="</select>";
$tablename = $cfg_tableprefix.'users';
$userLoginName = $dbf->idToField($tablename,'username',$_SESSION['session_user_id']);
if(isset($_GET[error])){
$error = (int)$_GET[error];
$errorMsg = "";
switch($error){
case 1:
$errorMsg="ERROR: invalid username or password";
break;
case 2:
$errorMsg="ERROR: Not a valid ammount: [$_GET[count]]";
break;
case 3:
$errorMsg="ERROR: Invalid Data";
break;
}
}
if($errorMsg != ""){
$body.="<br><font color=\"red\">".$errorMsg."</font><br>";
}
$body.="
<table border=\"0\"><tr><td>
<h2>Deposit...</h2>
<form class=\"form\" name=depositform enctype=\"multipart/form-data\" method=\"POST\" action=\"verifyaction.php\">
<h5>Please count all cash, cheques, and coupons in the coin box</h5>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font face=\"Verdana\" size=\"2\">Deposit Ammount: $
<input type=\"text\" name=\"ammount\" size=\"10\" value=\"$_GET[count]\">
<br>
Approved by:
<blockquote>Username: <input type=\"text\" name=\"username\" size=\"15\" value=\"$userLoginName\"><br>
Password: <input type=\"password\" name=\"password\" size=\"15\"></blockquote>
<br><br><br>
<input type=\"hidden\" name=\"action\" value=\"4\">
Deposited by: <input type=\"text\" name=\"data\" value=\"$_GET[data]\">
</font>
<input type=\"submit\" name=\"submit\" value=\"Process Deposit!\">
</form></td><td>
<h2>Payout...</h2>
<form class=\"form\" name=payoutform enctype=\"multipart/form-data\" method=\"POST\" action=\"verifyaction.php\">
<h5>Please count all cash, cheques, and coupons in the coin box</h5>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font face=\"Verdana\" size=\"2\">Payout Ammount: $
<input type=\"text\" name=\"ammount\" size=\"10\" value=\"$_GET[count]\">
<br>
Approved by:
<blockquote>Username: <input type=\"text\" name=\"username\" size=\"15\" value=\"$userLoginName\"><br>
Password: <input type=\"password\" name=\"password\" size=\"15\"></blockquote>
<br><br><br>
<input type=\"hidden\" name=\"action\" value=\"5\">
Payee: <input type=\"text\" name=\"data\" value=\"$_GET[data]\">
For: <input type=\"text\" name=\"data2\" value=\"$_GET[data2]\">
</font>
<input type=\"submit\" name=\"submit\" value=\"Process Payout!\">
</form></td></tr></table>
";
echo "$body";
// &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Counted by <b>$userLoginName</b>&nbsp;<input type=\"checkbox\" name=\"counter\">
$dbf->closeDBlink();
?>
</body>
</html>
+2
View File
@@ -0,0 +1,2 @@
[12-Mar-2009 01:49:01] PHP Parse error: syntax error, unexpected T_STRING in /home/recycle/public_html/www_campusbike.ca/pos/books/openshop.php on line 68
[12-Mar-2009 01:49:16] PHP Parse error: syntax error, unexpected $end in /home/recycle/public_html/www_campusbike.ca/pos/books/openshop.php on line 91
Executable
+32
View File
@@ -0,0 +1,32 @@
.form {
width: 400px;
margin-left: 15%;
//margin-right: auto;
margin-top: 0px;
padding: 10px;
border: 1px dotted #b2c7e7;
background-color: #EEEEEE;
}
.subform {
width: 250px;
margin: 0px;
padding: 0px;
border: 0px solid black;
background-color: #EEEEEE;
}
h2 {
width: 200px;
margin-top: 20px;
margin-bottom: 0px;
margin-left: 15%;
border-top: 1px dotted #b2c7e7;
border-left: 1px dotted #b2c7e7;
border-right: 1px dotted #b2c7e7;
background-color: #FFFFFF;
}
body {
background-color: #BBBBBB;
}
+75
View File
@@ -0,0 +1,75 @@
<?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();
}
echo "Processing...";
//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');
$adminID = $_SESSION['session_user_id'];
$field_names=array('date','event','user','ammount','data');
$field_data=array("$today", "open", "$adminID","$_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');
$field_data=array("$_POST[mechID]", "$tdin", "Mechanic");
$dbf->insert($field_names, $field_data, $tablename, "");
$adminID = $dbf->idToField($cfg_tableprefix.'users','customerID',$_SESSION['session_user_id']);
$field_data=array("$adminID", "$tdin", "Administrator");
$dbf->insert($field_names, $field_data, $tablename, "");
//$query = "INSERT INTO 'visits' ('userID' ,'intime' ,'activity') VALUES ('$_POST[mechID]', '$tdin', '\"using\"')";
//mysql_query($query);
echo "<script>document.location.href='../home.php'</script>";
$dbf->closeDBlink();
?>
</body>
</html>
+162
View File
@@ -0,0 +1,162 @@
\<?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();
}
//set default values, these will change if $action==update.
$userID='';
$loanID='';
$deposittaken='';
$loandate='';
$returndate='';
$notes='';
$latefeespaid='';
$paid='';
$id=-1;
//echo "post is $_POST[bikeID]and id is $id";
//Destroy the world if they didn't put a valid bike number in. Then apologize.
$bikecheck = mysql_query("SELECT * FROM bikes WHERE id='$_POST[bikeID]' LIMIT 1",$dbf->conn);
echo mysql_error();
$bikeexists = mysql_fetch_array($bikecheck);
$back = "<br /><br /><a href=\"index.php\">[Go Baaaaaack]</a>";
if($bikeexists['id'] == ""){ echo "<br />Bike Doesn't exist. Divide by zero. Did you put a bike number in the box? If you <b>did</b> put a number in, go back and try typing it again.$back"; die(); }
if($bikeexists['bikestatus'] == "repair"){ echo "<br />This is <b>a personal bike in for repair!</b> Take it from them and make a note! $back"; die(); }
if($bikeexists['bikestatus'] != "library"){ echo "<br />This is not a library bike. It is marked as <b>$bikeexists[bikestatus]</b>. Take it from them and tell the IT working group $back"; die(); }
if($bikeexists['putinservice'] == "" || $bikeexists['putinservice'] == "0000-00-00"){ echo "<br />This bike has not yet been put in service! DO NOT LOAN. Merci! $back"; die(); }
if($bikeexists['inrepair'] != "" && $bikeexists['inrepair'] != "0000-00-00"){ echo "<br />This bike is in repair. DO NOT LOAN. Merci! $back"; die(); }
if($bikeexists['retired'] != "" && $bikeexists['retired'] != "0000-00-00"){ echo "<br />This bike has been retired from the library. Do not loan. $back"; die(); }
//Check if bike is in or out
$inoutquery = mysql_query("SELECT * FROM libraryloans WHERE bikeID='$_POST[bikeID]' AND bikeout=1",$dbf->conn);
$loanarray = mysql_fetch_array($inoutquery);
//decides if the form will be used to sign in or add a loan.
if($loanarray['id'] != "")
{
$action="update";
// print_r($loanarray);
}
else
{
$action="insert";
}
//if action is update, sets variables to what the current loan data is.
if($action=="update")
{
$display->displayTitle("Bike is OUT. Sign it in");
if(isset($_POST['bikeID']))
{
// echo "Now it's all: $_POST[bikeID]";
$bikeID=$_POST['bikeID'];
$tablename = "$cfg_tableprefix".'libraryloans';
$result = mysql_query("SELECT *, UNIX_TIMESTAMP(duedate)as latedate FROM $tablename WHERE bikeID=\"$bikeID\" AND bikeout=1",$dbf->conn);
$row = mysql_fetch_assoc($result);
$userID=$row['userID'];
$loanID=$row['id'];
$deposittaken=$row['deposittaken'];
$loandate=$row['loandate'];
$duedate=$row['duedate'];
$returndate=$row['returndate'];
$notes=$row['notes'];
$latefees=$row['latefees'];
$latedate=$row['latedate'];
$today = date('U');
if($today > $latedate){
$todayowing = round((($today-$latedate)/60/60/24)-1, 0) * $cfg_dailyLateFee;
echo "<center>There is <b>\$$todayowing.00</b> owing in late fees.</center><br />";
}
}
}
else
{
$display->displayTitle("Bike #$_POST[bikeID] is available for loan. Use form below.");
}
//creates a form object
$f1=new form('process_form_library.php','POST','library','450',$cfg_theme,$lang);
// Get User ID's and names for the select creation
//sidenote: if user has bike, grab user number and add SELECTED to their entry in the select (last 3 lines)
$fnamearray = array();
$lnamearray = array();
$userIDarray = array();
$usrquery = mysql_query("SELECT first_name, last_name, id FROM customers ORDER BY last_name ASC");
while ($row = mysql_fetch_assoc($usrquery))
{
$namearray[] = $row['last_name'] .',' . $row['first_name'];
$idstring = $row['id'];
if($userID == $row['id']){
$idstring .= "SELECTED"; }
$userIDarray[] = $idstring;
}
if($action == "update"){ $disabled="disabled"; }
//creates form parts.
$f1->createSelectField("<b>Member: </b>",'userID',$userIDarray,$namearray,'170',"$disabled");
$f1->createInputField("<b>Deposit Taken:</b> $",'text','deposittaken',"$deposittaken",'24','170',"$disabled");
if ($action == "update"){ $f1->createInputField("Due Date (YYYY-MM-DD): ",'text','<b>duedate</b>',"$duedate",'24','170',"$disabled"); }
if ($action == "insert"){ $f1->createSingleDateSelectField("<b>Due Date</b>"); }
$f1->createCheckboxField("<b>Paying fees now?</b>","feespaid",'170');
//$f1->createInputField("<i>Late Fees Paid: $</i> ",'text','amtpaid',"",'24','170');
$f1->createTextareaField("Notes about this loan:",'notes','5','24',"$notes",'170');
//sends many hidden varibles needed for process_form_library.php.
echo "
<input type='hidden' name='action' value='$action'>
<input type='hidden' name='action' value='$action'>
<input type='hidden' name='id' value='$loanID'>
<input type='hidden' name='bikeID' value='$_POST[bikeID]'>";
if($action == "update"){
echo "<input type='hidden' name='userID' value='$userID'>";
echo "<input type='hidden' name='duedate' value='$duedate'>";
echo "<input type='hidden' name='deposittaken' value='$deposittaken'>";
echo "<input type='hidden' name='todayowing' value='$todayowing'>";
}
$f1->endLibraryForm();
$dbf->closeDBlink();
?>
</body>
</html>
+91
View File
@@ -0,0 +1,91 @@
<?php session_start(); ?>
<html>
<head>
<link rel="stylesheet" href="form.css" type="text/css">
</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,'Sales Clerk',$lang);
$display=new display($dbf->conn,$cfg_theme,$cfg_currency_symbol,$lang);
if(!$sec->isLoggedIn())
{
header ("location: ../login.php");
exit();
}
$today = date("Y-m-d");
$result = mysql_query("SELECT * FROM books");
if(!mysql_num_rows(mysql_query("SELECT * FROM books WHERE date='$today' AND event='close'")) && mysql_num_rows(mysql_query("SELECT * FROM books WHERE date='$today' AND event='open'"))){
header("location: ../home.php");
exit();
}
$body.="</select>";
$tablename = $cfg_tableprefix.'users';
$userLoginName = $dbf->idToField($tablename,'username',$_SESSION['session_user_id']);
$result = mysql_query("SELECT id,first_name,last_name FROM customers ORDER BY last_name ASC");
$error = (int)$_GET[error];
$errorMsg = "";
switch($error){
case 1:
$errorMsg="ERROR: if you are not $userLoginName please switch to your own administrator account";
break;
case 2:
$errorMsg="ERROR: Not a valid ammount: [$_GET[count]]";
break;
}
if($errorMsg != ""){
$body.="<br><font color=\"red\">".$errorMsg."</font><br>";
}
$body.="
<h2>Open The Shop...</h2>
<form class=\"form\" name=oopen enctype=\"multipart/form-data\" method=\"POST\" action=\"verifyaction.php\">
<h5>Before any members are singed in or any transactions are processed please count all
cash, cheques, and coupons in the coin box</h5>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font face=\"Verdana\" size=\"2\">Opening Count: $
<input type=\"text\" name=\"ammount\" size=\"10\" value=\"$_GET[count]\">
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Counted by <b>$userLoginName</b>&nbsp;<input type=\"checkbox\" name=\"counter\">
<br><br>";
if($cfg_mechAutoSignin != "no"){
if($cfg_mechAutoSignin == "option"){
$body .= "<input type=\"checkbox\" CHECKED name=\"m\">Sign in Mechanic: <br>";
}else{
$body .= "<input type=\"hidden\" value=\"on\" name=\"m\">";
}
$body .= "&nbsp;&nbsp;&nbsp;&nbsp;Mechanic on duty
<select name=\"data\">";
while($field = mysql_fetch_array($result)) { $body.="<option value=\"$field[id]\">$field[last_name], $field[first_name] </option>"; }
$body.="
</select>";
}
$body .= "<input type=\"hidden\" name=\"action\" value=\"1\">
<br><br><br>
</font>
<input type=\"submit\" name=\"submit\" value=\"Process!\">
</form>
";
echo "$body";
$dbf->closeDBlink();
?>
</body>
</html>
+190
View File
@@ -0,0 +1,190 @@
<?php session_start();
//<?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();
}
//echo "Processing...";
$action = $_POST[action];
//check to make sure it's a number
$actionPage = "";
$user = null;
switch($action){
case 1:
$actionPage = "openshop";
$user = $_SESSION['session_user_id'];
break;
case 2:
$actionPage = "closeshop";
$user = $_POST[username];
break;
case 3:
$actionPage = "openshop";
$user = $_POST[username];
break;
case 4:
case 5:
$actionPage = "depositPayout";
$user = $_POST[username];
break;
}
//make sure the ammount looks right
if(!isset($_POST[ammount]) || !strval(floatval($_POST[ammount])) == strval($_POST[ammount])){
header("location: $actionPage.php?error=2&count=$_POST[ammount]");
exit();
}
//check to make sure it was the administrator who counted
// Or that a valid username and password was entered
if($action == 1 && !$_POST[counter]){
header("location: $actionPage.php?error=1&count=$_POST[ammount]");
exit();
}else if($action != 1 && !$sec->checkLogin($_POST[username], md5($_POST[password]))){
header("location: $actionPage.php?error=1&count=$_POST[ammount]");
exit();
}
if((($action == 4 || $action == 5) && (!isset($_POST[data]) || !strlen($_POST[data]))) || ($action == 5 && (!isset($_POST[data2]) || !strlen($_POST[data]) || strrchr($_POST[data], "^")))){
header("location: $actionPage.php?error=3&count=$_POST[ammount]&data=$_POST[data]&data2=$_POST[data2]");
exit();
}
//echo "stuff";
if(($action == 1 || $action == 2) && !$_POST[nocompare]){
$lastCountFound = false;
$compareAmmount = 0.0;
if($action == 2){
$cashresult = mysql_query("SELECT sale_total_cost FROM sales WHERE date='$today'");
while ($casharray = mysql_fetch_array($cashresult)){
$compareAmmount += $casharray[sale_total_cost];
}
}
$le = mysql_query("SELECT * FROM books ORDER BY listID DESC");//, $dfb->conn);
while(($item = mysql_fetch_assoc($le)) && !$lastCountFound){
switch($item[event]){
case 1:
case 2://close
$lastCountFound = true;
$compareAmmount += ($item[ammount] / 100.0);
break;
case 4://deposit
$compareAmmount -= ($item[ammount] / 100.0);
break;
case 5://payout
$compareAmmount -= ($item[ammount] / 100.0);
break;
}
}
if($_POST[ammount] != $compareAmmount){
$difference = round(abs($_POST[ammount] - $compareAmmount), 2);//, PHP_ROUND_HALF_UP);
echo "<html><head><link rel=\"stylesheet\" href=\"form.css\" type=\"text/css\"></head>";
echo "<body><h2>Count was ";
if($_POST[ammount] < $compareAmmount){
echo "Short";
}else{
echo "Over";
}
echo "</h2><form class=\"form\" name=\"continue\" enctype=\"multipart/form-data\" method=\"POST\" action=\"verifyaction.php\">
<h3>There was a difference of $"."$difference<br><br>
<input type=\"hidden\" name=\"ammount\" value=\"$_POST[ammount]\">
<input type=\"hidden\" name=\"action\" value=\"1\">
<input type=\"hidden\" name=\"counter\" value=\"1\">
<input type=\"hidden\" name=\"data\" value=\"$_POST[data]\">
<input type=\"hidden\" name=\"nocompare\" value=\"$action\">
<input type=\"submit\" name=\"submit\" value=\"Count is correct, proceede...\">
</form><br><br>
<form name=\"redo\" class=\"subform\" enctype=\"multipart/form-data\" method=\"GET\" action=\"$actionPage.php\">
<input type=\"hidden\" name=\"count\" value=\"$_POST[ammount]\">
<input type=\"submit\" name=\"submit\" value=\"Recount...\">
</form>
</body>
</html>";
exit();
}
// <input type=\"text\" name=\"username\" size=\"15\" value=\"$_POST[username]\">
// <input type=\"hidden\" name=\"password\" size=\"15\ value=\"$_POST[password]\">
}
//$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');
$ammount = $_POST[ammount]*100.0;
$field_names=array('date','event','user','ammount','data');
$data = $_POST[data];
if($action == 5){
$data .= "^".$_POST[data2];
}
$field_data=array("$today", "$action", "$user","$ammount","$data");
$dbf->insert($field_names,$field_data,$tablename,"");
if($action == 1){//"open"){
//no one should be logged in but in case they are, log them out.
$now = date('Y-m-d H:i:s');
$userresult = mysql_query("SELECT * FROM visits WHERE endout IS NULL ORDER BY activity ASC");
while($row = mysql_fetch_array($userresult)){
$visitID = $row[visitID];
//
$query="UPDATE visits SET endout='$now' WHERE visitID='$visitID' LIMIT 1";
mysql_query($query) or die('Error, user not done . Consult Mark, he probably fucked up. OH shits');
}
$tablename="$cfg_tableprefix".'visits';
//$tdin = date('Y-m-d H:i:s');
if($cfg_mechAutoSignin != "no" && $_POST["m"]){
$sec->signinMember($_POST[data], $now, "Mechanic");
}
if($cfg_adminAutoSignin){
$adminID = $dbf->idToField($cfg_tableprefix.'users','customerID',$_SESSION['session_user_id']);
$sec->signinMember($adminID, $now, "Administrator");
}
header("location: ../home.php");
}else if($action == 2){//"close"){
//log everyone out
$userresult = mysql_query("SELECT * FROM visits WHERE endout IS NULL ORDER BY activity ASC");
while($row = mysql_fetch_array($userresult)){
$visitID = $row[visitID];
$now = date('Y-m-d H:i:s');
$query="UPDATE visits SET endout='$now' WHERE visitID='$visitID' LIMIT 1";
mysql_query($query) or die('Error, user not done . Consult Mark, he probably fucked up. OH shits');
}
session_destroy();
//header("location: ../shopclosed.php");
echo "<script>parent.document.location.href='../shopclosed.php'</script>";
}else{
//header("location: ../index.php");
echo "<script>document.location.href='../home.php'</script>";
}
$dbf->closeDBlink();
?>
<html>
<head>
<link rel="stylesheet" href="form.css" type="text/css">
</head>
<body>
</body>
</html>