Warning: Ip adress is not a security feature.
Create a new folder inside public folder and make it private.
Don't know if you have a CPanel or what ever to make this work.
Than create a NEW index.php and .htaccess.....
Inside index.php of private folder:
Mage::app(...., ....., $options....)
Mage::getModel('admin/session')->login($username, isset($password) ? $password : '');
Mage::run(...., ....., $options....)
And bob's your uncle.
So take away: Never create your own security logic. Just use the security features you already have. If unknow, ask your server administrator. And better sollution, is hire better employees that can use a login form and are smart enough to remember there password.