Jump to content
  • Advertisement
Sign in to follow this  
spraff

What was I thinking?

This topic is 3786 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Here's a line of PHP I wrote a while ago and didn't comment. Can anyone tell me why the hell I might have written that second regex?
$email_ok = preg_match("/^\w+(\.\w+)*@\w+(\.\w+)+$/", $_POST['email'])
	and preg_match("/^[']*$/", $_POST['email']);

Bizzarely, $email_ok ends up true in the normal course of things.

Share this post


Link to post
Share on other sites
Advertisement
I'm not a PHP-expert (or even novice, to be perfectly honest), but from the looks of it it's testing that the input doesn't contain an apostrophe ("'"), which could be used for SQL-injection.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!