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? 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. 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()? 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)); 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. 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
Archived
This topic is now archived and is closed to further replies.