shadwickman 159 Posting Pro in Training

Hello, I know you probably get quite a few threads asking this, but the DaniWeb search didn't pull up what I was looking for. So here we go:

I have a page that I've made as "private" by including my access control script at the top. The access control script starts a session, then checks to see if a username and password were POSTed, and if not, if they are in $_SESSION. If all that fails, then it displays the log in page. If it gets results though, it validates them against my MySQL database of usernames + passwords. If that all goes to plan, then it allows the page which included it to finish loading.

I can try to go to this "private" page, and the login page gets displayed instead, so I enter my username and password, which is correct so it displays the "private" page. When I click a link that takes me to the other "private" page, it displays the login form first again, and THEN the other private page when I've rePOSTed my info.

So obviously the problem I'm having is that my session data is not persisting (even though I assigned keys in $_SESSION after logging in). My php.ini file has a correct path to a temp folder to store the sessions in, and I can actually see the session file in that directory when I'm on the private page, yet it has 0 bytes of info in it.

I'm using EasyPHP 5.3.0 on Windows to test this out. Any help is appreciated! Thanks!


EDIT:
I am such an idiot. This problem had been bugging me for a while and I finally realized the dumbest mistake I had made. There was a "log out" link on the page, and its href was "<?php session_unset();?>" . I don't know how I ever thought that would execute only when that link was clicked... let the laughing commence I guess :P

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.