If the type of each of your input variables is a string and you want to sanitize them all at once, you can use:
// prevent XSS $_GET = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING); $_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
This will sanitize your $_GET and $_POST arrays.
Seen here: PHP -Sanitize values of a array
Related Posts:
- Difference between “as $key => $value” and “as $value” in PHP foreach
- Array to String PHP?
- “Notice: Undefined variable”, “Notice: Undefined index”, and “Notice: Undefined offset” using PHP
- Convert a PHP object to an associative array
- How to echo or print an array in PHP?
- Deleting an element from an array in PHP
- How to insert an item at the beginning of an array in PHP?
- Sort array of objects by object fields
- In_array not working
- PHP multidimensional array search by value
- Fatal error: Cannot use object of type mysqli_result
- php foreach with multidimensional array
- Convert php array to Javascript
- PHP reindex array?
- php – How do I fix this illegal offset type error
- Mysql where id is in array
- How to convert array to SimpleXML
- Array of PHP Objects
- Is there a function to make a copy of a PHP array to another?
- How to Sort a Multi-dimensional Array by Value
- PHP array printing using a loop
- Fastest way to implode an associative array with keys
- PHP array delete by value (not key)
- PHP Multiple Checkbox Array
- Display array values in PHP
- Reset PHP Array Index
- How to push both value and key into PHP array
- Remove empty array elements
- Google Calendar API event update always return 404 “not found” error
- How do I get a YouTube video thumbnail from the YouTube API?
- How to avoid Request Entity Too Large 413 error
- Should I use mysqli_real_escape string() or mysql_real_escape_string() for form data?
- currently unable to handle this request HTTP ERROR 500
- How to fix “Headers already sent” error in PHP
- PDOException SQLSTATE[HY000] [2002] No such file or directory
- How do I get PHP errors to display?
- What are the main differences between PHPExcel and PhpSpreadsheet?
- Get the full URL in PHP
- XAMPP Port 80 in use by “Unable to open process” with PID 4
- Expected status code 200 but received 500
- Regex to check for new line
- Elegant way to search for UTF-8 files with BOM?
- Is SAJAX dead? What to replace with?
- break out of if and foreach
- Redirect vs RedirectMatch
- Can curl make a connection to any TCP ports, not just HTTP/HTTPS?
- Error 330 (net::ERR_CONTENT_DECODING_FAILED):
- What does __FILE__ mean?
- Fatal error: Call to a member function bind_param() on boolean [duplicate]
- How do I fix “Undefined variable” error in PHP?
- How do you parse and process HTML/XML in PHP?
- How to call function of one php file from another php file and pass parameters to it?
- SQLSTATE[HY093]: Invalid parameter number: parameter was not defined
- Is it possible to run .php files on my local computer?
- MAMP “Apache couldn’t be started because port is in use.” AND “Can’t connect to local MySQL server through /tmp/mysql.sock
- Php include not working? function not being included
- PHP mail function doesn’t complete sending of e-mail
- Warning: file_get_contents(): https:// wrapper is disabled in the server configuration by all
- phpMyAdmin ERROR: mysqli_real_connect(): (HY000/1045): Access denied for user ‘pma’@’localhost’ (using password: NO)
- Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in
- Convert DateTime to String PHP
- Xampp Access Forbidden php
- SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens on line 102
- What does MYSQLI_NUM mean and do?
- Fatal Error: Allowed Memory Size of 134217728 Bytes Exhausted (CodeIgniter + XML-RPC)
- Laravel 5 Clear Views Cache
- phpinfo() is not working on my CentOS server
- XAMPP, using port:81, cannot run localhost:81/mywebsite
- ERROR: SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it
- What does double question mark (??) operator mean in PHP
- How can I find the php.ini file used by the command line?
- Check if a PHP cookie exists and if not set its value
- Deprecated: mysql_query() [duplicate]
- Call to undefined function mysql_query() with Login [duplicate]
- How to POST JSON Data With PHP cURL?
- htmlentities() vs. htmlspecialchars()
- PhpMailer SMTP NOTICE: EOF caught while checking if connected
- Facebook – Error parsing input URL, no data was cached, or no data was scraped
- How to use $_SERVER[‘HTTP_REFERER’] correctly in php?
- what is $_SERVER[‘QUERY_STRING’] ? how it works?
- PHP Error : Fatal error: Constant expression contains invalid operations
- CodeIgniter: Unable to connect to your database server using the provided settings Error Message
- Returning JSON from a PHP Script
- JavaScript equivalent of PHP’s in_array()
- Create a folder if it doesn’t already exist
- Implement linked list in php
- Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
- PHP: date function to get month of the current date
- How to make PDF file downloadable in HTML link?
- What is a templating language?
- Logout button php
- Determining Referer in PHP
- Unset cookies php
- PHP Like thing similar to MySQL Like, for if statement?
- Redirecting from HTTP to HTTPS with PHP
- PHP syntax question: What does the question mark and colon mean? [duplicate]
- PHP & Case Sensitivity
- PHP Header redirect not working [duplicate]
- Shortcode putting html such as
- Sanitizing, Validating and Escaping in WordPress (Plugin)