У меня проблема с тем, что мои переменные сеанса не устанавливаются / сохраняются.
Вот мой код:
index.php имеет:
<? //this is first line of page
session_start();
?>
<form action="admin_process_login.php" method="post">
<p>EMAIL</p><input name="email" type="text">
<p>PASSWORD</p><input name="password" type="password" />
<input type="submit" value="Enter">
</form>
admin_process_login.php
<? //this is first line of page
session_start();
$useremail = $_POST['email'];
$postpassword = $_POST['password'];
include('admin_config.php');
if ($postpassword != "" && $useremail != "") {
//Connect to database
mysql_connect("localhost", $dbusr, $dbpass) or die(mysql_error());
mysql_select_db("studioel_dental") or die(mysql_error());
//Look for a matching email/password
$query = "SELECT *
FROM users
WHERE users.email = '$useremail'
AND users.password = '$postpassword'";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);
if(mysql_num_rows($result)==0){
header("Location: http://www.dentalbenefitprogram.com/admin.php?error=nomatch");
} else {
//set session variables and load supplies page
$uid = $row['id'];
$unamex = $row['name'];
$uemailx = $row['email'];
$utypex = $row['type'];
$_SESSION['userid']=$uid;
$_SESSION['uname']=$unamex;
$_SESSION['uemail']=$uemailx;
$_SESSION['utype']=$utypex;
header("Location: http://www.dentalbenefitprogram.com/admin_groups.php");
exit;
};
} else {
//email or password fields were blank. Return to login page
header("Location: http://www.dentalbenefitprogram.com/admin.php?error=blank");
};
?>
Вероятно, вы можете догадаться: переменные сеанса не устанавливаются ...
Любая помощь приветствуется!