Welcome Guest ( Log In | Register )



 
Reply to this topicStart new topic
> Php Forum Cookies, I need help on a php forum cookie. All suggestions welcome.
sparkx
post Aug 3 2007, 01:29 AM
Post #1


Sparkx
Group Icon

Group: [HOSTED]
Posts: 366
Joined: 11-October 06
From: Dana Point, CA, USA
Member No.: 16,496
myCENTs:44.66



OK, I am making a forum in php (with a mysql database). It is much harder then I thought it would be but I have been getting along very well. I was just putting some finnishing things on it when I found a problem I couldn't figure out. All suggestions are welcome.

Problem: I want my forum (like all forums) to remember what topics you have already read. I want to do this via cookies and at first I was think of having to topic ID to be saved in a string. Example (Cookie: %x%) x=the forum topic ID. Then to retrieve that data I would simply look for %x% inside the cookie. 
If it was found then the forum would be marked as read otherwise it would appear
 unread. 
Now there are some problems that are very obviouse with this method.
1: New posts would not make the topic appear unread.
2: No way to mark all posts (well it would take lots of bandwidth at least).
The two ways I was thinking would require a large cookie and I dont feel right adding long cookies to people's computers.
1: Add the time that the topic was read example (cookie: %x-t%) x=forum topic ID t=internet time.
2: Instead have every post ID in the cookie rather then only the topic ID. Example (cookie: %y%) y=reply/post ID

What would you suggest? Are my two way listed the only ways or is there a more effective way that would require a smaller cookie? Once again all suggestions are welcome.
Thanks,
Sparkx
Note: Sorry about some odd spacing around the center of this topic. I was having trouble with my computer.
Go to the top of the page
 
+Quote Post
vizskywalker
post Aug 3 2007, 01:39 AM
Post #2


Techno-Necromancer
Group Icon

Group: Members
Posts: 1,018
Joined: 13-January 05
From: The Net
Member No.: 2,127



Umm... there are probably lots of ways to do that via cookies, but all of them would require large cookies. Except one I can think of, which would be a compression/hash algorithm that could take every post and its state, compress it into a hash of some sort, and then decompress it when the server gets the cookie back to retrieve that information. but good luck accomplishing that, especially in any reasonable amount of time. As far as I know, most forum software does that kind of thing on the server's end, not via cookies, associating accounts with whether posts have been read or not. there are several reasons for this:
1) It is nicer to the users.
2) It means that the users information is preserved across multiple computers.
3) It is usually faster.

Also, most forums I know simply keep track of a new message state, rather than a read/unread state. This is a lot easier to do, as it just keeps track of last time logged in, and any posts made after that get marked new.

~Viz
Go to the top of the page
 
+Quote Post
yordan
post Aug 3 2007, 08:51 PM
Post #3


Way Out Of Control - You need a life :)
Group Icon

Group: [MODERATOR]
Posts: 2,186
Joined: 16-August 05
Member No.: 7,896
myCENTs:61.17



I think the coookie could have simply a number.
This number could be the numID in the numID column of a table (obtained for instance with an NEXT_ONE algorythm). The other columns would be the username (confirmation), the last read topic identification, and for instance the previous numID.
Then, a single small info would be stored in the cookie, all other info's would be in tables inside the database.
Go to the top of the page
 
+Quote Post
sparkx
post Aug 7 2007, 01:15 AM
Post #4


Sparkx
Group Icon

Group: [HOSTED]
Posts: 366
Joined: 11-October 06
From: Dana Point, CA, USA
Member No.: 16,496
myCENTs:44.66



Thank you vizskywalker and yordan. I like the idea about keeping read and un-read on the server. I am thinking about maby keeping track of Topic ID and Viewed Date (for each topic) on my server connected to the user. I will simply have all un-read posts for guests (no cookies). The only problem with checking the login date is that the user did not neccissarly read all the posts on the last login, but then again it takes up a lot less space on my server.
Thanks again for all the help. I was really stuck on this problem,
Sparkx
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. phpBB2 vs IPB(44)
  2. How To Make A Successful Forum/website(22)
  3. Error 406 - Problem In My Phpbb Forum(8)
  4. Smf - Asta Style!(11)
  5. Photoshop Tutorial: Forum Signatures(12)
  6. Reverse Video(16)
  7. Best Forum System(25)
  8. Need Suggestions For Taking Diffusion Photographs(5)
  9. Computers As A Profession(25)
  10. Forum Based Multiplayer RPG(12)
  11. Finishing The Look Of Your Newly Install Web Script(2)
  12. Add A Forum To Your Site(23)
  13. I Am Looking For A Free Mmorpg(17)
  14. Preferred Forum System(24)
  15. How To Backup Your Phpbb2 Forum And Restore It On A Phpbb3 Server.(1)
  1. Oops, There Was An Intro Forum?(0)
  2. New To Forum And Like Many I Did Not See The Intro Before Posting(0)
  3. A Forum, Which Is The Safest(3)
  4. Easiest Free Forum To Create Custom Skin For?(2)
  5. Most Seo Friendly Forum(7)
  6. How To Drive Traffic To A Forum(3)
  7. Best Free Forum Software(12)
  8. Suggestions Needed For Latest Ycc Bot Maker Breakdown(5)
  9. How To: Make A Simple Php Forum System(4)
  10. Site Down Again, Help Or Suggestions?(6)
  11. Forum Hosting?(2)
  12. No Forum Glitch(2)
  13. Mycents Earns Differently In Each Forum?(10)


 



- Lo-Fi Version Time is now: 22nd November 2008 - 02:09 PM