Ik probeer met behulp van dit script te kijken of een computer online is of niet. Maar ook al staat hij online hij geeft toch 'offline' terug.
Weet iemand waarom?
Weet iemand waarom?
PHP:
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
| <?php # INSTELLINGEN $font="vixarasc.ttf"; # FONT NAAM $portarray=array(22,80,23,139,3306,7777); # LIJST VAN STANDAARD POORTEN $host='Studhuis.xs4all.nl'; # ALS $port NIET OPGEGEVEN STANDAARD POORTEN CONTROLEREN if(!$port) { # CONNECTIE CONTROLEREN OP BASIS VAN STANDAARD POORTEN for($i=0;$i<count($portarray) AND $status!='online';$i++) { $sock = fsockopen($host, $portarray[$i], &$num, &$error, 1); if(!$sock) { $status = "offline"; @fclose ($sock); } else { $status = "online"; @fclose ($sock); } } } else { # CONNECTIE CONTROLEREN OP BASIS VAN GEGEVEN POORT $sock = fsockopen($host, $port, &$num, &$error, 10); if(!$sock) { $status = "offline"; @fclose ($sock); } else { $status = "online"; @fclose ($sock); } } echo $status; ?> |