Jump to content

Filtering and stripping comment data...


cgm225

Recommended Posts

I am creating a class used to process comments posted by users on a blog page.  I set the variable values as follows, and I want to know if there are any other things I should be doing to check the user supplied data for badness...

 

        //Checks for, filters, and strips post data
        $this->name = !empty($_POST['name']) ? strip_tags($_POST['name']) : null;
        $this->email = (isset($_POST['email']) AND filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) ? $_POST['email'] : null;
        $this->url = (isset($_POST['url']) AND filter_var($_POST['url'], FILTER_VALIDATE_URL)) ? $_POST['url'] : null;
        $this->comment = !empty($_POST['comment']) ? strip_tags($_POST['comment']) : null;
        $this->ip = $_SERVER['REMOTE_ADDR'];

Link to comment
https://forums.phpfreaks.com/topic/123784-filtering-and-stripping-comment-data/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.