prosím kontrola php+html
Napsal: 16 bře 2010 11:41
caute kluci delam radiovou statistiku a zimchal sem podivne html + php a ted mam s toho hlavu jako slon, porad mi to nejak nejde. Posílám sem kod ze by nekdo mohl pomoci diky.
[php]<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2008 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: status.php
| Author: Best4you
+--------------------------------------------------------+
| Best4you
| Best4you
+--------------------------------------------------------*/
include('server.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", "ICQ", "BITRATE", "SERVERTITLE", "CURRENTLISTENERS", "MAXLISTENERS", "IRC", "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);
//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++;
}
fclose($scfp);
}
if($streamstatus == "1"){
echo'
<html>
<head>
<script type="text/javascript" language="JavaScript">
<!--
function nastav_rozmery()
{
window.resizeTo(510,720);
}
//--></script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Best4you rádio</title>
<style type="text/css">
<!--
body, html {
margin:0;
padding:0;
border:0;
}
.hlavni {
height: 600px;
width: 500px;
background-repeat: no-repeat;
background-position: 0px 0px;
background-attachment: fixed;
}
#moderator {
position: relative;
top: 10px;
}
#Layer1 {
position:absolute;
left:52px;
top:83px;
width:234px;
height:38px;
z-index:1;
font-family: "comic Sans MS";
font-size: 16px;
font-style: italic;
color: #FFFFFF;
}
#Layer2 {
position:absolute;
left:25px;
top:149px;
width:218px;
height:35px;
z-index:2;
font-family: "comic Sans MS";
font-size: 16px;
font-style: italic;
color: #FFFFFF;
}
#Layer3 {
position:absolute;
left:220px;
top:164px;
width:146px;
height:52px;
z-index:3;
font-family: "comic Sans MS";
font-size: 30px;
font-style: oblique;
color: #FFFFFF;
}
#Layer4 {
position:absolute;
left:205px;
top:274px;
width:128px;
height:40px;
z-index:4;
}
#Layer5 {
position:absolute;
left:32px;
top:485px;
width:349px;
height:208px;
z-index:4;
}
#Layer6 {
position:absolute;
left:22px;
top:204px;
width:93px;
height:30px;
z-index:5;
}
#Layer7 {
position:absolute;
left:24px;
top:202px;
width:111px;
height:49px;
z-index:5;
}
.obr {
height: 600px;
width: 500px;
background-repeat: no-repeat;
background-position: left bottom;
}
#Layer8 {
position:absolute;
left:24px;
top:259px;
width:101px;
height:38px;
z-index:5;
;
}
#Layer9 {
position:absolute;
left:40px;
top:361px;
width:228px;
height:49px;
z-index:6;
}
#Layer10 {
position:absolute;
left:100px;
top:488px;
width:146px;
height:32px;
z-index:7;
}
#Layer11 {
position:absolute;
left:355px;
top:69px;
width:113px;
height:61px;
z-index:8;
}
#Layer12 {
position:absolute;
left:36px;
top:464px;
width:435px;
height:106px;
z-index:9;
}
#Layer13 {
position:absolute;
left:45px;
top:435px;
width:403px;
height:229px;
z-index:9;
}
#Layer14 {
position:absolute;
left:19px;
top:466px;
width:465px;
height:24px;
z-index:9;
}
#Layer15 {
position:absolute;
left:1px;
top:564px;
width:344px;
height:40px;
z-index:10;
}
#Layer16 {
position:absolute;
left:24px;
top:17px;
width:475px;
height:8929px;
z-index:11;
}
#Layer17 {
position:absolute;
left:339px;
top:488px;
width:139px;
height:33px;
z-index:11;
}
#Layer18 {
position:absolute;
left:394px;
top:539px;
width:97px;
height:49px;
z-index:12;
}
.styl1 {
font-size: 14px;
font-weight: bold;
}
-->
</style>
</html>
<body onLoad="nastav_rozmery();">
<div id="Layer1">
<td><div style="color:#ffffff; font-size:11px; font-family:Verdana;"> <HTML>
<meta http-equiv="Pragma" content="no-cache"></head><body>'.$irc.'</td></div>
<div id="Layer2"><td><div style="color:#ffffff; font-size:11px; font-family:Verdana;"> <strong></strong> <HTML><meta http-equiv="Pragma" content="no-cache"></head><body>'.$song[0].'</td></div>
<div id="Layer3">
<td><div style="color:#ffffff; font-size:11px; font-family:Verdana;"> <strong></strong> <HTML><meta http-equiv="Pragma" content="no-cache"></head><body>'.$currentlisteners.'/'.$maxlisteners.'</td></div>
<div id="Layer8"><a href ="http://www.facebook.com/home.php?#!/profile.php?ref=profile&id=1295690655" target="_blank" border="0"><img src="http://www.nhl.NEZADOUCÍ_REKLAMA.cz/logo_facebook.png"border 0></a></div>
<div id="Layer9">
<embed src="jeste neniodkaz/" type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/Downoloads/Contents/Products/Media" name="Media Player"
transparentatstart="1" autostart="1" animationatstart="0" showcontrols="false" showaudiocontrols="1" showpositioncontrols="0" autosize="0" showstatusbar="0" volume="-100" displaysize="false" align="center" border="0" height="43" width="227"></embed>
</div>
<div id="Layer10">
<td><div style="color:#ffffff; font-size:14px; font-family:Verdana;">
<strong>596-824-991</strong></div></td></div>
<div class="styl1" id="Layer17">
<td><div style="color:#ffffff; font-size:16px; font-family:Verdana;"> <a href="mailto:SchmiederP@seznam.cz">Best@</a></div></td></div>
<div class="hlavni"><img src="http://www.nhl.NEZADOUCÍ_REKLAMA.cz/RADIOSTATS2.png" border="0" align="left" usemap="#Map" />
<map name="Map" id="Map"><area shape="rect" coords="38,521,471,563" href="http://www.radio.best4you.sk" target="_blank"border 0 />
</map></div>
<a href="http://www.netagent.cz"><script language="JavaScript" type="text/javascript">
<!--
document.write ('<a href="http://www.netagent.cz" target="_top"><img src="http://www.netagent.cz/agent.php?id=35417&ur='+escape(document.referrer)+'&rw='+escape(window.screen.width)+'&rh='+escape(window.screen.height)+'&cd='+escape(window.screen.colorDepth)+'&pt='+escape(document.title)+'&lc='+escape(document.location)+'" width="1" height="1" border="0" alt="netAgent" /></a>');
//--></script></a><noscript><a href="http://www.netagent.cz" target="_top"><img src="http://www.netagent.cz/agent.php?id=35417" border="0" alt="netAgent" width="1" height="1" /></a></noscript>
</body>
</html>
[/php]
[php]<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2008 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: status.php
| Author: Best4you
+--------------------------------------------------------+
| Best4you
| Best4you
+--------------------------------------------------------*/
include('server.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", "ICQ", "BITRATE", "SERVERTITLE", "CURRENTLISTENERS", "MAXLISTENERS", "IRC", "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);
//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++;
}
fclose($scfp);
}
if($streamstatus == "1"){
echo'
<html>
<head>
<script type="text/javascript" language="JavaScript">
<!--
function nastav_rozmery()
{
window.resizeTo(510,720);
}
//--></script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Best4you rádio</title>
<style type="text/css">
<!--
body, html {
margin:0;
padding:0;
border:0;
}
.hlavni {
height: 600px;
width: 500px;
background-repeat: no-repeat;
background-position: 0px 0px;
background-attachment: fixed;
}
#moderator {
position: relative;
top: 10px;
}
#Layer1 {
position:absolute;
left:52px;
top:83px;
width:234px;
height:38px;
z-index:1;
font-family: "comic Sans MS";
font-size: 16px;
font-style: italic;
color: #FFFFFF;
}
#Layer2 {
position:absolute;
left:25px;
top:149px;
width:218px;
height:35px;
z-index:2;
font-family: "comic Sans MS";
font-size: 16px;
font-style: italic;
color: #FFFFFF;
}
#Layer3 {
position:absolute;
left:220px;
top:164px;
width:146px;
height:52px;
z-index:3;
font-family: "comic Sans MS";
font-size: 30px;
font-style: oblique;
color: #FFFFFF;
}
#Layer4 {
position:absolute;
left:205px;
top:274px;
width:128px;
height:40px;
z-index:4;
}
#Layer5 {
position:absolute;
left:32px;
top:485px;
width:349px;
height:208px;
z-index:4;
}
#Layer6 {
position:absolute;
left:22px;
top:204px;
width:93px;
height:30px;
z-index:5;
}
#Layer7 {
position:absolute;
left:24px;
top:202px;
width:111px;
height:49px;
z-index:5;
}
.obr {
height: 600px;
width: 500px;
background-repeat: no-repeat;
background-position: left bottom;
}
#Layer8 {
position:absolute;
left:24px;
top:259px;
width:101px;
height:38px;
z-index:5;
;
}
#Layer9 {
position:absolute;
left:40px;
top:361px;
width:228px;
height:49px;
z-index:6;
}
#Layer10 {
position:absolute;
left:100px;
top:488px;
width:146px;
height:32px;
z-index:7;
}
#Layer11 {
position:absolute;
left:355px;
top:69px;
width:113px;
height:61px;
z-index:8;
}
#Layer12 {
position:absolute;
left:36px;
top:464px;
width:435px;
height:106px;
z-index:9;
}
#Layer13 {
position:absolute;
left:45px;
top:435px;
width:403px;
height:229px;
z-index:9;
}
#Layer14 {
position:absolute;
left:19px;
top:466px;
width:465px;
height:24px;
z-index:9;
}
#Layer15 {
position:absolute;
left:1px;
top:564px;
width:344px;
height:40px;
z-index:10;
}
#Layer16 {
position:absolute;
left:24px;
top:17px;
width:475px;
height:8929px;
z-index:11;
}
#Layer17 {
position:absolute;
left:339px;
top:488px;
width:139px;
height:33px;
z-index:11;
}
#Layer18 {
position:absolute;
left:394px;
top:539px;
width:97px;
height:49px;
z-index:12;
}
.styl1 {
font-size: 14px;
font-weight: bold;
}
-->
</style>
</html>
<body onLoad="nastav_rozmery();">
<div id="Layer1">
<td><div style="color:#ffffff; font-size:11px; font-family:Verdana;"> <HTML>
<meta http-equiv="Pragma" content="no-cache"></head><body>'.$irc.'</td></div>
<div id="Layer2"><td><div style="color:#ffffff; font-size:11px; font-family:Verdana;"> <strong></strong> <HTML><meta http-equiv="Pragma" content="no-cache"></head><body>'.$song[0].'</td></div>
<div id="Layer3">
<td><div style="color:#ffffff; font-size:11px; font-family:Verdana;"> <strong></strong> <HTML><meta http-equiv="Pragma" content="no-cache"></head><body>'.$currentlisteners.'/'.$maxlisteners.'</td></div>
<div id="Layer8"><a href ="http://www.facebook.com/home.php?#!/profile.php?ref=profile&id=1295690655" target="_blank" border="0"><img src="http://www.nhl.NEZADOUCÍ_REKLAMA.cz/logo_facebook.png"border 0></a></div>
<div id="Layer9">
<embed src="jeste neniodkaz/" type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/Downoloads/Contents/Products/Media" name="Media Player"
transparentatstart="1" autostart="1" animationatstart="0" showcontrols="false" showaudiocontrols="1" showpositioncontrols="0" autosize="0" showstatusbar="0" volume="-100" displaysize="false" align="center" border="0" height="43" width="227"></embed>
</div>
<div id="Layer10">
<td><div style="color:#ffffff; font-size:14px; font-family:Verdana;">
<strong>596-824-991</strong></div></td></div>
<div class="styl1" id="Layer17">
<td><div style="color:#ffffff; font-size:16px; font-family:Verdana;"> <a href="mailto:SchmiederP@seznam.cz">Best@</a></div></td></div>
<div class="hlavni"><img src="http://www.nhl.NEZADOUCÍ_REKLAMA.cz/RADIOSTATS2.png" border="0" align="left" usemap="#Map" />
<map name="Map" id="Map"><area shape="rect" coords="38,521,471,563" href="http://www.radio.best4you.sk" target="_blank"border 0 />
</map></div>
<a href="http://www.netagent.cz"><script language="JavaScript" type="text/javascript">
<!--
document.write ('<a href="http://www.netagent.cz" target="_top"><img src="http://www.netagent.cz/agent.php?id=35417&ur='+escape(document.referrer)+'&rw='+escape(window.screen.width)+'&rh='+escape(window.screen.height)+'&cd='+escape(window.screen.colorDepth)+'&pt='+escape(document.title)+'&lc='+escape(document.location)+'" width="1" height="1" border="0" alt="netAgent" /></a>');
//--></script></a><noscript><a href="http://www.netagent.cz" target="_top"><img src="http://www.netagent.cz/agent.php?id=35417" border="0" alt="netAgent" width="1" height="1" /></a></noscript>
</body>
</html>
[/php]