Jump to content

Help needed Cant figure out errors


Tunacha

Recommended Posts

Well as the title says i need some help i cant seeem to figure out why i keep getting parse errors on the last line of this code I an kinda new to php coding and ive tried to do this with the help of some other scripts with editing

 

If you know any other easyer way to check if a shoutcast server is online and show a page only if its online  and if its offline show a image that says Off-Air

Please let me know

 

 

Error im getting

Parse error: parse error in C:\xampp\htdocs\radio.php on line 88

 

 

 

Heres the code

<style type="text/css">
<!--
body {
background-image: url(http://64.235.59.54/web-gallery/v2/images/bg.png);
background-repeat: repeat;
}
h1 {
font-size: 24px;
color: #00FF33;
}
h2 {
font-size: 10px;
color: #FF9900;
}
-->
</style><title>Ultima Radio</title><div align="center"><body>
<table width="90%" height="90%" border="0" bgcolor="#FFFFFF">
  <tr>
    <td>

<div align="center"><img scr="YouBanner Here">
  <hr>
  <h1>Welcome to Ultima Radio</h1></div>
<div align="center">
  <?php
////////////////////////////////////////////////////////////////////////////////
//Script Name: Ultima Radio Player
//Credits: Roger Wilde
//
////////////////////////////////////////////////////////////////////////////////
//Edit These Settings
$scip = "216.246.13.117"; // Your Radio IP
$scport = "8255"; // Your Radio Port
$station_name = 'Ultima Radio'; //name of your station
$online_imgurl = 'http://yourdomain.com/images/online.gif'; //full url to your online image
$offline_imgurl = 'http://yourdomain.com/images/offline.gif'; //full url to your offline image
// End of Configuration


// Check if settings edited
if($scip == 'yourip' && $scport == 'port' && $station_name == 'your_station_name'){
echo 'Please Edit your details inside Player.php';
//Only 10 seconds needed to check if online
ini_set("max_execution_time", "10");

//initiate a tcp socket connection to determine whether or not the server
//is actualy up.
$scp = @fsockopen($scip, $scport, &$errno, &$errstr, 30);
//let me know where or not its up
if(!$scp){
    $sock_init = 'FALSE';
}
//show them whether or not the server is actualy up or not
if($sock_init == 'FALSE'){
	    echo ' <img srv='.$offline_imgurl.'>';
}
//check 7.html to see if dsp is connected
if($sock_init != 'FALSE'){
         fputs($scp,"GET /7.html HTTP/1.0\r\nUser-Agent: SC Status (Mozilla Compatible)\r\n\r\n");
		while(!feof($scp)) {
  			$sc7 .= fgets($scp, 1024);
			}
//close it up
@fclose($scp);
//while we got the page open into memory lets bomb n parse baby.
$sc7 = ereg_replace(".*<body>", "", $sc7);
$sc7 = ereg_replace("</body>.*", ",", $sc7);
$sc_contents = explode(",",$sc7);
$dummy = $sc_contents[0];
$dsp_connected = $sc_contents[1];
//check dsp connection and display the status of the shoutcast server in question
//do images first
	if($sock_init != 'FALSE'){
	    if($dsp_connected == '1'){
  		include (online.php);
	}
}
//end 7.html

?>
  <br>
  <br>
  <br>
<br>
  <h2>©Roger Wilde Of Ultima Hotel</h2></div>
</td>
  </tr>
</table>

Link to comment
Share on other sites

just to be more specific its this bit:

 

if($sock_init != 'FALSE'){
         fputs($scp,"GET /7.html HTTP/1.0\r\nUser-Agent: SC Status (Mozilla Compatible)\r\n\r\n");
		while(!feof($scp)) {
  			$sc7 .= fgets($scp, 1024);
			}

 

 

needs a }

Link to comment
Share on other sites

just spotted another open { without a matching close tag on line 41

 

if($scip == 'yourip' && $scport == 'port' && $station_name == 'your_station_name'){

 

the parse error goes away if you close the one i have previously mentioned at the end of your original code and the new one so at the end of your original code add two new { close brackets

 

if($sock_init != 'FALSE'){
	    if($dsp_connected == '1'){
  		include (online.php);
	}
}
}
}


Link to comment
Share on other sites

The thing to check is make sure this

 

$dsp_connected = $sc_contents[1];

 

is returning what you expect it to return. Also add quotes around your include parameter:

 

include ('online.php');

 

But if it does not hit that if statement, then chances are your variables are not what you expect them to be. Do some debugging and find out why.

 

Link to comment
Share on other sites

K hopefully this describes it better

radio.php Has my header and footer and a php script to check if a shoutcast server is online.

If that server is online i want online.php to show up between the headder and footer.

If the server is not online i want it to show a Off Air image between the header and footer

Basicaly how would i go about doing this seeing as the script i have obviously dosent work

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.