1
pipwax
Sessions vs. Cookies
  • 2005/10/29 0:20

  • pipwax

  • Not too shy to talk

  • Posts: 132

  • Since: 2005/9/12


I am using cookies and cache on my site now. I am thinking about using sessions. Can anyone tell me the advantages of using sessions over cookies if any, and how or what do I need to do special if anything, besides change the settings in the admin>preferences.
pipwax1@bellsouth.net
Quote:
To win in life one must be fluid like water, taking the shape needed to prevail


aspring IT Professional

2
m0nty
Re: Sessions vs. Cookies
  • 2005/10/29 1:32

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


both methods use cookies still.

the differences being that with custom session, u set the session names and expiry times via XOOPS instead of using the session name and expiry times set in php.ini

(i maybe wrong, but that's what i gather anyway)

3
zzzzsg
Re: Sessions vs. Cookies
  • 2006/4/13 20:49

  • zzzzsg

  • Just popping in

  • Posts: 86

  • Since: 2005/12/22


hi m0nty

do you know how to set the session expiry time in the php file? which file?

thank you

gui

4
jensclas
Re: Sessions vs. Cookies

Yous et it in admin - syetem admin general preferences:

From the configuration FAQ:
Use custom session
Select yes to customise session related values.

Session name
The name of session (Valid only when 'use custom session' is enabled)

Session expiration
Maximum duration of session idle time in minutes (Valid only when 'use custom session' is enabled. Works only when you are using PHP4.2.0 or later.)

Have you got the right php version?

Other than that type in a number - but not too long - in looking for an answer for you there can be issues of clogging the server with long session expiry times.

Check this FAQ

Cheers

5
zzzzsg
Re: Sessions vs. Cookies
  • 2006/4/14 22:16

  • zzzzsg

  • Just popping in

  • Posts: 86

  • Since: 2005/12/22


Hi jensclas

I think custom sessions aren't a good idea - read about problems with it on XOOPS 2.2.x.

And even if u edit it in system prefer, there is a max which u cannot exceed.

I would to know how to hard code the expiry time into the scripts.

I changed this is include/common.php

if ($xoopsConfig['use_mysession'] && $xoopsConfig['session_name'] != '') {^M
// setcookie($xoopsConfig['session_name'], session_id(), time()+(60*$xoopsConfig['session_expire'
]), '/', '', 0);^M
// commented out above and added line below 43200s = 12hrs
setcookie($xoopsConfig['session_name'], session_id(), time()+ 43200, '/', '', 0);^M
}^M
$xoopsUser->setGroups($_SESSION['xoopsUserGroups']);^M



Thank you

gui

6
m0nty
Re: Sessions vs. Cookies
  • 2006/4/15 0:12

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


y aren't they a good idea? i always use custom sessions. never had a problem either..

and what max limit are you on about??

your edit in common.php makes no sense at all to me as it is exactly the same as the line you commented out practically.

Quote:

// setcookie($xoopsConfig['session_name'], session_id(), time()+(60*$xoopsConfig['session_expire'
]), '/', '', 0);^M
// commented out above and added line below 43200s = 12hrs
setcookie($xoopsConfig['session_name'], session_id(), time()+ 43200, '/', '', 0);^M


60*$xoopsConfig['session_expire']

if u set session time in preferences correctly you can get 12hrs?? so i don't see how your edit changes anything whatsoever.

session expire = 720 mins * 60 = 43200s = exactly what you changed it to.

i've had my testing sites set at 10080 mins all the time.. which gives me 10080 * 60 = 604800secs. = 1 week

i've had it for a month b4 too.. so i don't know what max you are on about.

7
zzzzsg
Re: Sessions vs. Cookies
  • 2006/4/17 23:54

  • zzzzsg

  • Just popping in

  • Posts: 86

  • Since: 2005/12/22


Hi mOnty

Thank you for the reply.

Are you using XOOPS 2.2.x?
I remember reading somewhere here that custom sessions aren't advisable. Anyway, my custom sessions time expire setting didn't work when I set it.

Also, i didn't comment out the line.

setcookie($xoopsConfig['session_name'], session_id(), time()+ 43200, '/', '', 0)

Shouldn't this line set the time expire to 12 hours?

Login

Who's Online

333 user(s) are online (120 user(s) are browsing Support Forums)


Members: 0


Guests: 333


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits