Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 28th Mar 2016, 03:59 AM   #1
Warrior Member
 
Join Date: 2016
Posts: 16
Thanks: 0
Thanked 3 Times in 2 Posts
Default
How to use captcha in php?
Share on: 
fb share twitter share gplus share more share

How to use captcha in php?

karthikaqpt is offline  
Unread 29th Mar 2016, 08:55 AM   #2
Warrior Member
 
deepakgupta deepakgupta's Avatar
 
Join Date: 2016
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default
Re: How to use captcha in php?
Share on: 
fb share twitter share gplus share more share

This is very simple program captcha in php you should go to google and search captcha in php and you got hundred and more link and resolved your problem
deepakgupta deepakgupta is offline  
Unread 30th Mar 2016, 12:30 AM   #3
Warrior Member
 
Jimmy Saini's Avatar
 
Join Date: 2016
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default
Re: How to use captcha in php?
Share on: 
fb share twitter share gplus share more share

<?php
session_start();
include("./phptextClass.php");

/*create class object*/
$phptextObj = new phptextClass();
/*phptext function to genrate image with text*/
$phptextObj->phpcaptcha('#162453','#fff',120,40,10,25);
?>
Jimmy Saini is offline  
Unread 5th Apr 2016, 09:35 AM   #4
Active Warrior
 
Join Date: 2015
Location: Kherson, Ukraine
Posts: 42
Thanks: 0
Thanked 8 Times in 8 Posts
Default
Re: How to use captcha in php?
Share on: 
fb share twitter share gplus share more share

1. Create file "capcha.php":

<?php
$seccode = mt_rand(10000, 99999);
session_start();
$_SESSION['seccode'] = $seccode;
header("Content-Type: image/png");
$im = imagecreate(60, 18) or die('Error on create image!');
$corfundo = imagecolorallocate($im, 255, 244, 234);
$corfonte = imagecolorallocate($im, 255, 128, 0);
$corlinha = imagecolorallocate($im, 255, 200, 150);
$corborda = imagecolorallocate($im, 255, 128, 0);
for($x=10; $x <= 100; $x+=10){
imageline($im, $x, 0, $x, 50, $corlinha);
}
imageline($im, 0, 9, 100, 9, $corlinha);
imageline($im, 0, 0, 0, 50, $corborda);
imageline($im, 0, 0, 100, 0, $corborda);
imageline($im, 0, 17, 100, 17, $corborda);
imageline($im, 59, 0, 59, 17, $corborda);
imagestring($im, 5, 8, 1, $seccode, $corfonte);
imagepng($im);
imagedestroy($im);
?>

2. Create file "check.php":

<?php
session_start();
if(isset($_POST['key']) AND isset($_SESSION['seccode']) AND $_POST['key']==$_SESSION['seccode']){
echo 1;
} else {
echo 0;
}
?>

3. Create file "index.html":

<html>
<head><title>Capcha</title></head>
<body>
<form action="check.php" method="post">
<img src="capcha.php" alt="" />
<input type="text" name="key" />
<input type="submit" value="send" />
</form>
</body>
</html>
wordpress+expert is offline  
Closed Thread


Bookmarks

Tags
captcha, php


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 03:33 PM.