Rather than creating $_GLOBAL variables, you'll want to start sessions and carry them through using the $_SESSION array. Take a look at this-
Using session_start() and session_destroy() to create and end login sessions. Be sure to use session_start() at the top of any new page to access the already created session. Good luck.
Link edited out. Please refrain from linking to your web site. Thanks.
Hi there. I'm learning about PHP, MySQL, etc and I wanted to create a simple webpage for my GF's birthday (it's on 6-th this month) where when she logs with her UN/PW she will see some stuff I have placed there for her. I read a bunch of stuff, downloaded quite a few login scripts and finally I was seeing the </html> when it turned out that something is wrong. When I log in with the UN/PW the welcome message appears, but when I click on some other link it asks me to log in again. I tried all sort of things but since I'm not that experienced and I don't know enough I cannot make it work. I can try for like 2 more months with no success. I'm doing my best to find the problem, I'm reading through two different PHP books but there's not guarantee that I will find what I need. I asked a friend to look at it but he arrogantly said (wrote)
"the problem is that you lack basic PHP knowledge. You need a GLOBAL variable which marks if the user is logged or not. Every page should check the value of that variable and if we it shows "false" then the the user is not logged. If it is "true" then the user is logged.".
He doesn't want to tell me anything else and that didn't quite help me. Is it possible for anyone to see what I have done so far and fix it, please? If it is not very hard of course. I have uploaded it here http://4storing.com/3k7a9/0081c4c946dd23d68f5a3e3e2a6cf826.html If you have troubles downloading it I can upload it wherever you want or I can send it to your e-mail. It is currently a .rar file with 8 php, 2 css and several jpg files.
Help me, please.