Tuesday, October 20, 2009

Protect your email address from spam bots using jQuery

It is very useful to leave email address for your site visitors but damn spam bots finds them, and we get only not useful spam emails. But there is good way to protect your email address from spam bots using jQuery.

First step where you want to display your email add with class "myemail" (you can change this) like this:





Thursday, October 1, 2009

Secure your forms with Zend_Captcha captcha Part 2 reCaptcha


In last post I wrote that I would show you how to use reCaptcha service with your Zend Framework application. To use reCaptcha service you need service public key and private key. To get keys go to reCaptcha website and hit "Use reCAPTCHA on your site" red button on the bottom of the page and signup for free account. After sign up login to your reCaptcha account and create new reCaptcha key simply writing your website address. After creating new key you shoud get private and public keys.

To use reCaptcha with your Zend Framework put reCaptcha keys in config file or difine as constants in your bootsrap file like I did.


define('RECAPTCHA_PRIVATE_KEY', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
define('RECAPTCHA_PUBLIC_KEY', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');

Wednesday, September 30, 2009

Secure your forms with Zend_Captcha captcha

Zend_Captcha_Image example

While I'm working with my small project I'm testing various Zend Framework libraries. Today I would show how you can add captcha to your site using Zend_Captcha_Image. In next part of this post I would show how to implement reCAPTCHA with Zend_Captcha.

Tuesday, August 18, 2009

Zend_Form multiple file uploads

This blog I'm starting with this mini tutorial. Recently I have started using Zend Framework as my main PHP framework. Testing it and playing with different components I decided to create something useful. I created simple form where users could upload more than one file, I started googling how to achieve this. Found some nice tutorials but they did not suited for my needs.
After some time of experiments I ended with this code.

In form class i created files fields by adding these lines of code in my class:



//image upload field1
$this->files = new Zend_Form_Element_File('files');
$this->files->setLabel('Select files to upload')
->setMultiFile(3)
->addValidator(new Zend_Validate_File_IsImage)
->addValidator(new Zend_Validate_File_Size('2MB'))
->addValidator('Count', 3);