If you are trying an external script in Magento but are unable to complete the task and are getting the above error. Tasks such as deleting a customer will throw this error. The solution is this:

Use the below code after including the file “app/Mage.php

Mage::register(‘isSecureArea’, true);    /* set secure admin area*/
Mage::getModel(‘review/review’)->load($review)->delete();     /* Your operation */
Mage::unregister(‘isSecureArea’);        /* un set secure admin area*/


And that it! you can now run tasks that usually would require admin login, in your script.