Jump to content


Photo

Building a Forum and need help


  • Please log in to reply
10 replies to this topic

#1 webdogjcn

webdogjcn
  • Members
  • PipPipPip
  • Advanced Member
  • 40 posts

Posted 05 June 2006 - 05:57 PM

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


#2 localhost

localhost
  • Members
  • PipPipPip
  • Advanced Member
  • 152 posts

Posted 05 June 2006 - 06:40 PM

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.

#3 webdogjcn

webdogjcn
  • Members
  • PipPipPip
  • Advanced Member
  • 40 posts

Posted 05 June 2006 - 07:04 PM

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:
$temp=$_COOKIE['topicsread'];
$topic_id=",$_GET['id'];"
$cookie_life = 365*24*3600;
Setcookie(topicsread,$temp.$topic_id,time()+$cookie_life);
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


#4 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 05 June 2006 - 07:11 PM

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.
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)

#5 webdogjcn

webdogjcn
  • Members
  • PipPipPip
  • Advanced Member
  • 40 posts

Posted 05 June 2006 - 07:21 PM

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

#6 Daguse

Daguse
  • Members
  • PipPip
  • Member
  • 26 posts

Posted 05 June 2006 - 07:29 PM

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>.

#7 Buyocat

Buyocat
  • Members
  • PipPipPip
  • Advanced Member
  • 267 posts

Posted 05 June 2006 - 07:29 PM

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.
Looking for some easy-to-use tools?  Try these, https://sourceforge....jects/utils-php -- I made them myself.  They're distinct tools which are easy to understand and use.  See some examples uses at http://www.anotherearlymorning.com

#8 localhost

localhost
  • Members
  • PipPipPip
  • Advanced Member
  • 152 posts

Posted 05 June 2006 - 07:31 PM

"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>

???

#9 webdogjcn

webdogjcn
  • Members
  • PipPipPip
  • Advanced Member
  • 40 posts

Posted 05 June 2006 - 07:39 PM

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

#10 Buyocat

Buyocat
  • Members
  • PipPipPip
  • Advanced Member
  • 267 posts

Posted 05 June 2006 - 07:49 PM

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.
Looking for some easy-to-use tools?  Try these, https://sourceforge....jects/utils-php -- I made them myself.  They're distinct tools which are easy to understand and use.  See some examples uses at http://www.anotherearlymorning.com

#11 webdogjcn

webdogjcn
  • Members
  • PipPipPip
  • Advanced Member
  • 40 posts

Posted 05 June 2006 - 07:54 PM

alright, thanks everyone I will post later if I have anymore questions




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users