Announcement

Collapse
No announcement yet.

Odd little problem

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

  • Odd little problem

    I have written a function that queries a Half-Life gameserver and returns the map and the number of players. It simply returns a string which can be echoed onto the page. On the index of the site, this is working perfectly (www.the-group.org - check the right hand column). When in the forum, however, it doesn't work. Since output buffering doesn't seem to work with out new host i simply placed the contents of my footer include into the footer field for the style. the contents of that field are below - and the code is identical to the code for the frontpage. Any ideas would be greatly appreciated.

    PHP version: 4.04pl1
    MySQL Version: 3.23.21-beta-log
    Board URL: www.the-group.org/forums/
    Board Version: 2.2.2
    No hacks installed.

    The Footer Code:
    PHP Code:
      </td> 
    </tr> 
    </table> 
    <!-- /content area table -->
    <p align="center">
      <normalfont><b>&lt; <a href="$contactuslink">Contact Us</a> - <a href="$homeurl">$hometitle</a> &gt;</b></normalfont>
    </p>

    <p align="center"><smallfont>
    <!-- Do not remove this copyright notice -->
      Powered by: vBulletin Version $templateversion<br>
      Copyright &copy;2000, 2001, Jelsoft Enterprises Limited.<br>
    <!-- Do not remove this copyright notice -->
    $copyrighttext
    </smallfont></p>



    <?php

    function getgs($ip$port){
       
    $fp fsockopen ("udp://$ip"$port);
       if (!
    $fp) {
           return 
    "Could not connect to $ip";
           break;
       } else {
           
    fwrite($fp,"˙˙˙˙info\n");
           
    $serveroutput=fread($fp,1);
           
    socket_set_blocking($fp,0);
           
    $serveroutput.=fread($fp4096);
           
    fclose($fp);
       }
       
       
    $lines=explode("\x00"$serveroutput);
       
       
    $index=strlen($serveroutput)-3;
       
       if(
    ord($serveroutput[$index])!=1$players="players"; else $players="player";
       
       return 
    ord($serveroutput[$index]).$players on $lines[2]";
    }

    if(isset(
    $bbuserid)){   
       
    $Query="SELECT username FROM user WHERE userid=$bbuserid";
       
    $Result=mysql_query($Query);
       
       
    $Name=mysql_result($Result0);   
       
    $Name="Welcome, $Name!<br><a href=/forums/search.php?action=getnew><b>New Posts.</b></a>";
    }
    else{
       
    $Name="";
    }

    ?>


    <p align=center>
       <small>Design by Soulkrusher, Project404.org.<br>
       News System and site coding by Arta, Project404.org.<br>
       The-Group is a part of the Project404 Hosting Network and is 
       <sup>&copy;</sup>2001 Project404.org.<br>
       All Rights Reserved.
       </small>
       </p>
       
       </td>
                     </tr>
                     <tr> 
                       <td height="33" background="/assets/Untitled-1_r11_c2.gif"    >&nbsp;</td>
                     </tr>
                   </table>
                 </td>
                 <td width="130" valign="top"> 
                   <table width="130" border="0" cellspacing="0" cellpadding="0" height="100%">
                     <tr>
                       
                    <td height="85" align="right"><img src="/assets/Untitled-1_r2_c7.gif" width="130" height="85"></td>
                     </tr>
                     <tr>
                       
                    <td height="30"><img src="/assets/Untitled-1_r6_c7.gif" width="180" height="30"></td>
                     </tr>
                     <tr>
                       <td background="/assets/Untitled-1_r7_c7.gif" valign="top"><br>
                         <b>CS:</b><br>
                      67.89.77.74:27015<br>
                      (<? echo getgs("67.89.77.74"27015);?>)
                      <br><br>
                      <b>TFC:</b><br>
                      67.89.77.74:27016<br>
                      (<? echo getgs("67.89.77.74"27016);?>)
                      <br><br><br>
                      
                         <?php echo $Name?>
                         <br><br>
                         <b>Forums</b><br>
                         <a href=/forums/>View All Forums</a><br>
                         <?php if(!$Name) echo "<a href=/forums/register.php?action=signup>Register</a><br>"?>
                         <a href=/forums/usercp.php>Preferences</a><br>
                         <a href=/forums/memberlist.php>Members</a><br>
                         <a href=/forums/misc.php?&action=faq>Forum FAQ</a><br>
                         <a href=/forums/search.php>Search Forums</a><br>
                           <?php if($Name) echo "<a href=/forums/member.php?action=logout>Log Out</a><br>"?>
                         
                         
                         
                         <p><a href="/helpernet"><img src="/assets/thehelper.gif" width="88" height="31" border="0"></a></p>
                         <p><a href="http://www.dinobot.org"><img src="/assets/dinobot.gif" width="88" height="31" border="0"></a></p>
                         <p><a href="http://www.opentechsupport.net"><img src="/assets/ots.gif" width="88" height="31" border="0"></a>
                         <p><a href="http://www.rstefan01.com"><img src="/assets/rstefan01.gif" width="88" height="31" border="0"></a></p>
                         <p><a href="http://www.trillian.cc"><img src="/assets/trillian.gif" width="88" height="31" border="0"></a></p>
             </td>
                     </tr>
                     <tr>
                       
                    <td height="72" align="right"><img src="/assets/Untitled-1_r9_c7.gif" width="180" height="72"></td>
                     </tr>
                   </table>
                 </td>
               </tr>
             </table>
           </td>
         </tr>
       </table>

  • #2
    aha! i just noticed that the code's not being parsed. It's being echoed right out into the html.

    *puzzled*

    Comment


    • #3
      Well, i've fixed it. I put all the PHP into php parsed code thing at the top and just had variables in my footer code.

      Is it new as of version 2.2.2 that you can't put code in there? Or was it just that i was using buffering before and didn't notice?

      Comment


      • #4
        PHP code has never been parsed in any template except phpinclude.

        Comment

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