1 (edited by zer0 2006-10-16 08:42)

Topic: Image Verifcation For PunBB 1.2

Demo
http://bbs.wangyouzipai.net/register.php

This modification uses GD

http://bbs.wangyouzipai.net/plugins/validate.inc.php?n=2173Zhttp://bbs.wangyouzipai.net/plugins/validate.inc.php?n=2173Vhttp://bbs.wangyouzipai.net/plugins/validate.inc.php?n=2175Shttp://bbs.wangyouzipai.net/plugins/validate.inc.php?n=2175S


functions.php

FIND ?>

BEFORE, ADD

// Image verifcation hack  by  zer0
function get_validata_code()
{
    $rand_num = rand(1001, 9999);
    $md5data = md5($rand_num);
    $image = getvnimg($rand_num);
    return array('image' => $image , 'md5data' => $md5data);
}

function getvnimg($codec)
{
    //global $fixmozillabug, $is_mozilla;
    $part[0]=substr($codec,0,1);
    $part[1]=substr($codec,1,1);
    $part[2]=substr($codec,2,1);
    $part[3]=substr($codec,3,1);
    $plus=date("n", time())*date("d",time())+date("Y",time());
    //if ($fixmozillabug==1 && $is_mozilla==0)
    //{
    //    $csscom="background-image: url(img/validate/bg.gif); backgound-position: top; border:1px #B2B2B2 solid;";
    //} 
    //$out="<span style=\"width: 50px; height: 22px;  {$csscom}\">";
    $out = '<span class="validatecode">';
    for ($i=0; $i<4;$i++)
    {
        $cnow = $part[$i];
        $out .= '<img src="plugins/validate.inc.php?n=' . strval($plus + $cnow) . chr(rand(65,90)) . '" alt="Validata Code" />';
    }
    $out .= '</span>';
    return $out;
}
// end

open register.php

FIND 
require PUN_ROOT.'lang/'.$pun_user['language'].'/prof_reg.php';


AFTER, ADD 
// Image verifcation hack  by  zer0
$validata_array = get_validata_code();

FIND
else if (isset($_POST['form_sent']))
{

AFTER, ADD
    // Image verifcation hack  by  zer0
    if ( empty($_POST['validata_md5data'])  || empty($_POST['validata']) ||  md5($_POST['validata']) != $_POST['validata_md5data'] )
        message($lang_common['Bad validata']);
    // end

2

Re: Image Verifcation For PunBB 1.2

there is a lready a image verification mod hmm