Results 1 to 4 of 4

Thread: in localhost work but not on internet, why..?

  1. #1
    Join Date
    Jun 2008
    Posts
    14
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default in localhost work but not on internet, why..?

    Hello all..
    i have a problem with this script...
    when i try in localhost the script run goodly but when i upload it to internet my website crash.. i dont why this script not wrok on internet...

    so pleease help me with this..
    thanks,...

    Code:
    <?
    if(ereg(basename (__FILE__), $_SERVER['PHP_SELF']))
    {
    	header("HTTP/1.1 404 Not Found");
    	exit;
    }
    ob_start();
    // user id masukkan disini, dipisahkan dengan koma
    $id = array("mudies_05",
                "mudy_dja04");
    
    // gambar online dimasukkan disini sesuai dengan urutan ID diatas
    $online = array("http://www.nofiyanti.info/images/kingon.png",
                    "http://www.nofiyanti.info/images/queenon.png");
    
    // gambar offline dimasukkan disini sesuai dengan urutan ID diatas
    $offline = array("http://www.nofiyanti.info/images/kingoff.png",
                     "http://www.nofiyanti.info/images/queenoff.png");
    
    for($i=0;$i<count($id);$i++)
    {
    $buka = fopen("http://opi.yahoo.com/online?u=".$id[$i]."&m=t","r")
    or die
    ("<a href='ymsgr:sendIM?".$id[$i]."'><img src='http://opi.yahoo.com/online?u=".$id[$i]."&m=g&t=11'/></a>");
    while ($baca = fread( $buka, 2048 ))
    { $status .= $baca; }
    fclose($buka);
    if($status == $id[$i]." is ONLINE"){
    echo "<div align='center'><a href='ymsgr:sendIM?".$id[$i]."'><img border=0 src='".$online[$i]."'/></a><br /><br /></div>";
    } else {
    echo "<div align='center'><a href='ymsgr:sendIM?".$id[$i]."'><img border=0 src='".$offline[$i]."'/></a><br /><br /></div>";
    }
    }
    $out = ob_get_contents();
    ob_end_clean();
    ?>

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    What exactly doesn't work with it, and could you post a link to your problem page so that we can see what's going on with it. The only thing I could see is the short open tags that could possibly cause the problem. Anyways, change this: <? to this: <?php and see if that helps.
    Last edited by thetestingsite; 07-13-2008 at 07:33 PM.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  3. The Following User Says Thank You to thetestingsite For This Useful Post:

    asoekaya (07-13-2008)

  4. #3
    Join Date
    Jun 2008
    Posts
    14
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default

    bro..
    someone tell me i must change fopen with curl_init
    and i done... bellow the script i have change but why hothing show in result..
    you can see in my website www.nofiyanti.info on rigth bar Site Owner

    can u all help me how to change it rightly ..
    i dont have knowledge about script..
    the red script is what i was changed..

    Code:
    <?php
    
    if(ereg(basename (__FILE__), $_SERVER['PHP_SELF']))
    {
    	header("HTTP/1.1 404 Not Found");
    	exit;
    }
    ob_start();
    // user id masukkan disini, dipisahkan dengan koma
    $id = array("mudies_05",
                "syafira_salsabila31");
    
    // gambar online dimasukkan disini sesuai dengan urutan ID diatas
    $online = array("http://www.nofiyanti.info/images/kingon.png",
                    "http://www.nofiyanti.info/images/queenon.png");
    
    // gambar offline dimasukkan disini sesuai dengan urutan ID diatas
    $offline = array("http://www.nofiyanti.info/images/kingoff.png",
                     "http://www.nofiyanti.info/images/queenoff.png");
    
    for($i=0;$i<count($id);$i++)
    
    $ch = curl_init("http://opi.yahoo.com/online?u=".$id[$i]."&m=t","r");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $status = curl_exec($ch);
    curl_close($ch);
    
    if($status == $id[$i]." is ONLINE"){
    echo "<div align='center'><a href='ymsgr:sendIM?".$id[$i]."'><img border=0 src='".$online[$i]."'/></a><br /><br /></div>";
    } else {
    echo "<div align='center'><a href='ymsgr:sendIM?".$id[$i]."'><img border=0 src='".$offline[$i]."'/></a><br /><br /></div>";
    }
    
    $out = ob_get_contents();
    ob_end_clean();
    
    ?>

  5. #4
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    What you wanna use it file_get_contents:
    Code:
    <?
    if(ereg(basename (__FILE__), $_SERVER['PHP_SELF']))
    {
    	header("HTTP/1.1 404 Not Found");
    	exit;
    }
    ob_start();
    // user id masukkan disini, dipisahkan dengan koma
    $id = array("mudies_05",
                "mudy_dja04");
    
    // gambar online dimasukkan disini sesuai dengan urutan ID diatas
    $online = array("http://www.nofiyanti.info/images/kingon.png",
                    "http://www.nofiyanti.info/images/queenon.png");
    
    // gambar offline dimasukkan disini sesuai dengan urutan ID diatas
    $offline = array("http://www.nofiyanti.info/images/kingoff.png",
                     "http://www.nofiyanti.info/images/queenoff.png");
    
    for($i=0;$i<count($id);$i++)
    {
    while ($baca = file_get_contents("http://opi.yahoo.com/online?u=".$id[$i]."&m=t")){
    { $status .= $baca; }
    if($status == $id[$i]." is ONLINE"){
    echo "<div align='center'><a href='ymsgr:sendIM?".$id[$i]."'><img border=0 src='".$online[$i]."'/></a><br /><br /></div>";
    } else {
    echo "<div align='center'><a href='ymsgr:sendIM?".$id[$i]."'><img border=0 src='".$offline[$i]."'/></a><br /><br /></div>";
    }
    }
    $out = ob_get_contents();
    ob_end_clean();
    ?>
    Jeremy | jfein.net

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •