+ Reply to Thread
Results 1 to 6 of 6

Thread: fsocket

  1. #1
    jcgo16 is offline x10Hosting Member jcgo16 is an unknown quantity at this point
    Join Date
    Aug 2008
    Posts
    10

    fsocket

    we made a php code
    and im in php v2

    but it seems the fsocket is not working

    index.php
    PHP Code:
    <?php echo '<?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">'
    ;?>
    <head>
    <title>O2Jam R3 - The Recollection of Music</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <meta http-equiv="content-style-type" content="text/css" />
    <style type="text/css">
    html{ font-size:11px; font-family: Tahoma; }
    body{ background: #000; color: #ddd; }
    a{ color: #a7a; }
    a:hover{ text-decoration: none; }
    p{ line-height: 10pt; margin:0px 5px 0px 10px; }

    #page-wrapper {
        border: 1px solid #E4E8EF;
        margin: 0px;
        text-align: center;
        vertical-align: top;
        width: 420px;
    }

    b.green { color: green; text-align: center; }
    b.red { color: red; text-align: center; }

    #header, #footer{
        border: 1px solid #E4E8EF;
        padding: 5px;
        margin: 10px;
        text-align: center;
        vertical-align: bottom;
        width: 420px
    }

    .header{
        border-bottom: 2px dotted #494;
        color: #FC0;
        font-family: Arial;
        font-size: 1.25em;
        font-weight: bold;
        margin: 8px;
        padding: 8px;
        text-align: center;
        text-transform: uppercase;
    }

    .headerdesc{
        line-height: 10pt;
        margin: 8px;
        padding: 8px;
        text-align: center;
        white-space: normal;
    }
    </style>
    </head>

    <body>
    <div id="page-wrapper">
        <table><tbody>
            <tr><td id="header">
            O2Jam R3 - The Recollection of Music<br/>
                <?php
                    
    include 'serverstatus.php';    
                        
                    echo 
    'Game Server:&nbsp;';
                    if(
    $serverstatus == 1) { echo '<b class="green">Online</b>'; }
                    else { echo 
    '<b class="red">Offline</b>';}
                    
                    echo 
    '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
                    
                    echo 
    'Music Server:&nbsp;';
                    if(
    $ftptatus == 1) { echo '<b class="green">Online</b>'; }
                    else { echo 
    '<b class="red">Offline</b>'; }
                
    ?>
            </td></tr>
            
            <tr><td>
                <div class="header">:: 31 October 2008 ::</div>
                <div class="headerdesc">
                    <p>Let's all get spooked on All Hollow's Eve. New notice page coming in a few days...</p>
                </div>
                
                <div class="header">:: 14 October 2008 ::</div>
                <div class="headerdesc">
                    <p>New minor but important patch.
                    <br/>- Server IP Address Changed.
                    </p>
                </div>
            </td></tr>
            
            <tr><td id="footer">
                <p>&copy; 2008 Chu Chin Kuan. All rights reserved.</p>
                <a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Strict" height="31" width="88" /></a>
                <a href="http://jigsaw.w3.org/css-validator/"><img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!" /></a>
            </td></tr>
        </tbody></table>
    </div>
    </body>
    </html>
    and this is the serverstatus.php

    PHP Code:
    <?php
    $gameip 
    "o2jamr3.myftp.org";
    $ftpip "o2r3.servegame.com";

    // Game Status Check
    $timeout 1;

    if(
    $myipc = @fsockopen($gameip15010$errno$errstr$timeout)) {
    $serverstatus 1;
    fclose($myipc); }

    else{ 
    $serverstatus 0; }

    // FTP Status Check
    $timeout 1;

    if(
    $myipc = @fsockopen($ftpip121$errno$errstr$timeout)) {
    $ftpstatus 1;
    fclose($myipc); }

    else{ 
    $ftpstatus 0; }
    ?>
    pls... help
    all pages are correct
    why it is not working well
    its always says offline
    but in *name of hosting company removed*
    http://o2jam-r3.cjb.net/
    its says online
    pls.. help?
    Last edited by TechAsh; 11-01-2008 at 05:23 AM.

  2. #2
    themasterrocker Guest

    Re: fsocket

    -moved to programming help-

  3. #3
    Submariner is offline x10Hosting Member Submariner is an unknown quantity at this point
    Join Date
    Dec 2007
    Location
    TN, USA
    Posts
    44

    Re: fsocket

    Since you have passed the optional parameters $errno and $errstr modify the files as follows:

    index.php in 'page-wrapper' div:
    PHP Code:
    <?php
        
    include 'serverstatus.php';

        echo 
    '<!-- Game Error: "$gameErr" GameErrNo: "$gameErrNo" Ftp Error: "$ftpErr" FtpErrNo: "$ftpErrNo" -->';
            
        echo 
    'Game Server:&nbsp;';
        if(
    $serverstatus == 1) { echo '<b class="green">Online</b>'; }
        else { echo 
    '<b class="red">Offline</b>';}
        
        echo 
    '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
        
        echo 
    'Music Server:&nbsp;';
        if(
    $ftptatus == 1) { echo '<b class="green">Online</b>'; }
        else { echo 
    '<b class="red">Offline</b>'; }
    ?>
    serverstatus.php:
    PHP Code:
    <?php
    $gameip 
    "o2jamr3.myftp.org";
    $ftpip "o2r3.servegame.com";

    // Game Status Check
    $timeout 1;

    // error holders
    $gameErr "";
    $gameErrNo 0;
    $ftpErr "";
    $ftpErrNo 0;

    $myipc = @fsockopen($gameip15010$errno$errstr$timeout)
    if(
    $myipx) {
    $serverstatus 1;
    fclose($myipc); 
    } else { 
    $serverstatus 0
    $gameErr $errstr;
    $gameErrNo $errno;
    }

    // FTP Status Check
    $timeout 1;

    if(
    $myipc = @fsockopen($ftpip121$errno$errstr$timeout)) {
    $ftpstatus 1;
    fclose($myipc); 
    } else { 
    $ftpstatus 0
    $ftpErr $errstr;
    $ftpErrNo $errno;
    }
    ?>
    Then view the page source and look at the comment to see what the error messages and error number are. It would help troubleshooting a whole bunch.

    James

  4. #4
    jcgo16 is offline x10Hosting Member jcgo16 is an unknown quantity at this point
    Join Date
    Aug 2008
    Posts
    10

    Re: fsocket

    PHP Code:
    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
    <title>O2Jam R3 - The Recollection of Music</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <meta http-equiv="content-style-type" content="text/css" />
    <style type="text/css">
    html{ font-size:11px; font-family: Tahoma; }
    body{ background: #000; color: #ddd; }
    a{ color: #a7a; }
    a:hover{ text-decoration: none; }
    p{ line-height: 10pt; margin:0px 5px 0px 10px; }

    #page-wrapper {
        border: 1px solid #E4E8EF;
        margin: 0px;
        text-align: center;
        vertical-align: top;
        width: 420px;
    }

    b.green { color: green; text-align: center; }
    b.red { color: red; text-align: center; }

    #header, #footer{
        border: 1px solid #E4E8EF;
        padding: 5px;
        margin: 10px;
        text-align: center;
        vertical-align: bottom;
        width: 420px
    }

    .header{
        border-bottom: 2px dotted #494;
        color: #FC0;
        font-family: Arial;
        font-size: 1.25em;
        font-weight: bold;
        margin: 8px;
        padding: 8px;
        text-align: center;
        text-transform: uppercase;
    }

    .headerdesc{
        line-height: 10pt;
        margin: 8px;
        padding: 8px;
        text-align: center;
        white-space: normal;
    }
    </style>
    </head>

    <body>
    <div id="page-wrapper">
        <table><tbody>
            <tr><td id="header">
            O2Jam R3 - The Recollection of Music<br/>
                <br />
    <b>Parse error</b>:  syntax error, unexpected T_IF in <b>/home/jcgo16/public_html/serverstatus.php</b> on line <b>15</b><br />

    its says
    O2Jam R3 - The Recollection of Music

    Parse error: syntax error, unexpected T_IF in /home/jcgo16/public_html/serverstatus.php on line 15

  5. #5
    xPlozion's Avatar
    xPlozion is offline x10 Elder xPlozion is an unknown quantity at this point
    Join Date
    Mar 2008
    Location
    Delaware, USA
    Posts
    872

    Re: fsocket

    forgot the semicolon ;)
    PHP Code:
    $myipc = @fsockopen($gameip15010$errno$errstr$timeout
    also, where the ftp part is, change
    PHP Code:
    if($myipc = @fsockopen($ftpip121$errno$errstr$timeout)) { 
    to
    PHP Code:
    $myipc = @fsockopen($ftpip121$errno$errstr$timeout);
    if(
    $myipc) { 
    also, where you have
    PHP Code:
    $myipc = @fsockopen($gameip15010$errno$errstr$timeout
    if(
    $myipx) { 
    change they're not the same variable, so it will always return false. change the top to $myipx or the bottom to $myipc

    so... serverstatus.php should be:
    PHP Code:
    <?php 
    $gameip 
    "o2jamr3.myftp.org"
    $ftpip "o2r3.servegame.com"

    // Game Status Check 
    $timeout 1

    // error holders 
    $gameErr ""
    $gameErrNo 0
    $ftpErr ""
    $ftpErrNo 0

    $myipc = @fsockopen($gameip15010$errno$errstr$timeout);
    if(
    $myipc) { 
    $serverstatus 1
    fclose($myipc);  
    } else {  
    $serverstatus 0;  
    $gameErr $errstr
    $gameErrNo $errno


    // FTP Status Check 
    $timeout 1

    $myipc = @fsockopen($ftpip121$errno$errstr$timeout);
    if(
    $myipc) { 
    $ftpstatus 1
    fclose($myipc);  
    } else {  
    $ftpstatus 0;  
    $ftpErr $errstr
    $ftpErrNo $errno

    ?>
    Last edited by xPlozion; 11-01-2008 at 10:55 PM.

  6. #6
    jcgo16 is offline x10Hosting Member jcgo16 is an unknown quantity at this point
    Join Date
    Aug 2008
    Posts
    10

    Re: fsocket

    its says offline again
    nothing works
    i think the php blocks it

    dunno
    im version 2 intermediate
    im gonna change my hosting site
    thanks for help

+ Reply to Thread

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