Login Page Problems
Posted: Sat Apr 03, 2010 10:03 am
Hi i've written a login page with the help of an online tutorial here (http://www.howtodothings.com/computers- ... ur-website), but im having a hard time to get it to work i created 2 pages one where the user submits the data using a form and another file containig php script to do the actual login
here is what i have on the JMSystemLogin.php page
and here is what i have inthe log.php file
when i try to test it all i get is a blank page.
im using MySQL InnoDB on XAMPP. im a bit of a noob when it comes to this stuff, any help or advice is very much appreciated.
here is what i have on the JMSystemLogin.php page
Code: Select all
<?
session_name("JMSLogin");
session_start();
session_destroy();
if($_GET['JMSLogin'] == "failed") {
print htmlentities($_GET['cause']);
}
?>
<form name="login_form" method="post" action="log.php?action=JMSLogin">
Login: <input type="text" name="user"><BR>
Password: <input type="password" name="pwd"><BR>
<input type="submit">
</form>Code: Select all
<?
session_name("JMSLogin");
session_start();
if($_GET['action'] == "JMSLogin") {
$conn = mysql_connect("localhost","user","password");
$db = mysql_select_db("JMSystemDB");
$name = $_POST['user'];
$q_user = mysql_query("SELECT * FROM Employee WHERE EmployeeID='$name'");
if(mysql_num_rows($q_user) == 1) {
$data = mysql_fetch_array($q_user);
if($_POST['pwd'] == $data['SystemPassword']) {
session_register("Forename");
header("Location: Jobs.php");
exit;
} else {
header("Location: JMSystemLogin.php?login=failed&cause=".urlencode('Wrong Password'));
exit;
}
} else {
header("Location: JMSystemLogin.php?login=failed&cause=".urlencode('Invalid User'));
exit;
}
}
if(session_is_registered("Forename") == false) {
header("Location: JMSystemLogin.php");
}
?> im using MySQL InnoDB on XAMPP. im a bit of a noob when it comes to this stuff, any help or advice is very much appreciated.