26 Kwiecień 2024, 22:41:44

Autor Wątek: Generator stat shoutcast  (Przeczytany 3873 razy)

matt94

  • Grafik
  • Radiowiec
  • *****
  • Wiadomości: 50
    • Status GG
    • www.WebGrafa.pl
Generator stat shoutcast
« dnia: 22 Marzec 2012, 20:54:49 »
Witam jak mogę zrobić generator stat shoutcast chodzi mi o kod php ??

Oto kod statystyk shoutcast
Żeby wygenerować staty musze edytować plik jak to zrobić w php żebym miał dwa pola IP i Port i żeby mi zapisało to pliku cofing.php


<? include('../../cofing/cofing.php'); ?>
<?php
   $sc
[table1]   =   "<b>[dj][status]</b>";
   
$sc[table2]   =   "<b>[audycja][status]</b>";
   
$sc[table3]   =   "<b>[nuta][status]</b>";
   
$sc[table4]   =   "<b>[ile]/$konfrekord</b>";

if(
$fp fsockopen($konfip $konfport))
{
fputs($fp,"GET /index.html HTTP/1.0\r\nUser-Agent: XML Getter (Mozilla Compatible)\r\n\r\n");
fgets($fp);fgets($fp);fgets($fp);
       while(!
feof($fp)) $in.=strip_tags(fgets($fp));
fclose($fp);
  
# echo $in;

//  [status]
   
$m[0]="Server is currently";
   
$m[1]="";
   
$mp[0]=strpos($in,$m[0]);
   
$mp[1]=@strpos($in,$m[1]);
   
$ml[0]=strlen($m[0]);
   
$ml[1]=strlen($m[1]);

   
$tmp[1]=explode" " trimsubstr$in $mp[0] + $ml[0] , ) ) );

   if( 
$tmp[1][0] == "up" )
       
$dat[status] = "";
   elseif( 
$tmp[1][0] == "down" )
       
$dat[status] = "Aktualnie nie nadajemy";
   else
       
$dat[status] = "Uzupełnij poprawnie SHOUTcast";

   if(
$dat[status]=="")
   {

 
//  [audycja]
       
$m[0]="Stream Title:";
       
$m[1]="Content Type:";
       
$mp[0]=strpos($in,$m[0]);
       
$mp[1]=strpos($in,$m[1]);
       
$ml[0]=strlen($m[0]);
       
$ml[1]=strlen($m[1]);

       
$tmp[1]=trimsubstr$in $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1] ) );

       if( 
$tmp[1] ) $dat[audycja] = $tmp[1];
       else 
$dat[audycja] = "Uzupełnij poprawnie SHOUTcast";

   
//  [dj]
       
$m[0]="Stream Genre:";
       
$m[1]="Stream URL:";
       
$mp[0]=strpos($in,$m[0]);
       
$mp[1]=strpos($in,$m[1]);
       
$ml[0]=strlen($m[0]);
       
$ml[1]=strlen($m[1]);

       
$tmp[1]=trimsubstr$in $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1]-) );

       if( 
$tmp[1] ) $dat[dj] = $tmp[1];
       else 
$dat[dj] = "Uzupełnij poprawnie SHOUTcast";

   
//  [statyw]
       
$m[0]="Stream AIM:";
       
$m[1]="Stream IRC:";
       
$mp[0]=strpos($in,$m[0]);
       
$mp[1]=strpos($in,$m[1]);
       
$ml[0]=strlen($m[0]);
       
$ml[1]=strlen($m[1]);

       
$tmp[1]=trimsubstr$in $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1] ) );

       if( 
$tmp[1] ) $dat[statyw] = $tmp[1];
       else 
$dat[statyw] = "autopilot";

   
//  [gg]
       
$m[0]="Stream ICQ:";
       
$m[1]="Stream AIM:";
       
$mp[0]=strpos($in,$m[0]);
       
$mp[1]=strpos($in,$m[1]);
       
$ml[0]=strlen($m[0]);
       
$ml[1]=strlen($m[1]);

       
$tmp[1]=trimsubstr$in $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1] ) );

       if( 
$tmp[1] ) $dat[gg] = $tmp[1];
       else 
$dat[gg] = "Uzupełnij poprawnie SHOUTcast";

   
//  [ile]
       
$m[0]="kbps with";
       
