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


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

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';

$session = Mage::getSingleton('core/session');

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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