Main Menus
Make cash!
| WilliamBlake Articles: 8 | |
| SpencerWilkins Articles: 5 | |
| RobertCarlton Articles: 5 | |
| ezimedia Articles: 19 | |
| RalphBennett Articles: 7 | |
This article is licensed under a Creative Commons Attribution-No Derivative Works 3.0 Unported License, which means you may freely reprint it, in its entiretly, provided you include the author's resource box along with LIVE links (without "nofollow" tags).
View PDF | Print View | Html Version
by: ChrisChanning
Total views: 2
Word Count: 501
SQL injection is becoming a problem for web developers- especially those new to the field who aren't up to speed on how insecure PHP can really be. But as the experts like to say, PHP isn't the problem- it's the knowledge of the programmer that counts when it comes to preventing SQL injection attacks.
SQL injections are defined by the vulnerability in the SQL query that PHP developers make use of. When the developer in question puts forth an SQL query, he or she needs to make an effort to validate any input that could come from any web form or entry field. A simple input statement such as "a' OR 'a'='a'" could compromise the security of one's database with ease.
PHP developers have used the magic quotes function to help safeguard against SQL injections. Magic quotes are no longer in use, however, since they were more of a hassle than anything. It is recommended that if a developer has used magic quotes, he or she should remove them since they are no longer supported as of PHP 6. Thus, we need to look elsewhere for a security solution.
There is but one simple solution when it comes to getting rid of the threat of an SQL injection. This simplle solution comes via the function mysql_real_escape_string(). This function was created specifically for safeguarding against SQL injections, so it's well worth the time to use. Just pass any values being inserted through this function, and the result is a perfectly escaped string.
Oddly enough, we can create a greater sense of security through creating more user accounts via our SQL program. We can assign different types of access to different users, which would make it quite hard for attackers to get full access to our database should they find a hole somewhere. Having a user for creating, deleting, and inserting data is a good idea to help split up responsibility.
It should be noted that programs and web applications that stop SQL injections should not be obtained- since they commonly cost quite a bit of money. As long as webmasters take precautions with what they create, there should be no reason to spend hundreds of dollars on software that only makes use of escape characters and formatting data correctly. This type of application is created to con webmasters into buying something they don't need- so dont fall victim to them!
In Conclusion
SQL injections are never a pretty sight. They ruin databases, can be a security risk to users of the website, and they even can destroy entire websites. Thus, it's good to either hire developers that know what they are doing or to brush up on some security topics by one's self. Doing so can save a world of hurt for a webmaster, as well as quite a bit of money from not having to buy mock applications that claim to do the "hard work" for webmasters. In the end, it's recommended developers pick up a good book or visit their favorite PHP security websites to stay informed.
Learn more on A Great Guide and here.