Admin login problem in Magento
Today’s Magento installation has become a real drag!! The upgrade to version 1.2.1 was troubling as after the upgrade I had trouble logging into the admin page. After digging for hours trying to find a fix, I finally came up with the right fix!! View Entire Thread Here
The long and short of the fix is that apparently the newer Magento version is implementing some security check to make sure that the domain is a valid one that is accessing the admin page; a valid domain name or host consists of one with a period in the host name, so if you are installing locally using something like http://localhost, YOU WILL RUN INTO THIS PROBLEM! There are a couple ways to fix this
1) you can reference your admin page by using http://127.0.0.1 (this way it has periods in the host name) instead of localhost or
2) if you are on windows xp, add a host record in your hosts file by going to: C:WINDOWSsystem32driversetc and have 127.0.0.1 point to something like magento.localhost
3. modify the core Magento code (keep in mind you may have to re-apply the fix if you update the code Magento code) – go to: app/code/core/Mage/Core/Model/Session/Abstract and open up varien.php, and comment out lines 73 (comment out the comma at the end of the line) through 76 so that it looks like the following:
// set session cookie params
session_set_cookie_params(
$this->getCookie()->getLifetime(),
$this->getCookie()->getPath() //remove this after putting on server (leave the comma) ,
//$this->getCookie()->getDomain(),
//$this->getCookie()->isSecure(),
//$this->getCookie()->getHttponly()
);
Update (For Magento 1.4.*)
In Magento 1.4, you have to comment code from line 86 to 98 in app/code/core/Mage/Core/Model/Session/Abstract/Varien.php. Like this:-
01 /* if (!$cookieParams['httponly']) {
02 unset($cookieParams['httponly']);
03 if (!$cookieParams['secure']) {
04 unset($cookieParams['secure']);
05 if (!$cookieParams['domain']) {
06 unset($cookieParams['domain']);
07 }
08 }
09 }
10
11 if (isset($cookieParams['domain'])) {
12 $cookieParams['domain'] = $cookie->getDomain();
13 } */
Referred from: CasualCommerce.com and Chapagain.com.np