-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_availability.php
75 lines (69 loc) · 1.81 KB
/
check_availability.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
<?php
require_once("includes/config.php");
//For Email
if(!empty($_POST["emailid"])) {
$email= $_POST["emailid"];
if (filter_var($email, FILTER_VALIDATE_EMAIL)===false) {
echo "error : You did not enter a valid email.";
}
else {
$result ="SELECT count(*) FROM userRegistration WHERE email=?";
$stmt = $mysqli->prepare($result);
$stmt->bind_param('s',$email);
$stmt->execute();
$stmt->bind_result($count);
$stmt->fetch();
$stmt->close();
if($count>0)
{
echo "<span style='color:red'> Email already exist. Please try again.</span>";
}
}
}
// For Registration Number
if(!empty($_POST["regno"])) {
$regno= $_POST["regno"];
$result ="SELECT count(*) FROM userRegistration WHERE regNo=?";
$stmt = $mysqli->prepare($result);
$stmt->bind_param('s',$regno);
$stmt->execute();
$stmt->bind_result($count);
$stmt->fetch();
$stmt->close();
if($count>0)
{
echo "<span style='color:red'> Registration number already exist. Please try again .</span>";
}
}
// For old Password
if(!empty($_POST["oldpassword"]))
{
$pass=$_POST["oldpassword"];
$result ="SELECT password FROM userregistration WHERE password=?";
$stmt = $mysqli->prepare($result);
$stmt->bind_param('s',$pass);
$stmt->execute();
$stmt -> bind_result($result);
$stmt -> fetch();
$opass=$result;
if($opass==$pass)
echo "<span style='color:green'> Password matched .</span>";
else echo "<span style='color:red'> Password Not matched</span>";
}
// For room availbilty
if(!empty($_POST["roomno"]))
{
$roomno=$_POST["roomno"];
$result ="SELECT count(*) FROM registration WHERE roomno=?";
$stmt = $mysqli->prepare($result);
$stmt->bind_param('i',$roomno);
$stmt->execute();
$stmt->bind_result($count);
$stmt->fetch();
$stmt->close();
if($count>0)
echo "<span style='color:red'>$count Seats already full.</span>";
else
echo "<span style='color:red'>All Seats are Available</span>";
}
?>