-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsign_in.php
More file actions
115 lines (95 loc) · 3.75 KB
/
Copy pathsign_in.php
File metadata and controls
115 lines (95 loc) · 3.75 KB
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
<?php
ob_start();
error_reporting(0);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="ex_css/sign_in.css">
<link rel="stylesheet" href="https://unpkg.com/tailwindcss@2.2.19/dist/tailwind.min.css"/>
<title>Sign In</title>
</head>
<body>
<div class="brand-name"><a href="index.html">Freshers' Guidline</a></div>
<div class="content">
<div class="text">
Hello Sustian
</div>
<form action="" method="post">
<div class="field">
<span class="fas fa-user"></span>
<input type="number" name="reg" id="userName" placeholder="Registration No" required>
</div>
<div class="field">
<span class="fas fa-lock"></span>
<input type="password" name="password" id="pwd" placeholder="Password" required>
</div>
<div class="forgot-pass">
<a href="forget_pass.php">Forgot Password?</a>
</div>
<input type="submit" name="sign_in" value="Sign In" class="btn"></input>
</form>
<?php
require "config.php";
session_start();
if (isset($_POST["sign_in"])) {
$reg = $_POST["reg"];
$password = $_POST["password"];
if ($reg == 999 and $password == "999") {
header("location:admin_granted.php");
} else {
$sql = "SELECT * FROM users where reg = $reg;";
$query = mysqli_query($con, $sql);
$total1 = mysqli_num_rows($query);
if ($total1 == 1) {
$r1 = mysqli_fetch_assoc($query);
/*
echo "<pre>";
print_r($r1);
echo "</pre>";
*/
$actual_password = $r1["password"];
$user_name = $r1["name"];
$_SESSION["name"] = $user_name;
$_SESSION["reg"] = $reg;
$_SESSION["dept"] = $r1["dept"];
$_SESSION["email"] = $r1["email"];
$_SESSION["phone"] = $r1["phone"];
$_SESSION["address"] = $r1["address"];
$_SESSION["image"] = $r1["image"];
$_SESSION["gender"] = $r1["gender"];
$_SESSION["blood"] = $r1["blood"];
$_SESSION["dob"] = $r1["dob"];
$_SESSION["bio"] = $r1["bio"];
if ($actual_password === $password) {
$admin_check = "SELECT * from verification where reg = $reg;";
$admin_query = mysqli_query($con, $admin_check);
$admin_status = mysqli_fetch_assoc($admin_query);
if ($admin_status["status"] === "verified") {
$activation_sql = "UPDATE status SET status = 'Active' WHERE reg = $reg;";
$activation_query = mysqli_query($con, $activation_sql);
exit(header("location:profile.php"));
} else {
echo '<span style="color:red;">Hello </span>' . $user_name . '<br><span style="color:red;">Wait till being verified.</span>';
}
} else {
echo '<span style="color:red;">Hello </span>' . $user_name . '<br><span style="color:red;">You insert wrong password.Try the exact one.</span>';
}
} else {
echo '<span style="color:red;margin:1rem 0;"> no user found </span>';
}
}
}
?>
<div class="sign-up">
Not a member?
<a href="sign_up.php">signup now</a>
</div>
</div>
<?php
ob_end_flush();
?>
</body>
</html>