source: scripts/online.php@ 1

Last change on this file since 1 was 1, checked in by george, 17 years ago

Prvnotní import původních kódů z wowresource.

File size: 977 bytes
Line 
1<?php
2
3require ('../includes/config.php');
4
5mysql_connect($db_config['host'], $db_config['user'], $db_config['pass']);
6mysql_select_db($db_config['name']);
7
8$data = mysql_query("SELECT `id`,`ip`,`port` FROM `servers`");
9
10
11while ($row = mysql_fetch_array($data))
12 {
13
14 $check = @fsockopen($row[ip],$row[port],$ern,$erstr,1);
15
16 if($check)
17 {
18 $onservers[] = $row[id];
19
20 }
21 else
22 {
23
24 $offservers[] = $row[id];
25
26 }
27
28
29 }
30
31mysql_free_result($data);
32
33$onstr = implode(',',$onservers);
34$offstr = implode(',',$offservers);
35
36
37mysql_query("UPDATE `servers` SET `online_checks` = `online_checks` + 1, `online` = `online` + 1 WHERE `id` IN ('$onstr')");
38mysql_query("UPDATE `servers` SET `online_checks` = `online_checks` + 1 WHERE `id` in ('$offstr')");
39
40
41echo "Online :", count($onservers) ," Offline :", count($offservers);
42
43
44?>
Note: See TracBrowser for help on using the repository browser.