I tried to log in and it doesn't log in and go to the user.php I am not sure what to do next or what is wrong.
You can try to test this at
http://www.mesquitechristmas.com/local/login.php
email: test1@test.com
password: 22250916
All it does it refresh with no error
Here is the code.
<?php
include ('db_connect.php');
if (isset($_POST['submit']))
{
if ($_POST['email'] == "" || $_POST['password'] == "")
{
echo "it enters the missing fields box";
$error = 'Please fill in all fields.'; // here, they have not filled in either the username OR the password. Set an error.
}
else
{
// email and password sent from signup form
$email=$_POST['email'];
$password=$_POST['password'];
$sql="SELECT * FROM users WHERE email='$email' and password='$password'";
$result=mysql_query($sql);
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $email and $password, table row must be 1 row
if($count==1)
{
// Register $email, $password and redirect to file "user.php"
$_SESSION['hasLoggedIn'] = 1;
//get the users id that is associated with him
$SQL2 = "SELECT * FROM users WHERE email='$email'";
$result2 = mysql_query($SQL);
$row = mysql_fetch_assoc($result);
//store the id in the session for use
$_SESSION['userID'] = $row['id'];
session_register("email");
session_register("password");
header("location:user.php");
}
}
}
?>
-Thanks