+ Reply to Thread
Results 1 to 6 of 6

Thread: Wolfenstein Server Scan will this code work on x10hosting?

  1. #1
    johnnei is offline x10Hosting Member johnnei is an unknown quantity at this point
    Join Date
    Jun 2009
    Posts
    20

    Wolfenstein Server Scan will this code work on x10hosting?

    Hello,

    Here is my code:
    PHP Code:
    <?php 
    $server_ip 
    "udp://CENSORED";
    $server_port "27960"

    // Open the connection: 
    $connect fsockopen($server_ip$server_port$errno$errstr5); 

    // Set the timeout: 
    socket_set_timeout ($connect5); 

    // Get the information from the server, and put it into the $output array: 

    $send "ÿÿÿÿ" chr (0x00) . "getstatus"
    fputs($connect$send); 
    fwrite ($connect$send); 
    $output fread ($connect1); 
    echo 
    "Output: "$output;
    if (! empty (
    $output)) { 
       do { 
         
    $status_pre socket_get_status ($connect); 
         
    $output $output fread ($connect1); 
         
    $status_post socket_get_status ($connect); 
       } while (
    $status_pre[unread_bytes] != $status_post[unread_bytes]); 
    }; 

    // Close the connection: 
    fclose($connect); 

    // Select the variables from the $output array:
    $output explode ("\\"$output); 

    $max_index array_search ("sv_maxclients"$output); 
    $max_clients $output[$max_index+1]; 

    $max_index array_search ("mapname"$output); 
    $mapname $output[$max_index+1]; 

    $max_index array_search ("sv_hostname"$output); 
    $hostname $output[$max_index+1]; 

    $max_index array_search ("g_gametypestring"$output); 
    $gametype $output[$max_index+1]; 

    $last_value count($output) - 1
    $players_string $output[$last_value]; 
    $players_string explode("\""$players_string); 

    $get_first_ping explode("\n"$players_string[0]); 
    $players_string[0] = $get_first_ping[1]; 

    $i 1
    $players 0
    while (
    count($players_string) != $i) { 
    $i++; 
    $i++; 
    $players++; 


    // Create the image url: 
    if (substr($mapname03) == "dm/") { 
    $picture_src str_replace("dm/"""$mapname); 
    } else { 
    $picture_src str_replace("obj/"""$mapname); 

    $picture_src "images/" $picture_src ".jpg"

    // Start the output: 
    ?> 
    <html> 
    <head> 
          <title><?=$hostname?></title> 
    </head> 
    <body> 
    <table width="600" border="0" align="center"> 
    <caption><b><?=$hostname?></b></caption> 
    <tr> 
        <td width="256" valign="top"> 
        <table border="0"> 
             <tr> 
                 <td width="256">Game: <?=$gametype?><td> 
             </tr> 
             <tr> 
                 <td width="256">Players: <?=$players?>/<?=$max_clients?></td> 
             </tr> 
             <tr> 
                 <td width="256">Map: <?=$mapname?></td> 
             </tr> 
             <tr> 
                 <td width="256"><img src="<?=$picture_src?>"></td> 
             </tr> 
        </table> 
        </td> 
        <td valign="top"> 
            <table border="0"> 
            <tr> 
                <td width="300">Player name:</td> 
                <td width="44">Ping:</td> 
            </tr> 
            <? 
            $i 
    1
            while (
    count($players_string) != $i) { 
            
    $j $i -1
            
    ?> 
            <tr> 
                <td width="300"> 
                    <?=$players_string[$i]?> 
                </td> 
                <td width="44"> 
                    <?=$players_string[$j]?> 
                </td> 
            </tr> 
            <? 
            $i 
    $i 2
            } 
        
    ?> 
        </table> 
        </td> 
    </tr> 
    </table> 
    <center>Stats Version 1.00.01</center>
    </body> 
    </html>
    Will this code work on X10hosting?

    Greatings,
    Johnnei

  2. #2
    xgreenberetx is offline x10Hosting Member xgreenberetx is an unknown quantity at this point
    Join Date
    Oct 2009
    Posts
    57

    Re: Wolfenstein Server Scan will this code work on x10hosting?

    I am assuming it will.

    All tho you might get better results adding @ before fsockopen.

    $connect =@ fsockopen($server_ip, $server_port, $errno, $errstr, 5);
    Last edited by xgreenberetx; 01-03-2010 at 04:55 PM.

  3. #3
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: Wolfenstein Server Scan will this code work on x10hosting?

    Searching (the first thing you should do when you have a question) for "open ports" or "fsockopen" would reveal the answer: no.
    Last edited by misson; 01-03-2010 at 06:02 PM.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  4. #4
    xgreenberetx is offline x10Hosting Member xgreenberetx is an unknown quantity at this point
    Join Date
    Oct 2009
    Posts
    57

    Re: Wolfenstein Server Scan will this code work on x10hosting?

    When I put the @ in front of fsockopen I was able to get the script to work on my x10 hosting. I also had to change the get status string to
    $send ="\xFF\xFF\xFF\xFF\x02getstatus\x0a\x00";
    Code:
    $server_ip = "udp://serverip";
    $server_port = "12203"; //medal of honor
    
    // Open the connection: 
    $connect=@fsockopen($server_ip, $server_port, $errno, $errstr, 5);
    // Set the timeout: 
    socket_set_timeout ($connect, 5); 
    
    // Get the information from the server, and put it into the $output array: 
    $send ="\xFF\xFF\xFF\xFF\x02getstatus\x0a\x00";
    But then again I was querying a medal of honor server, I think they are pretty similar in the way you retrieve info.

  5. #5
    johnnei is offline x10Hosting Member johnnei is an unknown quantity at this point
    Join Date
    Jun 2009
    Posts
    20

    Re: Wolfenstein Server Scan will this code work on x10hosting?

    K thnx i will try a bit around...
    and greenberet this code is malfunctional :P i had to do /337/337/337/337/n or smt and now it works on my own computer host ^^ now i should get it working here

  6. #6
    xgreenberetx is offline x10Hosting Member xgreenberetx is an unknown quantity at this point
    Join Date
    Oct 2009
    Posts
    57

    Re: Wolfenstein Server Scan will this code work on x10hosting?

    Ahh so they do have different ways to send getstatus.

+ Reply to Thread

Similar Threads

  1. How to get ASP.Net to work at x10Hosting
    By Hue Kares in forum Tutorials
    Replies: 56
    Last Post: 11-11-2011, 01:09 PM
  2. Replies: 1
    Last Post: 12-18-2009, 02:03 PM
  3. Hybrid's HTML Lessons
    By Hybrid in forum Tutorials
    Replies: 18
    Last Post: 11-28-2009, 02:12 PM
  4. PHP Server Status.
    By Nathan in forum Scripts & 3rd Party Apps
    Replies: 2
    Last Post: 07-12-2005, 08:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers