PHP Code Samples

PHP Login Script with Remember Me

March 23, 2016
This post is outdated. See Secure Remember Me for Login using PHP Session and Cookies for creating a login with Remember Me. In a login script, remember me feature is used to preserve the login name and password entered by the user. And it can be populated in the login form at the time of […]
This tutorial was added to PHP.

PHP MySQL Date Range Search with jQuery DatePicker

February 14, 2016
In this tutorial, we are going to see how to search database records date between two given ranges. It will return the filtered results from the database based on these dates input. In this tutorial, we are using jQuery DatePicker to choose the dates for the search options. These date inputs are used to form […]
This tutorial was added to PHP.

Show PHP Captcha on Failed Login Attempts

February 2, 2015
In this tutorial, we are going to show captcha code if a user tried more than 3 failed login attempts. In the previous tutorial, we have seen user login and PHP captcha. So, we are going to combine this two tutorial to add captcha control for invalid login. In this example, we have a MySQL […]
This tutorial was added to PHP.

User Login Session Timeout Logout in PHP

November 24, 2014
This PHP tutorial is used for setting user login session expiration time for the logged-in user. Once, this time is elapsed then the user no longer access the authenticated pages of the application. In the previous tutorial, we have created session variables once a user logged in to our application. In this tutorial, we are […]
This tutorial was added to PHP.

PHP CRUD with Search and Pagination

November 2, 2014
In this tutorial, we will see about a simple PHP application for database create, read, update and delete (CRUD) operations. With these CRUD operations, we will also have search and pagination features integrated to it. Earlier, we saw about CRUD with AJAX and CRUD without AJAX (both did not have search and pagination). Now in […]
This tutorial was added to PHP.

Command Line PHP

August 25, 2014
Using PHP though command line is possible and we will see how to do it in this tutorial. Generally, PHP is used for creating web-based applications. There are occasions where PHP script can be used apart from regular web applications such as automatic mail sending, Cron job for getting backup, automatic log tracking and etc. […]
This tutorial was added to PHP.

Send Email in PHP using Gmail SMTP

December 5, 2013
In this tutorial, let us see how to send email in PHP using PHPMailer library via Gmail SMTP. Sending email in PHP can be done with various mail transfer libraries available. For example,  PHPMailer, PEAR::Mail interface. These libraries provide advanced features like SMTP authentication and more. Sending an email with PHP’s core function mail() is […]
This tutorial was added to PHP.


October 18, 2013
cURL – Client URL library is used to communicate with different type of servers with protocols FTP, HTTP, telnet, gopher and more. In PHP, we have to install libcurl library for using cURL function. If we used any one of AMP bundle like XAMPP, to create PHP environment, then the cURL library will come up […]
This tutorial was added to PHP.

PHP Change Password Script

September 15, 2013
Change password feature in a web application is to let the user change their old password at some periodic interval. It makes the user protect the sensitive pages from hackers. Some web application fixes some expiration period for user’s password. It forces the user to change the password once the expiration period is elapsed. For […]
This tutorial was added to PHP.

PHP Login Script with Session

July 22, 2013
In this tutorial, let us see how we can implement authentication using a standard login form with session handling. Most of the website will have login script to provide user authentication. I will present you an example PHP code to implement authentication using a login script. With authentication, we can protect our website by filtering genuine […]
This tutorial was added to PHP.

↑ Back to Top