Page 1 of 1

How to do browser information disable php

Posted: Sat May 09, 2009 5:38 am
by divya
Hello,
I am a new to PHP.
I have Login page (user name field, passwrod field and login button)
after successfull login (check in database), it goes to the "Information page" where some information is displying from database.
it is working fine.
But the problem is,
when I copy the browser link--> http://localhost/myproject/display_info.php
and close the window
starting a new browser and pasting the browser--> http://localhost/myproject/display_info.php

it is directly displaying the information page.
I want it will go to the login page again..

I dont knw how to do it..

Please help me out
thanks in advance

divya

Re: How to do browser information disable php

Posted: Sat May 09, 2009 8:26 am
by mickd
Could you post the code you have for that page please? (The bit that's handling the login part).

You'll need to check your cookie/session to see if you're logged in or not, then if they aren't, redirect them using header.

EDIT: Ah yes, i misunderstood what you meant, ignore this :)

Re: How to do browser information disable php

Posted: Sat May 09, 2009 8:27 am
by jazz090
hmm look in your php.ini configuraion. i assume you are using sessions to pass user data from page to page. chances are that session data as been set to not erase data once the browser has closed. but before going around in yout php.ini file, set this code in all your pages before session_start() to see whether if this is the problem:

Code: Select all

ini_set('session.gc_maxlifetime',0);
that line will force php to delete all session data once the browser has closed. if that worked, find that value in php.ini and change it there so you dont have to keep running that code over and over again.