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: 1152
  • Total: 1152

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


Porky

  echo '<IFRAME src="http://205.234.191.38:27015/" width="500" height="600" marginwidth=0 marginheight=0 frameborder=0 scrolling=yes></IFRAME>' ;

Ok this is what you need I think if you want the page to auto adjust to the users screen resolution then change the width and height to %

Tron420

i re installed the "default" site so u can see what it looks like "normally" in the link

Tron420

nope..
its still not all in the screen, sry



heres how the layout should be.. ( with the server status info all in the iframe w/ no scroll )

http://hittemupgaming.com/smf/index.php?page=10

feel free to make the height taller if u need to, theres allotta space left at the bottom
dont forget that normally theres a map pic of the current map thats displayed right beside the "GENERAL" box at the top

i attached the style sheet and other files for that page in the first post of this thread..
if you get it to work maybe TP can put this on the block code snippets page , ive noticed alotta ppl asking for a server minitor script.

Thurnok

What you are trying to do is resize the page to fit into a specific resolution.  You cannot do that.  You would need to edit the source HTML for the site and change some of the static table sizes in order to make it fit without scrollbars (which is what I assume you meant).

The only thing you can do is adjust your iframe to a size that fits the whole page in it without scrollbars.

Porky

Precisely you would have to edit the index.html file that it is pulling from to change to that resolution.

but a possible solution would be change the width to 100% and the height to whatever you want and chage the scrolling to no...


Tron420

how do i do that?


alternatively--

the style sheet and other files thats in the zip i attached can be edited to get the whole thing to fit in a 500 px wide space but i have no php knowledge what so ever.

can you plz take a look at em and see if u can fix it?

the iframe can be as tall as it needs to be
the width cant be over 500 or my page will distort


the www folder contains the web stuff (the other stuff is a plugin for the gameserver )

i can upload the edited files back to the site if u attach them
if u want me to test them



Porky

well looked at it without going in and changing the table cells and everything you really can't due it. you could turn off your left and right blocks while viewing this article to give you the space you need


Porky

I am not the best at php as I am still learning. Might see if one of the great php coders that lurk around here like Xarcell, G6 , and maybe crip

Tron420

yea the tables need to be edited..
i tried all day today but i keep messing it up. i really hope someone can help me because i wanna make this work so badly. :-\ :-\

someone , anyone ... help me plz . :o


kran1um

Hmm. this is only for Halflife, whats the BF2 string? Half life is $HLserverstats or something. How would I figure this out for BF2?

Tron420

o well i finally figured it out after an all nighter. nothing fancy.. http://hittemupgaming.com/smf/index.php?page=10

just letting whoever might be watching this post know its done and thx for the replies




This website is proudly hosted on Crocweb Cloud Website Hosting.