forked from bumasa/casino
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathonline.php
More file actions
40 lines (39 loc) · 802 Bytes
/
Copy pathonline.php
File metadata and controls
40 lines (39 loc) · 802 Bytes
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
<?
$on_ip = $REMOTE_ADDR;
$on_time = time();
$on_minutes = 3;
$on_found = 0;
$on_users = 0;
$on_user = "";
if (!is_file("online.txt"))
{
$on_s = fopen("online.txt","w");
fclose($on_s);
chmod("online.txt",0666);
}
$on_f = fopen("online.txt","r+");
flock($on_f,2);
while (!feof($on_f))
{
$on_user[] = chop(fgets($on_f,65536));
}
fseek($on_f,0,SEEK_SET);
ftruncate($on_f,0);
foreach ($on_user as $on_line)
{
list($on_savedip,$on_savedtime) = split("\|",$on_line);
if ($on_savedip == $on_ip) {$on_savedtime = $on_time;$on_found = 1;}
if ($on_time < $on_savedtime + ($on_minutes * 60))
{
fputs($on_f,"$on_savedip|$on_savedtime\n");
$on_users = $on_users + 1;
}
}
if ($on_found == 0)
{
fputs($on_f,"$on_ip|$on_time\n");
$on_users = $on_users + 1;
}
fclose ($on_f);
echo "Èãðîêîâ îíëàéí: ".$on_users;
?>