Przykład:
-Sprawdza datę rozpoczęcia np w pliku (12:00)
-I odejmuje czas rozpoczęcia od teraźniejszego.
I wyskoczy np :
Uptime: 09:34
ale bedzie sie zmieniało samo co 1min
Mój coś nie chce działać"
<?php function getinfo($host='94.23.150.254',$port=21){ // connects to server $data = ''; // if connected then checking statistics if($socket) { // sets 1 second timeout for reading and writing // sends packet with request // 06 - length of packet, 255, 255 is the comamnd identifier, 'info' is a request // reads respond } // closing connection to current server } return $data; } if ($cfg['status_update_interval'] < 60) $cfg['status_update_interval'] = 60; $info = getinfo($cfg['server_ip'], $cfg['server_port']); $infoXML = simplexml_load_string($info); $up = (int)$infoXML->serverinfo['uptime']; $up = $up - $h*3600; $up = $up - $m*60; if ($h < 10) {$h = "0".$h;} if ($m < 10) {$m = "0".$m;} } else { } ?>
XML:
<?xml version="1.0"?> <serverinfo uptime="0" ip="94.23.150.254" port="21" />