Filter input

Wratox1

Member
Reaction score
22
Hello, could someone tell me how i should filter form input to prevent sql injection?

either you could explain how to or give me a good tutorial on how to do it.
 

GetTriggerUnit-

DogEntrepreneur
Reaction score
129
Considering you use PHP for this example.
PHP:
<?php
    $query = mysql_real_escape_string(htmlentities(htmlspecialchars(addslashes($query))));
?>
Note that you will need to use stripslashes() before outputting your data, since you used addslashes().
 

tooltiperror

Super Moderator
Reaction score
231
Wouldn't [LJASS]htmlspecialchars_uni($input)[/LJASS] be enough?
 

Wratox1

Member
Reaction score
22
how would i use addslashes()? ive never used it before so could you show me an example?
 

GetTriggerUnit-

DogEntrepreneur
Reaction score
129
PHP:
$str = "I like your mom's pizza.";
addslashes($str);
print $str;
//prints "I like your mom\'s pizza."
 

Lyerae

I keep popping up on this site from time to time.
Reaction score
105
You should check to see if MySQLi is enabled. It's (from what I understand) a faster version of the MySQL driver for PHP. You can use prepared statements to prevent injections as well (or so I've been told).
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top