I want to authenticate user if he/she successfully logged in before or not, in every pages. Obviously on top of the pages I have to call a function or another page to run that function to carry out checks but, I really don't know what kind of code I have to use in function.
I read a lot of codes about sessions with hash, salt, session id, ip, timestamp etc but all blame each others code. I know nothing is perfect but at least I need someone to tell me "use this one" so I can use it so I need your help.
What do I set in session when logged in successfully and how do I validate those values in authentication function?
Thanks in advance