reset and begin
3/25/2010

tạo capcha 1 cách đơn giản

<?php session_start();
$chuoi="ABCDEFGHIJKLMNOPQRSTUVWYWabcdefghijklmnopqrstuvZ0123456789";
$i=0;
while($i<6)
{
$vitri=mt_rand(0,35);
$giatri=substr($chuoi,$vitri,5);
$i++;
}
session_register("kiemtra");
$_SESSION["kiemtra"]=$giatri;
?>


<?php require_once('random.php'); echo $_SESSION['kiemtra']; ?>

xử lý

<?php
$maBH = htmlentities($_POST['kiemtra'],ENT_QUOTES,'utf-8');

if($_SESSION['kiemtra']!=$maBH) echo "<script>alert('Bạn nhập mã bảo mật chưa chính xác');location.href='index.php?p=3'</script>" ;
?>

Bloger Comments
G+ Comments
Comments FaceBook

No comments:

List

Profiles Information


About me : Nothing is 1 vài thứ - 1985

Places I've Lived : I Hà Nội

Home Page : http://www.shimivn.blogspot.com/

Think : 1:1000000000

Languages spoken : Vietnamese,English.

Mobile : sony C2305

dell : i3-Ram 3GB- HDD 250GB .