473,396 Members | 1,992 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

User posting wait time question

384 256MB
I have a comment form and I want to stop users flooding the site with comments and potentially crashing the site.

I have a table that all comments are submitted to.

I was thinking to create a table that will create an entry when a user submits a new comment which will contain the users id and a datetime stamp of when the comment was added.

There I would have a check when a comment is added to see if the user has an entry in the database and check the difference between the entry datetime and the current submission datetime.

There would be a trigger in the database to remove entries once they hit a certain criteria like a certain amount of time has elapsed since being added.

My problem here would be how to get the time difference between two datetime stamps in PHP, they would be formatted like so '2010-06-17 13:22:11'.

Any ideas/help much appreciated.
Jun 17 '10 #1
1 1123
dlite922
1,584 Expert 1GB
see strtotime() in php manual.

You should always store date and times in unix epoch time. (an integer) then choose to display it however. If you store it in one format, you would have to convert it to a timestamp (from a string like you have above) than back to the format you wanted.

To keep things simple, you can also use a session variable that stores that last comment time. This will reduce the load on your database, but does not prevent it completely. Think of it as a front-line defense.

Apply the DB time stamp solution as well because anyone can clear their session and submit another comment.

Dan
Jun 17 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Matt | last post by:
Are there any settings to make a page invisible to the user until certain time? For example, I want mypage.html is invisible to the user until 12:00am. But mypage.html is already in the IIS server....
4
by: Yannick Turgeon | last post by:
Hello all, I've got a query which suddently became very slow. It now takes about 10 secs instead of 2 secs. I've got to identical DB (one is for test and the other is production). The query...
5
by: Gord | last post by:
Many scripts and calendars call client side system time in order to make presentations. However, the client's time may be improperly set, if set at all, and/or the relevant time may be from...
1
by: Juan Manuel Alegría B. | last post by:
Hi group!! I've been making an application in which I need to know if a user changed the time of the system clock. Is there a log where is registered that information or any API to consult? ...
3
by: rdemyan via AccessMonster.com | last post by:
My application is split into a front end and back end. Each user has their own copy of the front end. There are a few forms I only want to be open for one user at a time. So I've implemented the...
2
by: UnglueD | last post by:
Hello. I recently wrote an application that reads from a database and calls a webservice to output an xml file to an FTP directory. I published this application so that a couple of people in my...
17
by: teddysnips | last post by:
One of my clients has asked me to make a change to one of their Access applications. The application is a Front End/Back End standard app. I didn't develop it, but looking at it tells me that...
1
by: helraizer1 | last post by:
Hi folks, In my script I have this code: <?php unset($errors); include ("linesfile.php5");
2
by: =?Utf-8?B?TkJ1dGNoZXI=?= | last post by:
I am currently sharing my task list on an office server, so that all users can access, add and edit tasks (but not delete). Is there any way of preventing the same task being opened by more than...
1
by: justsam | last post by:
Hi Guys, can anybody help me to figure out how much sql server takes to process a query and in case application server is busy and due to that sql server is waiting to send the rsult to Application...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.