Cod-nes Posted March 19, 2008 Share Posted March 19, 2008 I keep getting this error:Parse error: syntax error, unexpected '{' in /homepages/31/d229779882/htdocs/upload/member.php on line 16I looked over the code a few times but I can't find the problem with the "Parse error: syntax error, unexpected '{'"So help please. <?php$sql= mysql_connect("SERCET 3x");$database=mysql_select_db("db238906134");$past = time() - 100;//connectif (!$sql){die('Could not connect: ' . mysql_error());}if (!$database){die ('Could not select db: ' . mysql_error());}if (isset($_COOKIE["username"]){$username = $_COOKIE['Username'];$password = $_COOKIE['Password'];$check = mysql_query("SELECT * FROM Member WHERE Username = '$username'")or die(mysql_error());while($info = mysql_fetch_array( $check )){ if ($password != $info['password']){die('Sorry but your password is wrong. <a href="index.php>try again</a>"' . 'setcookie(Username, gone, $past)' . 'setcookie(Password, gone, $past)'>}else{echo "<a href=upload.php>Upload</a>";echo "<a href=files.php>Your Files</a>";echo "<a href=logout.php>Logout</a>";echo "<a href=delete.php>Delete Account</a>";}}}else//if the cookie does not exist, they are taken to the login screen{header("Location: index.php");}?> Link to comment Share on other sites More sharing options...
imrie Posted March 19, 2008 Share Posted March 19, 2008 You are missing a bracket ) .You have -if (isset($_COOKIE["username"]){It should be -if (isset($_COOKIE["username"])){ Link to comment Share on other sites More sharing options...
Cod-nes Posted March 19, 2008 Author Share Posted March 19, 2008 Thanks! It's working now!EDIT:Great... now line 25....Parse error: syntax error, unexpected '}' in /homepages/31/d229779882/htdocs/upload/member.php on line 25 Link to comment Share on other sites More sharing options...
justsomeguy Posted March 19, 2008 Share Posted March 19, 2008 You need to learn how to find these errors yourself. The error message says it found something unexpected on line 25. So look at line 25. All it is is a single "}" character, there's nothing illegal about that. But if it's saying that it's not expecting that character then there must be a problem higher up that is causing it to become confused. Look at line 24. Link to comment Share on other sites More sharing options...
jeffman Posted March 19, 2008 Share Posted March 19, 2008 Kind of like the missing brace in the last line of your code really refers to something 1000 lines up. I used to get that error all the time. Link to comment Share on other sites More sharing options...
The Sea King Posted March 19, 2008 Share Posted March 19, 2008 Lines 15 to 42:I think I had corrected the problem... if (isset($_COOKIE["username"])){$username = $_COOKIE['Username'];$password = $_COOKIE['Password'];$check = mysql_query("SELECT * FROM Member WHERE Username = '$username'")or die(mysql_error());while($info = mysql_fetch_array( $check )){ if ($password != $info['password']){die('Sorry but your password is wrong. <a href=index.php>try again</a> . setcookie(Username, gone, $past) . setcookie(Password, gone, $past)')}else{echo "<a href=upload.php>Upload</a>";echo "<a href=files.php>Your Files</a>";echo "<a href=logout.php>Logout</a>";echo "<a href=delete.php>Delete Account</a>";}}}else//if the cookie does not exist, they are taken to the login screen{header("Location: index.php");}?> Link to comment Share on other sites More sharing options...
Cod-nes Posted March 19, 2008 Author Share Posted March 19, 2008 I'll try that. EDIT: it didn't work. Link to comment Share on other sites More sharing options...
jlhaslip Posted March 20, 2008 Share Posted March 20, 2008 <?php$sql= mysql_connect("SERCET 3x");$database=mysql_select_db("db238906134");$past = time() - 100;//connectif (!$sql){ die('Could not connect: ' . mysql_error()); }if (!$database){ die ('Could not select db: ' . mysql_error()); }if (isset($_COOKIE["username"])){ $username = $_COOKIE['Username']; $password = $_COOKIE['Password']; $check = mysql_query("SELECT * FROM Member WHERE Username = '$username'")or die(mysql_error()); while($info = mysql_fetch_array( $check )){ if ($password != $info['password']){ die('Sorry but your password is wrong. <a href="index.php>try again</a>"'); } else { echo "<a href=upload.php>Upload</a>"; echo "<a href=files.php>Your Files</a>"; echo "<a href=logout.php>Logout</a>"; echo "<a href=delete.php>Delete Account</a>"; } }} else {//if the cookie does not exist, they are taken to the login screen header("Location: index.php"); }?> Try that. The curly braces were messed up and a semi-colon missing here and ther, and a bracket, too, I think.Check to see if that is any better. Link to comment Share on other sites More sharing options...
Cod-nes Posted March 20, 2008 Author Share Posted March 20, 2008 I started from scratch and it works! yay! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.