-
Notifications
You must be signed in to change notification settings - Fork 0
/
check_availability.php
53 lines (49 loc) · 1.66 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
<?php
require_once("includes/config.php");
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 .</span>";
} else {
echo "<span style='color:green'> Email available for registration .</span>";
}
}
}
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>";
}
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>";
}
?>