Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0
This is the forum to discuss the Wrox book Beginning PHP5, Apache, and MySQL Web Development by Elizabeth Naramore, Jason Gerner, Yann Le Scouarnec, Jeremy Stolz, Michael K. Glass; ISBN: 9780764579660
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old January 5th, 2006, 06:25 PM
Registered User
 
Join Date: Jan 2006
Location: , WI, .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 12 - Not redirect or connect with user

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 12 - User Panel JohnBoy BOOK: Beginning VB.NET Databases 1 June 21st, 2006 11:07 AM
Errors on Chapter 12 example(12.8) sonnie ASP.NET 2.0 Professional 2 June 7th, 2006 10:55 AM
Ch. 12 Connect.asp mcauliff BOOK: Beginning ASP 3.0 2 August 5th, 2005 02:47 PM
Chapter 12 - $_POST['redirect'] problem cshu BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 4 July 25th, 2005 08:14 PM
Beginning ASP 3.0, Chapter 12 (Connect.asp). Richard LaChance BOOK: Beginning ASP 3.0 4 July 24th, 2004 04:12 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.