| | |
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 Oct 23rd, 2009
--> 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; Oct 23rd, 2009 at 2:54 pm.
1
#3 Oct 24th, 2009
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 Oct 24th, 2009
•
•
•
•
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 Oct 24th, 2009
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 |
agplv3 alfresco amazon api artisticlicense aws bizspark breathalyzer camparingtocolumns changingprices cmg communityjournalism contentmanagement contractors copyright count court crm database design developer development distinct drupal ec2 email enterprise eudora facebook form foss gartner gnu gpl greenit groklaw groupware hiring hyperic images innerjoins insert ip joebrockmeier join journalism keywords kickfire laptop law legal license licensing linux maintenance managing mariadb matchingcolumns metron micromanage microsoft microsoftexchange mindtouch montywidenius mozilla multiple music mysql mysqlcolumnupdating mysqldatetimeordermax() mysqlindex mysqlinternalqueries mysqlquery mysqlsearch news open-xchange opendatabasealliance opengovernment opensource oracle penelope php priceupdating query referencedesign reorderingcolumns resultset saas select sharepoint simpledb sourcecode spotify sql sugarcrm syntax techsupport thunderbird transparency virtualization





