Posts Tagged ‘PHP’

Securing PHP Applications Part III – Securing PHP on the server / Securing MySQL and Apache

Hi there. This is the last part of this tutorial where I tell you a few things about securing PHP on the server, about securing MySQL and Apache.
OBS: If you don’t administer your own server, this information will be useful to you while shopping for a Web host, so you better continue reading.
Before starting this [...]

Securing PHP Applications Part II – Securing PHP code

5. SQL injections
What is it?
This type of attack is one of the most common attacks. SQL injections occur after two failures of the part of developers: failure to filter data as it enters the application (filter input) and failure to escape data as it is sent to the database (escape output). For example, let’s suppose we [...]

Securing PHP applications Part I – Securing PHP code

There are a lot of books treating this issue. So, why another post about this subject. Well, here a try to cover this problem in a short way so that you don’t have to read hundreds of pages or to search all over the Internet for this.
These being said, you must know that securing a [...]

Design Pattern Part III – Observer

The problem:
Well, this is my favorite. Why? Because get you free of a lot of responsabilities. Let me explain: suppose you have an online newspaper website and for publishing an article you must follow these steps:
1. write the article
2. insert the article in the proper table in your database
3. delete the cache (an necessary operation for the article [...]

Design Patterns Part II – Factory

The problem:
We need a method that could generate us different “products” based on different conditions or, why not, depending on the context. If we didn’t know about design patterns we would solve this by creating an endless if then else set of conditions. I know, this is the fastest solution that comes into your head, [...]

Design patterns Part I – Singleton

Procedural vs object- oriented
One core difference between object-oriented and procedural code can be found in the way that responsibility is distributed. Procedural code takes the form of a sequential series of commands and method calls. The controlling code tends to take responsibility for handling differing conditions. This top-down control can result in the development of [...]

SWF image upload & crop for php using jQuery

Recently I’ve needed a plugin to upload an image using SWF upload and to crop the uploaded image using jQuery and then  save the crop result. I couldn’t find this combination, so I’ve tried to combine these requests: SWF upload, crop with jQuery and php.
I’ve found something about SWF upload here and something about jQuery [...]

Bandwidth limit script

Sometimes you want to limit the bandwidth for certain ips or sites, in order to keep your traffic within limits, or to keep constant bandwidth to all users, regardless of how much they are downloading.
Here is a solution to do that:

Common php errors and how to debug them

A lot of questions asked by beginners are about errors errors that occur when running a PHP script. In the following article, I will try to summarize these errors, hoping to be useful to those who, like me when I’ve started coding in PHP,met with such problems.

Running multiple processes in PHP

Sometimes you need multiple commands to run in parallel to save up script processing time for repetitive tasks.
In the “Building a Video sharing site” project that i will present here soon, I needed a script to run multiple video processing jobs. PHP wasn’t meant to support multitasking, but with a few tricks we can emulate [...]