//Example Vulnerable Code:
php
// Vulnerable PHP code snippet in login page
$username = $_POST['username'];
$password = $_POST['password'];
$query = "SELECT * FROM users WHERE username='$username' AND password='$password'";
//Example Vulnerable Code:
javascript
// Vulnerable JavaScript code in search functionality
var searchTerm = document.getElementById('searchTerm').value;
document.write("Search results for: " + searchTerm);
//Example Vulnerable Code:
php
// Vulnerable PHP code snippet for file download
$fileID = $_GET['fileID'];
$filePath = "/path/to/files/" . $fileID;
if (file_exists($filePath)) {
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . basename($filePath) . '"');
readfile($filePath);
exit;
}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.