Do We Need to Validate, Sanitize, or Filter Simple Numerical Superglobals (Cookies and Post)?

Without reading the question, just from the title, the answer is YES. Any input from the outside world should be validated and sanitized where appropriate, and this include inpude the server recieves the fact that it might have been generated in a form you designed is irrelevant. Input should never be trusted.

Now about internal consistency. After you already validate and sanitized the input fields you should check that the data makes sense in the context you expect to handle it. If you expect a post id of a post then you need to check not only that it actually exists but also that it is not a page. This is really just another aspect of validation… and the sooner you do it in your code path and more detailed your error message is the easier your life will be.

So how exactly to do it? There is no recipe, different contexts require different validation and sanitation. It is probably better to start as strict as you can and then relax checks only if you have too.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)