Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
08-25-2003, 11:55 PM
|
#1
|
Member
Registered: Jul 2003
Distribution: Red Hat, Fedora, Debian
Posts: 85
Rep:
|
Problem with php sessions
hi all,
well i m facing problem with the sessions in PHP.
i m developing PHP based MTP , for which i require session info to be passed between diff php files.
my first prob is related with security, when i create a session my session info is kept in a file in /tmp and is accessible by root. i want to restrict root to access this info as it contains some secured information.
my second prob is when i log out of my service, a logout script is called that will unregister variables and destroy sessions but when i click the back button in my browser, browser displays the prev page, ie page which can only be accessible by authorized user.
i will appriciate ur help
thanx in advance
|
|
|
08-26-2003, 12:49 AM
|
#2
|
Member
Registered: Aug 2003
Location: Belgium
Distribution: Debian (server), Kubuntu (desktop)
Posts: 248
Rep:
|
First of all, you can choose where your session file is saved, check the php.ini file for the session path variable. You can than restrict access to the folder you choose to save your sessions in.
Second question: on the 'secured' page, you could always check if a certain session variable is present and if it isn't, redirect the user to a different page.
|
|
|
08-26-2003, 01:07 AM
|
#3
|
LQ Newbie
Registered: Aug 2003
Posts: 8
Rep:
|
Hi -
For your first problem, I'd say move that session directory to somewhere else than just /tmp , like somewhere just outside your document root. (Edit your php.ini file like mentioned above). root owns, you can't prevent root from doing anything, so locking down a file from him isn't possible.(without something like a pbmaster type of root-management system, I'm not sure) You can however, lock out just about anyone else, so set permissions on the directory your writing them too. Just make sure whatever user apache is running as for your site, has permissions.
For the second problem, take a look at 'no-cache headers'.
In php, I believe: header("Pragma: no-cache");
that'll tell the browser (and proxies) not to cache your data. You can force a refresh of the secure page right after the logout, forcing the browser to re-request from the server. The server will deliver a new version of that page (the 'i'm logged out version') , rewriting it's cache.
I don't claim these are the only solutions, nor that they are note-perfect. Search for 'no-cache header' on google and read up.
Hope that helps.
Last edited by Sliptwixt; 08-26-2003 at 01:17 AM.
|
|
|
08-26-2003, 01:35 AM
|
#4
|
Member
Registered: Aug 2003
Location: Belgium
Distribution: Debian (server), Kubuntu (desktop)
Posts: 248
Rep:
|
I don't think it's a question of cache here, I think sashhoney just doesn't want the page to be displayed again when a user has logged out. So not even without session data. That is why I suggested checking a session variable.
But maybe I misunderstood the question, that's possible too.
|
|
|
08-26-2003, 02:59 AM
|
#5
|
LQ Newbie
Registered: Aug 2003
Posts: 8
Rep:
|
Yeah, I'm not sure then that I understand it completely either.
The problem with checking a session variable is that
the check is server-side. When the user hits 'Back',
the browser is delivering the cached version. There is
no data sent to the server for it to verify.
Don't get me wrong, checking sessions is the way I prefer to do things. However, a user having access to page they
just logged out of is not big concern for me in most of my applications. He just seems to be particulary concerned about
this, so that's my suggestion.
|
|
|
08-26-2003, 03:43 AM
|
#6
|
Member
Registered: Aug 2003
Location: Belgium
Distribution: Debian (server), Kubuntu (desktop)
Posts: 248
Rep:
|
My mistake. Indeed, if the user hits back the server will never get the chance to check the session because the page is loaded from cache.
So disabling the cache in php.ini should work (as Sliptwixt already suggested).
|
|
|
08-28-2003, 06:00 AM
|
#7
|
Member
Registered: Jul 2003
Distribution: Red Hat, Fedora, Debian
Posts: 85
Original Poster
Rep:
|
hi
thanx for giving this suggestion
i went through php.ini and modify session entries and
also i used 'Cache control' with header function.
now the problem is solved
thanx again
|
|
|
08-28-2003, 07:30 AM
|
#8
|
Member
Registered: Aug 2003
Location: Belgium
Distribution: Debian (server), Kubuntu (desktop)
Posts: 248
Rep:
|
You're very welcome.
|
|
|
All times are GMT -5. The time now is 09:04 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|