The Linux client was actually a PHP script I was working on just to see how well it would work

. It's not really finished, as I never got around to finishing it. Here's the most recent copy of the script:
sigclient.php:
#!/usr/bin/php
<?php
/**************************************************************\
| Dynamic-Sig.com Signature Client - PHP Linux version |
| (c) 2007 DanSoft Australia - http://www.dansoftaustralia.net |
\**************************************************************/
define('CLIENT', 'PHP Linux Client');
define('VERSION', '0.1 Beta');
define('SIG_SERVER', 'http://www.dynamic-sig.com/updateSig.php');
// Get our configuration
$config = parse_ini_file('sigclient.conf');
// Start with blank array.
$data = array();
// --- Uptime ---
$seconds = (float) file_get_contents('/proc/uptime');
// Some numbers
$secs = intval($seconds % 60);
$mins = intval($seconds / 60 % 60);
$hours = intval($seconds / 3600 % 24);
$days = intval($seconds / 86400);
if ($days > 0)
{
$uptimeString .= $days;
$uptimeString .= (($days == 1) ? ' day' : ' days');
}
if ($hours > 0)
{
$uptimeString .= (($days > 0) ? ', ' : '') . $hours;
$uptimeString .= (($hours == 1) ? ' hour' : ' hours');
}
if ($mins > 0)
{
$uptimeString .= (($days > 0 || $hours > 0) ? ', ' : '') . $mins;
$uptimeString .= (($mins == 1) ? ' minute' : ' minutes');
}
if ($secs > 0)
{
$uptimeString .= (($days > 0 || $hours > 0 || $mins > 0) ? ", " : "") . $secs;
$uptimeString .= (($secs == 1) ? ' second' : ' seconds');
}
$data['uptime'] = $uptimeString;
// --- Memory stuff ---
// !!! There must be a better way to do this!
$meminfo = array();
preg_match(
'/MemTotal: +(?P<totalram>[0-9]+) kB
MemFree: +(?P<availram>[0-9]+) kB/', file_get_contents('/proc/meminfo'), $meminfo);
// Convert kilobytes to bytes.
$data['totalram'] = ($meminfo['totalram'] * 1024);
$data['availram'] = ($meminfo['availram'] * 1024);
// --- Network interface stuff ---
// !!! Use ifconfig instead?
$matches = array();
$temp = file_get_contents('/proc/net/dev');
// Get the line for the current network device
preg_match('/' . $config['network_interface'] . ':(.+)' . "\n/", $temp, $matches);
$temp = $matches[1];
// Split it up
$matches = preg_split('/\s+/', trim($temp));
// Get the amount received
$data['netReceived'] = $matches[0];
$data['netSent'] = $matches[8];
// -----------------------------------------------------------------------------
// Now, time to send the data off :).
// !!! Rewrite this so it doesn't use cURL?
// Open the Curl session.
$session = curl_init(SIG_SERVER);
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
// The POST variables we send to the update script.
$postvars = 'client=' . CLIENT . '&version=' . VERSION . '&username=' . $config['username'] . '&password2=' . sha1(strtolower($config['username']) . $config['password']) . '&timezone=' . $config['timezone'];
// Loop through all our data.
foreach ($data as $key => $value)
// Add this as a POST variable.
$postvars .= '&' . $key . '=' . $value;
curl_setopt ($session, CURLOPT_POST, true);
curl_setopt ($session, CURLOPT_POSTFIELDS, $postvars);
// Make the call.
$return = curl_exec($session);
curl_close($session);
if (strpos($return, 'ERROR') === FALSE)
echo 'Server returned: ' . $return . "\n";
else
fwrite(STDERR, 'Error encountered: ' . $return . "\n");
?>
sigclient.conf:
; Configuration file for Dynamic-Sig.com client
; Your username on Dynamic-Sig.com
username = test2
; Your password
password = test
; Your timezone
timezone = 10
; Your network interface (eg. eth0)
network_interface = eth0
I have not tested this script since April, but it should work. It requires PHP 4.3.0 or higher (including PHP 5) and the cURL extension to be installed. Change the settings in the configuration file, set the file to executable (
chmod +x sigclient.php in a console), and then run the script (
./sigclient.php in a console). To have it update every so often, you'd need to add a cronjob for it.
Please tell me whether this works for you, and whether I should continue development (and finish it)

.
Edit: Oh yeah, any comment line with a !!! at the start of it is a "To do" line (like in the SMF code). It's a note for me, basically
