08-23-2005, 01:06 PM
|
Dragon
|
|
Join Date: Dec 2003
Location: Earth
Posts: 818
|
|
hmmm
Quote:
Originally Posted by Magoth78
Number of users online, their names and the number, using php.
It's my first Php code so don't be rude if it's extremly ugly, basic.
It will show the name and the amount of the connected characters char.
Code:
<?php
$Server = 'Host.com';
$Port = 9000;
$user = "your_user\r";
$pass = "your_pass\r";
$fp = fsockopen($Server, $Port);
fputs ($fp, $user);
usleep(125000);
fputs ($fp, $pass);
usleep(125000);
fputs ($fp, "who\r");
usleep(125000);
do
{
$output = fgets($fp);
$output = str_replace("Username: Password: Login accepted.", "", $output);
$output = str_replace($user">", "", $output);
$output = str_replace("who", "", $output);
$output = str_replace("Players", "", $output);
$output = str_replace("on", "", $output);
$output = str_replace("server:", "", $output);
$output = str_replace("line", "", $output);
$who = preg_replace('#^.*]\s+(.*?)\(.*$#','\1',$output);
echo $who;
if (preg_match("/Players/i", $who)) {
Break;
}
}
while(!feof($fp));
fclose($fp);
?>
Mag
|
All I get is a blank...
error msg says ..
xx.xx.xx.xxx - - [23/Aug/2005:20:32:47 -0400] "GET /who.php HTTP/1.1" 200 -
|