Skip to content

Instantly share code, notes, and snippets.

@shamun
Created July 11, 2011 18:18
Show Gist options
  • Save shamun/1076428 to your computer and use it in GitHub Desktop.
Save shamun/1076428 to your computer and use it in GitHub Desktop.
Hacker machine is running with ip: 1.0.0.1
1) /etc/hosts
8.8.8.1 zend.com
2) open and visit zend.com
3) What will be the result for this? in main server?
$ip = $this->getRequest()->getServer('REMOTE_ADDR');
8.8.8.1 or 1.0.0.1?
// Zend.com
// This server is running with ip: 8.8.8.1
//
public function fireAction()
{
$ip = $this->getRequest()->getServer('REMOTE_ADDR');
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/conf.ini', 'production');
if ($config->fire)
{
$ips = explode(",", $config->fire);
if (is_array($ips))
{
foreach($ips as $k=>$v)
{
$check = str_replace(" ", "", $v);
if ($check==$ip) {
$this->_redirect("/?failed");
exit;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment