-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainpage.php
77 lines (62 loc) · 1.55 KB
/
mainpage.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
<!DOCTYPE html>
<html>
<link rel="stylesheet" type="text/css" href="login1.css">
<head>
<div class="header">
<h1> PharmacyManagement System</h1>
</div>
<title>
Pharmacy Management System
</title>
</head>
<body>
<br><br><br><br>
<div class="container">
<form method="post" action="">
<div id="div_login">
<h1>Admin Login</h1>
<center>
<div>
<input type="text" class="textbox" id="uname" name="uname" placeholder="Username" />
</div>
<div>
<input type="password" class="textbox" id="pwd" name="pwd" placeholder="Password"/>
</div>
<div>
<input type="submit" value="Submit" name="submit" id="submit" />
<input type="submit" value="Click here for Pharmacist Login" name="psubmit" id="submit" />
<?php
include "config.php";
if(isset($_POST['submit'])){
$uname = mysqli_real_escape_string($conn,$_POST['uname']);
$password = mysqli_real_escape_string($conn,$_POST['pwd']);
if ($uname != "" && $password != ""){
$sql="SELECT * FROM admin WHERE a_username='$uname' AND a_password='$password'";
$result = $conn->query($sql);
$row = $result->fetch_row();
if(!$row) {
echo "<p style='color:red;'>Invalid username or password!</p>";
}
else {
session_start();
$_SESSION['user']=$uname;
header('location:adminmainpage.php');
}
}
}
if(isset($_POST['psubmit']))
{
header("location:mainpage1.php");
}
?>
</div>
</center>
</div>
</form>
</div>
<div class=footer>
<br>
<br><br>
</div>
</body>
</html>