-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
116 lines (108 loc) · 3.2 KB
/
index.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
107
108
109
110
111
112
113
114
115
116
<!DOCTYPE html>
<html>
<head>
<title>Log In</title>
<link href="css/bootstrap.css" rel="stylesheet" />
<script src="1.11.0/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<link rel='stylesheet' type='text/css' href='css/style.css' />
<style>
nav ul{
margin-top: 20px;
height: 50%;
padding: 20px 0px 20px 0px;
}
nav ul li a
{
height: 24px;
margin-left: 20px;
}
.error{
color: red;
font-family: serif;
}
img{
width: 100%;
}
.main{
margin-top: 20px;
margin-bottom: 20px;
}#main-content {
background-color: whitesmoke;
text-align: center;
border-color: cadetblue;
border-radius: 20px;
width: inherit;
box-shadow:0 0 20px #999;
border-style: inset;
padding: 54px;
margin-right: 20%;
margin-left: 20%;
margin-top: 20px;
margin-bottom: 20px;
}
</style>
</head>
<body>
<?php
$adminidErr="";
$passwordErr="";
$adminid="";
$password="";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
function test_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
if (empty($_POST["adminid"])) {
$adminidErr = "Pease Enter Provided ID";
} else {
$adminid = test_input($_POST["adminid"]);
}
if (empty($_POST["password"])) {
$passwordErr = "Pease Enter Provided Password";
}
else {
$password = test_input($_POST["password"]);
}
}
session_start();
if (! empty($_POST) && $_POST['adminid'] === 'admin' && $_POST['password'] === 'admin')
{
$_SESSION['logged_in'] = true;
header('Location: Upload.php');
}
else
{}
?>
<div class="main">
<header>
<img src="back.jpg"/>
</header>
<div class="page-wrap">
<nav>
<ul class="group">
<li><a class="active" href="index.php">HOME</a></li>
<li><a href="#">ABOUT US</a></li>
<li><a href="#myModal" data-toggle="modal" data-target="#myModal">CONTACT US</a></li>
</ul>
</nav>
<section id="main-content">
<div id="guts">
<!-- ******* validation for login********-->
<h1>ADMIN LOG-IN</h1>
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" method="post">
<input type="text" name="adminid" size="40" placeholder="Enter Your ID"/><br>
<span class="error">*<?php echo $adminidErr;?></span><br> <br>
<input type="password" name="password" size="40" placeholder="Enter Your Password"/><br>
<span class="error">*<?php echo $passwordErr;?></span><br> <br>
<button type="submit" name="LogIn" class="btn btn-primary" >Log In</button>
</form>
</div>
</section>
</div>
</div>
</body>
</html>