Session Shortage!

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!

Moderator: General Moderators

Post Reply
Nicoza
Forum Newbie
Posts: 11
Joined: Mon Oct 02, 2006 11:43 am

Session Shortage!

Post by Nicoza »

How to read session data in included pages?

My website consists of a geat deal of dynamic code. All pages are based on a structure or "Template" design. Each component or section of my site has an index page and all content dynamically loaded. If I have page called JokesIndex.php it will contain a random Joke, the latest Joke and script to manage which Joke is viewed. All of this will be loaded inside the main page JokesIndex.php using include.

Recently I learned about sessions and started implementing it. It works fine (well mostly). Problem is, my users register and the session info carried over from one page to another. The JokesIndex.php page recieves the session data and can display the active user, but, the files included does not!? So, if I include the page to add a new Joke, and write the data to MySQL along with the user's name (contributor), that included page does not recieve the users information from the session therefore I cannot write the name of the contributor into the db.

How do I fix this. Thanks.
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

you're going to need to post some code methinks
Post Reply