Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0
Password Reminder
Register
Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 04:24 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.