Joomla Views

You!Joomla Templates
Home How To How to add the senders IP address to the contact form for Joomla 1.5

How to add the senders IP address to the contact form for Joomla 1.5

Ever wanted to add the senders IP address when submitting a message via the contact form?  Just use our one line code hack.

 

This is a simple way to add the contact form senders IP address to the message for easy tracking; this is especially useful when you get those contact form spam emails.

addendum:Joomla! copies over this file with each update, but the fix is the same; just apply the code below to /components/com_contact/controller.php and you are ready to go.

It is a source code hack, and it works in Joomla 1.5.8 through 1.5.15; and you might need to change it or re-apply it when Joomla! releases the next version. The line number has been updated for the latest Joomla release 1.5.15.

Always, backup the source file before changing.

in file: /components/com_contact/controller.php

change line 169 from:

   $body     = $prefix."\n".$name.' <'.$email.'>'."\r\n\r\n".stripslashes($body);

to:

   $body    = $prefix."\n".$name.' ('.getenv('REMOTE_ADDR').' - '.gethostbyaddr(getenv('REMOTE_ADDR')).')' ."\r\n\r\n".stripslashes($body);

 

This will give you an email looking like this:



This is an enquiry e-mail via http://www.YOURWEBSITE.com/ from:
contact name (xxx.xx.xx.xxx - h169n2-gl-a-d5.ias.bredband.telia.com)



This is the message body.

 

Comments (0)

Write comment


busy
Related Articles/Posts
 
You!Joomla Templates

We Recommend

Login Form

Current Visitors

We have 147 guests online

Latest Articles

Top views