Jump to content

Register session as infinity


aniesh82

Recommended Posts

I tried by editing the php.ini

 

I have set 

ini_set("session.gc_maxlifetime","864000"); 

ini_set('session.cookie_lifetime',"864000"); 

in the php script and added one php.ini file in the directory which it executes. But session get expired after some hours.

 

Thanks in advance.

 

hello ToonMariner,

 

When we login in PHPFREAKS  can select any the option from select box like one hour, 2 hour, one day etc. Did you note that ?

 

I closed my browser and I returned on the next I saw that  login exists. How it happened?

 

 

 

Thorpe, Thanks for your reply.

 

So it is not possible to do this using sessions?

 

I am not sure but I think that, session id is stored in browser as a cookie, when we register a new session by server to identify the browser.

 

If this happen, how is not possible to store the session id as a cookie exists forever like you says ?

Let's pretend that you're coding some form of login script.... The suedo-php for this could be as follows:

 

if(session is set) {
show page
}
else {
if(cookie containing username and password is set) {
	if(username and pass are correct) {
			set session
			set cookie (if you want to...)
			exit script
	}
	else {
		unset cookie
		echo wrong pass
	}
}
elseif(POST data containing username and password is set) {
	if(username and pass are correct) {
		set session and cookie
		refresh page
		exit script
	}
	else {
		echo wrong pass
	}
}
}

html form for logging in goes here

 

It could actually be done a little shorter/more efficiently, but in suedo-code, that seemed like the best way.

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.