Wrox Programmer Forums

Need to download code?

View our list of code downloads.

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 May 6th, 2006, 07:27 PM
Registered User
 
Join Date: May 2006
Location: , , .
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..

Reply With Quote
  #2 (permalink)  
Old May 7th, 2006, 04:27 AM
Authorized User
 
Join Date: Mar 2006
Location: , , United Kingdom.
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');
}

?>
Reply With Quote
  #3 (permalink)  
Old May 7th, 2006, 12:41 PM
Registered User
 
Join Date: May 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks!

didnt notice the excercises :P



Reply With Quote
  #4 (permalink)  
Old April 11th, 2008, 09:07 AM
Registered User
 
Join Date: Sep 2007
Location: , , .
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?


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 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



All times are GMT -4. The time now is 12:21 PM.


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