parse error, unexpected T_LNUMBER

nfsmw15

Mitglied
Ich bekomme bei diesem Script immer einen fehler angezeigt:
Code:
Parse error: parse error, unexpected T_LNUMBER, expecting ',' or ';' in /srv/www/web3/html/stream/radio-stats.php on line 55
Ich finde keinen fehler :confused:

Kann man die die Wochentage als zahl augeben lassen? Weil bei "sende_tag" soll die jeweilige zahl für den Wochentag in die Datenbank eingelesen werden.
PHP:
<?php
include('config_radio.php');
$scfp = @fsockopen("$scip", $scport, &$errno, &$errstr, 30);
 if(!$scfp) {
  $scsuccs=1;
echo''.$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);
 }



 $loop = array("STREAMSTATUS", "BITRATE", "SERVERTITLE", "CURRENTLISTENERS", "MAXLISTENERS", "BITRATE", "AIM", "ICQ", "IRC");
 $y=0;
 while($loop[$y]!=''){
  $pageed = ereg_replace(".*<$loop[$y]>", "", $page);
  $scphp = strtolower($loop[$y]);
  $uhrzeit = date("H:i",$timestamp);
  $$scphp = ereg_replace("</$loop[$y]>.*", "", $pageed);
  if($loop[$y]==SERVERGENRE || $loop[$y]==SERVERTITLE || $loop[$y]==SONGTITLE || $loop[$y]==SERVERTITLE)
   $$scphp = urldecode($$scphp);


  $y++;
 }

 $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'
$dbverbindung = mysql_connect ($host, $user, $password);

$dbanfrage = "INSERT INTO `$tabelle` ( `id`, `sende_tag`, `sende_zeit`, `sende_dj` ) VALUES ('0', NULL , '.$uhrzeit.', '.$aim.')";

if (mysql_db_query ($dbname, $dbanfrage, $dbverbindung)) {
print ("Datenbankeintrag erfolgreich.");
} else {
print ("Es traten Probleme auf.");
}
mysql_close ($dbverbindung);
';
}
if($streamstatus == "0")
{

echo''.$offline.'';
}
?>
 
PHP:
if($streamstatus == "1"){

echo'

Was macht das echo ' da? Das erzeugt deinen Fehler.

Und den Wochentag als Zahl:

Vor PHP 5.1
PHP:
echo date("w");

0 = Sonntag, 6 = Samstag

Nach PHP 5.1
PHP:
echo date("N");

1 = Montag, 7 = Sonntag
 
Hallo
jetzt habe ich nochmal so einen problem wo ich nicht die ursache finde.
Es wird angezeigt:
Code:
Parse error: parse error, unexpected T_STRING, expecting ')' in /srv/www/web1/html/streambox/linkbox.php on line 7


Hier ist der Code
PHP:
<?php
	include('config_radio.php');

	$scfp = @fsockopen("$scip", $scport, &$errno, &$errstr, 30);
	 if(!$scfp) {
	  $scsuccs=1;
	function FensterOeffnen (Adresse) {
	  MeinFenster = window.open(Adresse, "Zweitfenster", "width=450,height=300,left=100,top=200");
	  MeinFenster.focus();
	}
	function link_gotourl(lnk) {
		window.open(lnk);
	}
	function link_gototb() {
		window.open("http://www.city-live-radio.de/");
	}
	function link_molink(tr) {
		tr.style.cursor = "pointer";
	}
document.write('<table id="Tabelle_01" width="130" height="181" border="0" cellpadding="0" cellspacing="0">');
document.write('  <tr onClick="JavaScript:link_gototb();" onMouseOver="JavaScript:link_molink(this);">');
document.write('	 <td colspan="3">');
document.write('			<img src="http://www.city-live-radio.de/streambox/normal/header.jpg" width="130" height="98" alt=""></td>');
document.write('	</tr>');
document.write('	<tr>');
document.write('		<td>');
document.write('			<img src="http://www.city-live-radio.de/streambox/normal/win.jpg" width="42" height="27" alt="" onClick="JavaScript:link_gotourl(\'http://privat.pytalhost.de/autostart/listen.pls\');" onMouseOver="JavaScript:link_molink(this);"></td>');
document.write('		<td>');
document.write('			<img src="http://www.city-live-radio.de/streambox/normal/play.jpg" width="44" height="27" alt="" onClick="JavaScript:FensterOeffnen(\'http://www.city-live-radio.de/listen/player.html\'); return false" onMouseOver="JavaScript:link_molink(this);"></td>');
document.write('		<td>');
document.write('			<img src="http://www.city-live-radio.de/streambox/normal/real.jpg" width="44" height="27" alt=""  onClick="JavaScript:link_gotourl(\'http://privat.pytalhost.de/autostart/listen.ram\');" onMouseOver="JavaScript:link_molink(this);"></td>');
document.write('	</tr>');
document.write('	<tr onClick="JavaScript:link_gototb();" onMouseOver="JavaScript:link_molink(this);">');
document.write('		<td colspan="3">');
document.write('			<img src="http://www.city-live-radio.de/streambox/normal/titel.jpg" width="130" height="9" alt=""></td>');
document.write('	</tr>');
document.write('  <tr> ');
document.write('    <td height="24" colspan="3" background="http://www.city-live-radio.de/streambox/normal/bg.jpg"><marquee scrollamount="1" scrolldelay="1"><font face="Tahoma" size="1" color="#000000"><b>Aktuell l&auml;uft: Test - Test</b></font></marquee></td>');
document.write('	</tr>');
document.write('	<tr onClick="JavaScript:link_gototb();" onMouseOver="JavaScript:link_molink(this);">');
document.write('		<td colspan="3">');
document.write('			<img src="http://www.city-live-radio.de/streambox/normal/mod.jpg" width="130" height="9" alt=""></td>');
document.write('	</tr>');
document.write('	  <tr> ');
document.write('    <td height="24" colspan="3" background="http://www.city-live-radio.de/streambox/normal/bg.jpg"><div align="center"><font face="Tahoma" size="1" color="#000000"><b>test</b></font></div></td>');
document.write('	</tr>');
document.write('	<tr onClick="JavaScript:link_gototb();" onMouseOver="JavaScript:link_molink(this);">');
document.write('		<td colspan="3">');
document.write('			<img src="http://www.city-live-radio.de/streambox/normal/fooder.jpg" width="130" height="45" alt=""></td>');
document.write('	</tr>');
document.write('</table>');
 }
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", "AIM", "ICQ", "IRC");
 $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);


  $y++;
 }
