-
Notifications
You must be signed in to change notification settings - Fork 34
/
login.php
29 lines (26 loc) · 828 Bytes
/
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
<?php
session_start();
if (isset($_SESSION["username"])) {
session_destroy();
}
include_once 'dbConnection.php';
$ref = @$_GET['q'];
$username = $_POST['username'];
$password = $_POST['password'];
$username = stripslashes($username);
$username = addslashes($username);
$password = stripslashes($password);
$password = addslashes($password);
$password = md5($password);
$result = mysqli_query($con, "SELECT name FROM user WHERE username = '$username' and password = '$password'") or die('Error');
$count = mysqli_num_rows($result);
if ($count == 1) {
while ($row = mysqli_fetch_array($result)) {
$name = $row['name'];
}
$_SESSION["name"] = $name;
$_SESSION["username"] = $username;
header("location:account.php?q=1");
} else
header("location:$ref?w=Wrong Username or Password");
?>