-
Notifications
You must be signed in to change notification settings - Fork 1
/
auth.php
31 lines (28 loc) · 926 Bytes
/
auth.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
<?php include 'db.php';?>
<?php
if(isset($_POST['username']) && isset($_POST['pass'])){
$name =mysqli_real_escape_string($con,$_POST['username']);
$pass =mysqli_real_escape_string($con,$_POST['pass']);
$query ="SELECT * FROM auth WHERE username='$name'";
$auth =mysqli_query($con,$query);
if(!$query) {
die("Query Failed: ". mysql_error());
} else {
$row=mysqli_fetch_assoc($auth);
$m=$row['name'];
$q =$row['username'];
if ($name==$q) {
if($name==$q && $pass==$row['password']) {
header("Location: profile.php?id=$m");
session_start();
$_SESSION['uname']=$m;
$_SESSION['use']=$q;
}else {
header("Location:login.php?id=Username or Password is incorrect");
}
} else {
header("Location:login.php?id=username already taken or your password is incorrect. Please try again");
}
}
}
?>