-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathview.php
More file actions
138 lines (89 loc) · 2.75 KB
/
Copy pathview.php
File metadata and controls
138 lines (89 loc) · 2.75 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<?php
session_start();
$loguser = $_SESSION['user'];
$role = $_SESSION['role'];
//$order = $_SESSION['order'];
if ($_SESSION['user']) {
//echo $da. ", welcome back";
/*$isSecure = 1;
if (isset($_SERVER['HTTPS'])) {
$isSecure = 2;echo "Secure is ".$isSecure. " da";
}*/
if (isset($_COOKIE['order'])) {
$va = $_COOKIE["order"];
// echo "ses";
}
if (($_COOKIE["order"] != $_GET['val']) && ($_GET['val'])) {
$va = $_GET['val'];
setcookie("order",$_GET['val'],time()+86400*30);
// $va = $_COOKIE["order"];
}
//echo $_GET['val'];
//if($va)
// echo $va;
//$lines = file('C:\xampp\new\htdocs\secret\topsecret');
?>
<?php include 'a1.lib'; ?>
<?php include 'a21.lib'; ?>
<div class="main">
<table class ="show" border = "1">
<tr>
<th><a href="view.php?val=itemName">Items</a></th><th><a href="view.php?val=description">Description</a></th><th><a href="view.php?val=supplierCode">Supplier Code</th>
<th><a href="view.php?val=cost">Cost</th>
<th><a href="view.php?val=price">Price</th><th><a href="view.php?val=onHand">On Hand</th>
<th><a href="view.php?val=reorderPoint">Reorder Point</th><th><a href="view.php?val=backOrder">Back Order</th><th>Delete/Restore</th>
<?php
$link = new DBLink();
if (isset($_POST['searchbutton']) && ($_POST['search']) !="") {
$keyword = $_POST['search'];
$sql_query = "SELECT * from inventory where description like \"%$keyword%\" ";
}
else {
$sql_query = "SELECT * from inventory order by '$va'";}
//Run our sql query
$result = $link->query($sql_query);
/*if (!$result) {
return false;
}*/
if($result->num_rows == 0) {
?>
<p text-align ="center"> The line can not be found </p>
<?php
}
while($row = $result->fetch_assoc())
{
?>
<tr>
<td><a href="add.php?id=<?php echo $row['id']; ?>"><?php print $row['itemName']; ?></a></td>
<td><?php print $row['description'];?></td>
<td><?php print $row['supplierCode'] ;?></td>
<td><?php print $row['cost'];?></td>
<td><?php print $row['price'];?></td>
<td><?php print $row['onHand'];?></td>
<td><?php print $row['reorderPoint'];?></td>
<td><?php print $row['backOrder'];?></td>
<?php if ($row['deleted']=='n') { ?>
<td><a href="delete.php?id=<?php echo $row['id'] ?>&change=<?php echo $row['deleted']?>">Delete</a></td></tr>
<?php } else { ?>
<td><a href="delete.php?id=<?php echo $row['id'] ?>&change=<?php echo $row['deleted']?>">Restore</a></td></tr>
<?php }
?>
<?php
}
unset($link);
?>
</table>
</div>
<?php
}
else {
header("Refresh:3;url=login.php");
?>
<div align = "center">
<img align ="center" src="cat.gif" alt="cat" style="width:128px;height:128px"><br> <br>
<?php
echo "You are redirecting to a login page. Wait 5 seconds"; ?>
</div>
<?php
}
?>