PHP SQL Probleem

PHP, HTML, Joomla, WordPress, etc..
Evertje

Re: PHP SQL Probleem

Ongelezen bericht door Evertje »

Dan zou ik ook graag status.php willen zien :-D
Gebruikersavatar
Wout
Beheerder
Berichten: 3501
Lid geworden op: 03 dec 2007, 14:17
SAM-versie: 2019.3
Database: MariaDB
Windows: 11
Locatie: West-Brabant
Contacteer:

Re: PHP SQL Probleem

Ongelezen bericht door Wout »

Status.php

Code: Selecteer alles

  <?php
// Shoutcast Server Stats
// Parses shoutcasts xml to make an effective stats thing for any website
// ©2004-2005 Daniel Brown http://www.gmtt.co.uk
// Please refer to the readme file for use.


// Add-On MAXLISTNERS insead of the / 10 MAXLISTENERS which was set, and the BITRATE add-on.
// Online and Offline graphics, and add-on code.
// Better HTML Script.

// Do Not Try To Edit This Only Unless You Know What You're Doing!!!!!!!

include('config.php');

$scfp = fsockopen("$scip", $scport, &$errno, &$errstr, 30);
 if(!$scfp) {
  $scsuccs=1;
echo''.$scdef.' is Offline'; 
 }
if($scsuccs!=1){
 fputs($scfp,"GET /admin.cgi?pass=$scpass&mode=viewxml HTTP/1.0\r\nUser-Agent: SHOUTcast Song Status (Mozilla Compatible)\r\n\r\n");
 while(!feof($scfp)) {
  $page .= fgets($scfp, 1000);
 }
######################################################################################################################
/////////////////////////part 1 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//define  xml elements
 $loop = array("STREAMSTATUS", "BITRATE", "SERVERTITLE", "CURRENTLISTENERS", "MAXLISTENERS", "BITRATE");
 $y=0;
 while($loop[$y]!=''){
  $pageed = ereg_replace(".*<$loop[$y]>", "", $page);
  $scphp = strtolower($loop[$y]);
  $$scphp = ereg_replace("</$loop[$y]>.*", "", $pageed);
  if($loop[$y]==SERVERGENRE || $loop[$y]==SERVERTITLE || $loop[$y]==SONGTITLE || $loop[$y]==SERVERTITLE)
   $$scphp = urldecode($$scphp);

// uncomment the next line to see all variables
//echo'$'.$scphp.' = '.$$scphp.'<br>';
  $y++;
 }
//end intro xml elements
######################################################################################################################
######################################################################################################################
/////////////////////////part 2\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//get song info and history
 $pageed = ereg_replace(".*<SONGHISTORY>", "", $page);
 $pageed = ereg_replace("<SONGHISTORY>.*", "", $pageed);
 $songatime = explode("<SONG>", $pageed);
 $r=1;
 while($songatime[$r]!=""){
  $t=$r-1;
  $playedat[$t] = ereg_replace(".*<PLAYEDAT>", "", $songatime[$r]);
  $playedat[$t] = ereg_replace("</PLAYEDAT>.*", "", $playedat[$t]);
  $song[$t] = ereg_replace(".*<TITLE>", "", $songatime[$r]);
  $song[$t] = ereg_replace("</TITLE>.*", "", $song[$t]);
  $song[$t] = urldecode($song[$t]);
  $dj[$t] = ereg_replace(".*<SERVERTITLE>", "", $page);
  $dj[$t] = ereg_replace("</SERVERTITLE>.*", "", $pageed);
$r++;
 }
//end song info
fclose($scfp);
}

//display stats
if($streamstatus == "1"){
//you may edit the html below, make sure to keep variable intact
echo'
<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<link rel=stylesheet href="" type="text/css">
</head>
<p align="center"><center>
<img src="images/online.png"><br>
</body>

</html>';
}
if($streamstatus == "0")
{
//you may edit the html below, make sure to keep variable intact
echo'
<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<link rel=stylesheet href="" type="text/css">
</head>

<body text="" bgcolor="">
<center>
<img src="images/offline.png">
</body>

</html>';
}
?>
De verbeterde versie van status.php , met dank aan Evert.

Code: Selecteer alles

  <?php
// Shoutcast Server Stats
// Parses shoutcasts xml to make an effective stats thing for any website
// ©2004-2005 Daniel Brown http://www.gmtt.co.uk
// Please refer to the readme file for use.


// Add-On MAXLISTNERS insead of the / 10 MAXLISTENERS which was set, and the BITRATE add-on.
// Online and Offline graphics, and add-on code.
// Better HTML Script.

// Do Not Try To Edit This Only Unless You Know What You're Doing!!!!!!!

include('config.php');

?>
<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<link rel=stylesheet href="" type="text/css">
</head>
<p align="center"><center>
<?php if(isset($scip) && $scip != 'SHOUTCASTIP' && isset($scport) && $scport != 'SHOUTCASTPORT' && isset($scpass) && $scpass != 'ADMINPASS'){
    $fp = fsockopen($scip, $scport, &$errno, &$errstr, 30);
    fputs($fp,"GET /7.html HTTP/1.0\r\nUser-Agent: XML Getter (Mozilla Compatible)\r\n\r\n");
    while(!feof($fp)){
        $page = fgets($fp, 1000);
    }
    fclose($fp);
    $page = ereg_replace(".*<body>", "", $page);
    $page = ereg_replace("</body>.*", ",", $page);
    $shoutcast = explode(",",$page);
    if(isset($shoutcast[1])){
        if($shoutcast[1] == 1){
            echo'<img src="images/online.png"><br>';
        } else {
            echo'<img src="images/offline.png"><br>';
        }
    } else {
        echo'<img src="images/onbekend.png"><br>';
    }
} else {
    echo'<img src="images/onbekend.png"><br>';
}
?>
</body>

</html>
Je hebt niet voldoende permissies om de bijlagen van dit bericht te bekijken.
Afbeelding
Evertje

Re: PHP SQL Probleem

Ongelezen bericht door Evertje »

Code: Selecteer alles

//Online_offline config:
$scdef = "Jouw Message!";               
$scip = "SHOUTCASTIP";
$scport = "SHOUTCASTPORT";                  
$scpass = "ADMINPASS";
Dit hoort in je config te staan én config niet include in status.php!!

Dan werkt alles inclusief de status, getest door onze super mod wout.. :shock:
Plaats reactie
  • Vergelijkbare Onderwerpen
    Reacties
    Weergaves
    Laatste bericht