0
Using PHP I display a table, in id
of each li
, I put the id
of the record that is in the database. Once they displayed, I have an option that deletes the record, I do it through AJAX, caught the id
that li
, and have PHP delete.
But I realized that if I use Developer Tools, "famous F12", and manually change the ID
of li
, He’s going to take this new ID that I put in. That way the project that I’m doing is vulnerable depending on who uses it. I say this because there is a lot that I am using this method. There is some attribute that the user cannot edit or some other more secure method?
Longer answer: Not.
– MarceloBoni
The way is to always validate in the backend.
– MarceloBoni
Normally you wouldn’t have to do anything special in html. A well-written application will not delete based only on the ID, but on the user’s credentials. If the user is allowed to delete, it does not matter if it was by devtools or if it was by the original interface. What may be wrong is your application does not validate your credentials. This would be a real application problem, different from the path sought in the question.
– Bacco