When a person logs in, it directs them to the index.php band lets them checkout on my checkout page. When i change where i am directing them when they click login it doesnt work, then when they go to check out it keeps asking them to login. Anyone know where i may be going wrong?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<div id="main">
<?php
include "base.php";
if(!empty($_SESSION['LoggedIn']) && !empty($_SESSION['Email']))
{
?>
<h1>Member Area</h1>
<p>Thanks for logging in! Your email address is: <b><?=$_SESSION['Email']?><b>
<ul>
<li><a href="logout.php">Logout.</a></li>
</ul>
<?php
}
elseif(!empty($_POST['email']) && !empty($_POST['password']))
{
$email = mysqli_real_escape_string($_SESSION['base'], $_POST['email']);
$password = md5(mysqli_real_escape_string($_SESSION['base'], $_POST['password']));
$checklogin = mysqli_query($_SESSION['base'], "SELECT * FROM Users WHERE Email = '".$email."' AND Password = '".$password."'");
if(mysqli_num_rows($checklogin) == 1)
{
$row = mysqli_fetch_array($checklogin);
$email = $row['Email'];
$_SESSION['Email'] = $email;
$_SESSION['LoggedIn'] = 1;
}
else
{
echo "<h1>Error</h1>";
echo "<p>Sorry, your account could not be found. Please <a href=\"index.php\">click here to try again</a>.</p>";
}
}
else
{
?>
<h1>Member Login</h1>
<p>Thanks for visiting! Please either login below, or <a href="register.php">click here to register</a>.</p>
<form method="post" action="index.php" name="loginform" id="loginform">
<fieldset>
<label for="email">Email:</label><input type="text" name="email" id="email" /> <br />
<label for="password">Password:</label><input type="password" name="password" id="password" /><br />
<input type="submit" name="login" id="login" value="Login" />
</fieldset>
</form>
<?php
}
?>
</div>
</body>
</html>
And here is the base.php
<?php
session_start();
$dbhost = "localhost"; // this will ususally be 'localhost', but can sometimes differ
$dbname = "Abandoned"; // the name of the database that you are going to use for this project
$dbuser = "root"; // the username that you created, or were given, to access your database
$dbpass = ""; // the password that you created, or were given, to access your database
$base = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname); if (!$base){
echo "<p>server connection error:
mysqli_connect_error()</p>";
}
$_SESSION['base'] = $base; //database connection status transfer;
?>