Jump to content

activate $_SESSION variable


ochi

Recommended Posts

Ops, ok, I'll tell you what I want to do, it cant be so difficult!!!!

 

My structure is: index.php (with user/password autentication) and page2.php and logout.php

 

I want to forbid users write in the browser: http://xx.xx.xx.xx/page2.php it should redirect to index.php. I suposse that the solution is $_SESSION variables, but it's not as simple as it looks.

 

If I activate $_SESSION['page2'] when the user introduce the correct user and password, but he close the browser before than puss the "page2" link, this variable is set and the next time the browser is open it'll be possible write http://xx.xx.xx.xx/page2.php

 

Thanks! regards

Hello again, in my php.ini  "session_timeout" doesnt exist. I was looking for it in google, and i found that it is:

session.gc_maxlifetime 

 

I change it to 60 (seconds as it's said in php.ini), after this I tried it waiting for 2 minutes:

 

if(isset($_SESSION['auth'])){
   echo "session establised";
}

 

and "session establised" is writed.

 

Other thing:

; Lifetime in seconds of cookie or, if 0, until browser is restarted.
session.cookie_lifetime = 0

 

When I close the browser and open it again, SESSION variables should exist? they do.

 

Thanks. REgards

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.