Blog

python tutorials and learn python

Created with Sketch.

PHP password_hash

PHP password_hash Summary: in this tutorial, you’ll learn how to use the PHP password_hash() function to create a password hash. Introduction to the PHP password_hash() function The password_hash() function allows you to create a password hash using a secure one-way hashing algorithm. Here’s the syntax of the password_hash() function: password_hash(string $password, string|int|null $algo, array $options…
Read more

PHP filter

PHP filter Summary: in this tutorial, you’ll learn to define a PHP filter() function that sanitizes and validates data. Define PHP filter() function In the previous tutorials, you learned how to define the sanitize() and validate() functions to sanitize and validate data. The sanitize() function sanitizes data based on specified filters and returns an array…
Read more

PHP Sanitize Input

PHP Sanitize Input Summary: in this tutorial, you’ll learn to develop a reusable PHP sanitize() function to sanitize inputs. Introduction to sanitizing input Before processing data from untrusted sources such as HTTP post or get request, you should always sanitize it first. Sanitizing input means removing illegal characters using deleting, replacing, encoding, or escaping techniques.…
Read more

PHP Validation

PHP Validation Summary: in this tutorial, you’ll learn to build a reusable PHP validation library from scratch. In previous tutorials, you learned how to validate a form field using the filter_input() and filter_var() functions. For example, the following sanitizes and validates the email field in the POST request: // validate email $email = filter_input(INPUT_POST, ’email’,…
Read more

PHP Contact Form

PHP Contact Form Summary: in this tutorial, you’ll learn how to build a contact form in PHP that includes form validation, sending email, honeypot, etc. Introduction to the PHP contact form A contact form allows visitors of a website to leave messages. Typically, a contact form has the name, email, subject, and message input fields.…
Read more

PHP Upload Multiple Files

PHP Upload Multiple Files Summary: in this tutorial, you’ll learn how to upload multiple files to the server in PHP securely. Introduction to the PHP upload multiple files In the previous tutorial, you learned how to upload a single file from a client to the webserver in PHP. All the rules of uploading a single…
Read more

PHP File Upload

PHP File Upload Summary: in this tutorial, you will learn how to create a file upload form and process uploaded files securely in PHP. Introduction to the file input element The <input> element with the type=”file” allows you to select one or more files from their storage and upload them to the server via the…
Read more

PHP PRG (Post-Redirect-Get)

PHP PRG (Post-Redirect-Get) Summary: in this tutorial, you’ll learn how to use the PHP PRG (Post-Redirect-Get) technique to prevent the double form submission problem. The double submit problem To change data on the server via a form, you often use the post method. When a form is submitted, you validate the data, update the database,…
Read more

PHP Flash Messages

PHP Flash Messages Summary: in this tutorial, you’ll learn about the PHP flash messages and define a reusable flash() function to manage the flash messages effectively. Introduction to the PHP flash messages A flash message allows you to create a message on one page and display it once on another page. To transfer a message…
Read more

PHP CSRF

PHP CSRF Summary: in this tutorial, you will learn about cross-site request forgery (CSRF) attacks and how to prevent them in PHP. What is CSRF CSRF stands for cross-site request forgery. It’s a kind of attack in which a hacker forces you to execute an action against a website where you’re currently logged in. For…
Read more