lundi 8 février 2016

Parse error: syntax error, unexpected 'else' (T_ELSE) in C:\xampp3\htdocs\wb_html\login.php on line 8

I' am tryin to make a registration and login system for my website and I am getting the parse error:syntax error unexpected 'else'(T_ELSE) in the login file when I click on login what could be the problem? Below is the file with the code:

    <?php
//include config
require_once('includes/config.php');

//check if already logged in move to home page
if($user->is_logged_in()){ 
    header('Location: index.php'); 
}
}
else
{

echo "<a href=register.php>Register</a>  <a href=login.php>Login</a>";
}   

//process login form if submitted
if(isset($_POST['submit'])){

    $username = $_POST['username'];
    $password = $_POST['password'];

    if($user->login($username,$password)){
        $_SESSION['username'] = $username;
        header('Location: memberpage.php');
        exit;

    } else {
        $error[] = 'Wrong username or password or your account has not been activated.';
    }

}//end if submit

//define page title
$title = 'Login';

Aucun commentaire:

Enregistrer un commentaire