Jump to content

Recommended Posts

Whats the best way to prevent your website to get sql injected?

 

i have this function that i wrap around my variables

 

function escape_data($data) {

  global $connect;

  if (ini_get('magic_quotes_gpc')) {

  $data = stripslashes($data);

}

  return mysql_real_escape_string(trim($data), $connect);

}

 

Is this function going to prevent my websites from getting owned? Any other recommendations anyone else?

 

Thanks again

 

Link to comment
https://forums.phpfreaks.com/topic/78292-best-way-to-prevent-sql/
Share on other sites

That's good.  Before you even get here, you might also want to force type cast variables of a specific type like INT.  So, there are many other little things you can do along the way.  Also, alert yourself by email to potential abuses in  your system and log them.

Yes don't allow them to keep trying at injecting sql into your forms and sites. Create somewhere in there an email or storage system which gets their ip and other important information. You can then at least take some steps to preventing them from even accessing your site let along attempting to sql inject or cross script your sites.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.