-
Notifications
You must be signed in to change notification settings - Fork 0
/
adminindex.php
executable file
·60 lines (56 loc) · 1.98 KB
/
adminindex.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
<?php
session_start();
include_once 'db.php';
if (isset($_POST['btn_submit'])) {
$uname = mysqli_real_escape_string($conn, $_POST['uname']);
$upass = mysqli_real_escape_string($conn, $_POST['upass']);
// Use the correct column names in the query
$res = mysqli_query($conn, "SELECT * FROM admin WHERE aname='$uname' AND apass='$upass'");
$row = mysqli_fetch_array($res);
if ($row) { // Check if the row exists
$_SESSION['user1'] = $row['uname'];
header("Location: adminhome.php");
exit(); // Add exit after redirecting to prevent further execution
} else {
// Display an error message using JavaScript alert
echo '<script>alert("Wrong details");</script>';
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="imagetoolbar" content="no" />
<meta name="keywords" content="slideman, sliderman.js, javascript slider, jquery, slideshow, effects" />
<meta name="description" content="Sliderman.js - will do all the sliding for you :)" />
<style type="text/css">
* { margin: 0; outline: none; }
/* ... CSS styles ... */
</style>
<script type="text/javascript" src="js/sliderman.1.3.8.js"></script>
<link rel="stylesheet" type="text/css" href="css/sliderman.css" />
<link href="style.css" rel="stylesheet">
</head>
<body style="background-color: cyan;">
<!-- ... HTML code ... -->
<div style="margin-left: 200px; margin-top:200px">
<form method="POST">
<div id="lbackimage">
<div id="loginback">
<div id="loginhead">
Login
</div>
<div id="loginarea">
<label>Username</label> <input type="text" name="uname" required/><br><br>
<label>Password</label> <input type="password" name="upass" required/>
<div id="dbutton1">
<input type="submit" name="btn_submit" value="LOGIN">
</div>
</div>
</div>
</div>
</form>
</div>
</body>
</html>