0

I am working on custom login using below code, before it was working fine now its giving error.

Error:

An uncaught Exception was encountered Type: Mage_Core_Model_Session_Exception Message: (null)

I don't know what caused this error. Please help me to fix this error

Thank you

<?php
function loginUser( $email, $password )
require_once ("app/Mage.php");
umask(0);
ob_start();
session_start();
Mage::app('default');
Mage::getSingleton("core/session", array("name" => "frontend"));

$websiteId = Mage::app()->getWebsite()->getId();
$store = Mage::app()->getStore();
$customer = Mage::getModel("customer/customer");
$customer->website_id = $websiteId;
$customer->setStore($store);
try {
    $customer->loadByEmail($email);
    $session = Mage::getSingleton('customer/session')->setCustomerAsLoggedIn($customer);
    $session->login($email, $password);
}catch(Exception $e){

}


} 
?>
Manashvi Birla
  • 8,833
  • 9
  • 27
  • 53
Sudhakar SJ
  • 71
  • 1
  • 14
  • Here the solution for this issue explained step-by-step https://magento.stackexchange.com/questions/167616/session-validation-failure-in-magento-1-ee-v-1-14-3-x-and-ce-1-9-3-x – itnavad Nov 20 '20 at 15:50

1 Answers1

0

There is a good chance that this issue is related to PHP 7. Could you confirm if any sessions are working on Magento and what PHP version the host server is using?

Jared
  • 11
  • 1
  • Hi. I found the solution, In the backend, I set the cookie time to Zero. but I don't know this is the way to remove this error. Now the error is gone. Thanks. – Sudhakar SJ Oct 16 '18 at 07:46