Ignore:
Timestamp:
Oct 30, 2010, 1:32:11 PM (13 years ago)
Author:
rvelices
Message:

feature 1915: add protection on user registration against robots

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_comment.inc.php

    r6604 r7495  
    120120  }
    121121
    122   $key = explode( ':', @$key );
    123   if ( count($key)!=2
    124         or $key[0]>time()-2 // page must have been retrieved more than 2 sec ago
    125         or $key[0]<time()-3600 // 60 minutes expiration
    126         or hash_hmac(
    127               'md5', $key[0].':'.$comm['image_id'], $conf['secret_key']
    128             ) != $key[1]
    129       )
     122  if ( !verify_ephemeral_key(@$key, $comm['image_id']) )
    130123  {
    131124    $comment_action='reject';
     
    249242  $comment_action = 'validate';
    250243
    251   $key = explode( ':', $post_key );
    252   if ( count($key)!=2
    253        or $key[0]>time()-2 // page must have been retrieved more than 2 sec ago
    254        or $key[0]<time()-3600 // 60 minutes expiration
    255        or hash_hmac('md5', $key[0].':'.$comment['image_id'], $conf['secret_key']
    256                     ) != $key[1]
    257        )
     244  if ( !verify_ephemeral_key($post_key, $comment['image_id']) )
    258245  {
    259246    $comment_action='reject';
Note: See TracChangeset for help on using the changeset viewer.