• Downloading from our site will require you to have a paid membership. Upgrade to a Premium Membership from 10$ a month today!

    Dont forget read our Rules! Also anyone caught Sharing this content will be banned. By using this site you are agreeing to our rules so read them. Saying I did not know is simply not an excuse! You have been warned.

Share code chống flood

Admin

Well-Known Member
Staff member
Administrator
• Tạo file với tên là
captcha.php hay gì đó
tùy ý bạn với nội
dung sau:
PHP:
<?php
error_reporting(0);
$rand = rand(1000,9999); //tạo số ngẫu nhiên
$_SESSION['captcha'] = $rand; //lưu captcha vào session
$image = imagecreate(45, 25); //kích thước hình
$bgcol = imagecolorallocate($image, 255, 255, 255); // màu nền
$txcol = imagecolorallocate($image, rand(0,255), rand(0,255), rand(0,255)); //màu text
$strn2 = imagestring($image, 5, 5, 5, $rand, $txcol);
header("Content-type: image/png; charset=utf-8");
imagepng($image);
imagedestroy($image);
?>
Sau đó để hiển mã thì
dùng thẻ img để hiển
thị nó.
PHP:
echo '<img src="captcha.php">';
Nếu muốn đẹp
thì rewrite đuôi file
captcha.php về dạng
png, jpg hay gif gì đó
cũng được.
 

Facebook Comments

New posts New threads New resources

Back
Top