Public feed
#888197
<?php if (!$site_config["MEMBERSONLY"] || $CURUSER) {begin_block("NAUJIENA: Uostas Radio"); //----------------------------------------------------------------------------- //--[ put the path to your config file below $cfg_path = "_scstats.cfg"; //_____________________________________________________________________________ //============================================================================= //--[ do not edit below this line! but i have commented to explain what we did //--[ script stats function function quiry_scserv($scservurl, $scservprt) { //--[ kets turn all host names to ips $scservfip = gethostbyname($scservurl); //--[ lets open a socket to the shoutcast server $getscserv = @fsockopen($scservfip, $scservprt, &$errno, &$errstr, 10) or $php_err .= "server doa"; //--[ clear any leftover data $servquiry = ""; //--[ if server is not found, return server quiry as offline if (!$getscserv) { return "offline"; } //--[ if server is online, go further else { //--[ ok we are in! lets quiry shoutcasts public 7.html page fputs($getscserv, "GET /7.html HTTP/1.1\r\nAccept: */*\r\nAccept-Encoding: gzip, deflate\r\nUser-Agent: RaveTrax SC_Serv Stats Getter v1.1 (Mozilla Compatible)\r\nConnection: Keep-Alive\r\n\r\n"); //--[ keep reading until we reach the end of the file while (!feof($getscserv)) { $servquiry .= fread($getscserv, 500); } //--[ close socket once we are done reading the 7.html file fclose($getscserv); //--[ lets read and setup the string... call the cows, a haystack is nearby $quiryb = substr($servquiry, strpos($servquiry, "\r\n\r\n") + 4); //--[ ok fucntion complete, lets return our server quiry as online with data return $quiryb; } } //--[ verifies you set a config file path, continues or exits... if (!$cfg_path) { echo "no config file listed!"; exit; } else { include($cfg_path); $cfg_key = str_replace("ravetrax" ,"y", $cfg_key); } //--[ the next few lines just varify that you have read the read me and edited the config //--[ file as needed, then continues or exits as needed... i'm so evil... :) if (!$html_a) { echo "no offline template found in config file"; exit; } if (!$html_b) { echo "no online template found in config file"; exit; } if ($cfg_key != "y") { echo "config file not found or formatted incorrectly!"; exit; } else { //--[ this is the guts of the script, lets call function here, hide if it fails echo "<!-- "; $scserv_quiry = quiry_scserv($scip, $scpt); echo " -->"; //--[ returned quiry is offline, lets bail! if ($scserv_quiry == "offline") { //--[ what verbage should be used? $csc_status = "$lang_a"; //--[ lets get the offline template and show user what we found. echo "Radias Off-Line <img src=\"http://www.iconarchive.com/icons/zakar/shining-z/Hamachi-SZ-32x32.png\" width=\"32\" height=\"32\" alt=\"Radio Logotipas\"/><br>"; //--[ time to exit... see ya! exit; } //--[ retuned quiry is online! let continue here else { //--[ lets explode the quiry data into an array... $quirydat = explode(",", $scserv_quiry); //--[ ok, now lets double check to see if server is actually broadcasting if ($quirydat[1] == "1") { //--[ double check says server is online, lets continue here. //--[ what verbage should be used? $csc_status = "$lang_b"; //--[ now lets turn the pretty array into some variables for output. $listener_c = $quirydat[0]; $listener_p = $quirydat[2]; $listener_m = $quirydat[3]; $listener_r = $quirydat[4]; $sc_bitrate = $quirydat[5]; $sc_playing = $quirydat[6]; //--[ let get the online template and show user the stats what we found. echo "Radias On-Line <img src=\"http://www.iconarchive.com/icons/zakar/shining-z/Hamachi-SZ-32x32.png\" width=\"32\" height=\"32\" alt=\"Radio Logotipas\"/><br><br>"; echo "<a href=http://77.79.23.24:8000/listen.pls> Klausyti!</a><br><BR>"; echo "Dabar grojame: "; echo $sc_playing;<br>" } else { //--[ double check says server is offline, lets bail! //--[ what verbage should be used? $csc_status = "$lang_a"; //--[ let get the offline template and show user what we found. include($html_a); //--[ time to exit... see ya! exit; } } } end_block(); } //_____________________________________________________________________________ //============================================================================= //--[ ok stop reading now, time to say goodbye! developed by rava@ravetrax.com?>