chq Posted June 8, 2009 Share Posted June 8, 2009 hello to any php experts on bw i need some help on editing 2 php files? Link to comment Share on other sites More sharing options...
Lloyd Posted June 8, 2009 Share Posted June 8, 2009 post them here, lets have a look at them. Ill see what i can do Link to comment Share on other sites More sharing options...
chq Posted June 8, 2009 Author Share Posted June 8, 2009 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 More sharing options...
Brutish Sailor Posted June 8, 2009 Share Posted June 8, 2009 now playing script for cybaFM: Get the CybaFM widget and many other great free widgets at Widgetbox! KNSJ.org / 89.1 FM San Diego Link to comment Share on other sites More sharing options...
chq Posted June 8, 2009 Author Share Posted June 8, 2009 now playing script for cybaFM: Get the CybaFM widget and many other great free widgets at Widgetbox! thank you Brutish Sailor but its not vaild http://validator.w3.org/check?uri=http%3A%2F%2Fcyba.fm%2Ftest%2Finteract%2F;accept=text%2Fhtml%2Capplication%2Fxhtml%2Bxml%2Capplication%2Fxml%3Bq%3D0.9%2C*%2F*%3Bq%3D0.8;accept-language=en-us%2Cen%3Bq%3D0.5;accept-charset=ISO-8859-1%2Cutf-8%3Bq%3D0.7%2C*%3Bq%3D0.7 Link to comment Share on other sites More sharing options...
Brutish Sailor Posted June 8, 2009 Share Posted June 8, 2009 ok, just Iframe this. I'm going to take the rate of refresh to 30 seconds. Because you do live mixing sets, it should be about 2 minutes apart, and I'll change that later. http://www.deadawakenradio.com/CybaFM.php KNSJ.org / 89.1 FM San Diego Link to comment Share on other sites More sharing options...
Brutish Sailor Posted June 8, 2009 Share Posted June 8, 2009 Send a couple of raver chicks my way and we are square KNSJ.org / 89.1 FM San Diego Link to comment Share on other sites More sharing options...
James Posted June 9, 2009 Share Posted June 9, 2009 Allright, firstly you cannot validate the php code itself. It can only validate what the php outputs. Can you post a page on your site where you have both these two scripts running and i can help you make the output valid Studiio - All-In-One Radio Communication Platform SMS | Phone Calls | Social Media | Content Link to comment Share on other sites More sharing options...
Lloyd Posted June 9, 2009 Share Posted June 9, 2009 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 More sharing options...
Lloyd Posted June 9, 2009 Share Posted June 9, 2009 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 More sharing options...
chq Posted June 9, 2009 Author Share Posted June 9, 2009 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 More sharing options...
chq Posted June 9, 2009 Author Share Posted June 9, 2009 Allright, firstly you cannot validate the php code itself. It can only validate what the php outputs. Can you post a page on your site where you have both these two scripts running and i can help you make the output valid sure thing http://cyba.fm/test/interact Link to comment Share on other sites More sharing options...
Brutish Sailor Posted June 9, 2009 Share Posted June 9, 2009 do you need me to be running this script then? I can go ahead and shut down the php on my server? KNSJ.org / 89.1 FM San Diego Link to comment Share on other sites More sharing options...
chq Posted June 9, 2009 Author Share Posted June 9, 2009 do you need me to be running this script then? I can go ahead and shut down the php on my server? thanks Brutish Sailor but you can delete it now Link to comment Share on other sites More sharing options...
Brutish Sailor Posted June 9, 2009 Share Posted June 9, 2009 will do. No problem Chq. Im still demanding the little candy flipping raver girls that dress like twins. LOL Just joking. KNSJ.org / 89.1 FM San Diego Link to comment Share on other sites More sharing options...
Lloyd Posted June 10, 2009 Share Posted June 10, 2009 Odd, http://validator.w3.org/check?uri=http://59.167.90.247/test.php&charset=(detect+automatically)&doctype=Inline&group=0 Thats it tested on my server and it passes first time... Link to comment Share on other sites More sharing options...
chq Posted June 10, 2009 Author Share Posted June 10, 2009 Odd, http://validator.w3.org/check?uri=http://59.167.90.247/test.php&charset=(detect+automatically)&doctype=Inline&group=0 Thats it tested on my server and it passes first time... hmm that is strange? also when i try to visit the w3c link above it says 500 internal error! Link to comment Share on other sites More sharing options...
James Posted June 10, 2009 Share Posted June 10, 2009 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! = 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 More sharing options...
chq Posted June 10, 2009 Author Share Posted June 10, 2009 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 More sharing options...
Brutish Sailor Posted June 10, 2009 Share Posted June 10, 2009 I never understood the importance of W3c. I have heard people say I have A W3C valid site, and they wouldnt touch it. 6 MONTHS LATER... I would check it, and BING! 110 errors. So it seems W3c is a little overrated. Just Personal opinion. KNSJ.org / 89.1 FM San Diego Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.