Session not working across pages

andylpsx

New Member
Messages
29
Reaction score
1
Points
3
By default the page after login.php is authorize.php which just checks the information then sends it off to index.php. From index.php I cannot get to my page 'volunForm.php', it just redirects me back to the login page. This is my first ever login system and my first time using sessions. Am I doing it all wrong? Is there a way I can make my sessions expire after certain time automatically and more importantly getting them to work across pages.

index: http://pastebin.com/Rc5zUJMA
volunForm: http://pastebin.com/Z65L7dZu
authorize: http://pastebin.com/aHfdYwLM

I was able to go to volunForm earlier from index with no problem but now it will not work at all. I don't think I changed anything, I am not quite sure why it won't work.

Edit:

I got it working using cookies instead of sessions, is this a good idea or should I get sessions working?
 
Last edited:

bradleyx

Member
Messages
108
Reaction score
1
Points
18
get sessions to work it does better.

can u give full code so i could take a look. its also best to use database with sessions, cookies. cookies will work but its limited really.

what is the site that ur trying to make?

http://pastebin.com/CfkME775

try this. it might work. i can't test it out.

i know i am using sessions with my site and it works fine from page to page.

usually i try to include the file that has the session saved.

print'<pre>';
print_r($_SESSION);
print'</pre>';

use this to get the session data to see if it is actually saving the session.
 
Last edited:

andylpsx

New Member
Messages
29
Reaction score
1
Points
3
I've since got sessions to work. I totally forgot I posted here. I was checking my email and saw I got a reply. I figured out that cookies are terrible, most for a security reason. I was able to change status and logged in status of anything I wanted to. Though it would take a while for someone to know the conventions I used it is totally possible they could guess it. I don't know what the problem was with the session the first time. It literally works perfectly fine now. I didn't add anything just uncommentted it and all is well. Thank you for the reply though!
 

essellar

Community Advocate
Community Support
Messages
3,295
Reaction score
227
Points
63
You may have had the misfortune of testing sessions while the server wasn't stable. It can happen, since "the server" is actually more than one machine, load-balanced. Normally, once a user has hit a particular machine, all subsequent traffic from that user is routed to the same machine, which will have the session file (if you're using the built-in PHP session without re-routing that to a database). When the system isn't working properly (rare, but it can happen), the user is shunted from machine to machine, and the session file may or may not be present. (Note that the session files are stored in a different directory from your site files, and on a clustered server, "different directory" can mean "different disk altogether". The upshot of that is that you can have the same access to your website files, which are stored on a SAN, or storage area network, but no access to some temporary files because they're on a disk in another box.)
 
Top