OFF-SOFT.net

This site is support & information site of WEB,and Software. This site might help you that create software or Web Site…perhaps?

Spam mail is repulsed with Bigo Captcha

Published on| October 28th, 2009 | No Comment.


Summary:

Joomla! Using the mail form that are made in standard, gradually, comes an increasing number of spam.

ON check function even if the session, and little by little, you will grow.

If such articles, especially overseas, is striking.

Well, if you like this, usually the mail form (contact you to search and fine) and uses the extension of this time, yvcomment Bigo Captcha extension can be captured using the default mail using the form how to use, I want to describe in concrete terms.

In fact, Bigo Captcha-mail form you can use the extension.

For example, ALFcontact is.

However, ALFcontact has recently found a security hole and, hey, you think want to unuse.

It also, combined, this time, I would like to add the default mail form.

Does, immediately, let's try.

Summary of changes

Later, Bigo Captcha as being installed, and start talking.

Also, here, using Joomla! Version, 1.5.14 is.

If different versions, php source code line number, so may be different in the source code for each version, check the context, please do the work.

In, I immediately start.

Php code to change the source, the following three.

However, in the language file, and comment if you want to change to accommodate changes in files that do add the following language.

(Here is the description does not end there.

)

administrator / language / ja-JP / ja-JP.com_contact.ini
administrator / language / en-GB / en-GB.com_contact.ini
language / ja-JP / ja-JP.com_contact.ini
language / en-GB / en-GB.com_contact.ini

  • administrator / components / com_contact / contact_items.xml
    - At this point, you add parameters to capture whether or not to use the mail form parameters of the component.

  • components / com_contact / controller.php
    - Here, the image capture process to determine whether the information matches the input, add the processing to display an image capture.

  • components / com_contact / views / contact / tmpl / default_form.php
    - This will add to the process of capturing images to view the mail form.

Let's change
[administrator/components/com_contact/contact_items.xml]

87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
	<params group="email">
		<param name="show_email_form" type="radio" default="1" label="Email Form" description="Show/Hide the email to form">
			<option value="0">Hide</option>
			<option value="1">Show</option>
		</param>
		<param name="email_description" type="text" size="30" default="" label="Description text" description="PARAMEMAILDESCTEXT" />
		<param name="show_email_copy" type="radio" default="1" label="Email Copy" description="PARAMEMAILCOPY">
			<option value="0">Hide</option>
			<option value="1">Show</option>
		</param>
		<param name="use_captcha" type="radio" default="1" label="Use Captcha" description="Enable Captcha verification">
			<option value="0">No</option>
			<option value="1">Yes</option>
		</param>
		<param name="banned_email" type="textarea" default="" label="BANNED EMAIL LABEL" rows="3" cols="30" description="BANNED EMAIL DESC" />
		<param name="banned_subject" type="textarea" default="" label="BANNED SUBJECT LABEL" rows="3" cols="30" description="BANNED SUBJECT DESC" />
		<param name="banned_text" type="textarea" default="" label="BANNED TEXT LABEL" rows="3" cols="30" description="BANNED TEXT DESC" />
	</params>

Here, adding the line 97 - line up to 100.

we add a parameter called use_captcha.

When you do this change will be appended to e-mail form below.






[components/com_contact/controller.php]

This source code, there are two additional large place.

117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
		if (!$email || !$body || (JMailHelper::isEmailAddress($email) == false))
		{
			$this-->setError(JText::_('CONTACT_FORM_NC'));
			$this-->display();
			return false;
		}
		/**
		Captcha
		*/
		if (!$this-->_checkCaptcha()) {
			JError::raiseWarning("666","You have entered the wrong CAPTCHA sequence. Please try again.");
			$this-->display();
			return false;
		}
 
		// Contact plugins
		JPluginHelper::importPlugin( 'contact' );
		$dispatcher	=& JDispatcher::getInstance();

Here, adding the line 124 - to 131 lines.

Here is the place to check the mail form input information, and check if they match the captured image and the input information.

128 line is the error message when incorrect information was entered.

If you want to change the wording is a good idea to change the string here.

396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
	/**
	@author bigo
	@date januray, 2008
	*/
	function displaycaptcha() {
		global $mainframe;
		$contactId = JRequest::getVar('contact_id', 0, '', 'int');
		// load the contact details
		$model    = &$this-->getModel('contact');
		$qOptions['id'] = $contactId;
		$contact        = $model-->getContact( $qOptions );
		$params = new JParameter( $contact-->params );
		if ($params-->get('use_captcha')) {
			$Ok = null;
			$mainframe-->triggerEvent('onCaptcha_Display', array($Ok));
			if (!$Ok) {
				echo "<br/>Error displaying Captcha<br/>";
			}
		}
	}
 
	function _checkCaptcha() {
		global $mainframe;
		$contactId = JRequest::getVar('id', 0, '', 'int');
		// load the contact details
		$model = &$this-->getModel('contact');
		$qOptions['id'] = $contactId;
		$contact = $model-->getContact( $qOptions );
		$params = new JParameter( $contact-->params );
		// not using captcha!
		if (!$params-->get('use_captcha')) {
			return true;
		}
		$return = false;
		$word = JRequest::getVar('word', false, '', 'CMD');
		$mainframe-->triggerEvent('onCaptcha_confirm', array($word, &$return));
		if ($return) {
			return true;
		} else return false;
	}
}

Here, adding the line 396 - is up to 435 lines.

Here, at the end of this class, we add the two methods.

One, displaycaptcha () method to display an image is captured.

Another, _checkCaptcha () method to check if they match the captured image and the input information.

[components/com_contact/views/contact/tmpl/default_form.php]

57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
			<?php if ($this-->contact-->params-->get( 'show_email_copy' )) : ?>
			<br />
				<input type="checkbox" name="email_copy" id="contact_email_copy" value="1"  />
				<label for="contact_email_copy">
					<?php echo JText::_( 'EMAIL_A_COPY' ); ?>
				</label>
			<?php endif; ?>
			<?php if ($this-->params-->get('use_captcha')) { ?>
			 <!-- Bigo Captcha -->
			 <br clear=left />
			 <img src="/index.php?option=com_contact&task=displaycaptcha&contact_id=<?php echo $this-->contact-->id; ?>">
			 <br clear=left />
			 <?php echo JText::_( 'Verification' ); ?> : <input type="text" name="word" />
			 <br />
			<?php } ?>

Here, adding the line 64 - line 71 is up.

Here, we are displaying images captured mail form.

And make this change, the form below to email Bigo Captcha image appears.


Here are 69 of the first line of "Verification" the wording "Please enter the letters in the picture" and is.

Is now complete.

Please actually watch them work.

There will be an error with the wrong type of information capture.

Also, at this time would erase all the information you entered.

Whether this is good, you just a little split.

I would be good to yourself and customize things.



Add to your favorites(bookmarks): はてなdel.icio.usLivedoor ClipYahoo!FC2Nifty ClipPOOKMARK. AirlinesBuzzurl(バザール)Choixnewsing

Trackback URL

After Admin approves this comment, it will be shown.


Comments

Leave a Reply








Tag Cloud

Links

Site Description

This site is support & information site of WEB,and Software. This site might help you that create software or Web Site…perhaps?

Add to your favorites(bookmarks)

はてなdel.icio.usLivedoor ClipYahoo!FC2Nifty ClipPOOKMARK. AirlinesBuzzurl(バザール)Choixnewsing