Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 PHP


  Using DateInterval class in PHP

DateInterval is (amongst others) a relatively new addition to the date extension in PHP 5.3. It allows to describe an interval in time, and you can perform actions with that interval. Basically, it allows to calculate with dates in a very easy way, and do even more fun stuff with it.Unfortunately no documentation exists today for DateInterval and friends, but PHP is open-source so you can easily have a peek at the code to see what’s happening under the engine. This is more or less what the documentation for DateInterval and some helper functions could look like:Prototype:DateInterval Da...

5,371 0       PHP DEMO CLASS DATEINTERVAL PHP 5.3


  Install and enable redis extension in PHP 5.X on Windows

Redis is frequently used as a caching layer for web applications to improve its performance. In PHP 5.x, if one wants to use Redis, the redis extension needs to be installed and enabled first.This post will show how to install and enable redis extension on Windows with PHP 5.X. Basically there are two dlls to be downloaded: php_redis.dll and php_igbinary.dll.Below are detailed stepsGo to http://windows.php.net/downloads/pecl/releases/redis/2.2.7/ and find the respective php_redis zip matching your environment.Go to windows.php.net - /downloads/pecl/releases/igbinary/2.0.1/ and f...

5,291 4       PHP WINDOWS REDIS PHP 5.6


  Handy PHP functions should be in your toolkit

When developing projects, there are always some common work should be accomplished, for example, encrption/decryption, get IP. As a PHP developer, you should have a list of the handy functions in your toolkit so that you can pick up in every project you work on. Here is a summary of some handy PHP functions.1. PHP encryption/decryptionEncryption/decryption can be used when storing user confidential information such as passwords. Below function uses base64 and MD5 to accomplish encryption/decryption.function encryptDecrypt($key, $string, $decrypt){ if($decrypt){ $decrypted = rtrim(m...

4,945 0       PHP SQL INJECTION FUNCTION REAL IP


  Top 10 PHP Best Security Practices for Sys Admins

PHP is widely used for various of web development. However, misconfigured server-side scripting would create all sorts of problem. And here are php security best practices that you should aware when configuring PHP securely. Nowadays most of the web servers are operated under Linux environment (like: Ubuntu, Debian...etc). Hence, in the following article, I am going to use list top 10 ways to enhance PHP Security Best Practices under Linux environment.My sample setup for PHP Security Tips:DocumentRoot: /var/www/Default Web server: Apache Default PHP configuration file: /etc/php.iniDefaul...

4,906 0       PHP ADVICE CODE SECURITY SYSTEM ADMIN BEST PRACTICE


  Kodiak PHP can run PHP codes offline on iPad

In the eyes of the vast majority of application developers, iPad is the terminal equipment for running code, rather than the tool used to write code. However, there are some applications developers finding iPad's potential to develop a wide variety of programming applications with some applications, such as Diet Coda, Koder, Gusto and so on. The family of applications for writing applications has added a new member -  Kodiak PHP. This application runs on iPad, it can be used to develop PHP applications and also can be used to run PHP codes offline.Kodiak PHP is an Integrated Development E...

4,738 0       IPAD KODIAK PHP ROGRAMMING


  Optional arguments in PHP function

In PHP, we can define our own functions which can accept optional number of arguments. In this kind of functions, the optional argument should be set with default value.Fox example, the next code example will illustrate this:<?php function func($name,$type=NULL) { echo "$name $type"; } func("Hello"); echo "<br />"; func("Hello","world"); echo "<br />";?>Here $type is an optional argument. It must be set with a default value either NULL or some other value. Quite simple.Right! In other programming languages, we can achieve similar effects. This is very convenient if we...

4,536 0       PHP OPTIONAL ARGUMENTS USER DEFINED FUNC


  PHP Apache MySQL Set-up Note

With the emergence of WAMP, LAMP, PHP developers are liberated from the tedious work of setting up PHP environment. Since PHP, Apache and MySQL are so tightly bundled, WAMP and LAMP provide a setp solution for setting up a PHP environment which includes the programming programming environment, server and database. But for a PHP who wants to learn more, you have to try to set the PHP environment yourself by installing PHP, Apache and MySQL manually and configuring them.Below is a simple note on how to setup the PHP environment on Mac OS X. This setup guide should also be helpful on other system...

4,529 0       PHP APACHE MYSQL


  File upload in PHP

File is a special kind of form data, when being uploaded to the server through HTTP POST request, PHP will create a $_FILES global array, the relevant file information will be stored in this global array. We will illustrate file upload with some code snippets using PHP and look into the internal work mechanism. Lastly will talk about file upload security.File uploadIn order for users to upload files in client side, we have to provide a form on the user interface. Since the uploaded file is a special data, it is different from other POST data, so we have have to set a special encoding for the f...

4,527 1       PHP FILE UPLOAD