PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
OK, I am having trouble getting my page2 recognize that page1 created the variable $_SESSION['logged_in'] because when I go to page1 and do login and go to page2, it never allows me to reach page2, my code automatically redirects me back to the page1 (login page) because it does not see that $_SESSION['logged_in'] exists (isset).
Below is the code that I am concerned about because it is not working how I beleive it should work. Any help would be greatly appreciated. I have programmed in PHP before, but it has been around 3 yrs now.
I was just trying to clean up my noobish attempt at showing my code.
I beleive the session.save_path is set to /tmp on my linux server which does exist, I will double check it. I will also double check to make sure that php is able to write to that directory. If this is supposed to be a path on the clients pc? please let me know and I will have to fix that.
twigletmac, I will try your idea as soon as I get home and let you know what I find, thanks for your help thus far.
Ok, I checked my /tmp directory and found a bunch of files starting with sess_.... which looked to be the session files, so I noticed none had been created today, so I went into my site and tried to access the pages as usual, then I rechecked the tmp directory and found a sess_.... file with todays date on it, so it appears to be able to have access to the directory and write to it.
I just wanted to let you know that I tried something else. On page1 after "logged_in" is created I added the code you gave me and there it shows up in the $_SESSION array, but when I go to page2 it does not show up. I don't know if that will help any as far as debugging purposes.
If figured out what was wrong, if someone wants to tell me why this made a difference I would greatly appreciate it, but all it took to get my code working was to add "SID" to the SESSION_START().
All the coding I have seen never mentions adding this in, someone want to explain to me why this made the difference please? Other than that my problem is solved thus far.
Ok, here is my php.ini SESSION section. Any of the lines with a semi-colon in front of it are included in the file, but are obviously not being used. Tell me what you think.