note 105335 deleted from reserved.variables.get by peehaa

From: Date: Sun, 28 Apr 2019 10:58:29 +0000
Subject: note 105335 deleted from reserved.variables.get by peehaa
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-210846@lists.php.net to get a copy of this message
Note Submitter: zgold ---- I don't directly use $_GET due to security concerns, instead I create a new array called $_CLEAN which contains cleaned superglobal variables. <?php function clean($elem) { if(!is_array($elem)) $elem = htmlentities($elem,ENT_QUOTES,"UTF-8"); else foreach ($elem as $key => $value) $elem[$key] = $this->clean($value); return $elem; } $_CLEAN['GET'] = clean($_GET); ?> I also do this for $_POST, as followed: <?php $_CLEAN['POST'] = clean($_POST); ?>

« previous php.notes (#210846) next »