Posted: May 1st, 2010 | Author: erwin | Filed under: PHP | Tags: Code Igniter, PHP | No Comments »
Hello, there.. In this post, I would like to explain how to create simple captcha in Code Igniter. Basic on this captcha is generate random code, save it to session, and check post code with session. If the post code is match then return TRUE and vice versa.
First create validation function on your form controller.
function captcha_check($str)
{
//check captcha
$get_false=FALSE;
if (strtolower(trim($this->session->userdata(“captcha”)))!=strtolower(trim($str)))
{
$get_false = TRUE;
$this->form_validation->set_message(‘captcha_check’, ‘Wrong code, please type again!’.$this->session->userdata(“captcha”));
return FALSE;
}
if ($get_false==FALSE)
{
return TRUE;
}
}
Then set you form captcha validation and put callback_captcha_check on validation rules.
//form validation
$config = array(
array(
‘field’ => ‘captcha’,
‘label’ => ‘Captcha’,
‘rules’ => ‘trim|required|callback_captcha_check’
)
);
$this->form_validation->set_rules($config);
Next create random string on your view and save it into session.
<?php $listAlpha = ‘abcdefghijklmnopqrstuvwxyz0123456789′;
$numAlpha=6;
$captcha=substr(str_shuffle($listAlpha),0,$numAlpha);
$code_captcha = array(
‘captcha’ => $captcha,
);
$this->session->set_userdata($code_captcha);
?>
The show the random string into your form and let user type the code on input form.
Posted: March 11th, 2010 | Author: erwin | Filed under: Wordpress | Tags: PHP, Projects, Wordpress | 1 Comment »
I have Wordpress plugin for moURL my shorten application and submitted by Wordpress on view days ago. But now I don’t know how to add my plugin to Wordpress Plugin repository. I really don’t know about svn and repository on opensource project. This is my first time and I’ll try it. I read some tutorial on Wordpress.org but didn’t found yet the solution. Then I get some tutorial from Diggin Into Wordpress and wow it’s working.
Read the rest of this entry »
Posted: March 8th, 2010 | Author: erwin | Filed under: Mac OS | Tags: Internet, Mac OS, Review | No Comments »
On this post, I want to share how to connect internet trough Huawei Modem installed on your Mac Os. First, I bought Huawei Modem and I can’t get Mac OS driver on package. So I must search driver trough internet. Download this driver on http://www.ziddu.com/download/8877516/HuaweiDataCardDriver.zip.html. Instal the driver till finish.
Then put your Huawei e160 modem to USB port. Go to the System Preference>>Network Preference and create new connection. Read the rest of this entry »
Posted: March 4th, 2010 | Author: erwin | Filed under: Ubuntu | Tags: Mac OS, Ubuntu | 1 Comment »
Today, I try to install parallel dekstop Ubuntu on Mac OS. First time you must have VMWare Fusion 3 installed on your Mac OS. You can get it on https://www.vmware.com/tryvmware/?p=vmware-fusion&lp=1 (this is trial version, you must registered to download this application). Then you must have Ubuntu 9.10 installation CD or image. You can download on this site http://ubuntu.com. Choose the server on your country and download Ubuntu image (*.iso). After get the iso file, you can burn it to CD or keep iso file saved in your hard disk. On this case I keep iso file on my hard disk.
After You get VMWare installed on your PC, Open your VMWare Application and you’ll get this. Read the rest of this entry »
Posted: March 3rd, 2010 | Author: erwin | Filed under: PHP | Tags: PHP | No Comments »
I try to install my old application on new the version of XAMPP, but my application didn’t working correctly with the new version of PHP, it caused by deprecated function on the new version of PHP 5.3.x.
In my application just shown PHP error message.
“SPLIT() function has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 6.0.0. Relying on this feature is highly discouraged.”
Then, I must change SPLIT() using EXPLODE() function. Read the rest of this entry »