Changeset 1313 in ExiteCMS


Ignore:
Timestamp:
02/27/08 12:37:15 (4 years ago)
Author:
root
Message:

replaced the internal captcha routine by SecureImaga

Location:
trunk
Files:
53 added
2 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/contact.php

    r1185 r1313  
    1515require_once dirname(__FILE__)."/includes/core_functions.php"; 
    1616require_once PATH_ROOT."/includes/theme_functions.php"; 
     17 
     18// include the secureimage class 
     19require_once PATH_INCLUDES."secureimage-1.0.3/secureimage.php"; 
    1720 
    1821// temp storage for template variables 
     
    3437 
    3538// captcha check 
    36 $cic = (isset($_POST['captcha_encode']) && !check_captcha($_POST['captcha_encode'], $_POST['captcha_code'])) ? "&cic=1" : ""; 
     39$cic = ""; 
     40$securimage = new Securimage(); 
     41if ($securimage->check($_POST['captcha_code']) == false) { 
     42    $cic = "&cic=1"; 
     43} 
    3744$variables['cic'] = $cic; 
    3845 
     
    5259// captcha check ok and message posted? 
    5360if ($cic == "" && isset($_POST['sendmessage'])) { 
    54     $result = dbquery("DELETE FROM ".$db_prefix."captcha WHERE captcha_datestamp<'".(time()-900)."'"); 
    5561    $errors = array(); 
    5662    if ($mailname == "") { 
  • trunk/includes/comments_include.php

    r1184 r1313  
    2828    if ((iMEMBER || $settings['guestposts'] == "1") && isset($_POST['post_comment'])) { 
    2929 
    30         $result = dbquery("DELETE FROM ".$db_prefix."captcha WHERE captcha_datestamp<'".(time()-900)."'"); 
    31  
    3230        $flood = false; 
    3331        if (dbrows(dbquery("SELECT $ccol FROM ".$db_prefix."$cdb WHERE $ccol='$comment_id'"))==0) { 
     
    4341         
    4442        // captcha check for guest posts 
    45         $cic = (iGUEST && !check_captcha($_POST['captcha_encode'], $_POST['captcha_code'])) ? "&cic=1" : ""; 
     43        $cic = ""; 
     44        if (iGUEST) { 
     45            // load the secureimage include 
     46            require_once PATH_INCLUDES."secureimage-1.0.3/secureimage.php"; 
     47            $securimage = new Securimage(); 
     48            if ($securimage->check($_POST['captcha_code']) == false) { 
     49                $cic = "&cic=1"; 
     50            } 
     51        } 
    4652 
    4753        $comment_message = trim(stripinput(censorwords($_POST['comment_message']))); 
  • trunk/includes/core_functions.php

    r1295 r1313  
    631631} 
    632632 
    633 // check captcha 
    634 function check_captcha($captchs_encode, $captcha_string) { 
    635     global $db_prefix; 
    636  
    637     if (preg_match("/^[0-9a-z]+$/", $captchs_encode) && preg_match("/^[0-9a-z]+$/", $captcha_string)) { 
    638         $result = dbquery("SELECT * FROM ".$db_prefix."captcha WHERE captcha_ip='".USER_IP."' AND captcha_encode='".$captchs_encode."' AND captcha_string='".$captcha_string."'"); 
    639         if (dbrows($result)) { 
    640             $result = dbquery("DELETE FROM ".$db_prefix."captcha WHERE captcha_ip='".USER_IP."' AND captcha_encode='".$captchs_encode."' AND captcha_string='".$captcha_string."'"); 
    641             return true; 
    642         } else { 
    643             return false; 
    644         } 
    645     } else { 
    646         return false; 
    647     } 
    648 } 
    649  
    650633// Replace offensive words with the defined replacement word 
    651634function censorwords($text) { 
  • trunk/includes/templates/include.comments.tpl

    r1184 r1313  
    107107                </td> 
    108108                <td align='left' width='50%' class='tbl1'> 
    109                     {make_captcha} 
     109                    <img id="captcha" src="{$smarty.const.INCLUDES}securimage-1.0.3/securimage_show.php" alt="CAPTCHA Image" /> 
    110110                </td> 
    111111            </tr> 
  • trunk/includes/templates/main.contact.tpl

    r1185 r1313  
    6060                {$locale.411} 
    6161                <br /><br /> 
    62                 {$locale.412} {make_captcha} 
     62                {$locale.412} <img id="captcha" src="{$smarty.const.INCLUDES}securimage-1.0.3/securimage_show.php" alt="CAPTCHA Image" /> 
    6363                {$locale.413} <input type='text' name='captcha_code' class='textbox' style='vertical-align:top;width:100px' /> 
    6464                <br /><br /> 
  • trunk/includes/templates/main.register.tpl

    r1121 r1313  
    103103                </td> 
    104104                <td class='tbl'> 
    105                     {make_captcha} 
     105                    <img id="captcha" src="{$smarty.const.INCLUDES}securimage-1.0.3/securimage_show.php" alt="CAPTCHA Image" /> 
    106106                </td> 
    107107            </tr> 
  • trunk/includes/theme_functions.php

    r1311 r1313  
    455455        // thread notifies: set to 14 days 
    456456        $result = dbquery("DELETE FROM ".$db_prefix."thread_notify WHERE notify_datestamp < '".(time() - $day * 14)."'"); 
    457         // captcha images: set to 6 minutes 
    458         $result = dbquery("DELETE FROM ".$db_prefix."captcha WHERE captcha_datestamp < '".(time() - $minute * 6)."'"); 
    459457        // new registered users: set to 3 days 
    460458        $result = dbquery("DELETE FROM ".$db_prefix."new_users WHERE user_datestamp < '".(time() - $day * 3)."'"); 
  • trunk/register.php

    r1286 r1313  
    2323 
    2424// include the DNS functions include 
    25 include PATH_INCLUDES."dns_functions.php"; 
     25require_once PATH_INCLUDES."dns_functions.php"; 
    2626 
    2727// load the locales for this module 
     
    134134 
    135135        if ($settings['display_validation'] == "1") { 
    136             if (!isset($_POST['captcha_encode']) || !isset($_POST['captcha_code']) || !check_captcha($_POST['captcha_encode'], $_POST['captcha_code'])) { 
     136            // include the secureimage class 
     137            require_once PATH_INCLUDES."secureimage-1.0.3/secureimage.php"; 
     138            $securimage = new Securimage(); 
     139            if ($securimage->check($_POST['captcha_code']) == false) { 
     140                // the code was incorrect 
    137141                $error .= $locale['410']."<br />\n"; 
    138             } 
     142            }            
    139143        } 
    140144         
Note: See TracChangeset for help on using the changeset viewer.