dmathew Posted March 23, 2011 Share Posted March 23, 2011 Hi When I get the Chapter 16 example up and running I noticed the following: If I login from the index page, I get the “Welcome to this site” page – as expected. The navigation links now show “logout” as one of the options. If I then hit the back button on my browser, it takes me back to the login page, again as expected. There is no change to the links, though. So I now have a logout and change password link on the navigation list) but a login main page. Any ideas for how I can get over this? Is it a security risk? I tried the same on amazon, where I seemed to be instantly logged out when I hit the back button, which I guess may be better from a security point of view… I am implementing my own site now, so the security side is paramount for me. Any help appreciated. Link to comment Share on other sites More sharing options...
Larry Posted March 23, 2011 Share Posted March 23, 2011 It's not a security risk, it's a caching issue. When you click "back", the browser tries to reload the previously-cached version. To force the page to be reload, you'll need to send "no cache" headers. I don't have the code off the top of my head, but I think it may be on the PHP manual page for the header() function. Link to comment Share on other sites More sharing options...
dmathew Posted March 23, 2011 Author Share Posted March 23, 2011 Fab - thanks very much for the info Link to comment Share on other sites More sharing options...
Stuart Posted March 23, 2011 Share Posted March 23, 2011 header("Last-Modified: Wed, 23 Mar 2011 21:42:00 GMT"); header("Expires: Tue, 22 Mar 2011 21:42:00 GMT"); header("Pragma: no-cache"); header("Cache-Control: no-cache"); Here's the code from Larry's PHP 5 Advanced for ensuring a page is not cached by browsers, servers etc... But like Larry says it's no a security issue to worry about. 1 Link to comment Share on other sites More sharing options...
Larry Posted March 24, 2011 Share Posted March 24, 2011 Thanks for posting that, Stuart! I knew I had seen it somewhere.... Link to comment Share on other sites More sharing options...
dmathew Posted March 24, 2011 Author Share Posted March 24, 2011 Thanks for posting that, Stuart! I knew I had seen it somewhere.... Link to comment Share on other sites More sharing options...
dmathew Posted March 24, 2011 Author Share Posted March 24, 2011 Excellent - looks like I need to embark on PHP 5 Advanced then..... is that due a new edition later this year by any chance? Link to comment Share on other sites More sharing options...
Larry Posted March 25, 2011 Share Posted March 25, 2011 Thanks for the interest in the book. The publisher has just agreed to a third edition of that book, but no deal is in place yet, so it'll be probably a year from now before the third edition is out. If you want to buy the 2nd edition now, I'll go ahead and offer you a free copy of the third edition when it is released. Link to comment Share on other sites More sharing options...
dmathew Posted March 25, 2011 Author Share Posted March 25, 2011 Well that's a no brainer, and very kind - have just ordered it on amazon. (I went through the link here on the site, but had to amend to amazon.co.uk so hope they still realise it came through here) Link to comment Share on other sites More sharing options...
Larry Posted March 25, 2011 Share Posted March 25, 2011 Thanks! When the third edition of the book comes out, just send me an email and remind me of this conversation. If you subscribe to the newsletter, you'll be notified of the book's status that way. To be clear, I don't even have a deal yet for this book, but the publisher is interested. Thanks for trying to credit me through the link, too. Not sure if that'll work, but I appreciate the effort (I'm generally opposed to advertising, but that Amazon widget is just about covering the cost of my hosting). Link to comment Share on other sites More sharing options...
Recommended Posts