-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
176 lines (150 loc) · 5.35 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
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
<?php
session_start();
include("menubar.php");
include("function.php");
$dbhost = "localhost";
$dbuser = "root";
$dbpassword = "";
$dbname = "ewed";
$con = mysqli_connect($dbhost, $dbuser, $dbpassword, $dbname);
if ($_SERVER['REQUEST_METHOD'] == "POST") {
$password = $_POST['password'];
$mail = $_POST['mail'];
if (($mail != "") && ($password != "")) {
$query = "select password,email,id from login where email = '$mail' and password = '$password' limit 1";
$result = mysqli_query($con, $query);
if ($result) {
if (mysqli_num_rows($result) > 0) {
$data = mysqli_fetch_assoc($result);
if ($data['password'] == $password && $data['email'] == $mail) {
$_SESSION['id'] = $data['id'];
$id = $_SESSION['id'];
$profilestatus = "select profilestatus from status where cid = $id ";
$profilestatusresult = mysqli_query($con, $profilestatus);
if (mysqli_num_rows($profilestatusresult) > 0) {
$profilestatusdata = mysqli_fetch_assoc($profilestatusresult);
if ($profilestatusdata['profilestatus'] == 0 || $profilestatusdata['profilestatus'] == 4 || $profilestatusdata['profilestatus'] == 5) {
?>
<script>
alert('Your are under processing,login after some times // Your account is Deactive !!');
</script>
<?php
unset($_SESSION['id']);
} else if ($profilestatusdata['profilestatus'] == 3) {
?>
<script>
alert('<?php echo $id, 'welcome admin'; ?>');
</script>
<?php
header("Location: admin.php");
} else if ($profilestatusdata['profilestatus'] == 2) {
?>
<script>
alert('<?php echo $id, 'welcome admin'; ?>');
</script>
<?php
header("Location: managing.php");
} else {
?>
<script>
alert('<?php echo $id; ?>');
</script>
<?php
$userlevel = "select userlevel from status where cid = '$id' limit 1";
$userlevelresult = mysqli_query($con, $userlevel);
if ($userlevelresult) {
if (mysqli_num_rows($userlevelresult) > 0) {
$userleveldata = mysqli_fetch_assoc($userlevelresult);
if ($userleveldata['userlevel'] == 0) {
echo "hello user";
?>
hello
<?php
header("Location: profile.php");
} else {
header("Location: main.php");
}
}
}
//header("Location: main.php");
}
}
}
} else {
?>
<script>
alert('Incorrect password/mail id');
</script>
<?php
}
}
} else {
echo "wrong password";
}
}
?>
<html>
<head>
<title>login</title>
<link rel="stylesheet" type="text/css" href="login.css">
<script language="javascript" type="text/javascript">
function sub() {
var mail = document.getElementById("mail").value;
var password = document.getElementById("password").value;
if (document.getElementById(id = "mail").value.length == 0) {
document.getElementById("demo").innerHTML = 'Enter a valid mail id ';
} else {
if (document.getElementById(id = "mail").value.length < 10) {
document.getElementById("demo").innerHTML = 'Enter a valid mail id';
} else {
if (document.getElementById(id = "password").value == '') {
document.getElementById("demo1").innerHTML = 'Please enter password';
document.getElementById("demo").innerHTML = '';
} else {
if (document.getElementById(id = "password").value.length < 8) {
document.getElementById("demo1").innerHTML = 'Password must contain atleast 8 letters';
} else {
document.getElementById("demo1").innerHTML = '';
}
}
}
}
}
</script>
<style>
#myVideo {
position: cover center;
right: 0;
bottom: 0;
/* margin-left: -50%; */
width: 100%;
height: 90%;
}
</style>
</head>
<body style="background-color:black;">
<video autoplay muted loop id="myVideo">
<source src="s_images/golden.mp4" type="video/mp4">
</video>
<div class="loginbox">
<img src="avatar.png" class="avatar">
<h1>LOGIN HERE</h1>
<br>
<form method="POST">
<p>E-Mail:</p><input type="mail" id="mail" name="mail" placeholder="Enter Email " pattern=".{10,}" required />
<center>
<h6 style="color:red;" id="demo"></h6>
</center>
<p>Password:</p><input type="password" id="password" name="password" placeholder="Password" pattern=".{8,}" required />
<center>
<h6 style="color:red;" id="demo1"></h6>
</center><br>
<center><input type="submit" value="Login" onclick="sub()"></center>
</form>
<br>
<center><a href="mail/forgot_password.php">Forgot password ?</a>
<a href="register.php">Don't have an account ?</a>
</center>
</div>
</body>
</html>