Jump to content

keepitcoder

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

keepitcoder's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. When I do $q = preg_replace("/^[a-zA-Z0-9 ]{0,48}$/D", "", $_GET["q"]); it doesn't actually work.
  2. So I have a basic search form that goes through and does a mySQL like '%$sanitizedInput%' to column in the table. The problem I have is that if I have two rows, one with a value "green" and the second "blue", and I do a search for "green", it shows the green result, if I do a search for "blue", it shows the blue result, but if i do a search for "green blue" it returns no results. Any ideas on how to fix this?
  3. Thank you guys! As soon as I get home, I'll test it all out. How would I utilize this with preg_replace (or another function), as I want to sanitize this input using that's collected from a form as I'll be using it with mySQL queries?
  4. I'm trying to sanitize some form inputs (from xss/sql injection, etc.). I was wondering if someone can help me write 2 different preg_replace statements, as I'm really confused by it. I need one that will allow only numbers up to 5 characters, and one that will allow a-zA-Z0-9 and spaces up to 48 characters. I found this online, would something like this work? $q = preg_replace("/[^a-zA-Z0-9 ]+/", '', $q); $p = preg_replace("/[^0-9]+/", '', $p); Can you guys help me or point me to some great and easy tutorial? Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.