p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > PHP/MySQL > BOOK: Professional CodeIgniter ISBN: 978-0-470-28245-8
I forgot my password Register Now
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 p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 5th, 2009, 05:41 PM
Registered User
Points: 94, Level: 1
Points: 94, Level: 1 Points: 94, Level: 1 Points: 94, Level: 1
Activity: 64%
Activity: 64% Activity: 64% Activity: 64%
 
Join Date: Nov 2009
Posts: 25
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old November 6th, 2009, 09:54 AM
Wrox Author
Points: 206, Level: 4
Points: 206, Level: 4 Points: 206, Level: 4 Points: 206, Level: 4
Activity: 23%
Activity: 23% Activity: 23% Activity: 23%
 
Join Date: May 2008
Location: Austin, TX, USA.
Posts: 52
Thanks: 0
Thanked 4 Times in 4 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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old November 6th, 2009, 05:22 PM
Registered User
Points: 94, Level: 1
Points: 94, Level: 1 Points: 94, Level: 1 Points: 94, Level: 1
Activity: 64%
Activity: 64% Activity: 64% Activity: 64%
 
Join Date: Nov 2009
Posts: 25
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #4 (permalink)  
Old November 6th, 2009, 05:43 PM
Wrox Author
Points: 206, Level: 4
Points: 206, Level: 4 Points: 206, Level: 4 Points: 206, Level: 4
Activity: 23%
Activity: 23% Activity: 23% Activity: 23%
 
Join Date: May 2008
Location: Austin, TX, USA.
Posts: 52
Thanks: 0
Thanked 4 Times in 4 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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #5 (permalink)  
Old November 7th, 2009, 03:44 AM
Registered User
Points: 94, Level: 1
Points: 94, Level: 1 Points: 94, Level: 1 Points: 94, Level: 1
Activity: 64%
Activity: 64% Activity: 64% Activity: 64%
 
Join Date: Nov 2009
Posts: 25
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');
    }
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #6 (permalink)  
Old November 7th, 2009, 04:30 AM
Registered User
Points: 94, Level: 1
Points: 94, Level: 1 Points: 94, Level: 1 Points: 94, Level: 1
Activity: 64%
Activity: 64% Activity: 64% Activity: 64%
 
Join Date: Nov 2009
Posts: 25
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".
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Log in page error zhugeliang ASP.NET 2.0 Basics 0 July 16th, 2006 05:14 PM
Error message with asp page runsrealfast ASP Forms 1 March 21st, 2005 04:35 PM
Log out disable back button cyber_kaley ASP Forms 4 January 21st, 2005 12:35 AM
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 12:27 PM



All times are GMT -4. The time now is 05:25 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc