Jump to content

forum


runnerjp

Recommended Posts

You'll need to implement a hits tracker of sorts.

 

I have a table like

id
ip
hits
forumid
time

 

When a user hits the forum, it will check to see if they have viewed that forum within the past 24 hours. If they have NEVER visited before at all, it will add a new row with all their corresponding data. If they HAVE, but HAVEN't visited in the past 24 hours, it will UPDATE their row (by IP address) and set hits to $hits + 1 and update the time. If they HAVE visited and HAVE visited in the past 24 hours, it will do nothing, as to try and keep stats pretty accurate.

 

Then to add up the stats you just do a SUM(hits) thingie with mysql.

 

Hope I wrote that to where you can understand it lol.

Link to comment
https://forums.phpfreaks.com/topic/107476-forum/#findComment-550901
Share on other sites

humm ok thing is i have my table like this

 

CREATE TABLE `forumtutorial_posts` (
  `postid` bigint(20) NOT NULL auto_increment,
  `author` varchar(255) NOT NULL default '',
  `title` varchar(255) NOT NULL default '',
  `post` mediumtext NOT NULL,
  `showtime` varchar(255) NOT NULL default '',
  `realtime` bigint(20) NOT NULL default '0',
  `lastposter` varchar(255) NOT NULL default '',
  `numreplies` bigint(20) NOT NULL default '0',
  `parentid` bigint(20) NOT NULL default '0',
  `lastrepliedto` bigint(20) NOT NULL default '0',
  PRIMARY KEY  (`postid`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=10 ;

 

so parentid is basicly if a user has posted on sum1 lese thred it just adds that threads id so if i was doing it how you say i would add

 

hits to it then do what lol

 

 

Link to comment
https://forums.phpfreaks.com/topic/107476-forum/#findComment-550964
Share on other sites

Archived

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

×
×
  • Create New...

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.