LooieENG Posted October 16, 2008 Share Posted October 16, 2008 Can I just use mysql_real_escape_string() when they input the email into the data and then use stripslashes when I use mail()? If not, what's the simplest validation with the least/simplest code? Quote Link to comment https://forums.phpfreaks.com/topic/128756-email-validation-as-fast-and-with-as-little-code-as-possible/ Share on other sites More sharing options...
aeonsky Posted October 16, 2008 Share Posted October 16, 2008 To sanatize and to validate, are different things. Right now you are sanitizing it against possible injections. And that is the right way to do it. Might want to add 'trim();' to it too. If you want to validate, make sure you check that the email contains '@' and '.com' or whatever. Quote Link to comment https://forums.phpfreaks.com/topic/128756-email-validation-as-fast-and-with-as-little-code-as-possible/#findComment-667354 Share on other sites More sharing options...
LooieENG Posted October 16, 2008 Author Share Posted October 16, 2008 Ah, I meant sanitse. It'll be for sending confirmation emails for registration, so if they don't enter a proper email that's fine with me Where should I use trim()? Quote Link to comment https://forums.phpfreaks.com/topic/128756-email-validation-as-fast-and-with-as-little-code-as-possible/#findComment-667356 Share on other sites More sharing options...
aeonsky Posted October 16, 2008 Share Posted October 16, 2008 mysql_real_escape_string(trim($email)); Quote Link to comment https://forums.phpfreaks.com/topic/128756-email-validation-as-fast-and-with-as-little-code-as-possible/#findComment-667379 Share on other sites More sharing options...
LooieENG Posted October 16, 2008 Author Share Posted October 16, 2008 Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/128756-email-validation-as-fast-and-with-as-little-code-as-possible/#findComment-667395 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.