Location: PHPKode > projects > Maian Gallery > maian_gallery/captcha/cryptographp.fct.php
<?php

// ----------------------------------------------------
// Cryptographp v1.4
// (c) 2006-2007 Sylvain BRISON 
//
// www.cryptographp.com 
// hide@address.com 
//
// Licence CeCILL modifiée
// => Voir fichier Licence_CeCILL_V2-fr.txt)
//
// Modified by David Ian Bennett for Maian Gallery
// ----------------------------------------------------

 if(session_id() == "") session_start();
 
 $_SESSION['cryptdir'] = 'captcha';
 
 // Function modified to return data rather than echo it..
 // New vars added for Maian Gallery..
 function dsp_crypt($cfg=0,$reload=1,$code,$refresh,$div=true) {
 global $SETTINGS,$theme;
 $string = '';
 // Affiche le cryptogramme
 $string = ($div ? "<div>" : "")."<img class='captcha_img' id='cryptogram' src='".$_SESSION['cryptdir']."/cryptographp.php?cfg=".$cfg."&amp;".SID."' alt='".$code."' title='".$code."' />";
 if ($reload) $string .= "<a title='".($reload==1?'':$reload)."' style=\"cursor:pointer\" onclick=\"javascript:document.images.cryptogram.src='".$_SESSION['cryptdir']."/cryptographp.php?cfg=".$cfg."&amp;".SID."&amp;'+Math.round(Math.random(0)*1000)+1\"><img src=\"".$SETTINGS->folder."/themes/".$theme."/images/captcha/reload.png\" alt=\"".$refresh."\" title=\"".$refresh."\" /></a>";
 $string .= ($div ? "</div>" : "");
 return $string;
 }


 function chk_crypt($code) {
 // Vérifie si le code est correct
 if (isset($_SESSION['configfile']) && file_exists($_SESSION['configfile'])) {
   include ($_SESSION['configfile']);
 }
 $code = addslashes ($code);
 $code = str_replace(' ','',$code);  // supprime les espaces saisis par erreur.
 $code = (isset($difuplow) ? $code : strtoupper($code));
 $code = md5($code);
 if ($_SESSION['cryptcode'] and ($_SESSION['cryptcode'] == $code))
    {
    unset($_SESSION['cryptreload']);
    if ($cryptoneuse) unset($_SESSION['cryptcode']);    
    return true;
    }
    else {
         $_SESSION['cryptreload']= true;
         return false;
         }
 }

?>
Return current item: Maian Gallery