Przejdź do treści
 

Pomoc Przy Statystykach

Zaczęty przez soundmix, 14 Kwiecień 2012, 18:33:07

Poprzedni wątek - Następny wątek

soundmix

Witajcie mam taki problem mam statystyki i chciałbym podpiąć pod fotkę wyświetlanie pola z
Stream URL czy jest to możliwe ? i jakim kodem poniżej zamieszczam statystyki

<?php
   
//Dane serwera
   
$sc[czas]="600";
   
$sc[ip]="sc5.24cast.pl"; //IP serwera do zmiany!
   
$sc[port]="7032"; //Port serwera do zmiany!
   
   //Dane statystyk
   
$sc[table1]="[prezenter][status]";
   
$sc[table2]="[audycja][status]";
   
$sc[table3]="[nuta][status]";
   
$sc[table4]="[ile][status]";
   
$sc[table5]="[nuta]";

   if(
$fp = fsockopen($sc[ip] , $sc[port]))
{
       
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);

   
// Funkcja [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( " " , trim( substr( $in , $mp[0] + $ml[0] , 5 ) ) );

   if(
$tmp[1][0] == "up" )
       
$dat[status] = "";
   elseif(
$tmp[1][0] == "down" )
       
$dat[status] = "Aktualnie nie nadajemy!";
   else
       
$dat[status] = "Nie prawidłowe dane!";
   
   if(
$dat[status]=="")
   {

   
// Funkcja [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]=trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1] ) );
   
   if(
$tmp[1] ) $dat[audycja] = $tmp[1];
       else
$dat[audycja] = "Nie prawidłowe dane!";

 
// Funkcja [prezenter]
   
$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]=trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1]-2 ) );

   if(
$tmp[1] ) $dat[prezenter] = $tmp[1];
       else
$dat[prezenter] = "Nie prawidłowe dane!";

 
// Funkcja [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( " " , trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1]-2 ) ) );

   if(
$tmp[1] ) $dat[ile] = $tmp[1][0];
       else
$dat[ile] = "Nie prawidłowe dane!";

   
// Funkcja [nuta]
   
$m[0]="Current Song:";
   
$m[0]="Stream URL:";
   
$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]=trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1] ) );

   if(
$tmp[1] ) $dat[nuta] = $tmp[1];
       else
$dat[nuta] = "Nie prawidłowe dane!";

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

   
$co=array('[status]','[audycja]','[prezenter]','[ile]','[nuta]');
   
$naco=array($dat[status],$dat[audycja],$dat[prezenter],$dat[ile],$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]);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl">
    <head>
        <meta http-equiv="content-type" content="text/html; charset=iso-8859-2" />
        <meta http-equiv="content-language" content="pl" />
        <title>Statystyki Shoutcast by Rootkor Ver. 1.0 (Grey)</title>
        <link rel="stylesheet" href="style.css" type="text/css" />






            <div id="foto">
                <img src='http://soundmix.xaa.pl/soundmix/kanalc.png'  align="left" height="132" />
                <a   href="<? echo $dat[nuta]; ?>" ><img src="djs/<? echo $dat[prezenter]; ?>.png"  style="   
border:solid 1px #696969;
-moz-box-shadow: 4px 2px 3px #999;
    -webkit-box-shadow: 4px 2px 3px #999;
        box-shadow: 4px 2px 3px #999;"width="123" height="125" />
            </div>


</div>
        </div>

    </body>
</html>


chce że jak kliknie sie w zdjęcie to odnosi się do tego linku który jest podany w polu Stream URL SHOUTCAST
przykładowo : http://s2.eradia.net:7058/

Karol

Skorzystaj z tej klasy: http://www.4stream.pl/forum/index.php?topic=1053.0

Użyć możesz tak:

echo '<a href="' . $statystyki -> show('STREAMURL') . '">nazwa linka</a>';

soundmix

#2
Podlinkowałem zdjęcie lecz nie działa

http://sound-mix.pl/soundmix/statystykiclub/staty2.php




<?php
//Dane serwera
$sc[czas]="600";
$sc[ip]="sc5.24cast.pl"; //IP serwera do zmiany!
$sc[port]="7032"; //Port serwera do zmiany!

