Messageboard: How do they do it?

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
fatalcure
Forum Contributor
Posts: 141
Joined: Thu Jul 04, 2002 12:57 pm
Contact:

Messageboard: How do they do it?

Post by fatalcure »

I've created my own messageboard and now im worndering, how on this messageboard, when you leave the forum and come back the next day, it has all the new topics that you haven't read yet w/ a lil ARROW, and once you've read it, the arrow goes away, but only for the one you read.

I thought it would be w/ a lastvisit cookie, and it shows everything posted above that time, but that wouldnt work too well if you wanna make it work like this forum.

Im pretty sure this forum uses Sessions for this, but how are they used? are there session variables assigned for each topic above the time of last visit and then the session variable is destroyed after you view the topic??

I've never worked w/ sessions b4, but if thats how its done, i'll look into it.

If there's another way of doing this, let me know as well.

THanks
lc
Forum Contributor
Posts: 188
Joined: Tue Apr 23, 2002 6:45 pm
Location: Netherlands

Post by lc »

actually I think it is indeed cookies.
MacDaddy
Forum Newbie
Posts: 12
Joined: Sun May 05, 2002 9:36 pm
Location: Atlanta, GA

Post by MacDaddy »

It's usually an extra field in the db
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Why not grab the source for this board and have a look around in it:
http://www.phpbb.com

Mac
User avatar
phice
Moderator
Posts: 1416
Joined: Sat Apr 20, 2002 3:14 pm
Location: Dallas, TX
Contact:

hrm

Post by phice »

I made mine in like 2 days ^_^ It's very easy. Although it's about 3:15 in the morning, and I have no sense of what thinking is. :/
Image Image
fatalcure
Forum Contributor
Posts: 141
Joined: Thu Jul 04, 2002 12:57 pm
Contact:

Post by fatalcure »

uhm, how'd u do it?
User avatar
BigE
Site Admin
Posts: 139
Joined: Fri Apr 19, 2002 9:49 am
Location: Missouri, USA
Contact:

Post by BigE »

Its just a field in the database. I've looked at the source for these forums before and I remember thats how they do it. They take each post ID and save it into a field in the DB that is in the user table. They separate every ID by a comma or something so they can split it in the code. Hope that helps.
fatalcure
Forum Contributor
Posts: 141
Joined: Thu Jul 04, 2002 12:57 pm
Contact:

Post by fatalcure »

hum, I see, I tried looking at the source as twigletmac stated, but it was a lil confusing for me :/

I'll see if i can get to work.

But the thing is, when do they reset the LAST TIME VISITED, like w/ this forum, if you close the browser and come back an hour or so later, it'll have all the new posts listed, then (without looking at any of the new posts), just close the browser again and come back to the forum, they're gone and the lastvisit time is set to the current time.

Am i making sense?

Just wondering how they did that...
User avatar
BigE
Site Admin
Posts: 139
Joined: Fri Apr 19, 2002 9:49 am
Location: Missouri, USA
Contact:

Post by BigE »

Thats a fairly easy one too. When a link is clicked, and a page is loaded, it stores the time in the database. Then when another page is called, if that time is so many minutes ago, then it says "hey, this person left for a while, so lets add all posts that are between that time, and so many minutes after that time to the 'read' pile". Thats kinda the basic idea of how it all works... peicing it together with code will be your part :D Have fun :wink:
Post Reply