Skip to content

Instantly share code, notes, and snippets.

@mamiwinsfall93
Created January 18, 2020 17:05
Show Gist options
  • Save mamiwinsfall93/078274683240bf0bb406637a6f2a2de9 to your computer and use it in GitHub Desktop.
Save mamiwinsfall93/078274683240bf0bb406637a6f2a2de9 to your computer and use it in GitHub Desktop.
php
<?php
if(isset($_POST['submit'])){
$name_bad = $_POST['name'];
$name_bad = mysql_real_escape_string($name_bad);
$query_bad = "SELECT * FROM customers WHERE username = '$name_bad'";
echo "<span style='color:green'>Escaped Bad Injection: <br />" . $query_bad . "<br />";
echo "mysql_real_escape_string() function has helped escape mysql injections<br><br></span>";
}
?>
<form method="post">
<label>Please Insert 'OR 1' (with single quotes as it is i.e. 'OR 1') </label><br>
<input type="text" name="name"><br>
<input type="submit" name="submit" value="submit">
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment