Visual Confirmation System
This tutorial will explains how to put a visual confirmation in your register form.
In somewhere on page of form, add:
In somewhere on page of form, add:
Code:
- /* generating the random number */
 - $rand = rand(11111,99999);
Â
Â- /* generating the image */
 - if (isset($_GET[‘mode’] && $_GET[‘mode’] == ‘image’)
 - {
 -  session_start();
 -  $_SESSION[‘code’] = md5($rand);
 -  $img = imagecreate(50, 20);
 -  $bkg = imagecolorallocate($img, 0, 0, 0);
 -  $color = imagecolorallocate($img, 255, 255, 255);
 -  imagestring($img, 5, 2, 2, $rand, $color);
 -  header(‘Content-type:image/gif’);
 -  imagegif($img);
 -  imagedestroy($img);
 -  exit;
 - }
Â
Â- ?>
Â
- Â
Â
- Â
Â
- Â
Â
- Â
Â
-
Â
Now in other file (specified on
before the fields of form) add:
Code:
- session_start();
Â
Â- $field = isset($_POST[‘visualconfirm’]) ? $_POST[‘visualconfirm’] : ”;
Â
Â- if (md5($field) == $_SESSION[‘code’])
 - {
 -  // action doed if confirmation code filled on field is correct
 - }
 - else
 - {
 -  // action doed if confirmation code filled on field is incorrect
 - }
Â
Â- ?>Â
P.S.: Don’t forgot that you must put the submit button in your form.
Share this tutorial
Â