SlideShare a Scribd company logo
1 of 4
PHP Filters
PHP filters are used to validate and filter data
coming from insecure source like user input, web
services data, cookies and database query
results.
It validate and sanitizing data. Validation data
means data is in proper form or not and
sanitizing means remove any illegal character
form data
Why Use Filters
 Almost all web applications depends
on external inputs and by using filter
you can be sure your application gets
correct input type
 Invalid submitted data can lead to
security problems and break your
webpage!
Functions and Filters
 Filter_var() :- filter a single variable with
specified filter flag
 Filter_var_array() :- filter the several variable
with the same or different
filter.
 Filter_input :- get one input variable and filter
it.
 Filter_input_array :-get several input variable and
filter then with the same
or different filter.
 Filter_id() :- return the filter id of specified of
filter name.
 Filter_list() :- return a list of all supported
Fiter_var()
 The below code use
FILTER_VALIDATE_INT flag to validate
integers
<?php
$int = 100;
if (!filter_var($int, FILTER_VALIDATE_INT) === false) {
echo("Integer is valid");
} else {
echo("Integer is not valid");
}
?>
 IP address, EMAIL and URL can be validate using
FILTER_VALIDATE_IP, FILTER_VALIDATE_EMAIL and
FILTER_VALIDATE_URL,

More Related Content

What's hot

class and objects
class and objectsclass and objects
class and objects
Payel Guria
 
Php Using Arrays
Php Using ArraysPhp Using Arrays
Php Using Arrays
mussawir20
 

What's hot (20)

Php mysql ppt
Php mysql pptPhp mysql ppt
Php mysql ppt
 
PHP - DataType,Variable,Constant,Operators,Array,Include and require
PHP - DataType,Variable,Constant,Operators,Array,Include and requirePHP - DataType,Variable,Constant,Operators,Array,Include and require
PHP - DataType,Variable,Constant,Operators,Array,Include and require
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
 
Html5 Basic Structure
Html5 Basic StructureHtml5 Basic Structure
Html5 Basic Structure
 
Introduction to laravel framework
Introduction to laravel frameworkIntroduction to laravel framework
Introduction to laravel framework
 
Php.ppt
Php.pptPhp.ppt
Php.ppt
 
Control Structures In Php 2
Control Structures In Php 2Control Structures In Php 2
Control Structures In Php 2
 
php
phpphp
php
 
class and objects
class and objectsclass and objects
class and objects
 
Php Ppt
Php PptPhp Ppt
Php Ppt
 
Laravel overview
Laravel overviewLaravel overview
Laravel overview
 
What Is Php
What Is PhpWhat Is Php
What Is Php
 
GET and POST in PHP
GET and POST in PHPGET and POST in PHP
GET and POST in PHP
 
Php basics
Php basicsPhp basics
Php basics
 
Django Introduction & Tutorial
Django Introduction & TutorialDjango Introduction & Tutorial
Django Introduction & Tutorial
 
Php Using Arrays
Php Using ArraysPhp Using Arrays
Php Using Arrays
 
PHP Loops and PHP Forms
PHP  Loops and PHP FormsPHP  Loops and PHP Forms
PHP Loops and PHP Forms
 
Php
PhpPhp
Php
 
jQuery
jQueryjQuery
jQuery
 
Lesson 2 php data types
Lesson 2   php data typesLesson 2   php data types
Lesson 2 php data types
 

Similar to PHP filter

Similar to PHP filter (20)

Secure Coding
Secure Coding Secure Coding
Secure Coding
 
PHP Built-in String Validation Functions
PHP Built-in String Validation FunctionsPHP Built-in String Validation Functions
PHP Built-in String Validation Functions
 
Secure coding | XSS Attacks on current Web Applications
Secure coding | XSS Attacks on current Web ApplicationsSecure coding | XSS Attacks on current Web Applications
Secure coding | XSS Attacks on current Web Applications
 
Owasp Top 10
Owasp Top 10Owasp Top 10
Owasp Top 10
 
Php forms
Php formsPhp forms
Php forms
 
Importing data to salesforce
Importing data to salesforceImporting data to salesforce
Importing data to salesforce
 
Web application security
Web application securityWeb application security
Web application security
 
Website Security
Website SecurityWebsite Security
Website Security
 
NIframer - CPanel IFrame Injector (Bash based) - Virus Bulletin Magazine
NIframer - CPanel IFrame Injector (Bash based) - Virus Bulletin MagazineNIframer - CPanel IFrame Injector (Bash based) - Virus Bulletin Magazine
NIframer - CPanel IFrame Injector (Bash based) - Virus Bulletin Magazine
 
Security in php
Security in phpSecurity in php
Security in php
 
Common Web Application Attacks
Common Web Application Attacks Common Web Application Attacks
Common Web Application Attacks
 
MVC by asp.net development company in india
MVC by asp.net development company in indiaMVC by asp.net development company in india
MVC by asp.net development company in india
 
Vulnerabilities in Web Applications
Vulnerabilities in Web ApplicationsVulnerabilities in Web Applications
Vulnerabilities in Web Applications
 
Validate your entities with symfony validator and entity validation api
Validate your entities with symfony validator and entity validation apiValidate your entities with symfony validator and entity validation api
Validate your entities with symfony validator and entity validation api
 
Application Programming Interface
Application Programming InterfaceApplication Programming Interface
Application Programming Interface
 
Point of Sale.pptx
Point of Sale.pptxPoint of Sale.pptx
Point of Sale.pptx
 
Istio's mixer policy enforcement with custom adapters (cloud nativecon 17)
Istio's mixer  policy enforcement with custom adapters (cloud nativecon 17)Istio's mixer  policy enforcement with custom adapters (cloud nativecon 17)
Istio's mixer policy enforcement with custom adapters (cloud nativecon 17)
 
Filters
FiltersFilters
Filters
 
Test automation of ap is using postman
Test automation of ap is using postmanTest automation of ap is using postman
Test automation of ap is using postman
 
OWASP TOP 10 by Team xbios
OWASP TOP 10  by Team xbiosOWASP TOP 10  by Team xbios
OWASP TOP 10 by Team xbios
 

Recently uploaded

Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
ssuserdda66b
 

Recently uploaded (20)

Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 

PHP filter

  • 1. PHP Filters PHP filters are used to validate and filter data coming from insecure source like user input, web services data, cookies and database query results. It validate and sanitizing data. Validation data means data is in proper form or not and sanitizing means remove any illegal character form data
  • 2. Why Use Filters  Almost all web applications depends on external inputs and by using filter you can be sure your application gets correct input type  Invalid submitted data can lead to security problems and break your webpage!
  • 3. Functions and Filters  Filter_var() :- filter a single variable with specified filter flag  Filter_var_array() :- filter the several variable with the same or different filter.  Filter_input :- get one input variable and filter it.  Filter_input_array :-get several input variable and filter then with the same or different filter.  Filter_id() :- return the filter id of specified of filter name.  Filter_list() :- return a list of all supported
  • 4. Fiter_var()  The below code use FILTER_VALIDATE_INT flag to validate integers <?php $int = 100; if (!filter_var($int, FILTER_VALIDATE_INT) === false) { echo("Integer is valid"); } else { echo("Integer is not valid"); } ?>  IP address, EMAIL and URL can be validate using FILTER_VALIDATE_IP, FILTER_VALIDATE_EMAIL and FILTER_VALIDATE_URL,