Tunacha Posted June 16, 2009 Share Posted June 16, 2009 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> Quote Link to comment https://forums.phpfreaks.com/topic/162366-help-needed-cant-figure-out-errors/ Share on other sites More sharing options...
Zane Posted June 16, 2009 Share Posted June 16, 2009 which line is it..which one is 88 Quote Link to comment https://forums.phpfreaks.com/topic/162366-help-needed-cant-figure-out-errors/#findComment-856968 Share on other sites More sharing options...
Tunacha Posted June 16, 2009 Author Share Posted June 16, 2009 line 88 is very bottom But even if i take it out of the table the Number in the error changes to the last lines number Quote Link to comment https://forums.phpfreaks.com/topic/162366-help-needed-cant-figure-out-errors/#findComment-856972 Share on other sites More sharing options...
Zane Posted June 16, 2009 Share Posted June 16, 2009 you're probably missing an end bracket just add another one to the end Quote Link to comment https://forums.phpfreaks.com/topic/162366-help-needed-cant-figure-out-errors/#findComment-856977 Share on other sites More sharing options...
Tunacha Posted June 16, 2009 Author Share Posted June 16, 2009 Nope that didnt do it just moved the error to the new last line Quote Link to comment https://forums.phpfreaks.com/topic/162366-help-needed-cant-figure-out-errors/#findComment-856981 Share on other sites More sharing options...
Tunacha Posted June 16, 2009 Author Share Posted June 16, 2009 So is anyone able to help? Quote Link to comment https://forums.phpfreaks.com/topic/162366-help-needed-cant-figure-out-errors/#findComment-857051 Share on other sites More sharing options...
sc_84 Posted June 16, 2009 Share Posted June 16, 2009 on line 58 theres an open { without a matching close } if($sock_init != 'FALSE'){ Quote Link to comment https://forums.phpfreaks.com/topic/162366-help-needed-cant-figure-out-errors/#findComment-857054 Share on other sites More sharing options...
sc_84 Posted June 16, 2009 Share Posted June 16, 2009 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 } Quote Link to comment https://forums.phpfreaks.com/topic/162366-help-needed-cant-figure-out-errors/#findComment-857059 Share on other sites More sharing options...
Tunacha Posted June 16, 2009 Author Share Posted June 16, 2009 Its still saying there is a error on the last line, Dose anyone know of a way to fix it or simplify the code, all i want it to do is check if a shoutcas6t server is online and if it is Go to the next page in the same window Quote Link to comment https://forums.phpfreaks.com/topic/162366-help-needed-cant-figure-out-errors/#findComment-857070 Share on other sites More sharing options...
sc_84 Posted June 16, 2009 Share Posted June 16, 2009 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); } } } } Quote Link to comment https://forums.phpfreaks.com/topic/162366-help-needed-cant-figure-out-errors/#findComment-857076 Share on other sites More sharing options...
Tunacha Posted June 16, 2009 Author Share Posted June 16, 2009 Ok so how would i make it show the online.php page right there because obvioulsy include isnt the way Quote Link to comment https://forums.phpfreaks.com/topic/162366-help-needed-cant-figure-out-errors/#findComment-857098 Share on other sites More sharing options...
premiso Posted June 16, 2009 Share Posted June 16, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/162366-help-needed-cant-figure-out-errors/#findComment-857137 Share on other sites More sharing options...
Tunacha Posted June 16, 2009 Author Share Posted June 16, 2009 everythings sorking it just isnt showing online.php wi it show it right were the imnclude statment is or in a defined place? Quote Link to comment https://forums.phpfreaks.com/topic/162366-help-needed-cant-figure-out-errors/#findComment-857146 Share on other sites More sharing options...
premiso Posted June 16, 2009 Share Posted June 16, 2009 So online.php is showing up, it just is not showing up where you think it should? I do not know, it was hard to figure out what you were trying to say in your last statement. Quote Link to comment https://forums.phpfreaks.com/topic/162366-help-needed-cant-figure-out-errors/#findComment-857153 Share on other sites More sharing options...
Tunacha Posted June 16, 2009 Author Share Posted June 16, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/162366-help-needed-cant-figure-out-errors/#findComment-857172 Share on other sites More sharing options...
Tunacha Posted June 16, 2009 Author Share Posted June 16, 2009 Are you able to understnd it more now? Quote Link to comment https://forums.phpfreaks.com/topic/162366-help-needed-cant-figure-out-errors/#findComment-857202 Share on other sites More sharing options...
Tunacha Posted June 17, 2009 Author Share Posted June 17, 2009 So can anyone help me? Quote Link to comment https://forums.phpfreaks.com/topic/162366-help-needed-cant-figure-out-errors/#findComment-857747 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.