-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcust_request.php
250 lines (222 loc) · 7.59 KB
/
cust_request.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
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
<?php
ob_start();
session_start();
if(!isset($_SESSION["CUS_ID"])){
header("location:login.php");
}
include("db.php");
if(!isset($_SESSION['CUS_ID']))
{
include("includes/main_header.php");
}
else
{
include("includes/header.php");
}
if(isset($_GET['id']))
{
$sql1="DELETE FROM request where rid={$_GET['id']};";
$res1=$db->query($sql1);
header('location: cust_request.php');
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Request books</title>
<link rel="stylesheet" type="text/css" href="css/cards.css">
<link rel="stylesheet" type="text/css" href="css/tables.css">
<link rel="stylesheet" type="text/css" href="css/cat_card.scss">
<link rel="stylesheet" type="text/css" href="css/font.scss">
<style>
.blackboard {
position: relative;
width: 640px;
margin: 7% auto;
border: tan solid 12px;
border-top: #bda27e solid 12px;
border-left: #b19876 solid 12px;
border-bottom: #c9ad86 solid 12px;
box-shadow: 0px 0px 6px 5px rgba(58, 18, 13, 0), 0px 0px 0px 2px #c2a782, 0px 0px 0px 4px #a58e6f, 3px 4px 8px 5px rgba(0, 0, 0, 0.5);
background-image: radial-gradient( circle at left 30%, rgba(34, 34, 34, 0.3), rgba(34, 34, 34, 0.3) 80px, rgba(34, 34, 34, 0.5) 100px, rgba(51, 51, 51, 0.5) 160px, rgba(51, 51, 51, 0.5)), linear-gradient( 215deg, transparent, transparent 100px, #222 260px, #222 320px, transparent), radial-gradient( circle at right, #111, rgba(51, 51, 51, 1));
background-color: #333;
}
.blackboard:before {
box-sizing: border-box;
display: block;
position: absolute;
width: 100%;
height: 100%;
background-image: linear-gradient( 175deg, transparent, transparent 40px, rgba(120, 120, 120, 0.1) 100px, rgba(120, 120, 120, 0.1) 110px, transparent 220px, transparent), linear-gradient( 200deg, transparent 80%, rgba(50, 50, 50, 0.3)), radial-gradient( ellipse at right bottom, transparent, transparent 200px, rgba(80, 80, 80, 0.1) 260px, rgba(80, 80, 80, 0.1) 320px, transparent 400px, transparent);
border: #2c2c2c solid 2px;
content: "Add Request";
font-family: 'Permanent Marker', cursive;
font-size: 2.2em;
color: rgba(238, 238, 238, 0.7);
text-align: center;
padding-top: 20px;
}
.form {
padding: 70px 20px 20px;
}
p {
position: relative;
margin-bottom: 1em;
}
label {
vertical-align: middle;
font-family: 'Permanent Marker', cursive;
font-size: 1.6em;
color: rgba(238, 238, 238, 0.7);
}
p:nth-of-type(5) > label {
vertical-align: top;
}
input,
textarea {
vertical-align: middle;
padding-left: 10px;
background: none;
border: none;
font-family: 'Permanent Marker', cursive;
font-size: 1.6em;
color: rgba(238, 238, 238, 0.8);
line-height: .6em;
outline: none;
}
select {
vertical-align: middle;
padding-left: 10px;
background : transparent;
border: none;
width : 40%;
font-family: 'Permanent Marker', cursive;
font-size: 1.6em;
color: rgba(238, 238, 238, 0.8);
line-height: .6em;
outline: none;
}
option {
vertical-align: middle;
padding-left: 10px;
background : rgb(63, 62, 70);
border: none;
font-family: 'Permanent Marker', cursive;
font-size: 1.0em;
color: rgba(238, 238, 238, 0.8);
line-height: .6em;
outline: none;
}
textarea {
margin-top: 1%;
height: 120px;
font-size: 1.4em;
line-height: 1em;
resize: none;
}
input[type="submit"] {
cursor: pointer;
color: rgba(238, 238, 238, 0.7);
line-height: 1em;
padding: 0;
}
input[type="submit"]:focus {
background: rgba(238, 238, 238, 0.2);
color: rgba(238, 238, 238, 0.2);
}
::-moz-selection {
background: rgba(238, 238, 238, 0.2);
color: rgba(238, 238, 238, 0.2);
text-shadow: none;
}
::selection {
background: rgba(238, 238, 238, 0.4);
color: rgba(238, 238, 238, 0.3);
text-shadow: none;
}
</style>
</head>
<body>
<form action="<?php echo $_SERVER["PHP_SELF"];?>" method = "post">
<div style="margin-right: 10%;">
<div class="blackboard">
<div class="form">
<hr>
<?php
if (isset($_POST["submit"])) {
$_POST["bname"] = addslashes($_POST["bname"]);
$_POST["request"] = addslashes($_POST["request"]);
$sql = "INSERT INTO request (cus_id ,bname, request, logs) VALUES ({$_SESSION["CUS_ID"]},'{$_POST["bname"]}','{$_POST["request"]}', now());";
$res = $db->query($sql);
if ($res) {
echo "<p style='color:green;'>Request Sent Successfully</p>";
header("location:cust_request.php");
}
else {
echo "<p style='color:red;'>Unable to send request</p>";
}
}
?>
<p><br>
<label for="bname">Book Name </label>
<input type="text" placeholder="Enter text" name="bname" required>
</p>
<p>
<label for="request" style="vertical-align:top;">Request </label>
<textarea name="request" placeholder="Enter your request" required></textarea>
</p>
<p class="wipeout" style="text-align:center">
<input type="submit" class="submit" name="submit" value="Submit" /></p>
</div>
</div></div>
</form>
<br>
<?php
$sql="SELECT * FROM request where request.cus_id = {$_SESSION["CUS_ID"]};";
$res=$db->query($sql);
if($res->num_rows>0)
{
echo "
<div style='margin-right:26%'>
<table class='container' style='background-color:#1F2739;'>
<thead>
<tr>
<th>BOOK NAME</th>
<th>REQUEST</th>
<th>TIME LOG</th>
<th>UNSEND</th>
</tr>
</thead>
<tbody>
";
while($rows=$res->fetch_assoc())
{
echo"
<tr>
<td>{$rows["bname"]}</td>
<td>{$rows["request"]}</td>
<td>{$rows["logs"]}</td>
<td><a style='color: red' href='cust_request.php?id={$rows['rid']}'>Unsend</a></td>
</tr>
";
}
echo"
</tbody>
</table>
</div>
";
}
else
{
echo "<p style='color: red'>No requests</p>";
}
?>
<style>
#request{
background: #8ae600;
}
#request:after{
color: #8ae600;
}
</style>
<?php ob_end_flush();?>