About phptuts

Author Archive | phptuts

PHP: Example of usage CURLOPT_HEADERFUNCTION

If you set option CURLINFO_HEADER_OUT to true, you can get request header with function curl_getinfo (see example 2) CURLOPT_HEADERFUNCTION: A callback accepting two parameters. The first is the cURL resource, the second is a string with the header data to be written. The header data must be written by this callback. Return the number of […]

Read full story Comments { 0 }

How To Install Linux, nginx, MySQL, PHP (LEMP) stack on Debian 8

Step 1: install nginx: Result: Step 2: Install MySQL Step 3: Install php-fpm and php5-mysql Result: Step 4: Edit file /etc/php5/fpm/php.ini Find line change to Step 5: Configure Nginx to use our PHP Example we edit file /etc/nginx/sites-available/default Done!

Read full story Comments { 0 }

How to install netstat on Linux

To install netstat on Linux, use one command line Result:

Read full story Comments { 0 }

PHP function chr of unicode character

PHP have function chr to find a character from a ASCII value. But PHP don’t support a function to find this with unicode character. Now, we provider some method, they are equivalent with String.fromCharCode() in Javascript: Examples:

Read full story Comments { 0 }

How to install OpenVPN on Linux

You can easily install OpenVPN on Debian, Ubuntu and CentOS by using only one command line: Result: Finish, now you retype that command to create new account, remove account, uninstall OpenVPN Result: Looks like OpenVPN is already installed If you get the error during the installation: You can easily fix it by using these command […]

Read full story Comments { 0 }

RC5 block cipher implement in PHP and Javascript – part 2

Read part 1: RC5 block cipher implement in PHP and Javascript Application of this block cipher method for stream cipher: There are many methods, but we can provide the method below: Split your string into many block with 64 bits (8 characters), then use this block cipher method. We can use the method Null-padding for […]

Read full story Comments { 1 }

PHP, JS: How to detect Safari browser

PHP Example: Result: Javascript

Read full story Comments { 0 }

RC5 block cipher implement in PHP and Javascript

In cryptography, RC5 is a symmetric-key block cipher notable for its simplicity. Designed by Ronald Rivest in 1994. RC5 encryption and decryption both expand the random key into 2(r+1) words that will be used sequentially (and only once each) during the encryption and decryption processes. All of the below comes from Rivest’s revised paper on […]

Read full story Comments { 1 }

XXTEA block cipher implement in PHP and Javascript

In cryptography, Corrected Block TEA (often referred to as XXTEA) is a block cipher designed to correct weaknesses in the original Block TEA. Source: https://en.wikipedia.org/wiki/XXTEA We provide some function implement in PHP and Javascript: PHP Javascript: Example: Try it yourself Read more: TEA block cipher implement in PHP and Javascript Test vectors TEA XTEA block […]

Read full story Comments { 1 }

XTEA block cipher implement in PHP and Javascript

In cryptography, XTEA (eXtended TEA) is a block cipher designed to correct weaknesses in TEA. The cipher’s designers were David Wheeler and Roger Needham of the Cambridge Computer Laboratory, and the algorithm was presented in an unpublished technical report in 1997 (Needham and Wheeler, 1997). It is not subject to any patents.[1] Like TEA, XTEA […]

Read full story Comments { 1 }