Mam 2 pliki:
form.php<?php
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Nazwa radia</title>
</head>
<body style="text-align:center">
<div style="width: 500px; margin: 0 auto;">
<form method="get" action="statystyki.php">
<div style="float: left; width:50%; height:30px"><p style="vertical-align:middle">Nazwa radia</p></div>
<div style="float: right; width: 50%; height: 30px;">
<input name="nazwaradia" type="text" style="width: 100%;margin-top: 4px;"/>
</div>
<div style="width: 500px;">
<div style="float: left; width:50%; height:30px"><p style="vertical-align:middle">
Adres IP</p></div>
<div style="float: right; width: 50%; height: 30px;">
<input name="adresip" type="text" style="width: 100%;margin-top: 4px;"/>
</div>
<div style="width: 500px;">
<div style="float: left; width:50%; height:30px"><p style="vertical-align:middle">
PORT</p></div>
<div style="float: right; width: 50%; height: 30px;" class="style1">
<input name="port" type="text" style="width: 48%; margin-top: 4px;" maxlength="6"/>
</div>
<div style="width: 500px;">
<div style="float: left; width:50%; height:30px"><p style="vertical-align:middle">
Styl statystyk</p></div>
<div style="float: right; width: 50%; height: 30px;">
</div>
<div style="width: 500px;">
<div style="float: left; width:50%; height:30px"><p style="vertical-align:middle">
Obraz1</p></div>
<div style="float: right; width: 50%; height: 30px;">
<input name="obraz" value="obraz1" type="radio" checked="checked" /></div>
<div style="width: 500px;">
<div style="float: left; width:50%; height:30px"><p style="vertical-align:middle">
Obraz2</p></div>
<div style="float: right; width: 50%; height: 30px;">
<input name="obraz" value="obraz2" type="radio" /></div>
<div style="width: 500px;" class="style1">
<div style="float: left; width:50%; height:30px">
<p style="vertical-align:middle" class="style2">
Obraz3</p></div>
<div style="float: right; width: 50%; height: 30px;" class="style2">
<input name="obraz" value="obraz3" type="radio" /></div>
<br />
<input type="submit" value="Wyślij!" />
</div>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</body>
</html>
?>
oraz
statystyki.php<?
$obraz = $_GET['obraz'];
$sc[ip] = ".'$_GET[adresip]'."; //Ip serwera shoutcast
$sc[port] = ".'$_GET[port]'."; //Port serwera shoutcast
$sc[czas] = "60"; //Czas odświeżania statywu
// Tutaj nic nie ruszać!
$sc[table1] = "<b>[dj]</b>";
$sc[table2] = "<b>[audycja]</b>";
$sc[table3] = "<b>[ile]</b>";
{
fputs($fp,"GET /index.html HTTP/1.0r\nUser-Agent: XML Getter (Mozilla Compatible)r\nr\n"); fgets($fp);fgets
($fp);fgets
($fp); # echo $in;
// [status]
$m[0]="Server is currently";
$m[1]="";
if( $tmp[1][0] == "up" )
$dat[status] = "";
elseif( $tmp[1][0] == "down" )
$dat[status] = "Aktualnie nie nadajemy";
else
$dat[status] = "Radio Party-Net Zapraszamy!!!";
if($dat[status]=="")
{
// [audycja]
$m[0]="Stream Title:";
$m[1]="Content Type:";
$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] = "Radio Party-Net Zapraszamy!!!";
// [dj]
$m[0]="Stream Genre:";
$m[1]="Stream URL:";
$tmp[1
]=trim( substr( $in , $mp[0
] + $ml[0
] , $mp[1
]-$mp[0
]-$ml[1
]-2
) );
if( $tmp[1] ) $dat[dj] = $tmp[1];
else $dat[dj] = "Radio Party-Net Zapraszamy!!!";
// [statyw]
$m[0]="Stream AIM:";
$m[1]="Stream IRC:";
$tmp[1
]=trim( substr( $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:";
$tmp[1
]=trim( substr( $in , $mp[0
] + $ml[0
] , $mp[1
]-$mp[0
]-$ml[1
] ) );
if( $tmp[1] ) $dat[gg] = $tmp[1];
else $dat[gg] = "Radio Party-Net Zapraszamy!!!";
// [ile]
$m[0]="kbps with";
$m[1]="listeners";
$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] = "Radio Party-Net Zapraszamy!!!";
// [peak]
$m[0]="Listener Peak:";
$m[1]="Average";
$tmp[1
]=trim( substr( $in , $mp[0
] + $ml[0
] , $mp[1
]-$mp[0
]-$ml[1
]-7
) );
if( $tmp[1] ) $dat[peak] = $tmp[1];
else $dat[peak] = "Radio Party-Net Zapraszamy!!!";
// [nuta]
$m[0]="Current Song:";
$m[1]="Written by Ste";
$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] = "Radio Party-Net Zapraszamy!!!";
}
}
else
{
$dat[status]="err";
}
$co = array('[status]','[audycja]','[dj]','[statyw]','[gg]','[ile]','[peak]','[nuta]'); $naco = array($dat[status
],$dat[audycja
],$dat[dj
],$dat[statyw
],$dat[gg
],$dat[ile
],$dat[peak
],$dat[nuta
]); ?>
<body style="text-align:center">
<div align="center" style="margin: 0 auto;">
<table border="0" style="margin: 0 auto;" cellpadding="0" cellspacing="0" bgcolor="#393939" background="
<? echo $obraz ?>.jpg">
<tr>
<td width="120" height="190" background="1.jpg">
<div style="position: absolute; width:89px; height: 15px; left: 586px; top: 56px;"><marquee>
<? echo $sc[table1
]; ?></marquee></div>
<div style="position: absolute; width:89px; height: 15px; left: 582px; top: 92px;"><marquee>
<? echo $sc[table2
]; ?></marquee></div>
<div style="position: absolute; width:54px; height: 20px; left: 622px; top: 126px;"><marquee>
<? echo $sc[table3
]; ?></marquee></div>
</td></tr></table>
</div>
</body>
Zadaniem tego ma być wstawianie na stronę statystyk shoutcast za pomocą iframe z mojej strony, nawet gdy nie mamy fopen.
Jednak skrypt nie działa prawidłowo.
Powinien wyświetlić dane, chociażby z :
http://sc2.supercast.pl:8510.
Adres musi być w "cudzysłowie".
Nie wiem, czy na cba jest fopen, ale nie ma błędu, więc sądzę że jest.
Proszę nie pisać w sprawie walidacji kodu, tym zajmę się gdy zrobię skrypt.
Z góry thx.
PS: Pomógł `rozdaje` zawsze, kiedy rozwiąże CAŁY problem.
Ten post edytował marian2299 29.07.2009, 01:14:47