Not signed in (Sign In)

Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorShawn
    • CommentTimeMar 30th 2006
     
    I have a two questions...

    One question I have is about the comment part. The email of the person leaving a comment does not appear to try and validate it as being an actual email addy. A user can simply type gibberish without the @ or the .com and the script will post their comment. The problem I see with this is it may allow for spammers to post easier. Any chance there is a way to validate this field?

    Second I wanted to put a required check box in the comment area before a visitor posted a comment, kind of like an ??agree to terms?. Two reasons, for one it would help cut down on the spam bots and two it would make a person more aware of the ??terms of usage?. Anyone have a way to do this?
  1.  
    for the first question, you'll want to use a regular expression. try adding this at about line 388 of plog-functions.php:

    if (!preg_match("(^[A-Z0-9._%-]+@[A-Z0-9._%-]+.[A-Z]{2,6}$)i", $email)) {
    return array("errors" => "You have entered an invalid email address.");
    };

    this just checks to make sure the entry looks like an email address... it doesn't verify if the address actually exists. More info on regular expressions and checking email addresses:
    http://www.regular-expressions.info/email.html
    • CommentAuthorShawn
    • CommentTimeMar 31st 2006
     
    Thanks so much for that... works like a charm, I knew what I needed to do but was looking in the wrong php files :o)