1) One of the most common problems when having any kind of forms on a site is receiving spam. The more popular the site is, the more likely it will become a target for spamming entities and more difficult is to stop form spam. The use of Captcha is an easy and effective way of
Category: PHP
PHP
Make a Custom Captcha in PHP
If you make a custom captcha using php then you should follow below code. First i have generate random string using below code in captcha.php <?php session_start(); $string = ”; for ($i = 0; $i < 5; $i++) { // this numbers refer to numbers of the ascii table (lower case) $string .= chr(rand(97, 122));
How to secure PHP web applications and prevent attacks?
1) Cross site scripting (XSS) XSS attacks happen when client-side code (usually JavaScript) gets injected into the output of your PHP script. This can be through the URL, but can also occur via a stored technique such as the database. // GET data is sent through URL: http://example.com/search.php?search=<script>alert(‘test’)</script> $search = $_GET[‘search’] ?? null; echo ‘Search
How to autoload classes using spl_auotolad_register method in PHP?
This post regarding how to autoload classes in PHP without included require method. Some rules you have to follow. 1) The file name must be the class name. Like if you declare a class like SampleClass then your file name should be the same name. 2) If you declare a namespace then your folder name
What is Transaction and how to implement transaction in php using mysqli ?
A transaction is a sequential group of database manipulation operations, which is performed in a sequential manner. In other words, a transaction will never be complete unless each individual operation within the group is successful. If any step or process within the transaction fails, the entire transaction will fail. Properties of Transactions Atomicity − All operations
What is Namespaces and how it is used?
Namespaces are one of the most significant changes in PHP 5.3.Namespaces are a way of encapsulating items. As the size of your PHP code library increases, the more likely you will accidentally reuse a function or class name that has been declared before. The problem is exacerbated if you attempt to add third-party components or
What is Traits and How it is used?
Traits are one of the biggest addition in the PHP 5.4. In PHP trait is the method of code re-usability.As we know PHP is single inheritance programming language.As per my opinion, the main intention of introducing the trait in PHP is to reduce limitation of code re-usability in PHP single inheritance nature. The structure of
New Important Features in PHP 7
Php 7 gives some important features through which you can really love to use and apply those things to your project So, let’s explore with new features. Please follow and like us: