Skip to content
Permalink
Browse files Browse the repository at this point in the history
Added XSS protection in MySimplifiedSQL_Examples.php
Added XSS protection to make sure people don't forget about it.
  • Loading branch information
foxoverflow committed Jan 18, 2015
1 parent 4915f72 commit 3b7481c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions MySimplifiedSQL_Examples.php
Expand Up @@ -24,8 +24,8 @@
*/
foreach($database->rowArray as $row) // Only to be used after a SELECT query ($database->select). If test mode is enabled, the array will be empty.
{
echo "First name:" . $row['FirstName'] . "<br>";
echo "Last name:" . $row['LastName'] . "<br>";
echo "First name:" . htmlentities($row['FirstName']) . "<br>"; // htmlentities is used here to combat XSS attack attempts
echo "Last name:" . htmlentities($row['LastName']) . "<br>";
}
$database->delete("users", array("FirstName" => "John", "LastName" => "Smith")); // "DELETE FROM users WHERE FirstName='John' AND LastName='Smith'" - Works like $database->select
// If you want more control over your queries, you can manually build an SQL Query, also known as direct query.
Expand Down

0 comments on commit 3b7481c

Please sign in to comment.