-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
43 lines (38 loc) · 1.42 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
<?php
session_start();
include("includes/connection.php");
include("includes/header.php");
if(isset($_POST['login'])){
$user = $_POST['login_field'];
$pwd = $_POST['password'];
$sql = "SELECT * FROM users WHERE username='$user' AND password='$pwd'";
$data = $conn->query($sql);
$row = $data->fetch_assoc();
if($data->num_rows > 0){
$_SESSION['user'] = $row;
header("location:profile.php");
}else{
echo "<p class='lead text-center error-msg'>Account not found</p>";
}
}
?>
<div class="container">
<div class="row justify-content-center">
<div class="col-lg-4 col-md-4 col-sm-12">
<form method="post" action="">
<div class="form-group">
<label for="login"><b>Username or email address</b></label>
<input id="login" name="login_field" type="text" class="form-control" />
</div>
<div class="form-group">
<label for="password"><b>Password</b></label>
<input id="password" type="password" class="form-control" name="password" />
</div>
<input type="submit" name="login" class="btn btn-block btn-success" value="Log in" />
</form>
</div>
</div>
</div>
<br />
<!-- login script -->
<?php include("includes/footer.php"); ?>