Make id and delkey required for sql query
This commit is contained in:
parent
f45c5396b7
commit
8796dfe73b
4
main.go
4
main.go
|
@ -162,10 +162,10 @@ func delHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
db, err := sql.Open("mysql", DATABASE)
|
db, err := sql.Open("mysql", DATABASE)
|
||||||
check(err)
|
check(err)
|
||||||
|
|
||||||
stmt, err := db.Prepare("delete from pastebin where delkey=?")
|
stmt, err := db.Prepare("delete from pastebin where delkey=? and id=?")
|
||||||
check(err)
|
check(err)
|
||||||
|
|
||||||
res, err := stmt.Exec(html.EscapeString(delkey))
|
res, err := stmt.Exec(html.EscapeString(delkey), html.EscapeString(paste))
|
||||||
check(err)
|
check(err)
|
||||||
|
|
||||||
_, err = res.RowsAffected()
|
_, err = res.RowsAffected()
|
||||||
|
|
Loading…
Reference in New Issue