-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvalidate.php
71 lines (70 loc) · 2.02 KB
/
validate.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
<?php
include 'connect_db.php';
if(isset($_POST['loginType']))
{
if($_POST['loginType'] == 'customer')
{
echo 'Customer login validation';
$email = $_POST['email'];
$password = $_POST['password'];
$sql = "SELECT * FROM customer where email = '$email'";
$result = $conn->query($sql);
$row = $result->fetch_assoc();
if($row['pwd'] == $password)
{
echo '<br>Login Successfull and redirecting ';
header('Location: /SWE/customer_dashboard.php');
session_start();
$_SESSION['cust_id'] = $row['userId'];
}
else
{
echo "<h1 style='color:red'>WRONG Credential</h1><h3>You are Legen-Wait-for-it-Dary!!!</h3><br>Chill! you can login again in 3 seconds";
header( "refresh:3;url=/SWE/customer_dashboard.php" );
}
}
#For Vendors
else if($_POST['loginType'] == 'vendor')
{
$paypal = $_POST['paypal_id'];
$password = $_POST['password'];
$sql1 = "SELECT * FROM vendor where paypal_id = '$paypal'";
$result1 = $conn->query($sql1);
$row = $result1->fetch_assoc();
if($row['pwd'] == $password)
{
echo '<br>Login Successfull and redirecting ';
header('Location: /SWE/vendor_dashboard.php');
session_start();
$_SESSION['vendor_id'] = $row['vendor_id'];
}
else
{
echo "<h1 style='color:red'>WRONG Credential</h1><h3>You are Legen-Wait-for-it-Dary!!!</h3><br>Chill! you can login again in 3 seconds";
header( "refresh:3 ;url=/SWE/vendor_login.php" );
}
}
#for Admins
else
{
$password = $_POST['password'];
if($password == "admin")
{
echo '<br>Login Successfull and redirecting ';
header('Location: /SWE/admin_dashboard.php');
session_start();
$_SESSION['admin'] = "admin";
}
else
{
echo "<h1 style='color:red'>WRONG Credential</h1><h3>You are Legen-Wait-for-it-Dary!!!</h3><br>Chill! you can login again in 3 seconds";
header( "refresh:3 ;url=/SWE/Admin_login.php" );
}
}
}
else
{
echo "<h1>You are Legen-Wait-for-it-Dary!!!</h1><br>please login!";
//Enter URL for the main page for login
}
?>