Changeset 1321 in ExiteCMS for trunk/contact.php


Ignore:
Timestamp:
02/28/08 00:25:43 (4 years ago)
Author:
hverton
Message:

updated the Securimage code
fixed non-working text validation code
moved CMS_getOS() from dns_functions.php to core_functions.php

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/contact.php

    r1315 r1321  
    3636locale_load("main.contact"); 
    3737 
    38 // captcha check 
    39 $cic = ""; 
    40 $securimage = new Securimage(); 
    41 if ($securimage->check($_POST['captcha_code']) == false) { 
    42     $cic = "&cic=1"; 
    43 } 
    44 $variables['cic'] = $cic; 
    45  
    46 // get variables from the post, or initialize them 
     38// captcha check ok and message posted? 
    4739if (isset($_POST['sendmessage'])) { 
    4840    $mailname = substr(stripinput(trim($_POST['mailname'])),0,50); 
     
    5042    $subject = substr(str_replace(array("\r","\n","@"), "", descript(stripslash(trim($_POST['subject'])))),0,50); 
    5143    $message = descript(stripslash(trim($_POST['message']))); 
    52 } else { 
    53     $mailname = ""; 
    54     $email = ""; 
    55     $subject = ""; 
    56     $message = ""; 
    57 } 
    58  
    59 // captcha check ok and message posted? 
    60 if ($cic == "" && isset($_POST['sendmessage'])) { 
     44    // error initialisation 
    6145    $errors = array(); 
     46    // captcha check 
     47    $securimage = new Securimage(); 
     48    if ($securimage->check($_POST['captcha_code']) == false) { 
     49        $errors[] = $locale['414']; 
     50    } 
    6251    if ($mailname == "") { 
    6352        $errors[] = $locale['420']; 
     
    8473    $template_variables['main.contact.message'] = $variables; 
    8574} else { 
    86     // form variables 
    87     $variables['mailname'] = $mailname; 
    88     $variables['email'] = $email; 
    89     $variables['subject'] = $subject; 
    90     $variables['message'] = $message; 
     75    // generate captcha text if needed 
     76    if ($settings['display_validation'] == "1" && $settings['validation_method'] == "text") { 
     77        require_once PATH_INCLUDES."secureimage-1.0.3/securimage.php"; 
     78        $securimage = new Securimage(); 
     79        $securimage->createCode(); 
     80        $variables['validation_code'] = $_SESSION['securimage_code_value']; 
     81    } 
    9182    // define the body panel variables 
    9283    $variables['target'] = $target; 
Note: See TracChangeset for help on using the changeset viewer.