Is it possible that one can add logic to a MySQL Table so that MySQL Table only allows insertion if certain conditions are met.
Say we have fields X1, X2, X3, X4

Can one then add logic to this Table such as:

Only allow INSERT IF X1 or X2 or X3 or X4 are NOT NULL.
Otherwise reject the INSERT.

Can such a logic be added to a MySQL Table and how?

FYI, we need to URGENTLY do this since someone is hacked one of our main Table and is
able to add data to it and I have blocked all such INSERT via the Php pages that we use
to to make such an INSERT, so that is want I want to add this logic on MySQL Table
level if possible.