Created
July 15, 2017 17:52
-
-
Save sunriax/fdc4b72f16b0c1fdbe884bc1fdf951bf to your computer and use it in GitHub Desktop.
Protection of your PHP environment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?PHP | |
// If you GET/POST/REQUEST variables from extern | |
// Do not forget to protect them from overriding | |
if( !isset($_GET["test1"]) && | |
!isset($_POST["test2"]) && | |
!isset($_REQUEST["test3"])) { $test1 = htmlentities($_GET["test1"]); | |
$test2 = htmlentities($_POST["test2"]); | |
$test3 = htmlentities($_REQUEST["test3"]); } | |
// If you use extern variables in MYSQL please | |
// do not forget to protect the query | |
$test1_escaped = mysqli_real_escape_string($_SOCKET, $test1); | |
$test2_escaped = mysqli_real_escape_string($_SOCKET, $test2); | |
$test3_escaped = mysqli_real_escape_string($_SOCKET, $test3); | |
$query = mysqli_query($_SOCKET, "SELECT id, name, text FROM data WHERE id = '".$test1."' .... ORDER BY id"); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment