No account yet?
 
Web El-Tech Website

Login Form

Advertisement

Who's Online

We have 1 guest online

Syndicate

Home
Advertisement
Use Image security with joomla core contacts component in 3 steps

By Itamar Elharar - איתמר אלהרר, on Saturday, 13 October 2007

Views : 1624    

Published in : my publications, tutorials and demos


Joomla contacts component for displaying and send email to your site contacts list is a very nice and simple component who do the work well. one it major disadvantage is the lack of a good captcha spam protection.

Today, using the captch images engine com_securityimages by cedric_walter its getting even easier to apply it to any joomla component and module.   the component security images has a built in hack for the joomla contacts component which never worked for me. you can try the develper forums but dont expect much support there as well... :) guees they are busy.

 

 

step 1 - install com_securityimages

download and install the component like any other component in joomla.

enter the component "Edit General Setting" menu option and choose you Captcha type and check your settings.

step 2 - Add the Captch image into contact.html.php file

edit the file at contact.html.php at components/com_contacts/ with your php editor.

add the following code in line 680

 
<?php 
 
     if (file_exists($mosConfig_absolute_path.'/administrator/components/com_securityimages/client.php')) {
 
     include ($mosConfig_absolute_path.'/administrator/components/com_securityimages/client.php'); 
 
     }
 
     
 
     $packageName = 'securityChooseUniqueKeyName'; 
 
     ?>
 
     <?php echo insertSecurityImage($packageName); ?>
 
     <?php echo getSecurityImageText($packageName); ?>

step 3 - insert the check/validation code into contact.php

edit the file at contact.php at components/com_contacts/ with your php editor.

add the following code in line 360

 
if (file_exists($mosConfig_absolute_path.'/administrator/components/com_securityimages/server.php')) {
 
  include ($mosConfig_absolute_path.'/administrator/components/com_securityimages/server.php');
 
  }
 
  $packageName = 'securityChooseUniqueKeyName';
 
$security_refid = mosGetParam( $_POST, $packageName.'_refid', '' );
 
$security_try = mosGetParam( $_POST, $packageName.'_try', '' );
 
$security_reload = mosGetParam( $_POST, $packageName.'_reload', '' );
 
 
 
$checkSecurity = checkSecurityImage($security_refid, $security_try);

at line 437 change the code to:

 
if (!$checkSecurity || !$email || !$text || ( JosIsValidEmail( $email ) == false ) ) {
 
   mosErrorAlert( _CONTACT_FORM_NC );
 
  } 
 

Last update : Saturday, 13 October 2007

   
Quote this article in website
Favoured
Print
Send to friend
Related articles
Save this to del.icio.us

Keywords : joomla, captcha, component, contact, security, php


Users' Comments  RSS feed comment
 

Average user rating

   (1 vote)

 

Display 3 of 3 comments

work like magic

By: pvmaster (Registered) on 20-10-2007 20:34

work like magic

By: pvmaster (Registered ) on 20-10-2007 20:34

hi Itamar, 
 
thanks for the explanation - it stopped my spam problem from joomla contacts 
 
keep on the good work ! 
 
pvmaster

 

» Report this comment to administrator

» Reply to this comment...

Test submission

By: musstanser (Registered) on 29-10-2007 13:49

Test submission

By: musstanser (Registered ) on 29-10-2007 13:49

test

 

» Report this comment to administrator

» Reply to this comment...

please delete

By: musstanser2 (Registered) on 29-10-2007 13:55

please delete

By: musstanser2 (Registered ) on 29-10-2007 13:55

just testing if two comments work together.

 

» Report this comment to administrator

» Reply to this comment...

Display 3 of 3 comments



Add your comment
Only registered users can comment an article. Please login or register.


mXcomment 1.0.2 © 2007-2008 - visualclinic.fr
License Creative Commons - Some rights reserved
 
Next >

El-Tech Elharar Techonology, Israel