Log in

View Full Version : in localhost work but not on internet, why..?



asoekaya
07-13-2008, 07:22 PM
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,...


<?
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();
?>

thetestingsite
07-13-2008, 07:24 PM
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.

asoekaya
07-13-2008, 10:21 PM
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..


<?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();

?>

Nile
07-13-2008, 10:33 PM
What you wanna use it file_get_contents:


<?
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();
?>