-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaccess_check.php
More file actions
46 lines (41 loc) · 1.04 KB
/
access_check.php
File metadata and controls
46 lines (41 loc) · 1.04 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
<?php
session_start();
if($_POST['mobile'])
{
$pid=$_POST['mobile'];
$pin=$_POST['pin'];
include "connect.php";
$result=mysqli_query($conn, "select * from users where pid='$pid' and pin='$pin' and status=1");
if(mysqli_num_rows($result) > 0)
{
$profile=mysqli_fetch_array($result);
$_SESSION['pid']=$profile['pid'];
$_SESSION['player_name']=$profile['player_name'];
$_SESSION['place']=$profile['place'];
$_SESSION['points']=$profile['points'];
mysqli_query($conn, "update users set lastseen=now() where pid='$pid' and pin='$pin'");
}
else
{
//clear session from globals
$_SESSION = array();
//clear session from disk
session_destroy();
header("Location:index.php?pwderror");
exit;
}
}
else if(isset($_SESSION['pid']))
{
$pid=$_SESSION['pid'];
}
else #if user access the page directly, redirect to login page
{
//clear session from globals
$_SESSION = array();
//clear session from disk
session_destroy();
header("Location:index.php");
exit;
}
?>