Far Cry Posted June 21, 2011 Share Posted June 21, 2011 I've been trying to fix this for a while. I've turned to you guys to help Parse error: syntax error, unexpected '{' in /home/farcry/public_html/~sandbox/settings.php on line 142 [/code<?php require("styles/top.php");?> <?php $salt1 = "*********"; $salt2 = "*********"; if(empty($username)){ echo"<script type='text/javascript'> window.location = 'index.php' </script>"; } $page = $_GET['page']; $ans = $_GET['a']; $resp = $_GET['resp']; ?> <div id="head_news"> <div id="head_cen_news"> <div id="head_sup_news" class="head_height_news"> <?php require("scripts/newsfeed.php"); ?> <?php require("scripts/links.php"); ?> </div> </div> </div> <div id="content"> <br /> <?php if($page == "confirm"){ $pass = $_GET['pass']; ?> <center> Are you sure you want to change your password? <br /> <a href="settings.php?a=1&pass=<?php echo $pass ?>">Yes</a> <a href="settings.php">No</a> </center> <?php } if($ans == 1){ $pass = $_GET['pass']; mysql_query("UPDATE farcry_cev2.users SET farcry_cev2.users.password='$pass' WHERE farcry_cev2.users.username='$username'"); echo"<script type='text/javascript'> window.location = 'settings.php?resp=success' </script>"; } if($resp == "success"){ echo"<script type='text/javascript'> alert('Password successfully changed!'); </script>"; } if(empty($page)){ ?> <center><p style="font-size:22px; color:#31A1FF; font-weight:bolder;">User Settings</p></center> <hr /> <center><p style="font-size:18px; color:#000; font-weight:bolder;">Change Link Textbox Hover Colors</p></center> <hr /> <center> <table> <tr> <td>Current Color </td> <td><?php $query = mysql_query("SELECT * FROM farcry_cev2.users WHERE userid='$userid'")or trigger_error('Error: ' . mysql_error()); $numrows = mysql_num_rows($query); $row = mysql_fetch_assoc($query); if($numrows == 1){ $color = ucfirst($row['hover_color']); ?> <font color="<?php echo $color; ?>"><b><?php echo"$color";?></b></font> <?php } else { echo"An error has occured! Please try again later!"; } ?> </td> </tr> <tr> <td>Change Color </td> <td> <select name="ch_color" class="textbox"> <option value="white">White</option> <option value="black">Black</option> <option value="green">Green</option> <option value="yellow">Yellow</option> <option value="blue">Blue</option> <option value="red">Red</option> </select> </td> </tr> <tr> <td><p class="login"> <input name="colorbtn" type="submit" class="btn" value="CHANGE" /> </p></td> </tr> </table> </center> </form> <?php if(isset($_POST['colorbtn'])){ $newcolor = $_POST['ch_color']; if(!empty($newcolor)){ mysql_query("UPDATE farcry_cev2.users SET hover_color='$newcolor'"); echo"<script type='text/javascript'> alert('Settings updated!'); </script>"; } } ?> <hr /> <center><p style="font-size:18px; color:#000; font-weight:bolder;">Change Password</p></center> <hr /> <form action="settings.php" method="post" enctype="multipart/form-data"> <center> <table> <tr> <td>New Password </td> <td><input type="password" name="newpass" class="textbox" /></td> </tr> <tr> <td>Confirm Password </td> <td><input type="password" name="newpasscon" class="textbox" /></td> </tr> <tr> <td><p class="login"> <input name="passbtn" type="submit" class="btn" value="CHANGE" /> </p></td> </tr> </table> </center> </form> <hr /> <?php if(isset($_POST['passbtn'])){ $newpass = $_POST['newpass']; $newpasscon = $_POST['newpasscon']; if(!empty($newpass) && !empty($newpasscon)){ if($newpass == $newpasscon){ $pass = $newpasscon; if(validPassword($pass){ $pass = $salt2.md5($pass).$salt1; echo"<script type='text/javascript'> window.location = 'settings.php?page=confirm&pass=$pass' </script>"; } } else{ echo"<center><font color=\"#FF0000\">Your passwords do not match!</font></center>"; } } else{ echo"<center><font color=\"#FF0000\">One of the password fields are empty!</font></center>"; } } } ?> <?php } ?> <div id="content_cen"> <div id="content_sup"> </div> </div> </div> <div id="foot_news"> <div id="foot_cen_news"> <ul> </ul> <p></p> </div> </div> </body> </html> ] Link to comment https://forums.phpfreaks.com/topic/240009-i-cant-find-where-the-error-is-occuring/ Share on other sites More sharing options...
Pikachu2000 Posted June 21, 2011 Share Posted June 21, 2011 It's here: if(validPassword($pass){ Hint: count the parentheses. Then after that, you have what seems to be an unnecessary closing curly brace about 20 lines later. Link to comment https://forums.phpfreaks.com/topic/240009-i-cant-find-where-the-error-is-occuring/#findComment-1232873 Share on other sites More sharing options...
gristoi Posted June 21, 2011 Share Posted June 21, 2011 you are missing a bracket: if(validPassword($pass){ should be if(validPassword($pass)){ and you have an extra curly brace on line 162 that needs removing Link to comment https://forums.phpfreaks.com/topic/240009-i-cant-find-where-the-error-is-occuring/#findComment-1232874 Share on other sites More sharing options...
Far Cry Posted June 21, 2011 Author Share Posted June 21, 2011 Thanks Link to comment https://forums.phpfreaks.com/topic/240009-i-cant-find-where-the-error-is-occuring/#findComment-1232879 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.