I have a php includes on my site for header and footer on each page.
I am changing the site to allow users to log in and out etc.
How can I pass things like username t开发者_运维知识库o the header? Also I will want the header to display Log In when no user name is present but Log Out when a username is present.
Any help appreciated.
Richard
You will have to use sessions, I can't post a step-by-step guide here, but you might want to have a look at php login script:
http://www.phpeasystep.com/phptu/6.html
use SESSION
You will need to make sure the variable is defined before you include your header file. So for example, storing the data in a session (which you should be if you're authenticating uses any way).
精彩评论