-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
57 lines (52 loc) · 1.74 KB
/
index.php
File metadata and controls
57 lines (52 loc) · 1.74 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
<?php
include("db_connect_Login.php");
session_start();
error_reporting(0);
$_SESSION["loggedIn"] =0;
$error=$uname=$pass=""; $count = 0;
if($_SERVER["REQUEST_METHOD"] == "POST"){
$pass = md5($_POST["pass"]);
$uname =$_POST["username"];
$sql = "SELECT userName FROM login_info WHERE userName = '$uname' AND pass= '$pass' ";
$match = mysqli_query($link, $sql);
$count = mysqli_num_rows($match);
if($count == 1){
$_SESSION["user"] = $_POST["username"];
$_SESSION["loggedIn"] = 1;
header("Location: front1.php", true, 301);
}
else{
echo "<script>alert('Woops! Email or Password is Wrong.')</script>";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="assets/css/style.css">
<link rel = "stylesheet" href= "BootStrap/css/bootstrap.min.css">
<title>Login VMS</title>
</head>
<body>
<div class="container">
<form action="" method="POST" class="login-email">
<h3 class="login-text" style="font-weight: 700;">Login</h3>
<div class="input-group">
<input class="form-control" autocomplete="off" type="username" placeholder="Username" name="username" value="<?php echo $username; ?>" required>
</div>
<div class="input-group">
<input class="form-control" autocomplete="off" type="password" placeholder="Password" name="pass" value="<?php echo $_POST['pass']; ?>" required>
</div>
<div class="input-group">
<button name="submit" class="btn">Login</button>
</div>
<div class="input-group">
<a href="home.php">Back Home</a>
</div>
</form>
</div>
</body>
</html>