form cleaning class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



now my debug shows that with the following code, all of the $_POST['whatever'] values are blank.


class forms {

	var $UserInput;
	
	// Forms to variables
	function forms() {
		if (count($_POST) > 0) {
			foreach($_POST as $curPostKey => $curPostVal) {
  				$_POST[$curPostKey] = forms::CleanInput($curPostVal);
			}
		}
		// Debug
		print_r($_POST);
	}

	// Clean XSS
	function CleanInput($UserInput) {
$allowedtags = "<strong><em><a><ul><li><pre><hr><blockquote><img><span>"; $notallowedattribs = array("@javascript:|onclick|ondblclick| onmousedown|onmouseup" ."|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown| onkeyup@si");
		$changexssto = '';
$UserInput = preg_replace($notallowedattribs, $changexssto, $UserInput);
		$UserInput = strip_tags($text, $allowedtags);
		$UserInput = nl2br($UserInput);
		return $UserInput;
	}
}

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux