Jump to content

php help


chq

Recommended Posts

Now Playing script:

/* ---------- General configuration ---------- */

$station_name = "";

$refresh = "0";  // Page refresh time in seconds. Put 0 for no refresh
$timeout = "5"; // Number of seconds before connecton times out - a higher value will slow the page down if any servers are offline

/* ----------- Server configuration ---------- */

// Note: dont include http://
// Main server: The song title will be taken from this server



$ip[1] = ""; 
$port[1] = "";


/* ----- No need to edit below this line ----- */
/* ------------------------------------------- */
$servers = count($ip);
?>




if ($refresh != "0") 
   {
   print "\n";
   }
print "$station_name Stats\n";
?>


$i = "1";
while($i    {
   $fp = @fsockopen($ip[$i],$port[$i],$errno,$errstr,$timeout);
   if (!$fp) 
       { 
       $listeners[$i] = "0";
       $msg[$i] = "ERROR [Connection refused / Server down]";
       $error[$i] = "1";
       } 
   else
       { 
       fputs($fp, "GET /7.html HTTP/1.0\r\nUser-Agent: Mozilla\r\n\r\n");
       while (!feof($fp)) 
           {
           $info = fgets($fp);
           }
       $info = str_replace('', "", $info);
       $info = str_replace('', "", $info);
       $stats = explode(',', $info);
       if (empty($stats[1]) )
           {
           $listeners[$i] = "0";
           $msg[$i] = "ERROR [There is no source connected]";
           $error[$i] = "1";
           }
       else
           {
           if ($stats[1] == "1")
               {
               $song[$i] = $stats[6];
               $listeners[$i] = $stats[0];
               $max[$i] =  $stats[3];
               $bitrate[$i] = $stats[5];
               $peak[$i] = $stats[2];
               if ($stats[0] == $max[$i]) 
                   { 
                   $msg[$i] .= "";
                   }
               $msg[$i] .= "Server is up at $bitrate[$i] kbps with $listeners[$i] of $max[$i] listeners";
               if ($stats[0] == $max[$i]) 
                   { 
                   $msg[$i] .= "";
                   }
               $msg[$i] .= "\n    
Listener peak: $peak[$i]";
               }
           else
               {
               $listeners[$i] = "0";
               $msg[$i] = "    ERROR [Cannot get info from server]";
               $error[$i] = "1";
               }
           }
       }
   $i++;
   }
$total_listeners = array_sum($listeners) ;
print "Now Playing: $song[1]";
?>




Link to comment
Share on other sites

Link to comment
Share on other sites

i has a copy of the code that is now valid. Ill edit this when i finds it

 

[/color][code]
[color=black]/* ---------- General configuration ---------- */[/color]
[color=black]$station_name = "";[/color]
[color=black]$refresh = "0"; // Page refresh time in seconds. Put 0 for no refresh[/color]
[color=black]$timeout = "5"; // Number of seconds before connecton times out - a higher value will slow the page down if any servers are offline[/color]
[color=black]/* ----------- Server configuration ---------- */[/color]
[color=black]// Note: dont include http://[/color]
[color=black]// Main server: The song title will be taken from this server[/color]

[color=black]$ip[1] = ""; [/color]
[color=black]$port[1] = "";[/color]

[color=black]/* ----- No need to edit below this line ----- */[/color]
[color=black]/* ------------------------------------------- */[/color]
[color=black]$servers = count($ip);[/color]
[color=black]?>[/color]
[color=black][/color]
[color=black][/color]
[color=black][/color]
[color=black][/color]
[color=black][color=black]if ($refresh != "0") [/color]
[color=black]{[/color]
[color=black]print "\n";[/color]
[color=black]}[/color]
[color=black]print "$station_name Stats\n";[/color]
[color=black]?>[/color]
[color=black][/color]
[color=black][/color]
[color=black][color=black]$i = "1";[/color]
[color=black]while($i[color=black]{[/color]
[color=black]$fp = @fsockopen($ip[$i],$port[$i],$errno,$errstr,$timeout);[/color]
[color=black]if (!$fp) [/color]
[color=black]{ [/color]
[color=black]$listeners[$i] = "0";[/color]
[color=black]$msg[$i] = "ERROR [Connection refused / Server down]";[/color]
[color=black]$error[$i] = "1";[/color]
[color=black]} [/color]
[color=black]else[/color]
[color=black]{ [/color]
[color=black]fputs($fp, "GET /7.html HTTP/1.0\r\nUser-Agent: Mozilla\r\n\r\n");[/color]
[color=black]while (!feof($fp)) [/color]
[color=black]{[/color]
[color=black]$info = fgets($fp);[/color]
[color=black]}[/color]
[color=black]$info = str_replace('', "", $info);[/color]
[color=black]$info = str_replace('', "", $info);[/color]
[color=black]$stats = explode(',', $info);[/color]
[color=black]if (empty($stats[1]) )[/color]
[color=black]{[/color]
[color=black]$listeners[$i] = "0";[/color]
[color=black]$msg[$i] = "ERROR [There is no source connected]";[/color]
[color=black]$error[$i] = "1";[/color]
[color=black]}[/color]
[color=black]else[/color]
[color=black]{[/color]
[color=black]if ($stats[1] == "1")[/color]
[color=black]{[/color]
[color=black]$song[$i] = $stats[6];[/color]
[color=black]$listeners[$i] = $stats[0];[/color]
[color=black]$max[$i] = $stats[3];[/color]
[color=black]$bitrate[$i] = $stats[5];[/color]
[color=black]$peak[$i] = $stats[2];[/color]
[color=black]if ($stats[0] == $max[$i]) [/color]
[color=black]{ [/color]
[color=black]$msg[$i] .= "";[/color]
[color=black]}[/color]
[color=black]$msg[$i] .= "Server is up at $bitrate[$i] kbps with $listeners[$i] of $max[$i] listeners";[/color]
[color=black]if ($stats[0] == $max[$i]) [/color]
[color=black]{ [/color]
[color=black]$msg[$i] .= "";[/color]
[color=black]}[/color]
[color=black]$msg[$i] .= "\n 
Listener peak: $peak[$i]";[/color]
[color=black]}[/color]
[color=black]else[/color]
[color=black]{[/color]
[color=black]$listeners[$i] = "0";[/color]
[color=black]$msg[$i] = " ERROR [Cannot get info from server]";[/color]
[color=black]$error[$i] = "1";[/color]
[color=black]}[/color]
[color=black]}[/color]
[color=black]}[/color]
[color=black]$i++;[/color]
[color=black]}[/color]
[color=black]$total_listeners = array_sum($listeners) ;[/color]
[color=black]print "[b]Now Playing: $song[1][/b]";[/color]
[color=black]?>[/color]
[color=black][/color]
[color=black][/color]
[color=black]
[/color]

Link to comment
Share on other sites

ontent-Type" content="text/html; charset=iso-8859-1">




$bannerCounter= 1; 

$bannerCode[$bannerCounter] = " \"http://cyba.fm/adds/ff.gif\"";
$bannerCounter++;
$bannerCode[$bannerCounter] = " \"http://cyba.fm/adds/doh.gif\"";
$bannerCounter++;

$bannerAdTotals = $bannerCounter - 1;
if($bannerAdTotals>1)
{
mt_srand((double)microtime() * 1234567);
$bannerPicked = mt_rand(1, $bannerAdTotals);
}
else
{
$bannerPicked = 1;
}
$bannerAd = $bannerCode[$bannerPicked];
?>



Link to comment
Share on other sites

i has a copy of the code that is now valid. Ill edit this when i finds it

 

[/color][code]
[color=black]/* ---------- General configuration ---------- */[/color]
[color=black]$station_name = "";[/color]
[color=black]$refresh = "0"; // Page refresh time in seconds. Put 0 for no refresh[/color]
[color=black]$timeout = "5"; // Number of seconds before connecton times out - a higher value will slow the page down if any servers are offline[/color]
[color=black]/* ----------- Server configuration ---------- */[/color]
[color=black]// Note: dont include http://[/color]
[color=black]// Main server: The song title will be taken from this server[/color]

[color=black]$ip[1] = ""; [/color]
[color=black]$port[1] = "";[/color]

[color=black]/* ----- No need to edit below this line ----- */[/color]
[color=black]/* ------------------------------------------- */[/color]
[color=black]$servers = count($ip);[/color]
[color=black]?>[/color]
[color=black][/color]
[color=black][/color]
[color=black][/color]
[color=black][/color]
[color=black][color=black]if ($refresh != "0") [/color]
[color=black]{[/color]
[color=black]print "\n";[/color]
[color=black]}[/color]
[color=black]print "$station_name Stats\n";[/color]
[color=black]?>[/color]
[color=black][/color]
[color=black][/color]
[color=black][color=black]$i = "1";[/color]
[color=black]while($i[color=black]{[/color]
[color=black]$fp = @fsockopen($ip[$i],$port[$i],$errno,$errstr,$timeout);[/color]
[color=black]if (!$fp) [/color]
[color=black]{ [/color]
[color=black]$listeners[$i] = "0";[/color]
[color=black]$msg[$i] = "ERROR [Connection refused / Server down]";[/color]
[color=black]$error[$i] = "1";[/color]
[color=black]} [/color]
[color=black]else[/color]
[color=black]{ [/color]
[color=black]fputs($fp, "GET /7.html HTTP/1.0\r\nUser-Agent: Mozilla\r\n\r\n");[/color]
[color=black]while (!feof($fp)) [/color]
[color=black]{[/color]
[color=black]$info = fgets($fp);[/color]
[color=black]}[/color]
[color=black]$info = str_replace('', "", $info);[/color]
[color=black]$info = str_replace('', "", $info);[/color]
[color=black]$stats = explode(',', $info);[/color]
[color=black]if (empty($stats[1]) )[/color]
[color=black]{[/color]
[color=black]$listeners[$i] = "0";[/color]
[color=black]$msg[$i] = "ERROR [There is no source connected]";[/color]
[color=black]$error[$i] = "1";[/color]
[color=black]}[/color]
[color=black]else[/color]
[color=black]{[/color]
[color=black]if ($stats[1] == "1")[/color]
[color=black]{[/color]
[color=black]$song[$i] = $stats[6];[/color]
[color=black]$listeners[$i] = $stats[0];[/color]
[color=black]$max[$i] = $stats[3];[/color]
[color=black]$bitrate[$i] = $stats[5];[/color]
[color=black]$peak[$i] = $stats[2];[/color]
[color=black]if ($stats[0] == $max[$i]) [/color]
[color=black]{ [/color]
[color=black]$msg[$i] .= "";[/color]
[color=black]}[/color]
[color=black]$msg[$i] .= "Server is up at $bitrate[$i] kbps with $listeners[$i] of $max[$i] listeners";[/color]
[color=black]if ($stats[0] == $max[$i]) [/color]
[color=black]{ [/color]
[color=black]$msg[$i] .= "";[/color]
[color=black]}[/color]
[color=black]$msg[$i] .= "\n 
Listener peak: $peak[$i]";[/color]
[color=black]}[/color]
[color=black]else[/color]
[color=black]{[/color]
[color=black]$listeners[$i] = "0";[/color]
[color=black]$msg[$i] = " ERROR [Cannot get info from server]";[/color]
[color=black]$error[$i] = "1";[/color]
[color=black]}[/color]
[color=black]}[/color]
[color=black]}[/color]
[color=black]$i++;[/color]
[color=black]}[/color]
[color=black]$total_listeners = array_sum($listeners) ;[/color]
[color=black]print "[b]Now Playing: $song[1][/b]";[/color]
[color=black]?>[/color]
[color=black][/color]
[color=black][/color]
[color=black]
[/color]

Link to comment
Share on other sites

hmm that is strange?

 

also when i try to visit the w3c link above it says 500 internal error!

 

sorry for my anger but when php outputs, ITS NOT VALID! :P

 

 = maybe valid

[output of the php script] = only valid if the code is valid in the container.

 

Also... Looking at w3c, you have multiple headers and footers on the page! No wonder you are getting errors :biggrinthumb:

 

Hope this helps!

Studiio - All-In-One Radio Communication Platform
SMS | Phone Calls | Social Media | Content

Link to comment
Share on other sites

Also... Looking at w3c, you have multiple headers and footers on the page! No wonder you are getting errors :biggrinthumb:

 

Hope this helps!

 

as i said before j

 

"i did not put them in there"

 

the php is out putting those extra headers footers etc

if i take out those two scripts then the extra headers, footers disapears then my page becomes vaild

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...