PHP - Snippets: Unterschied zwischen den Versionen

Aus Wikizone
Wechseln zu: Navigation, Suche
(Die Seite wurde neu angelegt: „== Clean up POST und GET == <pre> function clean($elem) { →‎used to add some security to get and post vars: if(!is_array($elem)) $elem = htmlentities($ele…“)
 
Zeile 1: Zeile 1:
 
== Clean up POST und GET ==
 
== Clean up POST und GET ==
 +
Zusätzliche Sicherheit für Post und Get.
 
<pre>
 
<pre>
 
function clean($elem) {
 
function clean($elem) {

Version vom 19. Oktober 2012, 18:26 Uhr

Clean up POST und GET

Zusätzliche Sicherheit für Post und Get.

function clean($elem) {
	/* used to add some security to get and post vars */
	if(!is_array($elem)) 
		$elem = htmlentities($elem,ENT_QUOTES,"UTF-8"); 
    	else 
		foreach ($elem as $key => $value) 
			$elem[$key] = $this->clean($value); 
    	return $elem; 
}