halben Posted September 17, 2013 Share Posted September 17, 2013 Hello Guys/Gals, Can someone please tell me how safe this sanitation is? $username = filter_var($_POST['user_name'], FILTER_SANITIZE_STRING); Thanks, Halben Link to comment https://forums.phpfreaks.com/topic/282224-sanitizing-strings-question/ Share on other sites More sharing options...
AbraCadaver Posted September 17, 2013 Share Posted September 17, 2013 Depends upon what you need. What are you hoping that will do? Make it safe for what? Link to comment https://forums.phpfreaks.com/topic/282224-sanitizing-strings-question/#findComment-1449905 Share on other sites More sharing options...
halben Posted September 17, 2013 Author Share Posted September 17, 2013 I'm doing something like this: $user_email_data = trim(strip_tags(stripslashes($_POST['user_email']))); // Now use PHP to check for validation if (filter_var($user_email_data, FILTER_VALIDATE_EMAIL)) { ..... How safe is that? Link to comment https://forums.phpfreaks.com/topic/282224-sanitizing-strings-question/#findComment-1449921 Share on other sites More sharing options...
AbraCadaver Posted September 17, 2013 Share Posted September 17, 2013 I'm doing something like this: $user_email_data = trim(strip_tags(stripslashes($_POST['user_email']))); // Now use PHP to check for validation if (filter_var($user_email_data, FILTER_VALIDATE_EMAIL)) { ..... How safe is that? Validate and sanitize filters are different. Sanitize will change it to make it "safe" and validate tells you whether it is valid or not. Link to comment https://forums.phpfreaks.com/topic/282224-sanitizing-strings-question/#findComment-1449923 Share on other sites More sharing options...
halben Posted September 17, 2013 Author Share Posted September 17, 2013 I think I figured it out. Thanks guys. Link to comment https://forums.phpfreaks.com/topic/282224-sanitizing-strings-question/#findComment-1449925 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.