$(function(){ $('.marquee1').marquee({ speed: 60, gap: 0, delayBeforeStart: 0, direction: 'left', duplicated: true, pauseOnHover: true }); $('.marquee2').marquee({ speed: 20, gap: 0, delayBeforeStart: 0, direction: 'left', duplicated: true, pauseOnHover: true }); }); "; class shoutcast2stats { private $_ip; private $_port; private $_sid; private $_json; public function __construct($ip, $port, $sid=1) { $this->_ip = $ip; $this->_port = $port; $this->_sid = $sid; $this->initCurl(); } private function initCurl() { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://'.$this->_ip.':'.$this->_port.'/stats?sid='.$this->_sid.'&json=1'); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (PortalRadiowy.pl)'); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_TIMEOUT, 3); $curl_exec = curl_exec($ch); $this->_json = ($curl_exec ? json_decode(iconv('UTF-8', 'UTF-8//IGNORE', $curl_exec)) : false); curl_close($ch); } public function get($name, $name_dj='') { if ($name == 'streamstatus') { if ($this->_json == false) { return 0; } elseif ($this->_json->streamstatus == 0) { return 1; } else { return 2; } } elseif (isset($this->_json->$name) && $name == 'dj' && !empty($name_dj)) { $dj_json = json_decode(substr(preg_replace('/\},[\s]*\{/', ',', preg_replace(array('/\([\s]*"/', '/"[\s]*\)/', '/"[\s]*,/'), array('{"', '"}', '":'), preg_replace_callback('/\\\\(\d+)/m', function($matches) { return iconv('Windows-1250', 'UTF-8//IGNORE', chr($matches[1])); }, $this->_json->dj))), 1, -1)); if (isset($dj_json->$name_dj)) { return htmlspecialchars($dj_json->$name_dj); } } elseif (isset($this->_json->$name)) { return htmlspecialchars($this->_json->$name); } return ''; } } $stats = new shoutcast2stats('145.239.26.146', 7350); ?> get('dj', 'icy-genre') == "") $imie = "Brak"; $FM_result = dbquery("SELECT * FROM ".$db_prefix."users"); while ($FM = dbarray($FM_result)) { if ($FM['user_name'] == $stats->get('dj', 'icy-genre')){ $miasto = $FM['user_location']; $imie = $stats->get('dj', 'icy-genre'); $zmiana = array($miasto, $imie); $losuj = rand(0,1); } } // fota echo "
"; print ""; echo "
"; // nazwa dj echo "
"; echo $zmiana[$losuj]; echo "
"; // nazwa audyci echo "
"; echo "
"; echo $stats->get('dj', 'icy-name'); echo ""; echo "
"; echo "
"; // rds $rds_result = dbquery("SELECT * FROM pr_serwer"); while ($rds = dbarray($rds_result)) { echo "
"; echo "
"; echo $stats->get('servertitle'); echo ""; echo $rds['rds1']; echo ""; echo $rds['rds2']; echo ""; echo $rds['rds3']; echo ""; echo $rds['rds4']; echo ""; echo $rds['rds5']; echo ""; echo date('< H:i:s <-> d-m-Y >'); echo ""; echo "
"; echo "
"; } ?>