Jump to content

Archived

This topic is now archived and is closed to further replies.

webdogjcn

Building a Forum and need help

Recommended Posts

Okay so, I need to know how to do the following with my forum:[ol type=\'1\'][*]Figuring out whether or not the user has viewed the newest post or not[*]Creating a Quick Reply box (im guessing I will have to do this w/ javascript if I want it without having to reload the page)[*]removing html from the title entry (so the user cant put in like <b><image src=''>HEY LOOK AT ME</b> to make their post title stand out)[/ol]
I have four tables in my db: categories, forums, topics, replies
You should be able to figure out how I am trying to do it from there. I really need this so if you can help out at all that would be really appreciated

Share this post


Link to post
Share on other sites
1. You might want to use cookies like vBulletin uses, I am not sure exactly how it is used so you might have to do more looking up on that.

2. Quick reply box is just the normal reply box on that page, and without it refreshing you will have to use AJAX. vBulletin has only used that just recently in vBulletin 3.5.4.

3. You have to use striptags with PHP they basically disallow whatever you want, <b> <i> <u> etc etc.

Share this post


Link to post
Share on other sites
alright, I will look into AJAX and stiptags, the main problem with cookies is Im not sure how I can store all of the information into one cookies w/o it being huge I thought of this:
[code]$temp=$_COOKIE['topicsread'];
$topic_id=",$_GET['id'];"
$cookie_life = 365*24*3600;
Setcookie(topicsread,$temp.$topic_id,time()+$cookie_life);
[/code]
Then expanding it up with EXPLODE where "," is found and somehow searching the resulting array for the newest topic id and if it is there then display the "No New Posts image" and else display the "New Posts Image".

Two problems arise:
1. I do not think I can add a "," in there like that
2. I do not know how to search an array

Share this post


Link to post
Share on other sites
for checking to see whether a post/thread was read or not, i would do a query that checks the time of the last post in each thread, vs. the time you last logged in and/or accessed a page while logged in.

Share this post


Link to post
Share on other sites
the problem with that is that if several posts were made since you've been online...they will all appear as though they have been read

Share this post


Link to post
Share on other sites
for Problem 3, I would use htmlentities($title).

That way if they do make a title with HTML it will echo the HTML tags as text.... all you would see is <b><image src=''>HEY LOOK AT ME</b>.

Share this post


Link to post
Share on other sites
To keep track of posts read I would make a separate table that contains user ids and post ids then when you load the page you query that table for the specific user id and mark each post id that comes up as "read" on the display side.

This would of course mean that each time you open a page it checks for the user id and post id in that table and if it doesn't find the couple enters it.

Share this post


Link to post
Share on other sites
"for Problem 3, I would use htmlentities($title).

That way if they do make a title with HTML it will echo the HTML tags as text.... all you would see is HEY LOOK AT ME."

dont you mean you would see <b>HEY LOOK AT ME.</b>

???

Share this post


Link to post
Share on other sites
okay...ill use the htmlentities...
I think I understand buyocat, but if I get a lot of users and end up with a lot of posts this will use a great deal of db space

Share this post


Link to post
Share on other sites
Web if you're using small or medium ints for key values I'm sure it won't be a huge burden and frankly by the time you got enough users/posts to make this an issue you would probably be such a success that you would want to upgrade to a private server anyway.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.