A little advice with login
Posted: Fri Nov 10, 2006 10:37 am
Hey everyone, sorry for all of the newb questions. I've been trying to create a simple login script and I can't seem to get it to work. Here is the code for login.php. Its not finalized, but I'm just trying to get it working so I can go from there. When the form is submitted, login.php is just a blank white screen so there must be a parse error of some sort.
Is that the proper way to register a session variable? Could that be the problem? I'm sure its something simple that I just can't put my finger on.
Code: Select all
<?php
if (!isset($_POST['submit'])) {
include ('loginform.php');
else {
$username = ($_POST['username']);
$pswd = ($_POST['pswd']);
$query = 'SELECT * FROM users WHERE email = "$username" AND pass = "$pswd"';
$result = mysql_query($query) or die(mysql_error());
$numrow = mysql_num_rows($result);
if ($numrow = "0") {
echo ('That information does not exist in our database, please try again.');
}
else {
$_SESSION['username'] = $username;
echo ('You have logged in successfully!');
}
}
}
?>