Announcement

Collapse
No announcement yet.

Bound to be a silly question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bound to be a silly question

    I run vBulletin 3.5 for a game server I run, now In light of that I'd like to add a new segment to "What's going on", that display's assorted info, on the actual game server.

    I'm Very, very, new at working with PhP Code, and while I found what I was looking for online at a site for people that play the game in question, I'm very lost as to how to tie this into the main index page As I'm not exactly sure what is needed..

    You can see the script Working here, the actual script is below. I'd be grateful for any help ya'll can give me. I think I have to strip out the HTML coding, to even display it on the index.php file, but with my lack of knowlage, I've avoided tampering with it for now.

    Code:
     
    <html>
    <head>
    <body background="#0B283B" text="#000000" link="#00CCFF" vlink="#0099CC" alink="#FFFFFF">
    <title>Zhentil Keep</title>
    <style type="text/css">
    <!--
    .r {
    }
    -->
    </style>
    </head>
    <body background="#0B283B" text="#000000" link="#00CCFF" vlink="#0099CC" alink="#FFFFFF">
    <center> 
    <?php 
    $ipaddr = "213.239.184.150";
    $port = "5121";
    $timeout = 5;
    $connect = fsockopen( "udp://" . $ipaddr, $port, $errno, $errstr, $timeout );
    if ( ! $connect ) {
    print( "<h1>Server is down</h1><br>\n" );
    print( "<h3>ERROR: $errno - $errstr</h3><br>\n" );
    exit;
    } else {
    socket_set_timeout( $connect, $timeout );
    $send = "\xFE\xFD\x00\xE0\xEB\x2D\x0E\x14\x01\x0B\x01\x05\x08\x0A\x33\x34\x35\x13\x04\x36\x37\x38\x39\x14\x3A\x3B\x3C\x3D\x00\x00";
    fwrite( $connect, $send );
    $output = fread( $connect, 5000 );
    if ( ! $output ) {
    print ( "<h1>Server is down.<br></h1>\n" );
    } else {
    $lines = explode( "\x00", $output );
    print( "<u>Server IP:</u> <i class='r'>$ipaddr</i>:<i class='r'>$port</i><br>\n" );
    print( "<u>Server Status:</u> <i class='r'>Online</i><br>\n" );
    print( "<u>Game Name:</u> <i class='r'>$lines[3]</i><br>\n" );
    print( "<u>Module Name:</u> <i class='r'>$lines[4]</i><br>\n" );
    print( "<u>Players:</u> <i class='r'>$lines[5]</i> / <i class='r'>$lines[6]</i><br><br>\n" );
    $dlines = explode( "\n", $lines[15] );
    foreach ( $dlines as $dline ) {
    }
    print( "</i>\n" );
    }
    }
    fclose( $connect ); 
    ?>
    </center>
    </body>
    </html>

  • #2
    Use a plugin:

    Admin CP -> Plugin System -> Add New Plugin

    Create a plugin for the forumhome_start hook location. Use code like this:

    Code:
    ob_start();
    require("serverstatus.php");
    $status = ob_get_contents();
    ob_end_clean();
    Now you can use this variable in the FORUMHOME template to show the output of that file:

    Code:
    $status
    This should work.

    Comment


    • #3
      Thank you Mr. Bunce

      I show my utter and complete lack of knowlage now but:

      Strip out the HTML code: Yes/No?

      Stick the $Status function on ____?
      index.php
      each style template
      Other location (Please elaborate)

      The Goal is to display this info Under currently active vBulletin users, but above server(vBulletin) stat's.

      Forums can be seen here if that helps any.

      Comment


      • #4
        Originally posted by [email protected]
        The Goal is to display this info Under currently active vBulletin users, but above server(vBulletin) stat's.
        FORUMHOME

        For example, add the red code:

        Code:
        <!-- what's going on box -->
        <table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
        <thead>
        	<tr>
        		<td class="tcat" colspan="2">$vbphrase[whats_going_on]</td>
        	</tr>
        </thead>
        <if condition="$show['loggedinusers']">
        <!-- logged-in users -->
        <tbody>
        	<tr>
        		<td class="thead" colspan="2">
        			<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('forumhome_activeusers')"><img id="collapseimg_forumhome_activeusers" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_forumhome_activeusers].gif" alt="" border="0" /></a>
        			<a href="online.php$session[sessionurl_q]" rel="nofollow">$vbphrase[currently_active_users]</a>: $totalonline (<phrase 1="$numberregistered" 2="$numberguest">$vbphrase[x_members_and_y_guests]</phrase>)
        		</td>
        	</tr>
        </tbody>
        <tbody id="collapseobj_forumhome_activeusers" style="$vbcollapse[collapseobj_forumhome_activeusers]">
        	<tr>
        		<td class="alt2"><a href="online.php$session[sessionurl_q]" rel="nofollow"><img src="$stylevar[imgdir_misc]/whos_online.gif" alt="$vbphrase[view_whos_online]" border="0" /></a></td>
        		<td class="alt1" width="100%">
        			<div class="smallfont">
        				<div style="white-space: nowrap"><phrase 1="$recordusers" 2="$recorddate" 3="$recordtime">$vbphrase[most_users_ever_online_was_x_y_at_z]</phrase></div>
        				<div>$activeusers</div>
        			</div>
        		</td>
        	</tr>
        </tbody>
        <!-- end logged-in users -->
        </if>
        [color=red]<!-- game server -->
        <tbody>
        	<tr>
        		<td class="thead" colspan="2">
        			Game Server
        		</td>
        	</tr>
        </tbody>
        <tbody>
        	<tr>
        		<td class="alt2"><img src="$stylevar[imgdir_statusicon]/announcement_old.gif" alt="Game Server" border="0" /></td>
        		<td class="alt1" width="100%">
        			<div class="smallfont">
        				$status
        			</div>
        		</td>
        	</tr>
        </tbody>
        <!-- end game server -->[/color]
        <tbody>
        	<tr>
        		<td class="thead" colspan="2">
        			<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('forumhome_stats')"><img id="collapseimg_forumhome_stats" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_forumhome_stats].gif" alt="" border="0" /></a>
        			<phrase 1="$vboptions[bbtitle]">$vbphrase[x_statistics]</phrase>
        		</td>
        	</tr>
        </tbody>

        Comment

        widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
        Working...
        X