Member Avatar for harintfs

Dear
I would like to set session expire time to 3hrs,
Which one is best ?
ini_set("session.cookie_lifetime","10800"); or session_set_cookie_params(3600 * 3);
Or can I use both?
And one more, Is it compulsary to place every page b4 where ever session_start()

Thanks. Pls help me.

you can set it once in your php.ini file on the server if you are on a dedicated server.

Otherwise yes you probably will need to set it on every page, you could make an include file so you only need to call the file on every page.

sessionStart.php

<?php
session_set_cookie_params(3600 * 3);
session_start();
?>

otherpage.php

<?php
require_once 'sessionStart.php';
//...
?>

I can't really say which function is better, i'd imagine session_set_cookie_params() is going to be faster and requires less permissions to run so i'd pick that one but i don't know for sure.

Also dear, in english, is used as a prefix to the addressee (person/company) so you would say Dear Biiim or Dear Someone.

Dear by itself is something grannies say to young people

Member Avatar for harintfs

Thanks, Mr. Biiim. Let I gothrough with your advice. Thanks once again.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.