开发者

php Includes header with User Name

开发者 https://www.devze.com 2023-01-08 04:03 出处:网络
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.

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).

0

精彩评论

暂无评论...
验证码 换一张
取 消