cgm225 Posted September 11, 2008 Share Posted September 11, 2008 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.