Click here to Skip to main content
15,884,353 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
What is the best way of securing my database against hackers. I use this code below:

PHP
<?php

$sname=mysql_escape_string(trim($_POST['sname']));


$insert=mysql_query("INSERT INTO user(sname) VALUES(sname)");


if ($insert){

echo "success";

}

else{

echo "not successful";

}

?>



Will this be enough to secure my database?
Posted

 
Share this answer
 
Security of you data requires taking quite a number of factors into consideration, some that pop up to mind are:

1. Encryption of data in the DB.
2. Transport layer encryption.
3. Username & Password protection, strength and encryption/hashing.
4. SQL Injection and other data level ditch-holes.

See a quick review on Securing SQL Server [^]

Good luck,
Edo
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900