Jump to content


Photo

Session problem


  • Please log in to reply
8 replies to this topic

#1 marshall

marshall
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 31 July 2006 - 02:32 PM

Well, it's very simple..

I have a session with a expiring time...

When session expire, I would like to redirect the site...

Which variable should I set or which function should I use ?

#2 hackerkts

hackerkts
  • Members
  • PipPipPip
  • Advanced Member
  • 593 posts
  • LocationSingapore
  • Age:18

Posted 31 July 2006 - 02:37 PM

If you want to have a expire time, then I would suggest you to use cookie.

Regards,
hackerkts

To be a coder, you must learn how to think and not to give up so easily.


#3 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 31 July 2006 - 02:41 PM

If you want to have a expire time, then I would suggest you to use cookie.

Sessions does use a cookie!

Also marshall I dont think what you are trying to do is possible.

#4 hackerkts

hackerkts
  • Members
  • PipPipPip
  • Advanced Member
  • 593 posts
  • LocationSingapore
  • Age:18

Posted 31 July 2006 - 02:48 PM

But session allow to set the time it expires ?

Regards,
hackerkts

To be a coder, you must learn how to think and not to give up so easily.


#5 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 31 July 2006 - 02:52 PM

Yess sessions does have time limit until the session timesout, however redirecting the user when the session expires isnt possble I dont think, that is what I meant.

#6 hackerkts

hackerkts
  • Members
  • PipPipPip
  • Advanced Member
  • 593 posts
  • LocationSingapore
  • Age:18

Posted 31 July 2006 - 02:54 PM

Ok, thanks for the explaination.
And I still think he should use a cookie instead of session, since you can set the seconds until the cookie ends and will redirect to other page as marshall mention.

Regards,
hackerkts

To be a coder, you must learn how to think and not to give up so easily.


#7 pedrobcabral

pedrobcabral
  • Members
  • PipPipPip
  • Advanced Member
  • 108 posts

Posted 31 July 2006 - 02:56 PM

I do not have shoure but i guess you mush change the value (seconds) "session.cookie_lifetime" in your php.ini file that is set as 0 as default. - expires when user closes the browser. Maybe you would have to check if a var is set, and if not redirect with something like <script>window.location="www.something.com";</script>

Do not know if it would work.

#8 king arthur

king arthur
  • Members
  • PipPipPip
  • Advanced Member
  • 335 posts
  • LocationUK HQ

Posted 31 July 2006 - 03:20 PM

Ok, thanks for the explaination.
And I still think he should use a cookie instead of session, since you can set the seconds until the cookie ends and will redirect to other page as marshall mention.


You can certainly set the time until a cookie expires but it still won't cause anything to be redirected.
Sir Isaac Newton said "If I have seen farther, it is by standing on the shoulders of giants". But it is not recorded as to whether he said it before or after he was hit on the head by a falling apple.

#9 pedrobcabral

pedrobcabral
  • Members
  • PipPipPip
  • Advanced Member
  • 108 posts

Posted 31 July 2006 - 03:21 PM

Maybe.. unless you check if session does or not exists..




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users