Magento CE 1.7 get the user ip included with the contact form -


one of magento ce 1.7 sites contact form being spammed human spam farms bypassing google recaptcha implemented on such forms. rate of spam received exorbitant 300 emails day have verified captcha.

as contact form being used, no sender ip address being emanated email, hence i need , guidance on how obtain user ip , have included spam contact email receive.

the idea ban ips being used spamming.

the php call user ip

echo mage::helper('core/http')->getremoteaddr(true); 

how can use within contact form , have ip submitted contact form contact.

i appreciate help.

with best regards

fab

andrew,

thanks lot.

the correct ip showed adjustment on code:

public function postaction() { $post = $this->getrequest()->getpost(); if ( $post ) {     $translate = mage::getsingleton('core/translate');     /* @var $translate mage_core_model_translate */     $translate->settranslateinline(false);     try {         $postobject = new varien_object();         $postobject->setdata($post);         // add ip..         $postobject->setdata(             'ip',              $_server['remote_addr']          ); 

thanks lot once again


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -