-
Notifications
You must be signed in to change notification settings - Fork 14
/
login.php
69 lines (59 loc) · 2.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
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/all.css">
<link rel="stylesheet" href="./css/style1.css">
<title>Proceed</title>
</head>
<body>
<?php
require('db.php');
session_start();
// If form submitted, insert values into the database.
if (isset($_POST['email'])){
$email = stripslashes($_REQUEST['email']); // removes backslashes
$email = mysqli_real_escape_string($con,$email); //escapes special characters in a string
$password = stripslashes($_REQUEST['password']);
$password = mysqli_real_escape_string($con,$password);
//Checking is user existing in the database or not
$query = "SELECT * FROM `customer` WHERE email='$email' and password='".md5($password)."'";
$result = mysqli_query($con,$query) or die(mysql_error());
$rows = mysqli_num_rows($result);
if($rows==1){
$_SESSION['email'] = $email;
header("Location: index.php"); // Redirect user to index.php
}else{
echo "<div class='form'><h3>Username/password is incorrect.</h3><br/>Click here to <a href='login.php'>Login</a></div>";
}
}else{
?>
<div data-aos="fade-down" class="container" id="container">
<div class="form-container sign-in-container">
<form method="post" action="" name="login">
<h1 style="padding-bottom: 20px">Sign in</h1>
<input type="email" name="email" placeholder="Email" required />
<input type="password" name="password" placeholder="Password" required/>
<a href="#">Forgot your password?</a>
<span style="padding-top: 10px"><button>Login</button></span>
<p>Not registered yet? <a href='registration.php' style="color:#FF0000;font-weight:bold;">Register Here</a></p>
</form>
</div>
</div>
<div class="landing"> <!---background-->
<div class="opac">
</div>
</div>
<footer>
<p>
Created with <i class="fa fa-heart"></i> by
<a target="_blank" href="index.html">Foodilite</a>
</p>
</footer>
<script src="./js/main.js"></script>
<?php } ?>
</body>
</html>