Php Syntax Error In Logout Script!?

I have 4 scripts that make up a basic login system with registration. Everything works except logout.php. It gets this error:
Parse error: syntax error, unexpected T_VARIABLE in /home/a9161210/public_html/logout.php on line 1
LOGOUT.PHP:

Login.php:
<?php
mysql_connect("mysql3.000webhost.com", "a9161210_login", "dualpower1") or die(mysql_error());
mysql_select_db("a9161210_login") or die(mysql_error());
//Checks if there is a login cookie
if(isset($_COOKIE['ID_my_site']))
//if there is, it logs you in and directes you to the members page
{
$username = $_COOKIE['ID_my_site'];
$pass = $_COOKIE['Key_my_site'];
$check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error());
while($info = mysql_fetch_array( $check ))
{
if ($pass != $info['password'])
{
}
else
{
header("Location: members.php");
}
}
}
//if the login form is submitted
if (isset($_POST['submit'])) {
// makes sure they filled it in
if(!$_POST['username'] | !$_POST['pass']) {
die('You did not fill in a required field.');
}
// checks it against the database
if (!get_magic_quotes_gpc()) {
$_POST['email'] = addslashes($_POST['email']);
}
$check = mysql_query("SELECT * FROM users WHERE username = '".$_POST['username']."'")or die(mysql_error());
//Gives error if user dosen't exist
$check2 = mysql_num_rows($check);
if ($check2 == 0) {
die('An error occured please try again, or Click Here to Register ‘);
}
while($info = mysql_fetch_array( $check ))
{
$_POST['pass'] = stripslashes($_POST['pass']);
$info['password'] = stripslashes($info['password']);
$_POST['pass'] = md5($_POST['pass']);
//gives error if the password is wrong
if ($_POST['pass'] != $info['password']) {
die(‘An error occured please try again, or Click Here to Register ‘);
}
else
{
// if login is ok then we add a cookie
$_POST['username'] = stripslashes($_POST['username']);
$hour = time() + 3600;
setcookie(ID_my_site, $_POST['username'], $hour);
setcookie(Key_my_site, $_POST['pass'], $hour);
//then redirect them to the members area
header(“Location: members.php”);
}
}
}
else
{
// if they are not logged in
?>
<form action="” method=”post”>

Login

Username:
Password:

Register.php:

Registered

Thank you, you have registered – you may now login.

<form action="” method=”post”>

Username:
Password:
Confirm Password:

members.php:
<?php
mysql

Both comments and pings are currently closed.

2 Responses to “Php Syntax Error In Logout Script!?”

  1. Bourne says:

    Am not sure about this but its parsed fine on my pc,
    try bracketing the cookie name maybe its not parsed?
    setcookie(“ID_my_site”, gone, $past);
    < ?php
    $past = time() - 100;
    //this makes the time in the past to destroy the cookie
    setcookie(ID_my_site, gone, $past);
    setcookie(Key_my_site, gone, $past);
    header("Location: login.php");
    ?>

  2. Beast Answers says:

    Why are you using Cookies to validate a login? It’s better to use Sessions.
    The logout would simply be…
    < ?php
    session_start();
    session_destroy();
    header("Location:index.php");
    ?>
    And it’s a lot safer. Only your own specific server can create a Session for that site.