_absurd Posted April 26, 2007 Share Posted April 26, 2007 This one's killing me. Anyone notice anything that I'm not? <? $_PAGE_TITLE = "Login Error"; include_once ("header.php"); $username = $_POST['username']; $password = $_POST['password']; if (!isset($username) || !isset($password)) { echo 'You are already logged in.'; } elseif (empty($username) || empty($password)) { session_unset(); session_destroy(); echo 'You left one or more fields blank. Please try again.'; } else { $result = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password'"); $rowCheck = mysql_num_rows($result); if($rowCheck > 0) { while($row = mysql_fetch_array($result)) { session_register('username'); session_register('password'); header("Location: index.php"); } } else { session_unset(); session_destroy(); echo 'Incorrect username or password. Please try again.'; } } require_once ("footer.php"); ?> Link to comment https://forums.phpfreaks.com/topic/48853-solved-parse-error-syntax-error-unexpected-t_variable-in-on-line-5/ Share on other sites More sharing options...
Psycho Posted April 26, 2007 Share Posted April 26, 2007 OK, there's something odd here. In the script above the include_once line liiks fine, but when I copy and paste all of the above into notepad, that line looks like this: include_once ("header.php");-- But, thos two "dashes" don't show up when I paste it back into this window, but they are there (I used regualr dashes above for display). So delete the last two "invisible" characters at the end of that line. IT works after that. Link to comment https://forums.phpfreaks.com/topic/48853-solved-parse-error-syntax-error-unexpected-t_variable-in-on-line-5/#findComment-239440 Share on other sites More sharing options...
_absurd Posted April 26, 2007 Author Share Posted April 26, 2007 I am working with the code in notepad myself, and there are no hidden characters after the include statement. I even deleted and rewrote that entire line and got the same error EDIT: I tried deleting the first 4 lines and rewriting them, and it worked. I guess there was a hidden character SOMEWHERE in there. Thanks mjdamato! Link to comment https://forums.phpfreaks.com/topic/48853-solved-parse-error-syntax-error-unexpected-t_variable-in-on-line-5/#findComment-239442 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.