Collections functions
General functions
Render functions
Theme permission functions
Resource functions

render_antispam_question()

Description

Render the antispam Question form section

Parameters

This function accepts no parameters.

Location

include/render_functions.php lines 5694 to 5750

Definition

 
function render_antispam_question()
    {
    global 
$scramble_key$lang;

    
$rndword array_merge(range('0''9'), range('A''Z'));
    
shuffle($rndword);
    
$timestamp=time();
    
$rndwordarray=  array_slice ($rndword 0,6);
    
$rndcodehash("SHA256",implode("",$rndwordarray) .  $scramble_key $timestamp);
    
$height 50//CAPTCHA image height
    
$width 160//CAPTCHA image width
    
$font_size 25//CAPTCHA Font size
    
$font=dirname(__FILE__). "/../gfx/fonts/vera.ttf";

    
$capimage imagecreate($width$height);
    
$graybg imagecolorallocate($capimage245245245);
    
$textcolor imagecolorallocate($capimage343434);
    
$green ImageColorAllocate($capimage12118865); 
    
ImageRectangle($capimage,0,0,$width-1,$height-1,$green); 
    
imageline($capimage0$height/2$width$height/2$green); 
    
imageline($capimage$width*4/52$width*4/5$height$green);
    
imageline($capimage$width*3/52$width*3/5$height$green);
    
imageline($capimage$width*2/52$width*2/5$height$green);
    
imageline($capimage$width/52$width/5$height$green);
    
    
$n=0;
    foreach(
$rndwordarray as $rndletter)
        {
        
imagefttext($capimage$font_size,rand(-2020), 10 + (24*$n), rand(2545), $textcolor$font$rndletter);
        
$n++;
        }
        
    
ob_start();
    
imagegif($capimage);
    
$imagedata ob_get_contents();
    
ob_end_clean();
    
?>
    <div class="Question">
        <input type="hidden" name="antispamcode" value=" echo $rndcode?>">
        <input type="hidden" name="antispamtime" value=" echo $timestamp?>">
        <label for="antispam"> echo $lang["enterantispamcode"]; ?><br>
            <div id="AntiSpamImage" style="
            margin: 0 0 .1em;
            background: url(data:image/gif;base64, echo base64_encode($imagedata); ?>) top left no-repeat;
            height:  echo $height?>px;
            width:  echo $width?>px;
            border-radius: 6px;
            display: inline-block;
            ">    
            </div>
        </label> 
        <input type="text" name="antispam_user_code" class="stdwidth" value="">
        <input type=text name="antispam" class="stdwidth" value="">
        <div class="clearerleft"></div>        
    </div>
    
    
}

This article was last updated 26th September 2022 13:05 Europe/London time based on the source file dated 22nd September 2022 16:20 Europe/London time.