php login error please help me

i have this error:
Parse error: syntax error, unexpected ‘else’ (T_ELSE) in C:\wamp\www\login.php on line 11

please help
here is my code:

<?php include 'core/init.php'; [php]if (empty($_POST) === false) { $username = $_POST['username']; $password = $_POST['password']; if (empty($username) == true || empty($password) === true); { $errors[] = 'You need to enter a username and password'; } else if (user_exists($username) === false) { $errors[] = 'We can not find that username. Have you registred?'; } } ?>[/php]

please answer soon :).

You have an unnecessary semi-colon here after your if condition, remove it

[php]if (empty($username) == true || empty($password) === true); {[/php]

Hi, I am a beginner in php and have a problem with the login page. here is the error I get:

Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\Blogtastic\login.php on line 61

and here is my code:

<?php session_start(); require("config.php"); $db = mysql_connect($dbhost, $dbuser, $dbpassword); mysql_select_db($database, $db); if($_POST['submit']) { $sql = "SELECT * FROM logins WHERE username = '" . $_POST['username'] . "' AND password = '" . $_POST['password'] . "';"; $result = mysql_query($sql); $numrows = mysql_num_rows($result); if($numrows == 1) { $row = mysql_fetch_assoc($result); session_register("USERNAME"); session_register("USERID"); $_SESSION['USERNAME'] = $row['username']; $_SESSION['USERID'] = $row['id']; header("Location: " . $config_basedir); } else { header("Location: " . $config_basedir . "/login.php?error=1"); } } else { require("header.php"); if($_GET['error']) { echo "Incorrect login, please try again!"; } ?>
Username
Password input type="password" name="password">

}

require(“footer.php”);

I appriciate if someone can help me to solve this problem.
Thank you

Magie, you need to re-open your PHP tags at the bottom:

[php]

<?php } require("footer.php"); ?>

[/php]

Thanks, that helped.

Sponsor our Newsletter | Privacy Policy | Terms of Service