//end intro xml elements
######################################################################################################################
######################################################################################################################
/////////////////////////part 2\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
 $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"){
function FensterOeffnen (Adresse) {
	  MeinFenster = window.open(Adresse, "Zweitfenster", "width=450,height=300,left=100,top=200");
	  MeinFenster.focus();
	}
	function link_gotourl(lnk) {
		window.open(lnk);
	}
	function link_gototb() {
		window.open("http://www.city-live-radio.de/");
	}
	function link_molink(tr) {
		tr.style.cursor = "pointer";
	}
document.write('<table id="Tabelle_01" width="130" height="181" border="0" cellpadding="0" cellspacing="0">');
document.write('  <tr onClick="JavaScript:link_gototb();" onMouseOver="JavaScript:link_molink(this);">');
document.write('	 <td colspan="3">');
document.write('			<img src="http://www.city-live-radio.de/streambox/normal/header.jpg" width="130" height="98" alt=""></td>');
document.write('	</tr>');
document.write('	<tr>');
document.write('		<td>');
document.write('			<img src="http://www.city-live-radio.de/streambox/normal/win.jpg" width="42" height="27" alt="" onClick="JavaScript:link_gotourl(\'http://privat.pytalhost.de/autostart/listen.pls\');" onMouseOver="JavaScript:link_molink(this);"></td>');
document.write('		<td>');
document.write('			<img src="http://www.city-live-radio.de/streambox/normal/play.jpg" width="44" height="27" alt="" onClick="JavaScript:FensterOeffnen(\'http://www.city-live-radio.de/listen/player.html\'); return false" onMouseOver="JavaScript:link_molink(this);"></td>');
document.write('		<td>');
document.write('			<img src="http://www.city-live-radio.de/streambox/normal/real.jpg" width="44" height="27" alt=""  onClick="JavaScript:link_gotourl(\'http://privat.pytalhost.de/autostart/listen.ram\');" onMouseOver="JavaScript:link_molink(this);"></td>');
document.write('	</tr>');
document.write('	<tr onClick="JavaScript:link_gototb();" onMouseOver="JavaScript:link_molink(this);">');
document.write('		<td colspan="3">');
document.write('			<img src="http://www.city-live-radio.de/streambox/normal/titel.jpg" width="130" height="9" alt=""></td>');
document.write('	</tr>');
document.write('  <tr> ');
document.write('    <td height="24" colspan="3" background="http://www.city-live-radio.de/streambox/normal/bg.jpg"><marquee scrollamount="1" scrolldelay="1"><font face="Tahoma" size="1" color="#000000"><b>Aktuell l&auml;uft: Test - Test</b></font></marquee></td>');
document.write('	</tr>');
document.write('	<tr onClick="JavaScript:link_gototb();" onMouseOver="JavaScript:link_molink(this);">');
document.write('		<td colspan="3">');
document.write('			<img src="http://www.city-live-radio.de/streambox/normal/mod.jpg" width="130" height="9" alt=""></td>');
document.write('	</tr>');
document.write('	  <tr> ');
document.write('    <td height="24" colspan="3" background="http://www.city-live-radio.de/streambox/normal/bg.jpg"><div align="center"><font face="Tahoma" size="1" color="#000000"><b>test</b></font></div></td>');
document.write('	</tr>');
document.write('	<tr onClick="JavaScript:link_gototb();" onMouseOver="JavaScript:link_molink(this);">');
document.write('		<td colspan="3">');
document.write('			<img src="http://www.city-live-radio.de/streambox/normal/fooder.jpg" width="130" height="45" alt=""></td>');
document.write('	</tr>');
document.write('</table>');
}
if($streamstatus == "0")
{
function FensterOeffnen (Adresse) {
	  MeinFenster = window.open(Adresse, "Zweitfenster", "width=450,height=300,left=100,top=200");
	  MeinFenster.focus();
	}
	function link_gotourl(lnk) {
		window.open(lnk);
	}
	function link_gototb() {
		window.open("http://www.city-live-radio.de/");
	}
	function link_molink(tr) {
		tr.style.cursor = "pointer";
	}
document.write('<table id="Tabelle_01" width="130" height="181" border="0" cellpadding="0" cellspacing="0">');
document.write('  <tr onClick="JavaScript:link_gototb();" onMouseOver="JavaScript:link_molink(this);">');
document.write('	 <td colspan="3">');
document.write('			<img src="http://www.city-live-radio.de/streambox/normal/header.jpg" width="130" height="98" alt=""></td>');
document.write('	</tr>');
document.write('	<tr>');
document.write('		<td>');
document.write('			<img src="http://www.city-live-radio.de/streambox/normal/win.jpg" width="42" height="27" alt="" onClick="JavaScript:link_gotourl(\'http://privat.pytalhost.de/autostart/listen.pls\');" onMouseOver="JavaScript:link_molink(this);"></td>');
document.write('		<td>');
document.write('			<img src="http://www.city-live-radio.de/streambox/normal/play.jpg" width="44" height="27" alt="" onClick="JavaScript:FensterOeffnen(\'http://www.city-live-radio.de/listen/player.html\'); return false" onMouseOver="JavaScript:link_molink(this);"></td>');
document.write('		<td>');
document.write('			<img src="http://www.city-live-radio.de/streambox/normal/real.jpg" width="44" height="27" alt=""  onClick="JavaScript:link_gotourl(\'http://privat.pytalhost.de/autostart/listen.ram\');" onMouseOver="JavaScript:link_molink(this);"></td>');
document.write('	</tr>');
document.write('	<tr onClick="JavaScript:link_gototb();" onMouseOver="JavaScript:link_molink(this);">');
document.write('		<td colspan="3">');
document.write('			<img src="http://www.city-live-radio.de/streambox/normal/titel.jpg" width="130" height="9" alt=""></td>');
document.write('	</tr>');
document.write('  <tr> ');
document.write('    <td height="24" colspan="3" background="http://www.city-live-radio.de/streambox/normal/bg.jpg"><marquee scrollamount="1" scrolldelay="1"><font face="Tahoma" size="1" color="#000000"><b>Aktuell l&auml;uft: Test - Test</b></font></marquee></td>');
document.write('	</tr>');
document.write('	<tr onClick="JavaScript:link_gototb();" onMouseOver="JavaScript:link_molink(this);">');
document.write('		<td colspan="3">');
document.write('			<img src="http://www.city-live-radio.de/streambox/normal/mod.jpg" width="130" height="9" alt=""></td>');
document.write('	</tr>');
document.write('	  <tr> ');
document.write('    <td height="24" colspan="3" background="http://www.city-live-radio.de/streambox/normal/bg.jpg"><div align="center"><font face="Tahoma" size="1" color="#000000"><b>test</b></font></div></td>');
document.write('	</tr>');
document.write('	<tr onClick="JavaScript:link_gototb();" onMouseOver="JavaScript:link_molink(this);">');
document.write('		<td colspan="3">');
document.write('			<img src="http://www.city-live-radio.de/streambox/normal/fooder.jpg" width="130" height="45" alt=""></td>');
document.write('	</tr>');
document.write('</table>');
}
?>
 
