-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.php
More file actions
71 lines (55 loc) · 1.66 KB
/
admin.php
File metadata and controls
71 lines (55 loc) · 1.66 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
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
include "config.php";
if(isset($_POST['but_submit'])){
$uname = mysqli_real_escape_string($con,$_POST['txt_uname']);
$password = mysqli_real_escape_string($con,$_POST['txt_pwd']);
if ($uname != "" && $password != ""){
$sql_query = "select count(*) as cntUser from AccountsRegister where username='".$uname."' and password='".$password."'";
$result = mysqli_query($con,$sql_query);
$row = mysqli_fetch_array($result);
$count = $row['cntUser'];
if($count > 0){
$_SESSION['uname'] = $uname;
header('Location: adminpage.php');
}else{
echo "Invalid username and password";
}
}
}
?>
<html>
<head>
<title>Login</title>
<style>
.container {
margin-top: 80px;
}
.containersignin{
margin-bottom: 200px;
}
body {
background-color: pink;
}
</style>
</head>
<body>
<div class="container">
<center>
<h1>ADMIN PAGE</h1>
<form method="post" action="">
<div id="div_login">
<div>
<input type="text" class="textbox" id="txt_uname" name="txt_uname" placeholder="Username" />
</div>
<div>
<input type="password" class="textbox" id="txt_uname" name="txt_pwd" placeholder="Password"/>
</div>
<div>
<input type="submit" value="Submit" name="but_submit" id="but_submit" />
</div>
</div>
</form>
</center>
</div>
</body>
</html>