Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test functions

render_antispam_question()

Description

Render the antispam Question form section

Parameters

This function accepts no parameters.

Location

include/render_functions.php lines 5888 to 5945

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);
    
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 escape($lang["enterantispamcode"]); ?> <sup>*</sup><br>
            <div id="AntiSpamImage" style="
            margin: 5px 0;
            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" id="antispam" class="stdwidth" value="">
        <div class="clearerleft"></div>        
    </div>
    
    
}

This article was last updated 17th November 2024 15:35 Europe/London time based on the source file dated 13th November 2024 14:05 Europe/London time.