Those Pesky Sessions
Moderator: General Moderators
-
smithjasonuk
- Forum Newbie
- Posts: 13
- Joined: Tue Mar 23, 2004 6:57 am
- Location: Glasgow, Scotland
Those Pesky Sessions
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.
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.
-
malcolmboston
- DevNet Resident
- Posts: 1826
- Joined: Tue Nov 18, 2003 1:09 pm
- Location: Middlesbrough, UK
im not at home so cant view the source code (cant be arsed downloading it) but i would imagine it uses something likeSo 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
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");
}well it has to be in some way doesnt it? or how would it know what posts are for what articleAnd the other question is, are the users table and the post message tables linked in some sort of way in relation to phpBB
-
smithjasonuk
- Forum Newbie
- Posts: 13
- Joined: Tue Mar 23, 2004 6:57 am
- Location: Glasgow, Scotland
-
malcolmboston
- DevNet Resident
- Posts: 1826
- Joined: Tue Nov 18, 2003 1:09 pm
- Location: Middlesbrough, UK
some valuable information here
Re: Those Pesky Sessions
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.
http://www.oreilly.com/catalog/javadtab ... r/ch02.pdf
The post table would have at least a user id column - possibly other user data if it's been deliberately de-normalised.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
http://www.oreilly.com/catalog/javadtab ... r/ch02.pdf
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....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.
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
-
smithjasonuk
- Forum Newbie
- Posts: 13
- Joined: Tue Mar 23, 2004 6:57 am
- Location: Glasgow, Scotland
Hmmm...
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.
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.
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.
-
smithjasonuk
- Forum Newbie
- Posts: 13
- Joined: Tue Mar 23, 2004 6:57 am
- Location: Glasgow, Scotland
-
smithjasonuk
- Forum Newbie
- Posts: 13
- Joined: Tue Mar 23, 2004 6:57 am
- Location: Glasgow, Scotland
-
smithjasonuk
- Forum Newbie
- Posts: 13
- Joined: Tue Mar 23, 2004 6:57 am
- Location: Glasgow, Scotland
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.
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.
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.
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.
-
smithjasonuk
- Forum Newbie
- Posts: 13
- Joined: Tue Mar 23, 2004 6:57 am
- Location: Glasgow, Scotland
-
smithjasonuk
- Forum Newbie
- Posts: 13
- Joined: Tue Mar 23, 2004 6:57 am
- Location: Glasgow, Scotland
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
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