//Dane statystyk
$sc[table1]="[prezenter][status]";
$sc[table2]="[audycja][status]";
$sc[table3]="[nuta][status]";
$sc[table4]="[ile][status]";
$sc[table5]="[nuta]";

if($fp = fsockopen($sc[ip] , $sc[port]))
{
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);

// Funkcja [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( " " , trim( substr( $in , $mp[0] + $ml[0] , 5 ) ) );

if( $tmp[1][0] == "up" )
$dat[status] = "";
elseif( $tmp[1][0] == "down" )
$dat[status] = "Aktualnie nie nadajemy!";
else
$dat[status] = "Nie prawidłowe dane!";

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

// Funkcja [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]=trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1] ) );

if( $tmp[1] ) $dat[audycja] = $tmp[1];
else $dat[audycja] = "Nie prawidłowe dane!";

 
// Funkcja [prezenter]
$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]=trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1]-2 ) );

if( $tmp[1] ) $dat[prezenter] = $tmp[1];
else $dat[prezenter] = "Nie prawidłowe dane!";

 
// Funkcja [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( " " , trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1]-2 ) ) );

if( $tmp[1] ) $dat[ile] = $tmp[1][0];
else $dat[ile] = "Nie prawidłowe dane!";

// Funkcja [nuta]
$m[0]="Current Song:";
$m[0]="Stream URL:";
$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]=trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1] ) );

if( $tmp[1] ) $dat[nuta] = $tmp[1];
else $dat[nuta] = "Nie prawidłowe dane!";

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

$co=array('[status]','[audycja]','[prezenter]','[ile]','[nuta]');
$naco=array($dat[status],$dat[audycja],$dat[prezenter],$dat[ile],$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]);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-2" />
<meta http-equiv="content-language" content="pl" />
<title>Statystyki Shoutcast by Rootkor Ver. 1.0 (Grey)</title>
<link rel="stylesheet" href="style.css" type="text/css" />



<link rel="stylesheet" href="http://soundmix.xaa.pl/soundmix/colorbox.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="http://soundmix.xaa.pl/soundmix/jquery.colorbox.js"></script>
<script>
$(document).ready(function(){
//Examples of how to assign the ColorBox event to elements
$(".group1").colorbox({rel:'group1'});
$(".group2").colorbox({rel:'group2', transition:"fade"});
$(".group3").colorbox({rel:'group3', transition:"none", width:"75%", height:"75%"});
$(".group4").colorbox({rel:'group4', slideshow:true});
$(".ajax").colorbox();
$(".youtube").colorbox({iframe:true, innerWidth:425, innerHeight:344});
$(".iframe").colorbox({iframe:true, width:"80%", height:"80%"});
$(".inline").colorbox({inline:true, width:"50%"});
$(".callbacks").colorbox({
onOpen:function(){ alert('onOpen: colorbox is about to open'); },
onLoad:function(){ alert('onLoad: colorbox has started to load the targeted content'); },
onComplete:function(){ alert('onComplete: colorbox has displayed the loaded content'); },
onCleanup:function(){ alert('onCleanup: colorbox has begun the close process'); },
onClosed:function(){ alert('onClosed: colorbox has completely closed'); }
});

//Example of preserving a JavaScript event for inline calls.
$("#click").click(function(){
$('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
return false;
});
});
</script>



<style>
/*  */

#tooltip{
position:absolute;
border:1px solid #929292;
background:#f7f5d1;
padding:4px 5px;

display:none;
font-size: 10pt;
color: black;
}

/*  */
</style>

<script type="text/javascript">
    var GB_ROOT_DIR = "http://sound-mix.pl/soundmix/greybox/";
</script>

<script type="text/javascript' src="greybox/AJS.js"></script>
<script type="text/javascript' src="greybox/AJS_fx.js"></script>
<script type="text/javascript' src="greybox/gb_scripts.js"></script>
<link href="greybox/gb_styles.css" rel="stylesheet" type="text/css" />



</head>
<body>
<div id="staty">

<div id="gra">
<font face="Verdana"><font color="#696969">Gra:</font> </font>
<BR>
<b><? echo $sc[table1]; ?></b>
</div>
<div id="audycja">
<font face="Verdana"><font color="#696969">Audycja: </font></font> 
<BR>
<marquee behavior="scroll" width="240" scrollamount="3" scrolldelay="60"><b><? echo $sc[table2]; ?></b></marquee>
</div>

