-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtry-lang.php
More file actions
80 lines (54 loc) · 1.76 KB
/
try-lang.php
File metadata and controls
80 lines (54 loc) · 1.76 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
$localIP = getHostByName(php_uname('n'));
//setcookie("visitor", $localIP, time() + (60 * 20));
//$currTime = time()+(60 * 10);
$currTime = time()+(60 * 10);
echo $localIP.'<br/>';
echo time().'<br><br>';
include_once("connection.php");
$sql = "SELECT * FROM visitorsip";
$result = mysqli_query($conn,$sql);
$count = mysqli_affected_rows($conn);
$add =True;
if ($count != 0) {
while ($row = mysqli_fetch_array($result)) {
if ($localIP == $row["ipaddress"]){
$add = False;
}
$i = $row["ID"];
if (time() >= $row["timer"]) {
$sql = "DELETE FROM visitorsip WHERE ID = '$i'";
mysqli_query($conn,$sql);
}
if ($localIP == $row["ipaddress"] && (time() >= $row["timer"])) {
$sql = "INSERT into visitorsip (ipaddress,timer) VALUES('$localIP','$currTime')";
mysqli_query($conn,$sql);
$sql = "SELECT * from stats";
$result = mysqli_query($conn,$sql);
$row = mysqli_fetch_array($result);
$visit = $row['VISITS']+1;
$sql = "UPDATE stats SET VISITS = '$visit'";
mysqli_query($conn,$sql);
}
}
if ($add) {
$sql = "INSERT into visitorsip (ipaddress,timer) VALUES('$localIP','$currTime')";
mysqli_query($conn,$sql);
$sql = "SELECT * from stats";
$result = mysqli_query($conn,$sql);
$row = mysqli_fetch_array($result);
$visit = $row['VISITS']+1;
$sql = "UPDATE stats SET VISITS = '$visit'";
mysqli_query($conn,$sql);
}
}else {
$sql = "INSERT into visitorsip (ipaddress,timer) VALUES('$localIP','$currTime')";
mysqli_query($conn,$sql);
$sql = "SELECT * from stats";
$result = mysqli_query($conn,$sql);
$row = mysqli_fetch_array($result);
$visit = $row['VISITS']+1;
$sql = "UPDATE stats SET VISITS = '$visit'";
mysqli_query($conn,$sql);
}
?>