Changeset 1184 in ExiteCMS


Ignore:
Timestamp:
12/31/07 13:01:02 (4 years ago)
Author:
hverton
Message:

Added a captcha validation check to comment posts of guests

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/administration/tools/language_pack_English.php

    r1182 r1184  
    23152315    $localestrings['c101'] = "No Comments have been Posted."; 
    23162316    $localestrings['c102'] = "Post Comment"; 
    2317     $localestrings['c103'] = "Name:"; 
     2317    $localestrings['c103'] = "Your Name:"; 
    23182318    $localestrings['c104'] = "Message:"; 
    23192319    $localestrings['c105'] = "Please Login to Post a Comment."; 
     
    23212321    $localestrings['c107'] = " Disable smileys in this comment"; 
    23222322    $localestrings['c108'] = "Toggle smileys"; 
     2323    $localestrings['c110'] = "Incorrect Validation Code"; 
     2324    $localestrings['c111'] = "The validation code below must be entered, it expires 15 minutes after page generation."; 
     2325    $localestrings['c112'] = "Validation Code:"; 
     2326    $localestrings['c113'] = "Enter Validation Code:"; 
    23232327    load_localestrings($localestrings, LP_LOCALE, "main.comments", $step); 
    23242328 
  • trunk/files/locales/en.main.global.php

    r1182 r1184  
    33// locale       : English 
    44// locale name  : main.global 
    5 // generated on : Tue Dec 25 2007, 15:30:41 CET 
     5// generated on : Mon Dec 31 2007, 12:03:00 CET 
    66// translators  : ExiteCMS team,WanWizard 
    77// ---------------------------------------------------------- 
  • trunk/includes/comments_include.php

    r1071 r1184  
    2525 
    2626    $variables = array(); 
    27      
     27 
    2828    if ((iMEMBER || $settings['guestposts'] == "1") && isset($_POST['post_comment'])) { 
     29 
     30        $result = dbquery("DELETE FROM ".$db_prefix."captcha WHERE captcha_datestamp<'".(time()-900)."'"); 
     31 
    2932        $flood = false; 
    3033        if (dbrows(dbquery("SELECT $ccol FROM ".$db_prefix."$cdb WHERE $ccol='$comment_id'"))==0) { 
     
    3841            if (isNum($comment_name)) $comment_name=""; 
    3942        } 
     43         
     44        // captcha check for guest posts 
     45        $cic = (iGUEST && !check_captcha($_POST['captcha_encode'], $_POST['captcha_code'])) ? "&cic=1" : ""; 
     46 
    4047        $comment_message = trim(stripinput(censorwords($_POST['comment_message']))); 
    4148        $comment_smileys = isset($_POST['disable_smileys']) ? "0" : "1"; 
    42         if ($comment_name != "" && $comment_message != "") { 
     49        if ($comment_name != "" && $comment_message != "" && $cic == "") { 
    4350            $result = dbquery("SELECT MAX(comment_datestamp) AS last_comment FROM ".$db_prefix."comments WHERE comment_ip='".USER_IP."'"); 
    4451            if (!iSUPERADMIN || dbrows($result) > 0) { 
     
    5461            if (!$flood) $result = dbquery("INSERT INTO ".$db_prefix."comments (comment_item_id, comment_type, comment_name, comment_message, comment_smileys, comment_datestamp, comment_ip) VALUES ('$comment_id', '$comment_type', '$comment_name', '$comment_message', '$comment_smileys', '".time()."', '".USER_IP."')"); 
    5562        } 
    56         redirect($clink); 
     63        if ($cic != "") redirect($clink.$cic); 
    5764    } 
    5865 
     
    7784    $variables['comment_id'] = $comment_id; 
    7885    $variables['post_link'] = $clink; 
     86    $variables['cic'] = (isset($_GET['cic']) && !empty($_GET['cic'])) ? $_GET['cic'] : ""; 
    7987 
    8088    // define the body panel variables 
  • trunk/includes/templates/include.comments.tpl

    r893 r1184  
    2424        <td class='tbl2'> 
    2525            <b> 
    26                 {if $smarty.const.iMEMBER && $comments[item].user_name|default:false} 
     26                {if $smarty.const.iMEMBER && $comments[item].user_name != ""} 
    2727                    <a href='{$smarty.const.BASEDIR}profile.php?lookup={$comments[item].comment_name}'>{$comments[item].user_name}</a> 
    2828                {else} 
    29                     {$comments[item].user_name} 
     29                    {$comments[item].comment_name} 
    3030                {/if} 
    3131            </b> 
     
    5959        {if $smarty.const.iGUEST} 
    6060            <tr> 
    61                 <td> 
    62                     {$locale.c103} 
    63                 </td> 
    64             </tr> 
    65             <tr> 
    66                 <td> 
    67                     <input type='text' name='comment_name' maxlength='30' class='textbox' style='width:100%;' /> 
     61                <td colspan='2' align='center'> 
     62                    {$locale.c103} <input type='text' name='comment_name' maxlength='30' class='textbox' style='width:200px;' /> 
     63                    <span style='color:#CC0000;font-weight:bold;'>*</span> 
     64                    <br /><br /> 
    6865                </td> 
    6966            </tr> 
    7067        {/if} 
    7168        <tr> 
    72             <td align='center'> 
     69            <td colspan='2' align='center'> 
    7370                <textarea name='comment_message' rows='6' cols='80' class='textbox' style='width:400px'></textarea><br /> 
    7471                <input type='button' value='b' class='button' style='font-weight:bold;width:25px;' onclick="addText('comment_message', '[b]', '[/b]');" /> 
     
    8784        </tr> 
    8885        <tr> 
    89             <td align='center'> 
    90                 <input type='submit' name='toggle' value='{$locale.c108}' class='button' onclick='javascript:flipDiv("smileys");return false;' /><br /><br /> 
     86            <td colspan=2' align='center'> 
     87                <input type='submit' name='toggle' value='{$locale.c108}' class='button' onclick='javascript:flipDiv("smileys");return false;' /> 
    9188                <input type='checkbox' name='disable_smileys' value='1' />{$locale.c107}<br /><br /> 
     89            </td> 
     90        </tr> 
     91        {if $smarty.const.iGUEST} 
     92            {if $cic != ""} 
     93                <tr> 
     94                    <td colspan='2' align='center'> 
     95                        <span style='color:#CC0000;font-weight:bold;'>{$locale.c110}<br /><br /></span> 
     96                    </td> 
     97                </tr> 
     98            {/if} 
     99            <tr> 
     100                <td colspan='2' class='tbl2'> 
     101                    {$locale.c111} 
     102                </td> 
     103            </tr> 
     104            <tr> 
     105                <td align='right' width='50%' class='tbl1'> 
     106                    {$locale.c112} 
     107                </td> 
     108                <td align='left' width='50%' class='tbl1'> 
     109                    {make_captcha} 
     110                </td> 
     111            </tr> 
     112            <tr> 
     113                <td align='right' width='50%' class='tbl1'> 
     114                    {$locale.c113} 
     115                </td> 
     116                <td align='left' width='50%' class='tbl1'> 
     117                    <input type='text' name='captcha_code' class='textbox' style='vertical-align:middle;width:100px' /> 
     118                </td> 
     119            </tr> 
     120            <tr> 
     121                <td colspan='2' class='tbl1'> 
     122                    &nbsp; 
     123                </td> 
     124            </tr> 
     125        {/if} 
     126        <tr> 
     127            <td colspan=2' align='center'> 
    92128                <input type='submit' name='post_comment' value='{$locale.c102}' class='button' /> 
    93129            </td> 
Note: See TracChangeset for help on using the changeset viewer.