-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreset.php
66 lines (57 loc) · 1.56 KB
/
reset.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
session_start();
include 'classes/session-timeout.php';
if($_SESSION["verified"] != "v3r1f13d" && $_SESSION["verified"] != "v3r1f13d-adm1n"){
header("Location: /inventory/index.php");
exit();
}
//Determine which button was pressed on the previous form
$unit = array_keys($_POST)[0];
$fixture = $_SESSION['fixnum'];
$shelf = $_SESSION['shelfnum'];
$box = $_SESSION['boxnum'];
//Grabs the data from SESSION, and indexes them numerically.
$infoarray = $_SESSION['barcode'];
$barcodes = array_keys($infoarray);
//Iterate through each barcode
foreach($barcodes as $barcode){
//Get the fix-shelf-box-qt counts for this barcode
$countsList = $infoarray[$barcode];
for($i=0;$i<count($countsList);$i++){
$split = explode("-",$countsList[$i]);
if($unit=="fixture"){
if($fixture==$split[0]){
unset($infoarray[$barcode][$i]);
continue;
}
}
if($unit=="shelf"){
//Note: fixture has to match too
if($fixture==$split[0]){
if($shelf==$split[1]){
unset($infoarray[$barcode][$i]);
continue;
}
}
}
if($unit=="box"){
//Note: all 3 must match
if($fixture==$split[0]){
if($shelf==$split[1]){
if($box==$split[2]){
unset($infoarray[$barcode][$i]);
continue;
}
}
}
}
}
//If there aren't any left:
if(empty($infoarray[$barcode]))
//delete that barcode
unset($infoarray[$barcode]);
}
$_SESSION["barcode"] = $infoarray;
//redirect back to scan.php
Header("Location: scan.php");
?>