Hello. I do authorization on php. session_start (); need to run only on the authorization page or on each, where I want to use the user authorization check?
1 answer
On every single page. At the very top. That is, if you have several PHP files connected in one, ONE need ONE session_start for all
- Thank you, that's what I need. Another question is how do I set a variable to verify authorization. So that on any page I could make a condition like if ($ user_exist) {echo "You are authorized";} else {echo "You are not authorized";}? - intranet
- That is that it is necessary to set a variable $ user_exist. - intranet
- one<code> $ _SESSION ['user_exist'] = true; if ($ _ SESSION ['user_exist']) {echo "You are authorized"; } else {echo "You are not authorized"; } - DL_
- All figured out. Thanks a lot for your help. - intranet
|