TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,964
  • Latest: stylix
Stats
  • Total Posts: 195,966
  • Total Topics: 21,317
  • Online today: 2,741
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 605
  • Total: 605

need html code for "live server view/ stats' for article page

Started by Tron420, December 06, 2006, 03:19:28 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Tron420

hi,
im not sure where to post this but..

im trying to make a "live server view" article using html to show the current map ( w/ pic )- connected players - etc., for my condition zero game server ( ip - 205.234.191.38:27015 ) that can be viewed in an article page on my smf - tp forum. but i need some help with the code. can anyone help explain how to do this please?

thank you

kran1um

Serverspy.com, Brainpecker.com or Game-monitor.com...

I cant get the Brainpecker (think mature) to work though, but my Serverspy is working but its a monthly fee...

Tron420

ive tried those 2 , dont like them.i need something thats not add supported .
. i just want the basic html so i can customize a server view page myself, and not use the normal "monitors".

Tron420

im trying to tool around w/ a "server query" script .. but i cant get it to work .
can anyone else?




<?php 
// IP address 
$ServerIP "205.234.191.38"
// Server port 
$ServerPort "27015"
// Create the variables of the info command to send to the server. 
$ServerinfoCommand "\377\377\377\377infostring\0"

// Open a connection to the server 
$fp fsockopen("udp://".$ServerIP$ServerPort$errno$errstr); 

//Send the request to the server. 
fwrite($fp$ServerinfoCommand); 

//Remove the junk headers sent back 
$JunkHead fread($fp,24); 

// Check to see if the server is running 
$CheckStatus socket_get_status($fp); 
if(
$CheckStatus["unread_bytes"] == 0

    die(
"Unable to connect to the server, ensure the IP and port is correct and that the server is running."); 


// Read through the returned data and put in variable 
$do 1
$HLServerStats""
while(
$do

    
$str fread($fp,1); 
    
$HLServerStats.= $str
    
$status socket_get_status($fp); 
    if(
$status["unread_bytes"]  == 0) {$do 0;} 

//Close the connection 
fclose($fp); 
?>

<?php 
// Explode the packet into an array. 
$HLServerStats explode("\\"$HLServerStats); 

// Count the amount of keys in the array. 
$count count($HLServerStats); 

// The amount of keys in the array MUST be an even number 
if($count == 0

    
// Loop though all the keys and put them in the $ServerData array with the key values. 
    
$i 0
    while(
$count != $i
    { 
        
$ServerData[$HLServerStats[$i]] = $HLServerStats[$i+1]; 
        
$i $i 2
    } 

?>


<?php
echo("Address: $ServerData[address]<br>");
echo(
"Players: $ServerData[players]<br>");
echo(
"Max Connects: $ServerData[max]<br>");
echo(
"Current Map: $ServerData[map]<br>");
?>


Thurnok

If you are trying to get that to work in a php block, you need to remove all the open and close php tags (<?php  and ?>).  You cannot use those in a block snippet.

Tron420

o ok ty
i have something that will work but the thing is... its a seperate webpage. i am trying to put the whole page in an article ( using iframe if needed ). the page name is - http://205.234.191.38:27015/.. is there any way to get the whole page into a 500 ( width ) 600 ( height ) space ( an article)?i have the style.css and also the 4 .inc files ( head - global - countdown - tail ) would redoing that page and putting everything in the top left corner and then placing the <iframe> tag in the article and aligning top nested left make it align in a 500 ( width ) 600 ( height ) article ? i cant get it to all fit w/ out scrolling. it really doesnt matter what the page looks like when its not showing in the iframe because thats the only time ppl will probably ever see it is when its in the iframe in the article. does anyone know html enough to rearrange these few tables on this page into a 500 ( width ) 600 ( height ) webpage ( or that can be centered in the article whole - no scroll ) im not gonna use the ".: Software Info :." section and also the current map pic shows right beside the .: General Information :. and its always .: 300 x 225 so the .: General Information :. table should be remade to 200 pxl so as not to go over the 500 width pxl limit for use in this article on my forum. and the connected player table cant be over 500 pxls either the whole thing  ( - minus the ".: Software Info :. " section ... i want to just get rid of that table all together ) needs to fit in 500 width and 600 height.
you can also get rid of the "admin - ip - and loss " sections of the .: Players and Scores :. table that will save space also

does anyone know how to go about doing this?

i attached the files for the page.... http://205.234.191.38:27015/

kran1um



Porky

when I get to my computer I will look at it. should'nt be to hard


This website is proudly hosted on Crocweb Cloud Website Hosting.