Page 1 of 2
Those Pesky Sessions
Posted: Tue Mar 23, 2004 6:57 am
by smithjasonuk
I am trying to develop my own PHP site with forums and all, I know ! Why aint I using phpBB? well in truth I feel intimidated by using something I don’t know everything about.
So down to it. phpBB uses sessions to track a user when logged in (I think). So if I am not logged in to this site how does it force me to login before i post a message in relation to sessions, does it start a session and then sends a cookie to the local computer to keep track of my details, so if i am not logged in, it forces me to, and what is the relationship to the session database on phpBB to the login session.
And the other question is, are the users table and the post message tables linked in some sort of way in relation to phpBB
I apologize if all this sounds like crap, I’m not the best person at explaining things, but come on someone’s gotta be able to understand me.
Posted: Tue Mar 23, 2004 8:01 am
by malcolmboston
So down to it. phpBB uses sessions to track a user when logged in (I think). So if I am not logged in to this site how does it force me to login before i post a message in relation to sessions, does it start a session
im not at home so cant view the source code (cant be arsed downloading it) but i would imagine it uses something like
Code: Select all
if(isset($_SESSION['username']))
{
//this would allow the user to post as they are logged in
}
else
{
// this would redirect the user as they are not logged in
header("Location: login.php");
}
very simple, but this bit is probably wrapped in a function in phpBB
And the other question is, are the users table and the post message tables linked in some sort of way in relation to phpBB
well it has to be in some way doesnt it? or how would it know what posts are for what article
Posted: Tue Mar 23, 2004 9:00 am
by smithjasonuk
As I said I’m new to this, or did I say that, anyways can anyone give me any examples or put me on to a good site that goes through sessions with php.
Thanks for the last reply that was helpful, but it brought me to realise that I need to get into these sessions.
Posted: Tue Mar 23, 2004 9:02 am
by malcolmboston
some valuable information
here
Re: Those Pesky Sessions
Posted: Tue Mar 23, 2004 9:08 am
by McGruff
Just call session_start before any client output and away you go. $_SESSION is an array like any other, apart from the superglobal scope of course.
smithjasonuk wrote:
And the other question is, are the users table and the post message tables linked in some sort of way in relation to phpBB
The post table would have at least a user id column - possibly other user data if it's been deliberately de-normalised.
http://www.oreilly.com/catalog/javadtab ... r/ch02.pdf
Posted: Tue Mar 23, 2004 9:11 am
by JayBird
smithjasonuk wrote:As I said I’m new to this, or did I say that, anyways can anyone give me any examples or put me on to a good site that goes through sessions with php.
Thanks for the last reply that was helpful, but it brought me to realise that I need to get into these sessions.
I really wish people would just take 5 mins to search this site. The ammount of times i see the same topics cropping up again and again and again and again and again....
If your really serious about learning PHP, your gonna have to use your brain once in a while!
Read Here -
viewtopic.php?t=1157
Mark
Hmmm...
Posted: Tue Mar 23, 2004 11:07 am
by smithjasonuk
Guru Moderator,
Cheers for the advice but u see I work for a ICT learning facility and we are on the move developing new applications all the time and when i say all the time I mean it. My core skills include XML and X-family development, I also put myself as an expert HTML programmer, and I am pretty familiar with JavaScript.
Most of my time is taken up not on development but in dealing with either other staff problems or network admin related tasks.
Yes so you are right about being lazy but I have a hell of a lot to do and not many staff with the compassion to learn things new, so maybe you can see my point in why I join these forums to get advice from the people who know, like yourself.
Posted: Tue Mar 23, 2004 11:27 am
by McGruff
You are of course very welcome to ask questions - that's what we're here for. However, it's always worthwhile trying a search first to find any information which already exists. Everyone here volunteers their time and are also busy working on their own projects: if you can find an answer in a previous topic that means we don't have to take time out to figure out the problem and post a message.
Posted: Tue Mar 23, 2004 11:34 am
by smithjasonuk
I totaly agree but i think if you look just under my posts you will see I am a "Newbie", so I must apologise for my urgency, or lazyness as you could say in getting information as quickly as possible.
but again I thank you guys and gals for taking the time to help me with my problems.
Posted: Tue Mar 23, 2004 11:46 am
by McGruff
Np - maybe we need to do more to guide new members around the forum.
PS: who are you rooting for on Thursday? Go on the bhoys!
Posted: Tue Mar 23, 2004 11:52 am
by smithjasonuk
God yes, may we get lucky on thursday, were gonna need it
Posted: Tue Mar 23, 2004 12:12 pm
by smithjasonuk
Right back to work, I have been looking at the database forum, and I cant find what i am looking for.
I am looking for some kind of documentation of the relationships with the tables on MySQL for phBB, i cant find much on the site only how the run, I am looking for the relationships.
This will help me understand the sessions problem too.
Posted: Tue Mar 23, 2004 12:30 pm
by McGruff
If you have a copy of phpBB installed you can examine the db schema and queries in the php scripts to figure out how it all fits together.
See
http://www.oreilly.com/catalog/javadtab ... r/ch02.pdf for a guide to relational db design.
If I remember rightly, not all the tables in phpBB are fully normalised. It's probably best to begin with a properly normalised design - much more flexible if you need to add new features later - and de-normalise only if there is a real performance gain to be had.
Posted: Tue Mar 23, 2004 12:37 pm
by smithjasonuk
In work I dont have a copy of it installed, damm. I was just asking in the off chance anyone has documentation of these relationships.
Thanks anyways
Posted: Tue Mar 23, 2004 1:50 pm
by smithjasonuk
Looking into it how would the posts table work
i thought it would look something like this
post_id (unique post id)
Topic_id (links to the topic table)
Forum_id (links to the forum table)
User_id (Linked to the user table)
subject
message
ect.
how can you reply to this post if the post_id is unique or how does the forum sort it self so that it knows where to send the posts to the correect topic ?
much app for an answer