-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathping.php
More file actions
executable file
·51 lines (40 loc) · 1.11 KB
/
ping.php
File metadata and controls
executable file
·51 lines (40 loc) · 1.11 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
<!--
Smart Chat
Authors:
Rishi Dua <https://github.com/rishirdua>
Harvineet Singh <https://github.com/harvineet>
File Desciption: updates a users entry in the pings text file to keep them logged in
This projected is licensed under the terms of the MIT license. See LICENCE.txt for details
-->
<?php
include("config.php");
$userid = $_GET['u'];
if($userid < 100000000 or $userid > 1000000000) die ("invalid user id");
$file = @file_get_contents($pings_file);
if( $file ) { $line = explode("\n",$file); }
$now = time();
$found = 0;
$num = count($line);
for( $i = 0; $i < $num; $i++ ) {
$data = explode(",",$line[$i]);
if( strstr($data[0],$userid) ) {
$found = 1;
$data[1] = $now;
$line[$i] = implode(",",$data);
}
}
// make sure a new file has at least one \n in it
if( !isset($line) ) { $line[0] = " "; }
// if the user doesn't have one, create a line for them
if( $found == 0 ) {
array_unshift( $line, $userid.",".time() );
//$line[$num] = $userid.",".time();
}
$file = implode("\n",$line);
$fp = @fopen($pings_file, "w");
if ($fp) {
fwrite($fp, $file);
@fclose($fp);
}
include("timeout.php");
?>