Current location: Hot Scripts Forums » Programming Languages » PHP » Limit the form submission according to time

Limit the form submission according to time

Reply
  #1 (permalink)  
Old 05-07-04, 07:13 PM
bionicsamir bionicsamir is offline
Newbie Coder
 
Join Date: Jan 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Limit the form submission according to time

Hi All...

There is a problem and I really need a solution for this.

This is what I want to do and I cannot do in PHP, probably because I am new to php.

I want it to be such that the people can submit the form every 24 hour. If someone submits the form, then a window comes up saying that the form will be reopen for submissin after 23 hrs 59 min 59 sec and so on. So when every one goes to the website to submit the form, the will see the amount of time remaining for the form to be open for submission. Once, the 24 hrs has passed, the page for the form is displayed and people can submit the form with their information. As soon as a person submits the form, the window comes up saying the time that the form will be reopen form submission after so and so time.

The reason I want to do this is so that I receive only one form submission in the 24 hr period time.

I would really appreciate if someone could write me a code in php for this. Waiting eagerly for the reply. Thanks.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 05-08-04, 06:17 PM
Lost Lost is offline
Wannabe Coder
 
Join Date: Mar 2004
Posts: 101
Thanks: 0
Thanked 0 Times in 0 Posts
Hmmm do you have a MySQL database to store the submissions in? If you have that, then making a script for this is no problem.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 05-08-04, 08:29 PM
bionicsamir bionicsamir is offline
Newbie Coder
 
Join Date: Jan 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Lost
Hmmm do you have a MySQL database to store the submissions in? If you have that, then making a script for this is no problem.

Thanks for replying.... Yes I do have MySql database to store the submission in. In fact, when the person submits the form, the information goes into the database and gets stored there. I will be waiting for your reply on how to do that. Thanks.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 05-09-04, 12:08 AM
Marshall Marshall is offline
Newbie Coder
 
Join Date: May 2004
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
One way to do this would be have an entry called Open and have it set to 0 then make a cron job every 24 hours to set it to 1, then once someone submits it will set it back to 0 and it always checks it before it allows then to submit.

Then if its 0 it can display the error message and if its 1 itll say the success message. You can also store the time until the cron job goes again and have that for the countdown timer. Should be easy enough to code, may have to search google about the cron job but the rest is simple queries. Hope it helps.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 05-09-04, 12:12 AM
Keith's Avatar
Keith Keith is offline
Community VIP
 
Join Date: Feb 2004
Posts: 1,176
Thanks: 0
Thanked 3 Times in 3 Posts
You can stay away from cron altogether and store a timestamp with each submission.

then each time the form is visited, check the latest recorded entry. if the latest entry is less than 24 hours old, show an error... otherwise show the form.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 05-09-04, 06:04 AM
bionicsamir bionicsamir is offline
Newbie Coder
 
Join Date: Jan 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Keith
You can stay away from cron altogether and store a timestamp with each submission.

then each time the form is visited, check the latest recorded entry. if the latest entry is less than 24 hours old, show an error... otherwise show the form.

Yea.... Someone had told me to use timestamp.... and I tried using it, but due to lack of my knowledge in php.... I was not able to implement it successfully, I would realy appreciate if someone can write me a sample code that does that. Thanks.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #7 (permalink)  
Old 05-09-04, 08:59 AM
SirRaven's Avatar
SirRaven SirRaven is offline
Newbie Coder
 
Join Date: Mar 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Go check http://www.php.net/manual/en/function.mktime.php - mktime() generates those timestamps.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #8 (permalink)  
Old 05-09-04, 11:10 PM
bionicsamir bionicsamir is offline
Newbie Coder
 
Join Date: Jan 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by SirRaven
Go check http://www.php.net/manual/en/function.mktime.php - mktime() generates those timestamps.

Thanks for the link, actually I know that link.... I tried to use it, but I was not successful in implementing it and get the desired result. Thats why I posted to this forum. If someone can write me the code that does what I want, I would really appreciate that. Thanks.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
formmail problem gscraper Perl 12 08-27-04 03:06 AM
Form Submission Question Peter_Moore HTML/XHTML/XML 1 04-15-04 09:16 AM
First time poster needs help with a mouseover submit form button mess. teh_fonx JavaScript 3 12-21-03 12:19 AM
Reduce the time intensive phases of .Net application development using TierDeveloper3 smars General Advertisements 0 12-02-03 05:15 AM
SQL database registration form help vinhkhuong PHP 3 10-10-03 03:49 AM


All times are GMT -5. The time now is 06:07 AM.
vBulletin® Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.