-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlog.php
More file actions
54 lines (46 loc) · 2.58 KB
/
Copy pathlog.php
File metadata and controls
54 lines (46 loc) · 2.58 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
51
52
53
54
<?php
include 'connect.php';
include('getBrowser.php');
$browser = getBrowser();
$user_agent = ($browser['name']) ; //user browser
$ip_address = getUserIP(); // user ip adderss
$query1="Update user_location_info SET active_status='0' where ip='$ip_address' and user_browser='$user_agent'";
$runs1 = mysqli_query($con,$query1);
if (!$runs1) {
?>
<script type="text/javascript">alert("Failed")</script>
<?php
}
$minute = $_POST['em'];
$sec=$_POST['es'];
if($minutes<0 )
$minutes*=-1;
if($sec<0 )
$sec*=-1;
$ip_address = $_SERVER["REMOTE_ADDR"];
$t_query="INSERT INTO log (ip,min,sec) VALUES ('$ip_address','$minute','$sec')";
$runs = mysqli_query($con,$t_query);
if(!$runs){
echo "not registered";
}
function getUserIP()
{
if( array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER) && !empty($_SERVER['HTTP_X_FORWARDED_FOR']) )
{
if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',')>0)
{
$addr = explode(",",$_SERVER['HTTP_X_FORWARDED_FOR']);
return trim($addr[0]);
}
else
{
return $_SERVER['HTTP_X_FORWARDED_FOR'];
}
}
else
{
return $_SERVER['REMOTE_ADDR'];
}
}
?>
<h3 style="display: none;" id="none1">Done</h3>