$m[1]="listeners";
       
$mp[0]=strpos($in,$m[0]);
       
$mp[1]=strpos($in,$m[1]);
       
$ml[0]=strlen($m[0]);
       
$ml[1]=strlen($m[1]);

       
$tmp[1]=explode" " trimsubstr$in $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1]-) ) );

       if( 
$tmp[1] ) $dat[ile] = $tmp[1][0];
       else 
$dat[ile] = "Uzupełnij poprawnie SHOUTcast";

     
//  [peak]
       
$m[0]="Listener Peak:";
       
$m[1]="Average";
       
$mp[0]=strpos($in,$m[0]);
       
$mp[1]=strpos($in,$m[1]);
       
$ml[0]=strlen($m[0]);
       
$ml[1]=strlen($m[1]);

       
$tmp[1]=trimsubstr$in $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1]-7) );

       if( 
$tmp[1] ) $dat[peak] = $tmp[1];
       else 
$dat[peak] = "Uzupełnij poprawnie SHOUTcast";

 
//  [nuta]
       
$m[0]="Current Song:";
       
$m[1]="Written by Ste";
       
$mp[0]=strpos($in,$m[0]);
       
$mp[1]=strpos($in,$m[1]);
       
$ml[0]=strlen($m[0]);
       
$ml[1]=strlen($m[1]);

       
$tmp[1]=trimsubstr$in $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1] ) );

       if( 
$tmp[1] ) $dat[nuta] = $tmp[1];
       else 
$dat[nuta] = "Uzupełnij poprawnie SHOUTcast";

   }
}
else
{
   
$dat=array();
   
$dat[status]="err";
}

$co             =   array(&#39;[status]&#39;,&#39;[audycja]&#39;,&#39;[dj]&#39;,&#39;[statyw]&#39;,&#39;[gg]&#39;,&#39;[ile]&#39;,&#39;[peak]&#39;,&#39;[nuta]&#39;);
$naco           =   array($dat[status],$dat[audycja],$dat[dj],$dat[statyw],$dat[gg],$dat[ile],$dat[peak],$dat[nuta]);
$sc[table1]   =   str_replace($co,$naco,$sc[table1]);
$sc[table2]   =   str_replace($co,$naco,$sc[table2]);
$sc[table3]   =   str_replace($co,$naco,$sc[table3]);
$sc[table4]   =   str_replace($co,$naco,$sc[table4]);
?>

<html>
<head>
<title>Statyw by Novik</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-2" />
<meta http-equiv="Refresh" Content="<? echo $sc[czas]; ?>; URL="index.php">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body>
<!--Szanij prawa autorskie-->
<!--Statyw radiowy by Novik, www.e-wszystko.net-->
<div class="sluchaj">
<a href="http://<? echo $konfip; ?>:<? echo $konfport; ?>/listen.pls" target="_blank">
<img src="images/sluchaj.gif" alt="SŁUCHAJ" border="0" /></a>
</div>
<div class="fotka">
<img src="../../fotos/<? echo $dat[statyw]; ?>.gif" width="128" height="96">
</div>
<table cellspacing="0" cellpadding="0" background="images/panel.jpg" border="0" width="400">
<tr>
<td valign="top" height="16"></td>
</tr>
<tr>
<td width="49">&nbsp;</td>
<td width="149"><marquee behavior="alternate" width="149" scrolldelay="125"><? echo $sc[table1]; ?></MARQUEE></td>
</tr>
<tr>
<td valign="top" height="14">
</tr>
<tr>
<td width="49">&nbsp;</td>
<td width="149"><MARQUEE Scrollamount=3 width="149"><? echo $sc[table2]; ?></MARQUEE></td>
</tr>
<tr>
<td valign="top" height="13">
</tr>
<tr>
<td width="49">&nbsp;</td>
<td width="149"><MARQUEE Scrollamount=3 width="149"><? echo $sc[table3]; ?></MARQUEE></td>
</tr>
<tr>
<td valign="top" height="12">
</tr>
<tr>
<td width="49">&nbsp;</td>
<td width="149">&nbsp;<? echo $sc[table4]; ?></td>
</tr>
<tr>
<td valign="top" height="18">
</tr>
</table>
</body>
</html>
« Ostatnia zmiana: 22 Marzec 2012, 21:25:20 wysłana przez karol »