Das „document.write()“ ist kein PHP sondern JavaScript und darf deshalb nicht so in einem PHP-Codeblock auftauchen.
 
Wie kann man dieses Java Script in ein PHP Script einfügen? Ohne das die fehlermeldungen kommen. Weil das PHP sollen Variablen an das Javascript weitergeben den Stream Titel und den Moderator.
 
Wenn du es einfach nur ausgeben möchtest, reicht es, den PHP-Codeblock zu schließen und am Ende einen neuen zu beginnen:
PHP:
<?php

	// PHP-Code

?>
direkte Ausgabe
<?php

	// PHP-Code

?>
 
Nein das funktioniert nicht bei diesem Script leider nicht weil ja noch variabeln an das JavaScript gegeben werden sollen wie z.B. hier '.$servertitle.' :

Code:
document.write('  <tr> ');
document.write('    <td height="24" colspan="3" background="/streambox/normal/bg.jpg"><marquee scrollamount="1" scrolldelay="1"><font face="Tahoma" size="1" color="#000000"><b>Aktuell l&auml;uft: '.$servertitle.'</b></font></marquee></td>');
document.write('	</tr>');
 
Wieso nicht?
PHP:
?>
document.write('  <tr> ');
document.write('    <td height="24" colspan="3" background="/streambox/normal/bg.jpg"><marquee scrollamount="1" scrolldelay="1"><font face="Tahoma" size="1" color="#000000"><b>Aktuell l&auml;uft: <?php echo $servertitle; ?></b></font></marquee></td>');
document.write('	</tr>');
<?php
 
Zurück