Forum Moderators: coopster

Message Too Old, No Replies

Future Dating

         

designworx

8:08 pm on Mar 26, 2008 (gmt 0)

10+ Year Member



I am currently running a form on a website that extends a products warranty once submitted. But i cant figure out how to prevent the user from entering future date. eg, a date greater than the system date.

Does anyone now what the best script is that i could use to prevent future date from being used.

whoisgregg

8:55 pm on Mar 26, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld, designworx!

Don't let them enter the date at all... populate that server side using the date() function. :)

designworx

10:23 pm on Mar 26, 2008 (gmt 0)

10+ Year Member



Hi,
I thought about it but the client wants to know when the purchase date was. And some people have already used a future date to fool the system.

mooger35

11:36 pm on Mar 26, 2008 (gmt 0)

10+ Year Member



Why does the purchase date need to be a form input?

And one step further... why use that purchase date when processing the form?

designworx

1:32 am on Mar 27, 2008 (gmt 0)

10+ Year Member



needs to be inputed so the system can calculate teh extension period.

whoisgregg

12:03 pm on Mar 27, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can validate the date they provide isn't in the future using something like the code below:

$purchase_date = $_POST['date'];
if( strtotime($purchase_date) >= strtotime("+1 day") ){
echo 'Purchase date is in the future!';
} else {
echo 'Valid purchase date.';
}

mooger35

3:52 pm on Mar 27, 2008 (gmt 0)

10+ Year Member



needs to be inputed so the system can calculate teh extension period.

But if the purchase date is in the database you can call it when you are processing the extension. It doesn't have to be in the form... just the "id" of the item.

whoisgregg

6:18 pm on Mar 27, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It sounds like they don't have a database of the actual sale dates. :/

designworx

8:03 pm on Mar 27, 2008 (gmt 0)

10+ Year Member



Your right they dont, sorry wasn't to clear on the full situation my client is a distributor of sunglasses and the information that they receive is from the end user (retail customer)

deMorte

1:13 pm on Mar 31, 2008 (gmt 0)

10+ Year Member



And here I was hoping this topic would be about the future of dating people.

I'd say that the solution whoisgregg provided in his second to last post would be the way to go.
I'd also say that your distributor client has some morally questionable retail customers if they exploit the system like that.

PHP_Chimp

10:02 am on Apr 1, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This still leaves the problem that customers could purchase a set of glasses then register them 6 months later for an extended warranty (morally questionable...me...never ;).

Do your clients have any way to tie purchases to actual glasses? Receipt numbers, invoice numbers, name and address anything more than the clients word for it?

As the really morally questionable will just not register there glasses until they break then register and claim on the warranty. So there really should be some additional checking done on the end users choice of date.