User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 455,976 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,797 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 758 | Replies: 1
Reply
Join Date: Nov 2007
Posts: 1
Reputation: pdb is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
pdb pdb is offline Offline
Newbie Poster

How to expire pages? (prevent clicks on old ones)

  #1  
Nov 28th, 2007
Hello,

I've read all about how to expire a session, but this doesn't seem to be what I need. (unless I misunderstood it) The way I understand sessions, it's all about expiring the _cache_. Here's what I want:

I want to allow my site visitors to search without logging in.

However, once they have a search results page, I don't want them to be able to leave it for days, and then come back and click on one of the links. (and have that old data sent to the server for processing)

Instead, as soon as they click _anywhere_ on an old page, I want a dialog box telling them it's expired to come up, and I want the page to erase itself.

But.....maybe I don't have to worry about this at all? Once I load my site onto a web host's server, perhaps it will do this automatically? I'm currently developing my site locally using a local Apache server.

If you got a good laugh out of this question, could you explain the joke to me?? I'm brand new to php, so please don't answer in acronyms! :-)

Thank you!
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Nov 2007
Location: Arkansas
Posts: 416
Reputation: buddylee17 will become famous soon enough buddylee17 will become famous soon enough 
Rep Power: 3
Solved Threads: 81
buddylee17's Avatar
buddylee17 buddylee17 is offline Offline
Posting Pro in Training

Re: How to expire pages? (prevent clicks on old ones)

  #2  
Nov 28th, 2007
A Session generally expires when the browser is closed. Just set the Session variable on the page that you want the user to access the search result through. Then on the search result page have a simple script like:
  1. session_start();
  2. if(!$_SESSION['loggedin']="valid")
  3. {
  4. header ('Location:login.php');
  5. }
Notice the !(not sign). This will tell the server that if they are not logged in, to redirect them to the page (I used login.php) that you want them to go to.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the PHP Forum

All times are GMT -4. The time now is 9:21 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC