Captcha

Started on the old forum in October 2011 · view the original in the archive · old links redirect here

23 replies · 1,313 views · started 15 years ago · 1 min read

11 participants
jaidon20k Developer · 64 posts #1

Please i need very simple captcha with no image it will look like dis . 8F5A5. thanks

GumSlone Administrator Principal · 1,690 posts #2

jaidon20k wrote: Please i need very simple captcha with no image it will look like dis . 8F5A5. thanks

$code = strtoupper(substr(md5(time()),0,5));

echo '<div>'.$code.'</div>';
 echo '<form method="post" action="some_php_file.php">
<div>
insert the security code from above <input type="text" name="captcha_code" value=""/><input type="hidden" name="captcha_code_check" value="'.$code.'"/>
</div>
</form>
';

some_php_file.php

if($_POST['captcha_code']!=$_POST['captcha_code_check']) $error = 'Wrong security code';
if(!empty($error)) echo $error;

but this type of captcha doesnt make any sense, because its very easy for bots to read the captcha text.

Advertise your mobile site for FREE with AdTwirl

External image (may be gone)

subzero Super moderator Fellow · 3,954 posts #6

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

bivaswap Junior · 31 posts #8

@ Gumslone

Sir, this code have no session control, it just a true false case.

Hot Indian Desi videos Visit : http://hotgirlsex.net

ionutvmi Junior · 45 posts #12

he means if i click submit nothing is stoping me to click refresh and that code is useless... If you want to do text you can do something like: whats 3+4 ? Just store in an array the question =>answer and random select one to be displayed and put the answer in session just like image captcha

PIMP-WAP.NET - PIMP YOUR MOBILE

MASTER-LAND.NET - WAPMASTERS LAND

hider Newbie · 5 posts #13

ok here it is

add it ur register form page

$hider=rand(1000,100000);
<small><b>Enter This Code Below:*</b></small><br/>
<b>$hider</b><br/>
<input type=\"hidden\" name=\"scode\" value=\"$hider\"/>

and the post field

<postfield name=\"code\" value=\"$(code)\"/>

and post

$code=htmlspecialchars(stripslashes(trim($code)));
$scode=htmlspecialchars(stripslashes(trim($scode)));
$pcode=htmlspecialchars(stripslashes(trim($pcode)));

and the error msg

if(($code) != ($scode)) $error='Incorrect security code!<br/>Please Enter Correct Code Shown In Last Page<br/>';

njoy bro

jaidon20k Developer · 64 posts #15

Ok i need that math captcha with on background image

razzbee Developer · 130 posts #16

hider wrote: ok here it is

add it ur register form page

$hider=rand(1000,100000);
<small><b>Enter This Code Below:*</b></small><br/>
<b>$hider</b><br/>
<input type=\"hidden\" name=\"scode\" value=\"$hider\"/>

and the post field

<postfield name=\"code\" value=\"$(code)\"/>

and post

$code=htmlspecialchars(stripslashes(trim($code)));
$scode=htmlspecialchars(stripslashes(trim($scode)));
$pcode=htmlspecialchars(stripslashes(trim($pcode)));

and the error msg

if(($code) != ($scode)) $error='Incorrect security code!<br/>Please Enter Correct Code Shown In Last Page<br/>';

njoy bro

Gumslone..Why are You confusing the guy if you dont want to teach him the how to do it best..I believe in teaching one how to fish so that he can fish and become better...anyway I still believe that code up there is a crap since bots can still read that thing cos before i create a bot I will have to check your html form input source code first,dont think the hidden attribute will save U ..Session I know is one of the best way to track captcha code both for mobile and pc,only that the session id is best in url for mobile that cookies(I never agreed with Gumslone that session is not the best)...

GumSlone Administrator Principal · 1,690 posts #17

razzbee wrote: Gumslone..Why are You confusing the guy if you dont want to teach him the how to do it best..I believe in teaching one how to fish so that he can fish and become better...anyway I still believe that code up there is a crap since bots can still read that thing cos before i create a bot I will have to check your html form input source code first,dont think the hidden attribute will save U ..Session I know is one of the best way to track captcha code both for mobile and pc,only that the session id is best in url for mobile that cookies(I never agreed with Gumslone that session is not the best)...

first of all, there are several captcha scripts here in forums which he could find using the site search, second, he wanted a text captcha so i gave him an example how he could do it and told that it was not very clever to use that type of captcha, and last third thing, if you were an experienced wapmaster you would know that sessions/cookies are not the best way for captcha on mobile phone.

Advertise your mobile site for FREE with AdTwirl

External image (may be gone)

subzero Super moderator Fellow · 3,954 posts #18
  1. Make a PHP script (separate file captcha.php) which will generate the image:
<?php 
session_start(); 
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");  
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");  
header("Cache-Control: no-store, no-cache, must-revalidate");  
header("Cache-Control: post-check=0, pre-check=0", false); 
header("Pragma: no-cache");  

function _generateRandom($length=6) 
{ 
    $_rand_src = array( 
        array(48,57) //digits 
        , array(97,122) //lowercase chars 
//        , array(65,90) //uppercase chars 
    ); 
    srand ((double) microtime() * 1000000); 
    $random_string = ""; 
    for($i=0;$i<$length;$i++){ 
        $i1=rand(0,sizeof($_rand_src)-1); 
        $random_string .= chr(rand($_rand_src[$i1][0],$_rand_src[$i1][1])); 
    } 
    return $random_string; 
} 

$im = @imagecreatefromjpeg("captcha.jpg");  
$rand = _generateRandom(3); 
$_SESSION['captcha'] = $rand; 
ImageString($im, 5, 2, 2, $rand[0]." ".$rand[1]." ".$rand[2]." ", ImageColorAllocate ($im, 0, 0, 0)); 
$rand = _generateRandom(3); 
ImageString($im, 5, 2, 2, " ".$rand[0]." ".$rand[1]." ".$rand[2], ImageColorAllocate ($im, 255, 0, 0)); 
Header ('Content-type: image/jpeg'); 
imagejpeg($im,NULL,100); 
ImageDestroy($im); 
?> 
  1. Add the following line at the top of the page where you need to implement CAPTCHA:
<?php session_start() ?> 
  1. Add the following line to check whether the CAPTCHA string entered by the visitor is valid, before the line where you will proceed with a submitted message:
<?php 
if($_SESSION["captcha"]==$_POST["captcha"])
{
    //CAPTHCA is valid; proceed the message: save to database, send by e-mail ...
}
?>
  1. Finaly add the CAPTCHA to the form:
<?php session_start() ?>
<form method="post" action="">
<table bgcolor="#CCCCCC">
<tr><th>Contact us (Post new message):</th></tr>
<tr><td><textarea cols="30" rows="5" name="message"></textarea></td></tr>
<tr><td align="center">CAPTCHA:<br>
    (antispam code, 3 black symbols)<br>
    <table><tr><td><img src="captcha.php" alt="captcha image"></td>
    <td><input type="text" name="captcha" size="3" maxlength="3"></td></tr></table>
</td></tr>
<tr><th align="center"><input type="submit" value="Submit"></th></tr>    
</table>
</form>
<?php
if(isset($_POST["captcha"]))
if($_SESSION["captcha"]==$_POST["captcha"])
{
    //CAPTHCA is valid; proceed the message: save to database, send by e-mail ...
    echo 'CAPTCHA is valid; proceed the message';
}
else
{
    echo 'CAPTCHA is not valid; ignore submission';
}
?>

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

metulj Super moderator Principal · 1,726 posts #20

ASNirman wrote: subzero can u give captcha.php on a zip file?

subzero's entire post in TXT => ziped

It's better to keep your mouth shut and give the impression that you're stupid, than to open it and remove all doubt. ⓣⓗⓔ ⓠⓤⓘⓔⓣⓔⓡ ⓨⓞⓤ ⓑⓔ©ⓞⓜⓔ, ⓣⓗⓔ ⓜⓞⓡⓔ ⓨⓞⓤ ⓐⓡⓔ ⓐⓑⓛⓔ ⓣⓞ ⓗⓔⓐⓡ ! ιη тнєσяу, тнє ρяα¢тι¢є ιѕ α яєѕυℓт σƒ тнє тнєσяу, вυт ιη ρяα¢тι¢є ιѕ тнє σρρσѕιтє.

キノgんイノ刀g 4 ア乇ムc乇 ノ丂 レノズ乇 キucズノ刀g 4 √ノ尺gノ刀ノイリ!

Attachments: subzero.zip

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close