0

I am creating a custom session value from an external file, How can I limit this custom session value to 5 minutes only?

require_once('app/Mage.php');
umask(0);
Mage::app("default");

$sessionCode = Mage::getSingleton("core/session",  array("name"=>"frontend"));
$verifiedCustomer = $sessionCode->getData("verifnum");

1 Answer 1

1

The simplest solution is to set second parameter in the session with value = time() and then to check with it.

require_once 'app/Mage.php';
Mage::app();

$session = Mage::getSingleton('core/session');
$session->setParam1('some');
$session->setParam2(time());

//in other file or I don't know what is your idea
if ($session->hasParam1() && $session->hasParam2() && $session->getParam2() + 300 > time()) {
    echo $session->getParam1();
}
2
  • How can I implement your solution to my code?
    – zeusukdm
    Commented Dec 21, 2014 at 17:50
  • @tufanayd - I edit my code, but I don't know what exactly you want to accomplish.
    – michael
    Commented Dec 21, 2014 at 18:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.