Jump to content

[SOLVED] Parse error: syntax error, unexpected T_VARIABLE in ###### on line 5


_absurd

Recommended Posts

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");
?>

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.

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!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.