Multiple submit buttons in PHP
Last Updated on Tuesday, 5 July 2011 10:47 Written by A.Jesin Wednesday, 16 February 2011 09:21
This tutorial explains how to use multiple submit buttons in a HTML form and have PHP handle it. Usually a HTML form has only one submit button but there are situations when you might need to use more than one submit buttons and have PHP check which button has been pressed and an action to be done according to the button pressed. Having multiple submit buttons and handling them through PHP is just a matter of checking the the name of the button with the corresponding value of the button using conditional statements. Read More…
PHP IP Address
Last Updated on Friday, 4 February 2011 10:56 Written by A.Jesin Friday, 4 February 2011 10:56
PHP can be used to get the IP Address of a website visitor, IP address of the server hosting the website and resolve the IP address to get the hostname a.k.a reverse DNS records. PHP has predefined $_SERVER array variable using which IP addresses of both visitors and host can be retrieved. The gethostbyaddr() function is used to find out the hostname. The indices REMOTE_ADDR and HTTP_HOST contain the visitor IP address and host IP address Read More…
PHP Captcha Tutorial
Last Updated on Monday, 15 August 2011 04:01 Written by A.Jesin Thursday, 20 January 2011 11:02
Create a PHP captcha using simple PHP image handling functions. Creating a PHP Captcha image explained. The only difference between a captcha and a normal text written on an image is the former generates random strings and places it crookedly on the image making it difficult for bots to find out. This PHP captcha tutorial will make use of six image functions imagecreate(), imagecolorallocate(), imageline(), imagettftext(), imagepng(), imagedestroy(). You can feel free to modify it and add more functions to bring visual effects. For PHP Random string generation see the previous article. Read More…
PHP random string generation
Last Updated on Monday, 15 August 2011 07:26 Written by A.Jesin Tuesday, 18 January 2011 11:01
Generate a random alphanumeric string containing both uppercase and lowercase characters in PHP. The rand() function in PHP generates a random number we’ll be using this function to generate a random alphanumeric string. A variable should be declared containing all the alphabets in English both uppercase and lowercase (A-Z and a-z) and numbers from 0-9. The concept here is to randomly pick a character from the string containing all the characters and assign it to a variable. Each time this process is done the currently randomly selected character is concatenated with the previously generated characters. This should be done as many times the length of the random string required. For this a looping statement can be used. Read More…
PHP error_log .htaccess
Last Updated on Monday, 17 January 2011 01:35 Written by A.Jesin Monday, 17 January 2011 01:35
The PHP error_log setting specifies in which file the PHP script errors are logged. This setting is usually specified in the PHP configuration file php.ini which points to a file in which errors of all PHP scripts on that server are logged. It can be modified per directory basis to maintain separate logs for different set of scripts. For users on shared hosting account it is a bonus feature of being able to modify the error_log setting. Normally the error log is a single file for an entire server which is stored in one central place which is only accessible by the root user. But by modifying the error_log setting using htaccess you can have a separate error log for your web hosting account. The php_value error_log requires the php_flag log_errors to be On. Read More…
PHP Login Page Script
Last Updated on Monday, 15 August 2011 04:04 Written by A.Jesin Friday, 3 December 2010 11:08
PHP Login page script with three modules, the first one for allowing new users to register, the second for allowing users to login and the third page is a private page which only logged in users can access. Before reading this article make sure you read Connect PHP with MySQL because there is extensive use of PHP mysql functions throughout this article. The registration module uses INSERT query, the login module uses SELECT query to verify whether a user’s credentials exist in the database and creates a session and the private page checks to see if there is a session variable. Read More…
