-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlog_out.php
More file actions
50 lines (35 loc) · 1.3 KB
/
Copy pathlog_out.php
File metadata and controls
50 lines (35 loc) · 1.3 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
<?php
require_once("mycon.php");
session_start();
$hrs = date('H') - (int) $_SESSION['login_time'];
echo $hrs;
$query = "select id from user_hours where user_id = ".(int) $_SESSION["user_id"]." and dnt = '".date("Y-m-d")."' ";
echo $query;
$q = mysqli_query($con, $query);
echo mysqli_num_rows($q) ;
/*function updateLogOut()
{
if(mysqli_num_rows($q) == 0) {
$q = mysqli_query($con, "insert into user_hours (user_id, hours, dnt) values (".(int) $_SESSION["user_id"].", 0, '".date("Y-m-d")."' ) ");
}
else {
$q = mysqli_query($con, "update user_hours set hours = hours + ".$hrs." where user_id = ".(int) $_SESSION["user_id"]." and dnt = '".date("Y-m-d")."' ");
}
}*/
$q = mysqli_query($con, "update users set logout_time = '".date(DATE_RFC822)."' where id =1");
//$q = mysqli_query($con, "update users set logout_time = '".date(DATE_RFC822)."' where id = ".$row['id']." ");
# if condition to check if in fensing area ( update logout should run in both)
/*
if(
((int)$_SESSION['longitude'] - $main_long > 2 || (int)$_SESSION['longitude'] - $main_long < 2) &&
((int)$_SESSION['latitude'] - $main_lat > 2 || (int)$_SESSION['latitude'] - $main_lat < 2)
)
{
updateLogOut();
}
*/
echo mysqli_error($con);
session_unset();
session_destroy();
header("location: /login.php");
?>