Hello,
I write all codes of the book but when I try access with admin.login.php with my login and password send me a this URL :
http://www.xxxx/admin_login.php?redi...a&submit=login
and not the admin_area.php
I change in db admin the field admin_level 0,1,2 but I not solve the problem.
This is admin.login.php
---------------------------------
<?php
session_start();
include "conn.inc.php";
if (isset($_POST['submit'])) {
$query ="SELECT username, password, admin_level FROM admin WHERE username ='".$_POST['username']."' AND password=(password('".$_POST['password']."'))";
$result= mysql_query($query)
or die(mysql_error());
$row = mysql_fetch_array($result);
if (mysql_num_rows($result)==1) {
$_SESSION['admin_logged'] = $_POST['username'];
$_SESSION['admin_password'] = $_POST['password'];
$_SESSION['admin_level'] = $row['admin_level'];
header("Refresh:5; URL=".$_POST['redirect']."");
echo "You are being redirected to our original page request!<br>";
echo "(If our browser doesn't support this, ".
"<a href=\"".$_POST['redirect']."\">Click here</a>)";
} else {
?>
<html>
<head>
<title> ERROR IN ADMIN ZONE </title>
</head>
<body>
<p>
Invalid Username or Password!<br>
<form action="admin_login.php" method="post">
<input type="hidden" name="redirect"
value="<?php echo $_POST['redirect']; ?>">
Username: <input type="text" name="username"><br>
Password" <input type="password" name="password"><br><br>
<input type="submit" name="submit" value="login">
</form>
</p>
</body>
</html>
<?php
}
}else{
if (isset($_GET['redirect'])) {
$redirect = $_GET['redirect'];
} else {
$redirect = "index.php";
}
?>
<html>
<head>
<title> Admin Zone </title>
</head>
<body>
<p>
Login below by supplying your username/password...<br>
<form action="admin_login.php" action="post">
<input type="hidden" name="redirect"
value="<?php echo $redirect; ?>">
Username: <input type="text" name="username"><br>
Password: <input type="password" name="password"><br><br>
<input type="submit" name="submit" value="login">
</form>
</p>
</body>
</html>
<?php
}
?>
----------------------------------------
Could your help me with this file.
Alerian.net
WebDesign in Spanish