Hallo, ich habe ein problem mit einen script, den ich in php kit einbinden möchte per php geht er nur nicht in der navbox vllt. kann mir einer helfen. ich hoffe es mal würde mich freuen.
Alles anzeigen
PHP-Quellcode
- <?php//eval ("\$boxlinks[]= \"".getTemplate("navigation/test3")."\";");
- ?>
- <?php
- //include('./global.php');
- //include('./config5.php');
- $host = "localhost"; //Hostname, or ip address of server. IE blah.com or xx.xx.xx.xx
- $port = "1212"; //Port server is running on. IE 8000
- $password = "party"; //Password of server, can be normal or admin. Doesn't matter.
- //Configuration Finished
- //Runs each time an XML element starts
- function StartHandler(&$Parser, &$Elem, &$Attr) {
- global $Data, $CData;
- /* Start with empty CData array. */
- $CData = array();
- /* Put each attribute into the Data array. */
- while ( list($Key, $Val) = each($Attr) ) {
- $Data["$Elem:$Key"] = trim($Val);
- // debug // echo "$Elem:$Key = " . $Data["$Elem:$Key"] . "\n";
- }
- }
- //Runs each time XML character data is encountered
- function CharacterHandler(&$Parser, &$Line) {
- global $CData;
- /*
- * Place lines into an array because elements
- * can contain more than one line of data.
- */
- $CData[] = $Line;
- }
- //Runs each time an XML element ends
- function EndHandler(&$Parser, &$Elem) {
- global $Data, $CData, $listeners, $server, $song, $dj, $wee;
- //Mush all of the CData lines into a string and put it into the $Data array.
- $Data[$Elem] = trim( implode('', $CData) );
- //echo "$Elem = " . $Data[$Elem] . "<br>\n";
- switch ($Elem){
- //for each case, we are putting some data into a variable.
- case 'AIM':
- $dj['AIM'] = $Data['AIM'];
- break;
- }
- }
- //open connection
- $fp = fsockopen("$host", $port, &$errno, &$errstr, 30);
- if (!$fp) {
- echo "Connection to server could not be established! <BR>";
- }
- else {
- //request xml
- fputs($fp,"GET /admin.cgi?pass=".$password."&mode=viewxml&page=0 HTTP/1.0\nUser-Agent: Mozilla Compatible\n\n");
- while(!feof($fp)) {
- //put xml into $Data
- $Contents .= fgets($fp, 1000);
- }
- }
- //close connection
- fclose($fp);
- $Contents = str_replace('HTTP/1.0 200 OK','', $Contents);
- $Contents = str_replace('Content-Type:text/xml','', $Contents);
- $Contents = str_replace("\n",'', $Contents);
- $Contents = str_replace("\r",'', $Contents);
- $Contents = preg_replace('/(&|&)/i', '&', $Contents);
- $Contents = preg_replace('/[^\x20-\x7E\x09\x0A\x0D]/', "\n", $Contents);
- $Data = array();
- // Initialize the parser.
- $Parser = xml_parser_create('ISO-8859-1');
- xml_set_element_handler($Parser, 'StartHandler', 'EndHandler');
- xml_set_character_data_handler($Parser, 'CharacterHandler');
- //Pass the content string to the parser.
- if (!xml_parse($Parser, $Contents)) {
- $Probs[] = "<img src=images/radio_offline.gif ";
- }
- if (isset($Probs)) {
- echo implode("\n", $Probs);
- }
- //Output
- $listeners['AVERAGETIME'] = $listeners[AVERAGETIME]/10;
- $wee = $wee -1;
- $search = 'balu';
- $replace = '<IMG SRC="dj-bilder/balu.jpg" width="100" height="73" BORDER="0"></A><br>';
- echo str_replace($search, $replace, "
- <tr><td></td><td>{$dj[AIM]}</td></tr>\n
- ");
- $search = 'playlist';
- $replace = '<IMG SRC="dj-bilder/playlist.jpg" width="100" height="73" BORDER="0"></A><br>';
- echo str_replace($search, $replace, "
- <tr><td></td><td>{$dj[AIM]}</td></tr>\n
- ");
- $search = 'alex_kola@hotmail.de';
- $replace = '<IMG SRC="dj-bilder/kola.jpg" width="100" height="73" BORDER="0"></A><br>';
- echo str_replace($search, $replace, "
- <tr><td></td><td>{$dj[AIM]}</td></tr>\n
- ");
- $search = 'NA';
- $replace = '<IMG SRC="dj-bilder/off.jpg" width="100" height="73" BORDER="0"></A><br>';
- echo str_replace($search, $replace, "
- <tr><td></td><td>{$dj[AIM]}</td></tr>\n
- ");
- ?>;
- <html>
- <table border="0" width="18%">
- <tr>
- <td width="44">
- <p align="center"><a href="http://party-radio.net:1212/listen.pls">
- <img border="0" src="./winamp-Icon.gif" width="44" height="41"></a></td>
- <td width="45">
- <p align="center"><a href="http://party-radio.net/media2.m3u">
- <img border="0" src="./mplayer.jpg" width="42" height="43"></a></td>
- <td>
- <p align="center"><a href="http://party-radio.net/live2.ram">
- <img border="0" src="./icon_real.gif" width="44" height="44"></a></td>
- </tr>
- </table>
- </html>