I’ve spent two days trying to make a login/logout panel in PHP. I’m using one PHP file which checks if you are already logged in by a session variable and echoes the appropriate “panel”.
The problem I have is that after logging in and out, I have to refresh the page so the other panel actually appears. I’ve found that in PHP is done through header() but I’m having a problem implementing that because I always get the headers have been sent thing. Anyway after many hours I decided to go with javascript, so I made a basic redirect(url) function that takes a URL and opens that page and I’m passing $_SERVER["PHP_SELF"] to that so I go back to the same page, basically refreshing. But now I was thinking, If someone disables JS I’m going to have a problem with that.
Any alternatives I’m not aware of?
Cheers
Javascript Solution:
or
HTML solution:
PHP solution:
or
User Solution: