firoz-ahmad-likhon / codeigniter-audit-trail

CodeIgniter audit trail is a convenient way to track all users activities in the database.
MIT License
14 stars 12 forks source link

Dangerous for UPDATE and DELETE for me #5

Open msushahidullah opened 3 years ago

msushahidullah commented 3 years ago

UPDATE command updates all record in the table DELETE removes all record from table

BEFORE (audit trail): The following code was working nicely to update 'table' row where table_id=$id_value; ($id_value must have a value set) $this->db->where('table_id', $id_value); $this->db->update('table', ARRAY_OF_KEY_VALUE_PAIR );

It manipulated all record in the table

AFTER: (audit trail): The following VERY SAME code updates 'table' all row without setting table_id=$id_value; ($id_value must have a value set) $this->db->where('table_id', $id_value); $this->db->update('table', ARRAY_OF_KEY_VALUE_PAIR );

SAME result for DELETE

It destroyed all record from the table

ziaulsakib commented 2 years ago

UPDATE command updates all record in the table DELETE removes all record from table

BEFORE (audit trail): The following code was working nicely to update 'table' row where table_id=$id_value; ($id_value must have a value set) $this->db->where('table_id', $id_value); $this->db->update('table', ARRAY_OF_KEY_VALUE_PAIR );

It manipulated all record in the table

AFTER: (audit trail): The following VERY SAME code updates 'table' all row without setting table_id=$id_value; ($id_value must have a value set) $this->db->where('table_id', $id_value); $this->db->update('table', ARRAY_OF_KEY_VALUE_PAIR );

SAME result for DELETE

It destroyed all record from the table

Did you figureed it out?