T
T
targyn2021-06-17 13:31:41
PHP
targyn, 2021-06-17 13:31:41

How to confirm a request to add an entry to the database via mail?

Tell me where to dig if I want to implement the confirmation process for adding an entry to the database via mail. That is, a person leaves some data on the site and sends it. And before the data was added to the database, the data must be sent to the mail and, upon confirmation through the mail, it was added to the database.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
irishmann, 2021-06-17
@targyn

I would do so. Immediately write to the database, put an additional verify field, false by default. The script writes to the database, gets the record ID, generates a link to the confirmation script and sends it to the mail. The verification script only gets the record ID and sets the verify field to true. Wherever you need to implement verify. Periodically, either cron or manually clean the database.

A
Adamos, 2021-06-17
@Adamos

The data, if there is not much of it, can be written immediately upon receipt with GET parameters to the confirmation link, add a field with the date of filling and a signature - a hash from (all data + mail address + salt known only to the site) and send to this mail. By reference, check if the hash converges and if the date is fresh. If everything is OK - then write to the database.
No intermediate storage is required.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question