generated from diveshlunker/BloodX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
117 lines (88 loc) · 3.19 KB
/
login.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
<?php
session_start();
if(isset($_SESSION['uid']))
{
header('location:users/home.php');
}
?>
<html>
<head>
<title>Login PopUp</title>
<link rel="stylesheet" type="text/css" href="css2/login2.css">
</head>
<body>
<div class="wrapper">
<div class="container">
<br><br>
<div class="signup"><hr>Login<hr></div>
<form action="login.php" method="post">
<div class="signup-form" >
<input type="text" placeholder="Your Email Address" name="email" class="input" required><br />
<input type="password" placeholder="Create Password" name="password" class="input" required><br />
<input type="submit" class="btn" name="submit" value="LOGIN"/><br>
</div>
</form>
</div>
</div>
</body>
</html>
<?php
include('dbcon.php');
if(isset($_POST['submit'])){
$email = $_POST['email'];
$pass = $_POST['password'];
$qrysearch = "SELECT * FROM `users` WHERE `email` = '$email' AND `password`='$pass' ";
$run = mysqli_query($con,$qrysearch);
if(mysqli_num_rows($run)<=0){
$qrysearchorg = "SELECT * FROM `organization` WHERE `email` = '$email' AND `password`='$pass' ";
$runorg = mysqli_query($con,$qrysearchorg);
if(mysqli_num_rows($runorg)<=0){
$qrysearchspon = "SELECT * FROM `sponsers` WHERE `email` = '$email' AND `password`='$pass' ";
$runspon = mysqli_query($con,$qrysearchspon);
if(mysqli_num_rows($runspon)<=0){
$qrysearchadmin = "SELECT * FROM `admin` WHERE `email` = '$email' AND` password`='$pass' ";
$runadmin = mysqli_query($con,$qrysearchadmin);
if(mysqli_num_rows($runadmin)<=0){
?>
<script>
alert("Incorrect Id Or Password! Try Again");
</script>
<?php
}
else{
$data = mysqli_fetch_assoc($runadmin);
$id = data['id'];
$_SESSION['uid'] = $id;
header('location:admin/dash.php');
}
}
else{
$data = mysqli_fetch_assoc($runspon);
$id = data['id'];
$_SESSION['uid'] = $id;
header('location:spon/dash.php');
}
}
else{
$data = mysqli_fetch_assoc($runorg);
$id = data['id'];
$_SESSION['uid'] = $id;
?>
<script>
window.open('org/dash.php?sid=<?php echo $id;?>','self');
</script>
<?php
}
}
else{
$data = mysqli_fetch_assoc($run);
$id = data['id'];
$_SESSION['uid'] = $id;
?>
<script>
window.open('users/dash.php?sid=<?php echo $id;?>','self');
</script>
<?php
}
}
?>