| | |
SQL Injection -measures for prevention
Please support our MySQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
0
#2 31 Days Ago
--> mysql_real_escape_string
--> Use htmlentities() for user submitted data!
when you get the id from the url:
$id = $_GET["id"];
use this:
$id = (int)$_GET["id"];
this is only when the ID is a integer!
I would suggest using a php mysql class!
--> Use htmlentities() for user submitted data!
when you get the id from the url:
$id = $_GET["id"];
use this:
$id = (int)$_GET["id"];
this is only when the ID is a integer!
I would suggest using a php mysql class!
Last edited by smartness; 31 Days Ago at 2:54 pm.
1
#3 31 Days Ago
using php base64_encode and php base64_decode can help as well.
never run a query on data you unsure about.
also, its a good idea to restrict the permissions of the mysql user your scripts are using, so in case someone does get in, they can't create, alter or drop tables. require an additional login before allowing those type of queries.
backup early. backup often.
never run a query on data you unsure about.
also, its a good idea to restrict the permissions of the mysql user your scripts are using, so in case someone does get in, they can't create, alter or drop tables. require an additional login before allowing those type of queries.
backup early. backup often.
Don't pay data charges. txtFeeder.com is a free way to read the web on your mobile, and avoid data charges! **Now txtFeeder has a wireless note feature! Make notes on the go!
-Kyle Getson
-Kyle Getson
•
•
Join Date: Sep 2009
Posts: 13
Reputation:
Solved Threads: 0
0
#4 30 Days Ago
•
•
•
•
when you get the id from the url:
$id = $_GET["id"];
use this:
$id = (int)$_GET["id"];
this is only when the ID is a integer!
I had never known about that, it looks interesting. For example if I have "index.php?id=33&page=1" . What to encode? I guess "id=33&page=1" ?
0
#5 30 Days Ago
When creating links use:
Then when getting those variables:
hope that helps.
MySQL Syntax (Toggle Plain Text)
$id=33; $page=1; $link = "index.php?id=".base64_encode($id)."&page=".base64_encode($page);
Then when getting those variables:
MySQL Syntax (Toggle Plain Text)
$id = base64_decode($_GET['id']); $page = base64_decode($_GET['page']);
hope that helps.
Don't pay data charges. txtFeeder.com is a free way to read the web on your mobile, and avoid data charges! **Now txtFeeder has a wireless note feature! Make notes on the go!
-Kyle Getson
-Kyle Getson
![]() |
Similar Threads
- SQL Injection Attack (Database Design)
- SQL Injection (Windows NT / 2000 / XP)
- Data Safe - SQL Injection (PHP)
- SQL Injection Attacks (Database Design)
- Sql injection (MS SQL)
- SQl Injection through ASP and MS SQl 2000 (ASP)
Other Threads in the MySQL Forum
- Previous Thread: mySQL permissions ... a few newbie questions
- Next Thread: Any experience with MySQL Dump Timer ?
| Thread Tools | Search this Thread |
amazon api artisticlicense aws bizspark breathalyzer camparingtocolumns changingprices cmg communityjournalism contentmanagement contractors copyright count court crm data database design developer development distinct drupal dui ec2 email enterprise eudora facebook form foss gartner gnu government gpl greenit groklaw groupware hiring hyperic images innerjoins insert ip joebrockmeier journalism keyword keywords kickfire laptop law legal license licensing linux managing mariadb matchingcolumns metron micromanage microsoft microsoftexchange mindtouch montywidenius mozilla multiple music mysql mysqlcolumnupdating mysqlindex mysqlinternalqueries mysqlquery mysqlsearch news opendatabasealliance opengovernment opensource oracle penelope php priceupdating query referencedesign reorderingcolumns resultset saas select sharepoint simpledb single sourcecode spotify sql sugarcrm syntax table techsupport thunderbird transparency virtualization





