-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathorderrent2.php
214 lines (203 loc) · 5.77 KB
/
orderrent2.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
<?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,book_id,MobileNumber,Address,city,daysissued,rent,PayAmnt,order_no) values('$uid','$itemno','$mn','$add','$c','$dy','$pr','$pa','$order_no')"))
{
echo "<script>location.href='buy.php?order=$order_no'</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.html");
}
}
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");
}
?>
<body>
<div>
<div><br/><center><h2><font face="Lucida Handwriting" size="+2" color="#111">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></center>
<h2 align="right"><a href="?log=out"><font color="#111">LogOut</font></a></h2>
</div>
<div style="width:25%;float:right">
<br><br><br><br>
</div>
<center><div style="width:70%;float:right" align="center">
<center><h2><font strong size="+1" color="#1f1f1f">Order Form</font></h2></center>
<fieldset style="width:50%">
<br><br>
<?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'];
}
?>
<form method="post" name="f1" onSubmit="return vali()">
<table width="366" border="0" align="center">
<tr>
<td width="164"><div align="center"><font size="+1" face="Comic Sans MS"><b>User Id:</b></font></div></td>
<td width="192">
<input name="uid" type="text" id="uid" onChange="return fnam()" readonly="readonly" value="<?php echo $id;?>"> </td>
</tr>
<tr>
<td><div align="center"><strong><font size="+1" face="Comic Sans MS">BookName: </font></strong></div></td>
<td><label>
<input name="bn" type="text" id="bn" onChange="return fnam()" readonly="readonly" value="<?php echo $b;?>">
</label></td>
</tr>
<tr>
<td width="164"><div align="center"><font size="+1" face="Comic Sans MS"><b> Author:</b></font></div></td>
<td width="192">
<input name="au" type="text" id="au" onChange="return fnam()" readonly="readonly" value="<?php echo $a;?>"> </td>
</tr>
<tr>
<td width="164"><div align="center"><font size="+1" face="Comic Sans MS"><b> Publlisher:</b></font></div></td>
<td width="192">
<input name="pn" type="text" id="pn" onChange="return fnam()" readonly="readonly" value="<?php echo $pc;?>"> </td>
</tr>
<tr>
<td><div align="center"><font size="+1" face="Comic Sans MS"><strong>Rent:</strong></font></div></td>
<td><input name="pr" type="text" id="pr" onChange="return lnam()" readonly="readonly" value="<?php echo $p;?>Rs"> </td>
</tr>
<tr> <td><div align="center"><font size="+1" face="Comic Sans MS"><b>Daysyouwant: </b></font></div></td>
<td><input name="dy" type="text" id="dy" required="required" onChange="return phone()"></td>
</tr>
<tr> <td><div align="center"><font size="+1" face="Comic Sans MS"><b>Mobile no: </b></font></div></td>
<td><input name="mn" required="required" type="text" id="mn" onChange="return phone()"></td>
</tr>
<tr>
<td><div align="center"><font size="+1" face="Comic Sans MS"><strong>Address:</strong></font></div></td>
<td><label>
<textarea name="ad" required="required" id="ad" value="return add()"></textarea>
</label></td>
</tr>
<tr>
<td><div align="center"><font size="+1" face="Comic Sans MS"><strong>City:</strong></font></div></td>
<td><input name="c" type="text" id="c" onChange="return coun()"></td>
</tr>
<tr>
<td colspan="2"><label><br>
<center>
<input name="send" type="submit" id="send" value="Send">
</center>
</label></td>
</tr>
</table>
</form>
</fieldset>
</div>
</center>
</div>
<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>