Wrox Programmer Forums
|
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
 
Old May 6th, 2006, 07:27 PM
Registered User
 
Join Date: May 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default chapter 16 - Problems with sessions.

hello.

when i had sucsesfully completed the board in chapter 16, i've found ou that you coud get acsess to the adminCP with typing /admin.php into the browser. how can i get adim.php to redirect all who is not logged in, to the login site?

coud really need to get that fixed..

 
Old May 7th, 2006, 04:27 AM
Authorized User
 
Join Date: Mar 2006
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi kb90 to stop people from accessing the admincp if they are not the admin or not logged in you'll want to read page 701 in the book for the answer.

Basically all you have to do is add the following to the very top of admin.php page:
Code:
<?php
session_start();

include "http.php";

if($_SESSION['access_lvl'] < 3)
{
    redirect('index.php');
}

?>
 
Old May 7th, 2006, 12:41 PM
Registered User
 
Join Date: May 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks!

didnt notice the excercises :P



 
Old April 11th, 2008, 09:07 AM
Registered User
 
Join Date: Sep 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have just added that code to my admin page but now when I log in and go to the admin page I get this

'Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in my directory'

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in my directory on line 21
Access denied for user 'ODBC'@'localhost' (using password: NO)'

Had no problems when the new code wasn't there?







Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 16, Message Board Header Problems markdean BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 5 January 30th, 2011 08:44 AM
Chapter 16 Fig 16-11 krsouthern BOOK: Professional SharePoint 2007 Development ISBN: 978-0-470-11756-9 1 July 8th, 2008 12:11 PM
Problems in chapter 15 and 16 sgeorgiev BOOK: Ivor Horton's Beginning Visual C++ 2008 ISBN: 978-0-470-22590-5 0 May 7th, 2008 11:57 PM
Chapter 16 problems silas428 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 1 January 4th, 2008 06:32 PM
Problems with Sessions HelpWanted ASP.NET 1.0 and 1.1 Basics 2 December 7th, 2006 04:56 PM





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