-
Notifications
You must be signed in to change notification settings - Fork 1
/
login.php
94 lines (86 loc) · 2.69 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
<?php
require 'config.php';
session_start();
if(!empty($_SESSION["usn"])){
header("Location: index1.php");
}
if(isset($_POST["submit"])){
$usn = $_POST["usn"];
$password = $_POST["password"];
$hashed_pass=password_hash($password,PASSWORD_DEFAULT);
$result = mysqli_query($conn, "SELECT * FROM studentinfo WHERE usn = '$usn'");
$row = mysqli_fetch_assoc($result);
if(mysqli_num_rows($result) > 0){
if(password_verify($password,$row['password'])){
$_SESSION["login"] = true;
$_SESSION["usn"] = $row["usn"];
header("Location: index1.php");
}
else{
echo
"<script> alert('Wrong Password.'); </script>";
}
}
else{
echo
"<script> alert('User Not Registered.'); </script>";
}
}
?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Login</title>
<link rel="stylesheet" href="css/preloginstyle.css">
<link rel="stylesheet" href="css/loginstyle.css">
<link rel="stylesheet" href="css/navbarstyle.css">
</head>
<body>
<header>
<div class="logo">MCE Portal</div>
<div class="hamburger">
<div class="line"></div>
<div class="line"></div>
<div class="line"></div>
</div>
<nav class="nav-bar">
<ul>
<li>
<a href="" class="active">Home</a>
</li>
<li>
<a href="">Schedule</a>
</li>
<li>
<a href="grievance.php">Grievance</a>
</li>
<li>
<a href="">About</a>
</li>
<!-- <li>
<a href="">Link 4</a>
</li> -->
</ul>
</nav>
</header>
<div class="container">
<div class="card">
<div class="inner-box">
<div class="card-front">
<h2>LOGIN</h2>
<form class="" action="" method="post" autocomplete="off">
<input type="text" name="usn" id="usn" class="input-box" placeholder="Enter your USN" > <br>
<input type="password" name="password" id="password" class="input-box" placeholder="Password" > <br>
<button type="submit" class="main-btn" name="submit">SUBMIT</button>
<a href="registration.php">
<button type="button" class="side-btn" onclick="registration.php">REGISTER</button>
</a>
</form>
<br>
</div>
</div>
</div>
</div>
</body>
</html>