Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

add "human input" code to existing script

add "human input" code to existing script

add "human input" code to existing script

I'm not a programmer, just read and modify tiniest bits, and here the problem:
My greeting card script has one place where it checks the email addresses, I guess that is where I have to add the code for "human input" check, but don't know how...

my script's (Bignosebird.com cardcgi v2.0) snippet:

sub valid_address
  $testmail = $fields{'recip_email'};
  if ($testmail =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/ ||
  $testmail !~ /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/)
     return 0;
      return 1;

sub bad_email
print <<__STOP_OF_BADMAIL__;
Content-type: text/html

<FONT SIZE="+1">
SORRY! Your request could not be processed because of an improper
recipient's e-mail address. Please use your back button to return
to the card screen and try again!

and here the code I need to add:

    use CGI;
    $q = new CGI;

    use Digest::MD5 qw(md5_hex);
    my $skey    = 'ChangeIt';         # secret key
    my $code    = $q->param('code');  # user put code
    my $session = $q->param('hv_sess');
    my $hash    = $q->param('hv_hash');
    my $expire  = 60*2;   # seconds expire session

    if (time - $session > $expire ) {  
      $errors .="ERROR: The code has expired.<br>";
    if ($hash ne md5_hex($code,$skey,$session) ) {  
      $errors .="ERROR: Code Entered is wrong.<br>";

anyone could help me?
Thank you!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close