Created
December 13, 2022 14:35
-
-
Save jovialcore/9f4bdacb874e4667cb8f403458d2766c to your computer and use it in GitHub Desktop.
This file contains 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 | |
http: //testphp.vulnweb.com/search.php?test=query | |
$pdo = new PDO('msql:host=vulnweb.com;dbname=vulnweb', 'dbuser', 'dbpassword'); | |
$query = "SELECT * FROM searchabletable WHERE topic LIKE :keyword"; | |
$stmt = $pdo->prepare($query); | |
$stmt->bindValue(':keyword', '%' . $variable . '%'); | |
$stmt->execute(); | |
// fetch results | |
$fetch = $statement->fetchAll(PDO::FETCH_ASSOC); | |
if ($fetch) { | |
// do something | |
} else { | |
//do something else | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fixing a search page with sql injection