-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathindex.php
More file actions
67 lines (57 loc) · 2.14 KB
/
index.php
File metadata and controls
67 lines (57 loc) · 2.14 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
<?php
session_start();
require 'dbconfig/config.php';
?>
<!DOCTYPE html>
<html>
<head>
<title>Seven Inc.</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body bgcolor="#191919">
<h1 style="font-size:56px; color:#f7b32d"> SE7EN<img src="logo.png" alt="Logo" style="width:100px; height:115px" align="left"></h1>
<hr style="border-width:3px; border-color:#f7b32d">
<h5 align="right" style="color:#f7b32d">
<a href="index.php" style="text-decoration:none; color:#f7b32d"> HOME </a> |
<a href="register.php" style="text-decoration:none; color:#f7b32d"> REGISTRATION </a> |
<a href="index.php" style="text-decoration:none; color:#f7b32d"> LOGIN </a>
</h5>
<div id="main-wrapper">
<center>
<h2>User Login</h2>
<img src="imgs/avatar.png" class="avatar"/>
</center>
<form class="myform" action="index.php" method="post">
<label><b>Username:</b></label><br>
<input name="username" type="text" class="inputvalues" placeholder="Type your username" required/><br>
<label><b>Password:</b></label><br>
<input name="password" type="password" class="inputvalues" placeholder="Type your password" required/><br>
<input name="login" type="submit" id="login_btn" value="Login"/><br>
<a href="register.php"><input type="button" id="register_btn" value="Register"/></a>
</form>
<?php
if(isset($_POST['login']))
{
$username=$_POST['username'];
$password=$_POST['password'];
$query="select * from userinformation WHERE username='$username' AND password='$password'";
$query_run = mysqli_query($con,$query);
if(mysqli_num_rows($query_run)>0)
{
$row = mysqli_fetch_assoc($query_run);
// valid
$_SESSION['username']= $row['username'];
$_SESSION['imglink']= $row['imglink'];
header('location:homepage.php');
}
else
{
// invalid
echo '<script type="text/javascript"> alert("Invalid credentials") </script>';
}
}
?>
</div>
<footer align="right" style="font-size:10px; color:#191919">© 2018 | Jubayer Alam | 1420268042 | NSU</footer>
</body>
</html>