Last active
August 19, 2023 02:55
-
-
Save rizkytegar/75998e62286219b646f719b144fa5c12 to your computer and use it in GitHub Desktop.
TestController.ts
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
// Route yang rentan terhadap SQL injection | |
app.get('/users', (req, res) => { | |
const username = req.query.username; | |
const sql = `SELECT * FROM users WHERE username = '${username}'`; | |
db.query(sql, (err, results) => { | |
if (err) { | |
console.error('Error executing query:', err); | |
return res.status(500).send('Error executing query'); | |
} | |
res.json(results); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment