Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

PHP advice please

Name: Anonymous 2008-04-16 20:18

Hi guys newbie PHP guy here and I wanted an experienced persons opinion on how I did on this little page (the teamspeak function is not mine but leeched source(inb4 idiots and flamers)


<html>
<head>
<title>Status</title>
</head>
<body bgcolor=black text=green>
<p>

<?php

$avgpath = "/proc/loadavg";
$avghandle = fopen($avgpath, "r");
$avgread = fread($avghandle, 15);
fclose($avghandle);
$avgout = explode(" ", $avgread);

$freespace = disk_free_space("/home");
$totalspace = disk_total_space("/home");
$freeout = $freespace/1024/1024/1024;
$totalout = $totalspace/1024/1024/1024;

function check_ts($ip, $tcp, $udp, $timeout=1) {
$tsinput = @fsockopen($ip, $tcp, $errno, $errstr, $timeout);
@fclose($tsinput);
}

function check_irc($ip, $tcp, $timeout=1) {
$ircinput = @fsockopen($ip, $tcp, $errno, $errstr, $timeout);
@fclose($ircinput);
}

echo "<br />";
echo "Server load averages: $avgout[0] $avgout[1] $avgout[2]";
echo "<br /><br />";

echo "Free harddrive space: ";
echo floor($freeout);
echo " GB <br />";
echo "Total harddrive space: ";
echo floor($totalout);
echo " GB <br /><br />";

if(check_ts("localhost", 51234, 8767)) {
echo "Teamspeak is currently online<br />";
}
else {
echo "Teamspeak is currently offline<br />";
}

if(check_irc("localhost", 6667)) {
echo "IRC is currently online<br />";
}
else {
echo "IRC is currently offline<br /><br />";
}

?>

<a href="javascript:window.close()">Close me</a>

</p>
</body>
</html>

Name: Anonymous 2008-04-16 20:40

hmm you guys are as useful as /g/ which figures because 4chan is full of retards anymore

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List