-
Notifications
You must be signed in to change notification settings - Fork 1
/
orderrent.php
331 lines (287 loc) · 8.24 KB
/
orderrent.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
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
<?php
error_reporting(1);
?><?php
session_start();
$id=$_SESSION['eid'];
include("config.php");
$itemno=$_REQUEST['itemno'];
if(isset($_REQUEST['send']))
{
$spl=mysql_query("select * from booksonrent where user_name='$id'");
$nck=0;
if($spl==false)
{
die(mysql_error());
}
while($mt = mysql_fetch_array($spl))
{
$mtc=$mt['Status'];
if($mtc=='Approved')
$nck++;
}
if($nck==0)
{
$sql=mysql_query("select * from rbook where ID='$itemno'");
if($sql==false)
{
die(mysql_error());
}
while($mat = mysql_fetch_array($sql))
{
$s=$mat['stock'];
}
if($s!=0)
{
$uid=$_REQUEST['uid'];
$bn=$_REQUEST['bn'];
$dy=$_REQUEST['dy'];
$pr=$_REQUEST['pr'];
$pn=$_REQUEST['pn'];
$mn=$_REQUEST['mn'];
$add=$_REQUEST['ad'];
$c=$_REQUEST['c'];
$pa=$dy*$pr;
$order_no='rent'.rand(100,500);
if($pa>0)
{
if($pa<15)
{
if($pa>5)
{
$s=$s-1;
if(mysql_query("UPDATE rbook
SET stock='$s'
WHERE ID='$itemno'"))
{ }
else
{
die(mysql_error());
}
if(mysql_query("insert into booksonrent (user_name,ID,MobileNumber,Address,city,daysissued,rent,PayAmnt,order_no) values('$uid','$itemno','$mn','$add','$c','$dy','$pr','$pa','$order_no')"))
{
echo "<script>location.href='ordersent.php?ordersent.php?order=$order_no&i=3&pa=$pa'</script>";
}
else
{
die(mysql_error());
}
}
else
{
echo "sorry we cant provide books less than 5 days";
}
}
else
echo "sorry we cant provide books more than 15 days";
}
else
{
header("location:days.html");
}
}
else
{
header("location:outofstock.php");
}
}
else
{
echo"<h2 align='center'><strong>SORRY YOU CAN RENT ONLY ONE BOOK AT A TIME</strong></h2>";
}
}
if(isset($_REQUEST['log'])=='out')
{
session_destroy();
header("location:index.php");
}
else if($id=="")
{
header("location:index.php");
}
else if($itemno=="")
{
header("location:index.php");
}
?>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="form-basic.css">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<style>
body
{
background-image:url(12.jpg);
background-size:cover;
}
</style>
</head>
<body>
<?php
$sql=mysql_query("select * from users where user_name='$id'");
if($sql==false)
{
die(mysql_error());
}
while($mat = mysql_fetch_array($sql))
{
$j=$mat['Name'];
echo $j;
}
?>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li class="active"><a href="index.php">NewBooks</a></li>
<li><a href="oldbook.php">OldBooks</a></li>
<li><a href="rentbook.php">Rent a book</a></li>
<li><a href="feedback.php">Feedback</a></li>
<li><a href="contact.php">ContactUs</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="login.php"><span class="glyphicon glyphicon-user"></span> MyProfile</a></li>
<?php
session_start();
$id=$_SESSION['eid'];
if($id!="")
echo"<li><a href='?log=out'><span class='glyphicon glyphicon-log-out'></span> Logout</a></li>";
if(isset($_REQUEST['log'])=='out')
{
session_destroy();
header("location:index.php");
}
?>
</ul>
</div>
</div>
</nav>
</div>
</div>
</nav>
<br/>
<br/>
<br/>
<br/>
<div>
<div><br/><center><h2><font face="Lucida Handwriting" size="+2" color="white">Welcome
<?php
$sql=mysql_query("select * from users where user_name='$id'");
if($sql==false)
{
die(mysql_error());
}
while($mat = mysql_fetch_array($sql))
{
$j=$mat['Name'];
echo $j;
}
?>
</font></h2>
</div>
<?php
$sql=mysql_query("select * from rbook where ID='$itemno'");
if($sql==false)
{
die(mysql_error());
}
while($mat = mysql_fetch_array($sql))
{
$a=$mat['Author'];
$b=$mat['BOOKNAME'];
$p=$mat['Rent'];
$pc=$mat['PublicatonHouse'];
}
?>
<div class="main-content">
<form method="post" name="f1" onSubmit="return vali()" class="form-basic">
<div class="form-title-row">
<h3>Rent Form</h3>
</div>
<div class="form-row">
<label>
<span>User Id:</span>
<input name="uid" type="text" id="uid" onChange="return fnam()" readonly="readonly" value="<?php echo $id;?>">
</label>
</div>
<div class="form-row">
<label>
<span>BookName:</span>
<input name="bn" type="text" id="bn" onChange="return fnam()" readonly="readonly" value="<?php echo $b;?>">
</label>
</div>
<div class="form-row">
<label>
<span>Author:</span>
<input name="au" type="text" id="au" onChange="return fnam()" readonly="readonly" value="<?php echo $a;?>">
</label>
</div>
<div class="form-row">
<label>
<span>Publisher:</span>
<input name="pn" type="text" id="pn" onChange="return fnam()" readonly="readonly" value="<?php echo $pc;?>">
</label>
</div>
<div class="form-row">
<label>
<span>Rent:</span>
<input name="pr" type="text" id="pr" onChange="return lnam()" readonly="readonly" value="<?php echo $p;?>Rs">
</label>
</div>
<div class="form-row">
<label>
<span>No of Days:</span>
<input name="dy" type="text" id="dy" required="required" onChange="return phone()">
</label>
</div>
<div class="form-row">
<label>
<span>Mobile no:</span>
<input name="mn" required="required" type="text" id="mn" onChange="return phone()">
</label>
</div>
<div class="form-row">
<label>
<span>Address</span>
<textarea name="ad" required="required" id="ad" value="return add()"></textarea>
</label>
</div>
<div class="form-row">
<label>
<span>City</span>
<select name="c" id="c">
<option value="Mumbai">Mumbai</option>
<option value="Pune">Pune</option>
</select>
</label>
</div>
<div class="form-row">
<button name="send" type="submit" id="send" value="Send">Submit</button>
</div>
</form>
</div>
<br/>
<br/>
<br/>
<div id="Bottom" align='center'>
<h5 class="down" align='center'><b>DONT USE THIS PROJECT FOR COMMERCIAL PURPOSE</b></h5>
<h5 class="down" align='center'><b>Copyright © ABHISHEK DUDHAL</b></h5>
</div>
</body>
</html>