Role Based Access Control in PHP. There are several different approaches when it comes to managing user permissions, and each have their own positives and negatives.
For example, using bit masking is extremely efficient but also limits you to 32 or 64 permissions (the number of bits in a 32- or 64-bit integer). Another approach is to use an access control list (ACL), however you can only assign permissions to objects rather than to specific or meaningful operations. How to write secure Yii applications. Warning: While this security guide tries to be quite complete, is not exhaustive.
If security matters for you, you ought to check several other references. General principles ¶ Validate the user input (see below for details).Protect (escape) your application output according to context (see below for a few output types, mostly HTML and SQL).Test your application in debug mode. Set the constant YII_DEBUG to true (by default, it is defined in index.php) and put alongside error_reporting(E_ALL);. Error Handling in PHP » phpmaster. Errors are the most common event a developer faces when programming.
Errors can be categorized as syntactical, run-time, or logical: missing the semicolon at the end of a statement is an example of a syntax error; trying to connect to a database when the server is down is an example of a run-time error; providing incorrect data to a variable is an example of a logic error. To help reduce the number of errors in your code, and to mitigate their effects, proper error handling is essential in your web application.
This article is a crash course in PHP error handling. How to Create a PHP Website Template from Scratch. This is a tutorial on creating a PHP website template starting with HTML and CSS.
We will start with the basics and you can also download the final product. Please remember that I am using very basic CSS styling in this example just for you to get the idea, and not so much to make it look pretty. The download will contain both the styled example as well as a complete blank template that you can use for your own starting point for any project personal or commercial. The demo files are released under GPL V2.
Manual. Formatting PHP Strings with printf and sprintf. Home : Articles : Formatting PHP Strings with printf and sprintf Tutorial by Matt Doyle | Level: Advanced | Published on 19 November 2009 Categories: Learn how to use PHP's printf(), sprintf() and related functions to format strings.