-
Notifications
You must be signed in to change notification settings - Fork 0
/
authentication.php
31 lines (26 loc) · 1.12 KB
/
authentication.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('connection.php');
$username = $_POST['user'];
$password = $_POST['pass'];
$username = stripcslashes($username);
$password = stripcslashes($password);
$username = mysqli_real_escape_string($con, $username);
$password = mysqli_real_escape_string($con, $password);
$sql = "select *from login where username = '$username' and password = '$password'";
$ty="select type from login where username='$username' and password='$password'";
$result = mysqli_query($con, $sql);
$row = mysqli_fetch_array($result, MYSQLI_ASSOC);
$count = mysqli_num_rows($result);
if($count == 1){
session_start();
$_SESSION['loggedin']=true;
$_SESSION['username']=$username;
$_SESSION['password']=$password;
header("location: home.php");
}
else{
echo '<script language="javascript">';
echo 'alert("WRONG CREDENTIALS! Please Go Back to Login Page.")';
echo '</script>';
}
?>