•
•
•
•
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
![]() |
•
•
Join Date: Nov 2007
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
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!
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!
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:
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.
php Syntax (Toggle Plain Text)
session_start(); if(!$_SESSION['loggedin']="valid") { header ('Location:login.php'); }
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Other Threads in the PHP Forum
- Previous Thread: checkbox array storage and retrieval
- Next Thread: regular expression


Linear Mode