Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > BOOK: Professional CodeIgniter ISBN: 978-0-470-28245-8
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional CodeIgniter ISBN: 978-0-470-28245-8
This is the forum to discuss the Wrox book Professional CodeIgniter by Thomas Myer; ISBN: 9780470282458
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional CodeIgniter ISBN: 978-0-470-28245-8 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 November 5th, 2009, 05:41 PM
Authorized User
 
Join Date: Nov 2009
Posts: 26
Thanks: 3
Thanked 0 Times in 0 Posts
Red face Error message when I click go back one page after log out

First I log in and log out from admin.

Then when I click go back button of a browser, I get the following error messages.

Also when I visit /index.php/admin/dashboard directly without logging-in I get the same error messages.

Could anyone tell me how to fix the problem please?


Thanks in advance.

Quote:
A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: admin/dashboard.php

Line Number: 8

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\codeigniter_shopping\system\librar ies\Exceptions.php:166)

Filename: helpers/url_helper.php

Line Number: 539

Last edited by phpcoder101; November 5th, 2009 at 05:51 PM..
Reply With Quote
  #2 (permalink)  
Old November 6th, 2009, 09:54 AM
Wrox Author
 
Join Date: May 2008
Location: Austin, TX, USA.
Posts: 53
Thanks: 0
Thanked 5 Times in 5 Posts
Default this was another last-minute thing

Your dashboard controller should start like this:

Code:
class Dashboard extends Controller {
  function Dashboard(){
    parent::Controller();
    session_start();
    
	if (isset($_SESSION['userid']) && $_SESSION['userid'] < 1){
    	redirect('welcome/verify','refresh');
    }
  }
what is your email address so I can send you the ZIP archive I have?
__________________
Thomas Myer
Author, Professional CodeIgniter
http://www.tripledogs.com
Reply With Quote
  #3 (permalink)  
Old November 6th, 2009, 05:22 PM
Authorized User
 
Join Date: Nov 2009
Posts: 26
Thanks: 3
Thanked 0 Times in 0 Posts
Default Thanks but I think ...

Thanks. I changed all the files in admin folders, then it works.

When I click "go back" button, it automatically log-in.

However I think once, you log-out, it should require log-in again rather taking you to admin again. I think it is more secure.

If I want to do it, what I should do it?

okada.shin[at]google[dot]com

Thanks in advance.

Last edited by phpcoder101; November 6th, 2009 at 05:39 PM..
Reply With Quote
  #4 (permalink)  
Old November 6th, 2009, 05:43 PM
Wrox Author
 
Join Date: May 2008
Location: Austin, TX, USA.
Posts: 53
Thanks: 0
Thanked 5 Times in 5 Posts
Default hmmmmm....

confused...isn't it already knocking you out to welcome/verify if you aren't logged in?
__________________
Thomas Myer
Author, Professional CodeIgniter
http://www.tripledogs.com
Reply With Quote
  #5 (permalink)  
Old November 7th, 2009, 03:44 AM
Authorized User
 
Join Date: Nov 2009
Posts: 26
Thanks: 3
Thanked 0 Times in 0 Posts
Default Me too.

I tested with FF and chrome.

I loged in and loged out.

Then when I click "Go Back" button, I can go to admin still.

It should ask to log in again.

I have the following codes in all the files in the admin folder as you suggested.

Code:
  
...
...
parent::Controller();
    session_start();
    
	if (isset($_SESSION['userid']) && $_SESSION['userid'] < 1){
    	redirect('welcome/verify','refresh');
    }
Reply With Quote
  #6 (permalink)  
Old November 7th, 2009, 04:30 AM
Authorized User
 
Join Date: Nov 2009
Posts: 26
Thanks: 3
Thanked 0 Times in 0 Posts
Default Solved.

All the line in admin files have this line.

Code:
if ($_SESSION['userid'] < 1){
redirect('welcome/verify','refresh');

I changed to the following.

Code:
if (!isset($_SESSION['userid']) || $_SESSION['userid'] < 1){
	$this->session->set_flashdata('error',"You must log in!");  
    	redirect('welcome/verify','refresh');
Then it does not take you admin any more and take you to index page with flash message "You must log in".
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
Log in page error zhugeliang ASP.NET 2.0 Basics 0 July 16th, 2006 04:14 PM
AppException Class -Log Error to Event Log bekim BOOK: ASP.NET Website Programming Problem-Design-Solution 7 December 7th, 2004 01:01 PM
Error Message: The page cannot be displayed BSkelding ASP.NET 1.0 and 1.1 Basics 2 April 23rd, 2004 11:27 AM



All times are GMT -4. The time now is 07:38 PM.


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