-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.php
More file actions
89 lines (86 loc) · 2.46 KB
/
admin.php
File metadata and controls
89 lines (86 loc) · 2.46 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Pro-Langine</title>
<link rel="favicon" href="assets/images/favicon.png">
<link rel="stylesheet" media="screen" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,700">
<link rel="stylesheet" href="assets/css/bootstrap.min.css">
<link rel="stylesheet" href="assets/css/font-awesome.min.css">
<!-- Custom styles for our template -->
<link rel="stylesheet" href="assets/css/bootstrap-theme.css" media="screen">
<link rel="stylesheet" type="text/css" href="assets/css/da-slider.css" />
<link rel="stylesheet" href="assets/css/style.css">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="assets/js/html5shiv.js"></script>
<script src="assets/js/respond.min.js"></script>
<![endif]-->
<style>
th, td {
padding:5px;
}
</style>
</head>
<body>
<?php
include "nav.php";
$strconn=mysqli_connect("localhost","root","","project");
if(!$strconn)
echo "Connection failed".mysqli_connect_error();
else{}
?>
<header id="head" class="secondary">
<div class="container">
<div class="row">
<div class="col-sm-8">
<h1>Admin Login</h1>
</div>
</div>
</div>
</header>
<br>
<form action="" method="POST">
<table border=0 align="center">
<tr>
<td><label>Enter your User Name:</label></td>
<td><input type="text" class="form-control" name="id" placeholder="User Name"></td>
</tr>
<tr>
<td><label>Enter your Password:</label></td>
<td><input type="password" class="form-control" name="pass" placeholder="Password"></td>
</tr>
<tr>
<td colspan="2" align="center"><button name="btnsubmit" class="btn btn-block">Submit</button></td>
</tr>
</table>
</form>
<br>
<?php
if(!empty($_POST['id'])&&!empty($_POST['pass']))
{
if(isset($_POST['btnsubmit']))
{
$name = $_POST["id"];
$password = $_POST["pass"];
$query = "SELECT * FROM admin_info WHERE UserName='$name' and Password='$password'";
$result = mysqli_query($strconn,$query);
$count = mysqli_num_rows($result);
if($count==1)
{
session_start();
$_SESSION["username"]=$_POST['id'];
//header("location:user/index.php");
echo("<script>location.href = 'admin/index.php';</script>");
}
else
{
echo "<div class='alert alert-danger' role='alert'><center>Username or password is incorrect..Try again<center></div>";
}
}
}?>
<?php
include "footer.php";
?>
</body>
</html>