2012年2月8日星期三
Gonzalo Ayuso's Blog: How to protect from SQL Injection with PHP
In a recent post to his blog, Gonzalo Ayuso shares a few tips on preventing SQL injection attacks on your applications.
Security is a part of our work as developers. We need to ensure our applications against malicious attacks. SQL Injection is one of the most common possible attacks. Basically SQL Injection is one kind of attack that happens when someone injects SQL statements in our application. You can find a lot of info about SQL Injection attack. Basically you need to follow the security golden rule: "Filter input, Escape output".
He advocates the use of the PDO abstraction layer to filter out a lot of the issues. Using its prepared statements, you can easily strip out things that just adding slashes to user input wouldn't prevent. He also includes a reminder about database permissions - allowing only certain users the ability to, for example, delete can help provide one more level of security (in other words, don't use a "super user" in production).
Rob Allen's Blog: One-to-Many Joins with Zend_Db_Table_Select
Rob Allen has a tip for the Zend Framework users out there using the Zend_Db module to connect to their database resources - how to do a one to many join with the help of Zend_Db_Table_Select (easier than it sounds).
Let's say that you want to set up a one-to-many relationship between two tables: Artists and Albums because you've refactored my ZF1 tutorial. [...] Assuming you're using Zend_Db_Table, the easiest way is to turn off the integrity check and do a join in a mapper or table method.
He includes a few lines of source to illustrate, calling the "setIntegrityCheck" value to "false" to tell ZF not to worry about the additional join value over to the artists table. The result is a new column value with the artist's name instead of just the ID.
2012年2月7日星期二
Voices of the ElePHPant: Interview with Elizabeth Naramore
The Voices of the ElePHPant podcast has released their latest episode (one recorded a while back) - an interview with Elizabeth Naramore, a well-known PHP community member.
This episode was recorded in 2011. Elizabeth now works for Orchestra.io. It's still a fun interview though because...well, it's Elizabeth.
You can find her blog here and follow her on Twitter here. If you'd like to listen to this latest episode, you can either listen in-page or download the mp3 directly.
Brandon Savage's Blog: New Rockville PHP Group
If you're in the Montgomery County, Maryland area and are a PHP developer looking to reach out and meet others, you should check out this new post from Brandon Savage. He's trying to start up a user group in that area.
There are lots of active, vibrant developer groups in the DC area: DC PHP, Baltimore PHP, and the Frederick Web Tech group. The DC PHP Beverage Subgroup meets monthly in Northern Virginia. But in the middle between all these groups lies Montgomery County, Maryland. In that area live hundreds of developers who struggle to reach any of the developer groups in the area on a weeknight. It's time to build them something of their own.
His focus is the Montgomery County area so as not to directly take away from any of the other groups in the area people already attend. If you're interested in a group in that area, leave him a comment or hit him up on Twitter.
NetTuts.com: Turbocharge your Website with Memcached
On the NetTuts.com site there's a new tutorial showing you how to introduce the Memcached tool to your application - a quick and easy way to cache data and optimize performance.
Your latest PHP/MySQL website is finally online. And it's awesome. But it's not as fast as you want it to be, because of the many SQL queries running every time a page is generated. And above that, you have the feeling it will not scale well under heavy loads. And you are most likely right. In this tutorial, we will see how you can greatly improve your website's responsiveness [...] by implementing a cache layer between your code and your database. The good news is it is fairly easy, and can be done in a few minutes!
They help you get the memcached server installed (a one-liner in most linux distributions) and how to install the memcached extension using PECL. Code is included showing you how to connect to the server, store data into the cache based on a generated key and how to pull the same data back out.