-
Notifications
You must be signed in to change notification settings - Fork 1
/
login.php
48 lines (43 loc) · 1.37 KB
/
login.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
<?php
include "system/core/init.php";
print(load_which("system/templates/header.tpl.php"));
?>
<html>
<body>
<head>
</head>
<?php
if (isset($_POST['username'])){
$username = ($_REQUEST['username']);
$password = ($_REQUEST['password']);
//Checking is user existing in the database or not
$query = "SELECT * FROM `users` WHERE username='$username'
and password='$password'";
$result = mysqli_query($conn,$query) or die(mysql_error());
$rows = mysqli_num_rows($result);
if($rows==1){
$_SESSION['username']= $username;
$_SESSION['loggedin']= true;
header("Location: index.php");
}else{
echo "<div class='form'>
<h3>Username/password is incorrect.</h3>
<br/>Click here to <a href='login.php'>Login</a></div>";
}
}else{
}
?>
<div class="container">
<form name="frmChange" role="form" class="form-signin" method="POST" action="">
<div class="form-group">
<label for="InputPassword2">Username</label>
<input type="useranme" class="form-control" id="username" placeholder="User Name" name="username">
<label for="InputPassword3">Password</label>
<input type="password" class="form-control" id="password" placeholder="Password" name="password"> </div>
<button class="btn btn-lrg btn-default btn-block" input type="submit" name="submit">Login</button>
</div>
</body>
</html>
<?php
print(load_which("system/templates/footer.tpl.php"));
?>