Make users input more secure
- Download or clone
- Open
phpsecurity.php
- Copy the class
- Look at example.php for usage and options
$test->TextScript("<script>alert('You would never see this')</script>Hello there person");
Hello there person
$test->SQLSelect(
"test",
array("name", "email", "extraData"), // could also be "*"
(object)array( // Where data
"name" => (object)array(
"or" => false, // if TRUE then ... OR ... else ... AND ...
"value" => "Tazio" // Value is required
),
)
);
SELECT (name, email, extraData) FROM test WHERE name = 'Tazio'
$test->SQLInsert(
"test",
array("name", "password", "email", "extraData"), // Table keys like (ID, firstname etc.)
array(
(object)array( // This will be seen as JSON
"firstname" => "Tazio",
"middlename" => "de",
"lastname" => "Bruin"
),
"thisPasswordIsNotSafe",
"contact@tazio.nl",
array("test","value")
)
);
INSERT INTO test (`name`, `password`, `email`, `extraData`) VALUES ('{"firstname":"Tazio","middlename":"de","lastname":"Bruin"}', 'thisPasswordIsNotSafe', 'contact@tazio.nl', '["test","value"]')