Magento Admin Login not working on localhost

If you want to install Magento on WAMP server, localhost, then you are going to face a very irritating problem with it, which does not let you go into the admin panel, even if you enter the correct username and password and give error message.

Open this file,

app/code/core/Mage/Core/Model/Session/Abstract/Varien.php Go to line 96 or locate the code similar below:

if (isset($cookieParams['domain'])) {
    $cookieParams['domain'] = $cookie->getDomain();

Replace the code found in line 96 with this one:

if (isset($cookieParams['domain']) && !in_array("", self::getValidatorData())) {

The purpose of this code change is to disable the Magento’s domain checking only if it is accessed via localhost and run as usual if it is being accessed thru a valid domain.

Clear your browser’s cookies to start with a clean slate then clear the Magento cache by deleting all the contents of the following folder:
At this point you should be able to login now with your admin username and password using localhost as your domain.