jnerotrix Posted December 5, 2008 Share Posted December 5, 2008 I Get This Error Parse error: syntax error, unexpected '}', expecting ',' or ';' in /www/rack111.com/m/y/t/mytestsite/htdocs/youtube/other.php on line 22 In This Code <?php error_reporting(0); $ip = $_SERVER['REMOTE_ADDR']; $useripdata = '/ip/' . $ip .'.txt'; if (file_exists($useripdata)) { foreach (file('/ip/' . $ip . '.txt') as $line) { echo '$' . $line; } for ($i=0; $i < $numTimes; $i++) { echo '<object width="$setwidth" height="$setheight""><param name="movie" value="http://www.youtube.com/v/' . $shorturl . '&hl=en&fs=1"></param><param name="allowFullScreen" value="false"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/' . $shorturl . '&hl=en&fs=1$autoplay" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="false" width="$setwidth" height="$setheight"></embed></object>'; } echo "<meta http-equiv='refresh' content='$reloadtime' url='index.php'>;" } else { if (isset($_POST['action'])) { $numTimes = (isset($_POST['times']) && is_numeric($_POST['times']))?$_POST['times']:10; $shorturl = $_POST['url']; $autoplay = "&autoplay=1"; $reloadtime = $_POST['reloadtime']; $setwidth = $_POST['setwidth']; $setheight = $_POST['setheight']; $shorturl = $_POST['url']; $fullurl = "http://www.youtube.com/watch?v=' . $shorturl . '"; $myFile = "/ip/' . $ip . '.txt"; $fh = fopen($myFile, 'w') or die("can't open file"); $stringData = "numTimes = "10"\n"; fwrite($fh, $stringData); $stringData = "shorturl = $shorturl \n"; fwrite($fh, $stringData); $stringData = "autoplay = $autoplay \n"; fwrite($fh, $stringData); $stringData = "reloadtime = $reloadtime \n"; fwrite($fh, $stringData); $stringData = "setwidth = $setwidth \n"; fwrite($fh, $stringData); $stringData = "setheight = $setheight \n"; fwrite($fh, $stringData); $stringData = "fullurl = $fullurl \n"; fwrite($fh, $stringData); fclose($fh); function check_if_valid($fullurl) { $res = (($check = @fopen($fullurl, ‘r’)) === false) ? false : @fclose($check); return ($res == TRUE) ? VIDEO_IS_VALID:VIDEO_IS_INVALID ; } if ($HTTP_POST_VARS["submitted"] == "yes"){ echo "<meta http-equiv='refresh' content='$reloadtime'>"; } for ($i=0; $i < $numTimes; $i++) { echo '<object width="$setwidth" height="$setheight""><param name="movie" value="http://www.youtube.com/v/' . $shorturl . '&hl=en&fs=1"></param><param name="allowFullScreen" value="false"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/' . $shorturl . '&hl=en&fs=1$autoplay" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="false" width="$setwidth" height="$setheight"></embed></object>'; } } } ?> <table border="1"> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <tr> <td>Video Url:<input type="text" readonly="1" value="http://www.youtube.com/watch?v=" size="30"><input type="Text" name="url"></td> </tr> <tr> <td>(Number)<input type="text" name="times" value="10"> of Times to Display Video in <input type="text" name="reloadtime" value="5">(Seconds)</td> </tr> <tr> <td>Set Width <input type="text" name="setwidth" value="425"> Set Height <input type="text" name="setheight" value="344"> </tr> <tr> <td align="center" valign="center"><input type="submit" name="action" value="Submit"> <input type="hidden" name="submitted" value="yes"> </td> </tr> </form </table> Quote Link to comment https://forums.phpfreaks.com/topic/135640-unexpected-expecting-or/ Share on other sites More sharing options...
Mchl Posted December 5, 2008 Share Posted December 5, 2008 echo "<meta http-equiv='refresh' content='$reloadtime' url='index.php'>;" Does this look right to you? Quote Link to comment https://forums.phpfreaks.com/topic/135640-unexpected-expecting-or/#findComment-706653 Share on other sites More sharing options...
jnerotrix Posted December 5, 2008 Author Share Posted December 5, 2008 I still Get The Error after changing it Quote Link to comment https://forums.phpfreaks.com/topic/135640-unexpected-expecting-or/#findComment-706654 Share on other sites More sharing options...
Mchl Posted December 5, 2008 Share Posted December 5, 2008 What did you change it to? Quote Link to comment https://forums.phpfreaks.com/topic/135640-unexpected-expecting-or/#findComment-706655 Share on other sites More sharing options...
jnerotrix Posted December 5, 2008 Author Share Posted December 5, 2008 echo "<meta http-equiv='refresh' content='$reloadtime'>;" Quote Link to comment https://forums.phpfreaks.com/topic/135640-unexpected-expecting-or/#findComment-706656 Share on other sites More sharing options...
jnerotrix Posted December 5, 2008 Author Share Posted December 5, 2008 Ok i Fixed it I had ;" indtead of "; but now i get a new error Parse error: syntax error, unexpected T_LNUMBER in /www/rack111.com/m/y/t/mytestsite/htdocs/youtube/other.php on line 38 Quote Link to comment https://forums.phpfreaks.com/topic/135640-unexpected-expecting-or/#findComment-706658 Share on other sites More sharing options...
Mchl Posted December 5, 2008 Share Posted December 5, 2008 Sheesh... $stringData = "numTimes = "10"\n"; Does that look right to you? Quote Link to comment https://forums.phpfreaks.com/topic/135640-unexpected-expecting-or/#findComment-706661 Share on other sites More sharing options...
keiran420 Posted December 5, 2008 Share Posted December 5, 2008 I am unable to test the code, but i have taken it, indented, looked through it, and replaced quite a few small errors... and changed some stuff i wasn't sure about... I see no reason why it shouldn't run... though if im wrong, please return the error <?php error_reporting(0); $ip = $_SERVER['REMOTE_ADDR']; $useripdata = '/ip/' . $ip .'.txt'; if (file_exists($useripdata)){ foreach (file('/ip/' . $ip . '.txt') as $line){ echo '$' . $line; } for ($i=0; $i < $numTimes; $i++) { echo "<object width='".$setwidth."' height='".$setheight."'> <param name='movie' value='http://www.youtube.com/v/".$shorturl."&hl=en&fs=1'></param> <param name='allowFullScreen' value='false'></param> <param name='allowscriptaccess' value='always'></param> <embed src='http://www.youtube.com/v/".$shorturl."&hl=en&fs=1".$autoplay."' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='false' width='".$setwidth."' height='".$setheight."'> </embed></object>"; } echo "<meta http-equiv='refresh' content='".$reloadtime."' url='index.php'>"; } else { if (isset($_POST['action'])){ $numTimes = (isset($_POST['times']) && is_numeric($_POST['times']))?$_POST['times']:10; $shorturl = $_POST['url']; $autoplay = "&autoplay=1"; $reloadtime = $_POST['reloadtime']; $setwidth = $_POST['setwidth']; $setheight = $_POST['setheight']; $shorturl = $_POST['url']; $fullurl = "http://www.youtube.com/watch?v=".$shorturl; $myFile = "/ip/".$ip.".txt"; $fh = fopen($myFile, 'w') or die("can't open file"); $stringData = "numTimes = "10"\n"; fwrite($fh, $stringData); $stringData = "shorturl = $shorturl \n"; fwrite($fh, $stringData); $stringData = "autoplay = $autoplay \n"; fwrite($fh, $stringData); $stringData = "reloadtime = $reloadtime \n"; fwrite($fh, $stringData); $stringData = "setwidth = $setwidth \n"; fwrite($fh, $stringData); $stringData = "setheight = $setheight \n"; fwrite($fh, $stringData); $stringData = "fullurl = $fullurl \n"; fwrite($fh, $stringData); fclose($fh); function check_if_valid($fullurl){ $res = (($check = @fopen($fullurl, ‘r’)) === false) ? false : @fclose($check); return ($res == TRUE) ? VIDEO_IS_VALID:VIDEO_IS_INVALID ; } if ($HTTP_POST_VARS["submitted"] == "yes"){ echo "<meta http-equiv='refresh' content='".$reloadtime."'>"; } for ($i=0; $i < $numTimes; $i++) { echo "<object width='".$setwidth."' height='".$setheight."'> <param name='movie' value='http://www.youtube.com/v/".$shorturl."&hl=en&fs=1'> </param><param name='allowFullScreen' value='false'></param> <param name='allowscriptaccess' value='always'></param> <embed src='http://www.youtube.com/v/".$shorturl."&hl=en&fs=1$autoplay' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='false' width='".$setwidth."' height='".$setheight."'>< /embed></object>"; } } } ?> <table border="1"> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <tr><td> Video Url:<input type="text" readonly="1" value="http://www.youtube.com/watch?v=" size="30"> <input type="Text" name="url"> </td></tr><tr><td> (Number)<input type="text" name="times" value="10"> of Times to Display Video in <input type="text" name="reloadtime" value="5">(Seconds) </td></tr><tr><td> Set Width <input type="text" name="setwidth" value="425"> Set Height <input type="text" name="setheight" value="344"> </tr><tr><td align="center" valign="center"> <input type="submit" name="action" value="Submit"> <input type="hidden" name="submitted" value="yes"> </td></tr> </form> </table> it reads easier indented EDIT, gah, missed a " ^^ Quote Link to comment https://forums.phpfreaks.com/topic/135640-unexpected-expecting-or/#findComment-706667 Share on other sites More sharing options...
Mchl Posted December 5, 2008 Share Posted December 5, 2008 You didn't fix the error in line 38 though. Quote Link to comment https://forums.phpfreaks.com/topic/135640-unexpected-expecting-or/#findComment-706668 Share on other sites More sharing options...
keiran420 Posted December 5, 2008 Share Posted December 5, 2008 You didn't fix the error in line 38 though. DOH >.< fixed... does it work? Quote Link to comment https://forums.phpfreaks.com/topic/135640-unexpected-expecting-or/#findComment-706670 Share on other sites More sharing options...
keiran420 Posted December 5, 2008 Share Posted December 5, 2008 $stringData = "numTimes = "10"\n"; fwrite($fh, $stringData); looks wrong as hell to now i see it in colour... $stringData = "numTimes = 10\n"; fwrite($fh, $stringData); Quote Link to comment https://forums.phpfreaks.com/topic/135640-unexpected-expecting-or/#findComment-706673 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.