Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-29-2012, 06:16 PM   PM User | #1
dgf
New to the CF scene

 
Join Date: Dec 2012
Location: Argentina
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
dgf is an unknown quantity at this point
Contact Form once per day

Hi! I have been asked to create a contact form for a contest that each person can only send it once per 24hs. What would be the right method to do this without using db? I dont have much skills in php or java, and none in db, so Im asking for your help please!

The info that I will use to know which person filled the form is an input called DNI (which is the personal identification number) so when validating the form, it sholud look for that number (i dont know were and how hehe) and compare dates (or hours) to allow or deny sending the form.


sry my english if its not right

thks!!
dgf is offline   Reply With Quote
Old 12-29-2012, 07:26 PM   PM User | #2
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,513
Thanks: 45
Thanked 439 Times in 428 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
Quote:
Originally Posted by dgf View Post
What would be the right method to do this without using db?

I dont have much skills in php or java, and none in db, so Im asking for your help please!

so when validating the form, it sholud look for that number (i dont know were and how hehe)
Without a database, in short you can't do it. You need to be able to record things such as submission times etc to a database so that you can check them, run time difference calculations etc.

Sorry to be blunt about this but if you're not able to use a database, not prepared to try or learn then you shouldn't be taking on this job if you're simply not skilled enough to do so.
__________________
Please wrap your code in [php] tags. It is a sticky topic and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is offline   Reply With Quote
Old 12-29-2012, 09:06 PM   PM User | #3
dgf
New to the CF scene

 
Join Date: Dec 2012
Location: Argentina
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
dgf is an unknown quantity at this point
thx for answering!
Maybe saving the data in a xml or txt file and then reading the information from there?
dgf is offline   Reply With Quote
Old 12-29-2012, 09:17 PM   PM User | #4
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,513
Thanks: 45
Thanked 439 Times in 428 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
You could do that but then supposing you need to cross reference data, count how many users submitted a form within a 24 hour period etc? You'd need to open up possibly thousands of files (consuming system memory) and then loop through every single one, store things in an array (using more memory) etc etc.

With a database you just run a query, the database does it all in a memory efficient way and returns only the data you need and in a fraction of the time.

I speak from personal experience. I avoided databases like they were the plague - for years on end. I used text files for several projects and all you end up doing is chasing your own tail around, debugging why things don't work, why did that bit of data get wiped etc. It really is far easier to use a database and it really isn't as hard as you think either.
__________________
Please wrap your code in [php] tags. It is a sticky topic and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is offline   Reply With Quote
Old 12-29-2012, 10:26 PM   PM User | #5
tempz
Regular Coder

 
Join Date: Jul 2012
Location: London
Posts: 436
Thanks: 4
Thanked 80 Times in 80 Posts
tempz is an unknown quantity at this point
I don't think it's possible without a database, you might be able to use cron jobs.

You could save the data to a xml file, but you would need some sort of script to record a unqiue id and recall that id..
(their ip address

Take a look @ http://fabrikar.com/forums/showthread.php?t=12168
tempz is offline   Reply With Quote
Reply

Bookmarks

Tags
contact, date, form, limit, php

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:56 AM.


Advertisement
Log in to turn off these ads.