Always remove slashes from GET and POST

This is a small piece of code that I use since many years. It removes all slashes from $_GET and…

April 27, 2010

This is a small piece of code that I use since many years. It removes all slashes from $_GET and $_POST arrays if magic quote parameter is setted. Sometimes is usefull, put it at the beginning of your scripts…

if (get_magic_quotes_gpc()) {

	function slashes($e) { if (is_array($e)) return array_map("slashes", $e); else return stripslashes($e); }
	if (isset ($_POST) && count($_POST)) $_POST = array_map("slashes", $_POST);
	if (isset ($_GET) && count($_GET)) $_GET = array_map("slashes", $_GET);

}

Author

I'm a software engineer, an everyday web developer and a maker. I usually build sites with PHP, within or without WordPress. I build Internet of Things with Arduino and ESP8266. I'm the founder of Rockit.it and Dailybest.it and I'm actually the Chief Technical Officer of Better Days web agency.

Recommended

Arduino links

Blinking led definitvo Interfaccia simulazione Arduino Wokwi

November 1, 2022

Machine learning links

Test Just a collection of links: MACHINE LEARNING WITH PHP DATASETS ML ON ARDUINO

October 25, 2022

Reti neurali, corso base (2/2)

Corso base su reti neurali, elenco slide:

June 16, 2021

Reti neurali, corso base (1/2)

Corso tenuto presso un’azienda per introdurre il team di sviluppatori al Machine Learning. Slide:

June 15, 2021

Count coloured cells on Google Sheets with reference

In a spreadsheet if you need to count cells based on their background you can use this code in Google…

May 22, 2020

WP doesn’t send email? try this

Snippets for sending emails with Wordpress

February 8, 2020