</div>

<div id="winamp">
<a  href="http://sound-mix.pl/playclub.m3u" onMouseOver='rollover.src="http://soundmix.xaa.pl/soundmix/winamp2.png"' onMouseOut='rollover.src="http://soundmix.xaa.pl/soundmix/winamp.png"' ><img src="http://soundmix.xaa.pl/soundmix/winamp.png" name="rollover"  width="50" height="50" border="0"></a>



</div>
<div id="wmp">
<a  href="http://sound-mix.pl/playclub.m3u" onMouseOver='rollover2.src="http://soundmix.xaa.pl/soundmix/wmp2.png"' onMouseOut='rollover2.src="http://soundmix.xaa.pl/soundmix/wmp.png"'><img src="http://soundmix.xaa.pl/soundmix/wmp.png" name="rollover2"  width="50" height="50" border="0"></a>
</div>

<div id="pozdrowienia">




<a   href="#"  onclick="window.open('http://www.mixsound.panelradiowy.pl/embed.php?script=pozdrowienia','','scrollbars=yes, toolbar=no, menubar=no, location=no, personalbar=no, resizable=no, directories=no, status=no, width=440, height=470')"  ><button class="minimal"> <img src='http://soundmix.xaa.pl/soundmix/arrow.png' width='12' height='12'  border="0" align='left'> Pozdrowienia</button></a>





</div>

<div id="ramowka">
<a   href="#"  onclick="window.open('http://www.mixsound.panelradiowy.pl/embed.php?script=ramowka','','scrollbars=yes, toolbar=no, menubar=no, location=no, personalbar=no, resizable=no, directories=no, status=no, width=440, height=470')"  ><button class="minimal"> <img src='http://soundmix.xaa.pl/soundmix/arrow.png' width='12' height='12'  border="0" align='left'> Ramówka</button></a>


</div>







<div id="foto">
<img src='http://soundmix.xaa.pl/soundmix/kanalc.png'  align="left" height="132" />
echo '<a href="' . $statystyki -> show('STREAMURL') . '"><img src="djs/<? echo $dat[prezenter]; ?>.png"  style="
border:solid 1px #696969;
-moz-box-shadow: 4px 2px 3px #999;
-webkit-box-shadow: 4px 2px 3px #999;
        box-shadow: 4px 2px 3px #999;"width="123" height="125" />
</div>';

<div id="player">
<object type="application/x-shockwave-flash" data="http://www.mixsound.panelradiowy.pl/player.swf" id="audioplayer" height="22" width="340">
<param name="movie" value="http://www.mixsound.panelradiowy.pl/player.swf">
<param name="FlashVars" value="playerID=1&soundFile=http://sc5.24cast.pl:7032/;&titles=Sound-MiX - Kanał Club - <? echo $sc[table1]; ?>&buffer=0&rightbg=696969&lefticon=A9A9A9&righticon=A9A9A9&loader=000080&leftbg=696969&track=A9A9A9&bg=A9A9A9&rightbghover=696969&tracker=A9A9A9&autostart=no&animation=no&playerID=panelradiowy.pl&initialvolume=60">
<param name="quality" value="high">
<param name="menu" value="false">
<param name="wmode" value="transparent">
</object>
</div>
</div>

</body>
</html>



tutaj mają coś takiego ;)

http://pulsstacja.fm/staty_black2/glowny.php

Karol

Bo nigdzie nie tworzych obiektu klasy ShoutCast. Zmienna $statystyki nie istnieje. W kodzie tym co Ci wysłałem na dole masz przykład użycia tego skryptu. Zrób wszystko co zostało tam opisane.

I nie kopiuj tego bezmyślnie bo też nie zadziała. Przeczytaj na spokojnie i rób krok po kroku.

soundmix

a na gotowca bym liczyć nie mógł ?

Karol

Aż tak trudno przeczytać parę linijek komentarzy?

<?php
include_once('shoutcast.php');

$statystyki = new SHOUTcast();
if( !
$statystyki -> connect('127.0.0.1', 'port', 'haslo'))
 echo
'Serwer jest wyłączony';
// Jesli skrypt uzyska polaczenie z serwerem
else {

echo '<a href="' . $statystyki -> show('SERVERURL') . '">' . $statystyki -> show('SERVERURL') . '</a>';

}
$statystyki -> free_result();
?>