Jump to content
MakeWebGames

Auto Log out


Scipol

Recommended Posts

PHP manual, A.K.A. the link he just put..

 

Set cookie parameters defined in the php.ini file. The effect of this function only lasts for the duration of the script. Thus, you need to call session_set_cookie_params() for every request and before session_start() is called.

So in globals.php

Link to comment
Share on other sites

I refer you again to session_set_cookie_params() and indeed the remainder of the session_xxx function suite. It is far from useless as our talented friend above claims, as many web developers can attest to. The note referred to above was unfortunately written by somebody who failed to understand how session cookies themselves work both at server and client ends.

"How do I get results from a MySQL database" may be answered simply by a link to the mysql_query() documentation, however it should be apparent to anybody how has taken the time to at least make a cursory glance at the documentation that mysql_connect(), mysql_close(), mysql_fetch_array(), mysql_free_result() are all important.

Likewise in this case - my initial link is a pointer the primary reading point of the documentation - I would expect people to take the time to read further, to try and understand the ins and outs of the tools at their fingertips.

Is this not after all a programming forum? If the OP simply can't be arsed to do the work him/herself, then fine - I say go ask Jeeves/Google or whatever your poison is, but don't clutter up the board with dumb requests. If however it is indeed a programming forum, then isn't it better to have a pointer in the right direction - which in turn may lead to the OP learning things that obviously other people here haven't taken the time to.

Link to comment
Share on other sites

What you say is true.

But as you mentioned this is a programming forum, and not a reference guide. Simply referencing one link to another seems inutile.

I am aware at how sessions work on both sides, and I can agree on what that person says.

The most basic idea of a session cookie is to have the same data on both sides, and that it does. But, he default way sessions are stored on the server side is through usage of files in a certain directory(set by the session save path). Then, something to remember as well with this, is that these files are only seen as usable for a certain period of time.

The way PHP works with these session files, is that it only updates it's lifetime when the data within these files are altered, and not in fact when they are accessed.

The cookie stored on the client side of things, works on the same concept of lifetime. It only updates when the data in contains is altered, and in PHP, altering client side cookies can only be done my replacing the cookie with other data: this is seen as altering the cookie's contents.

Now with that in mind, it is safe to say that this function is almost useless for what it portrays. PHP isn't efficient enough with this by itself, and a user intervention is required if you want a viable solution to set the timeout length of a session.

Your method isn't "wrong", it's just not efficient enough for setting the lifetime/timeout of a session.

I'd be happy to go into this further, but I think I've made my point clear.

Link to comment
Share on other sites

User intervention? Efficiency? - and No, your post doesn't explain the disadvantage of sscp(), as I do not see that as a disadvantage. I suspect were I to look at the relevant RFCs covering cookie use and the source for sscp() itself, PHP would be following those guidelines to the letter (although one can always take bets on that). However I've grown tired of this, I can see a perfect solution which uses sscp(), I'm sorry if you think differently. I formerly retract my original statement as apparently - it's not good enough.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...