-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsign_in.php
106 lines (86 loc) · 2.28 KB
/
sign_in.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
<?php
require_once 'db_conn.php';
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Sign In | S-Pharm</title>
<link rel="stylesheet" type="text/css" href="./style/style.css">
</head>
<body>
<header>
<div class="container">
<div id="sitename">
<h1>S-PHARM</h1>
</div>
<nav>
<ul>
<li><a href="index.php">Home</a></li>
<li><a href="services.html">What We Offer</a></li>
<li><a href="about.html">About Us</a></li>
<li><a href="contact.php">Contact Us</a></li>
<li class="signin"><a href="signup.php">Sign up</a></li>
</ul>
</nav>
</div>
</header>
<section id="maincontent">
<div class="container">
<article id="col">
<h1 id="maintitle" style="color: red;">Sign in Error !</h1>
<div class="container"><br>
<?php
// Check user login details
if(isset($_POST['btn-signin']))
{
$uname = $_POST['uname'];
$pass = $_POST['pass'];
if(empty($uname) || empty($pass))
{
echo '<h3><center>Username/Email and/or Password is empty!</center></h3><br>';
}
else
{
$query = " SELECT * FROM users WHERE username='$uname' or email='$uname'";
$result = mysqli_query($conn,$query);
if($row=mysqli_fetch_assoc($result))
{
$db_pass = $row['password'];
if($pass == $db_pass)
{
header("location:stores.php");
}
else
{
echo '<h3><center>Password is incorrect!</center></h3><br>';
}
}
else
{
echo '<h3><center>Username or Email is incorrect!</center></h3><br>';
}
}
}
?>
<script type="text/javascript">
function prevPage() {
window.history.back();
}
</script>
<center><button class="btn" onclick="prevPage()">Go back</button></center>
<br><br>
</article>
</div>
</section>
<footer>
<h3>Subscribe to our Newsletter</h3>
<form id="letter">
<input type="email" name="letter" placeholder="Enter your email address...">
<button type="submit" class="btn">Subscribe</button>
</form>
<h4 id="copy">© Copyright 2019. Supreme Pharmacy LLC</h4>
</footer>
</body>
</html>