Raphael Caixeta

Web & iOS Developer. @gripd co-founder. Investor. Adrenaline rush junkie. Brazilian. All around nerd, overall awesome.

  • Website
  • Twitter
  • Facebook
  • Dribble
  • Ask me anything
  • MySQL Data Sanitation

    If your project is accepting user input and you’re using MySQL, you’ll probably want to take a look at data sanitation. Luckily for you, I have a really useful function that takes your user’s input and sanitizes it so that it’s safe for database use.

    The function:

    function safedata($original) {
    return mysql_real_escape_string(stripslashes(strip_tags(
    htmlspecialchars(trim($original)))));
    }

    How to use the function:
    $username = safedata($_POST['username']); // That's all you need!

    Please note that in order for this function to work properly, you’ll need to be connected to a database.

    permalink Quick Tip Post
Theme by Elevate Local — Powered by Tumblr