|
|
|
| Web Hosting |
![]() ![]() |
Php Forum Cookies, I need help on a php forum cookie. All suggestions welcome. |
Aug 3 2007, 01:29 AM
Post
#1
|
|
|
Sparkx Group: [HOSTED] Posts: 371 Joined: 11-October 06 From: Dana Point, CA, USA Member No.: 16,496 myCENTs:0.61 |
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. |
|
|
|
Aug 3 2007, 01:39 AM
Post
#2
|
|
|
Techno-Necromancer 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 |
|
|
|
Aug 3 2007, 08:51 PM
Post
#3
|
|
|
Way Out Of Control - You need a life :) Group: [MODERATOR] Posts: 2,292 Joined: 16-August 05 Member No.: 7,896 myCENTs:99.39 |
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. |
|
|
|
Aug 7 2007, 01:15 AM
Post
#4
|
|
|
Sparkx Group: [HOSTED] Posts: 371 Joined: 11-October 06 From: Dana Point, CA, USA Member No.: 16,496 myCENTs:0.61 |
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 |
|
|
|
![]() ![]() |
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
Similar Topics
| Topic Title | Replies | Topic Starter | Views | Last Action | |||
|---|---|---|---|---|---|---|---|
![]() |
5 | Kid Saiyan | 1,858 | 3rd January 2009 - 07:11 AM Last post by: iG-curtis |
|||
![]() |
14 | ScriptMan | 1,177 | 29th December 2008 - 08:17 AM Last post by: surg |
|||
![]() |
26 | FirefoxRocks | 2,265 | 27th December 2008 - 05:47 AM Last post by: jlhaslip |
|||
![]() |
21 | khalilov | 1,792 | 6th December 2008 - 12:26 PM Last post by: yordan |
|||
![]() |
27 | Vagodeoz | 5,344 | 26th November 2008 - 03:21 PM Last post by: Michalak |
|||
![]() |
12 | Vyoma | 1,874 | 13th November 2008 - 01:42 AM Last post by: Guest |
|||
![]() |
7 | LegallyHigh | 567 | 1st November 2008 - 06:57 AM Last post by: Jezstarr |
|||
![]() |
2 | yordan | 455 | 18th October 2008 - 03:01 PM Last post by: yordan |
|||
![]() |
23 | Aditya | 5,388 | 29th August 2008 - 01:41 AM Last post by: skedad |
|||
![]() |
8 | hihihihi88 | 1,843 | 30th July 2008 - 09:48 PM Last post by: Guest |
|||
![]() |
2 | iWolf | 422 | 2nd July 2008 - 05:03 PM Last post by: Quatrux |
|||
![]() |
12 | Dream | 8,792 | 22nd June 2008 - 10:46 PM Last post by: iGuest |
|||
![]() |
2 | LegallyHigh | 519 | 19th June 2008 - 08:41 AM Last post by: Atomic0 |
|||
![]() |
4 | Miles | 662 | 18th June 2008 - 07:07 PM Last post by: sparkx |
|||
![]() |
22 | RunerNMage | 10,689 | 22nd May 2008 - 02:14 AM Last post by: iGuest |
|||
|
Lo-Fi Version | Time is now: 8th January 2009 - 02:03 AM |
© 2009 AstaHost: Free Web Hosting & Technical Discussion, Free Web Hosting. a member of xisto.
Powered by Invision Board. Skin: IPB Forum Skins
Expand / Collapse Navigation



Aug 3 2007, 01:29 AM





