Posted: Sat Nov 04, 2006 2:44 pm
Neither ValidateInput nor ValidateOutput add slashes that must be removed.bob_the _builder wrote:To strip the slashes that were added during the ValidateOutput?
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Neither ValidateInput nor ValidateOutput add slashes that must be removed.bob_the _builder wrote:To strip the slashes that were added during the ValidateOutput?
Code: Select all
$mysql = new array();
$html = new array();
$mysql['content'] = mysql_real_escape_string($_REQUEST['content']);
$html['body'] = htmlentities($row['body'], ENT_QUOTES, 'UTF-8');Code: Select all
public abstract class Preparator {
private $values;
public function Preparator() {
this->values = new array();
}
public function Set($key, $value) {
$this->values[$key] = this->Prepare($value);
}
public function Get($key) {
if (array_key_exists($key, $this->values)) {
return $this->values[$key];
} else {
throw new Exception("There was no value available for the key " . $key);
}
}
public abstract funcion Prepare($value);
}
public class MySqlPreparator extends Preparator {
public MySqlPreparator() {
parent::__constructor();
}
public Prepare($value) {
return mysql_real_escape_string($value);
}
}
public class HtmlPreparator extends Preparator {
public HtmlPreparator() {
parent::__constructr();
}
public function Prepare($value) {
return htmlentities($value, ENT_QUOTES, 'UTF-8');
}
}