L
L
LiveHuman2015-11-23 00:55:12
PHP
LiveHuman, 2015-11-23 00:55:12

How to make a coupon entry form?

Hey! Tell me good people!
How to implement the following scenario on a website (landing page):
When a person fills out a feedback form, a random code is generated under his email (well, like what is in any coupon sites), but this code is sent to my mail. And after I sent him this code by email, he could enter this code on the same site and press the thank you button. Those. the thank you button must be attached to these random codes (a random user cannot activate it). It doesn’t matter how, manually screw it on, entering each code separately or using a script to enter it into the database.
PS if the project succeeds, who helped with the issue I will reward with money or take the admin to the site)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
Cyrilca, 2015-11-23
@Cyrilca

Perhaps I misunderstood the essence of the question, but still.
I think, initially, it is not necessary to generate any codes on the client side. After sending a post request, on the server you can take some part of the email type data and, based on its length, for example, generate some arbitrary code.
Next, you can create a table in the db and enter data there:
id email code is_activated
================================== =========
1 | [email protected] | h57hda4fasd | 0 (false)
The next time you send a thank you code (I don’t know just how to call it) on the client side, you can send an ajax request to the server, and check the data with the string entered by the user. If the code passed, then set is_activated to true, thereby preventing the code from being re-entered.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question