Return to Snippet

Revision: 12047
at February 28, 2009 18:22 by lajevardi


Initial Code
public function siftDown($dataStack){
		if(!is_array($dataStack)){
			$dataStack = ereg_replace("[\'\")(;|`,<>]","",$dataStack);
			$dataStack = mysql_real_escape_string(trim($dataStack),$this->connection);
			$dataStack = stripslashes($dataStack);
			return $dataStack;
			}
		$safeData = array();
		foreach($dataStack as $p=>$data){
					$data = ereg_replace("[\'\")(;|`,<>]","",$data);
					$data = mysql_real_escape_string(trim($data),$this->connection);
					$data = stripslashes($data);
					$safeData[$p] = $data;
					}
		return $safeData;
		}

Initial URL


Initial Description
This is a method of my database class which let me sift the unsafe data inputs down.

Initial Title
Method to prevent SQL Injection attacks.

Initial Tags
database, sql, security

Initial Language
PHP