Making a post URL one-time-only or "single use URL"



Sep 4, 2022
Reaction score
Hello !

you can use a single 'hash' provided by a random number.
the 'unix time' is a good way to achieve, both in the db as 'time clue', and to build the 'hash' and for security, it's one more tool.

It's just one more var in your request string to build. <- ( unix time or hash of unix time )
so in your code, if the hash, and the message are already in the DB, you don't add it twice.

1 - the user send a message
2 - message is insert in the db with a 'unix time' column


if a user 'refresh' or flood the request :
3 - you check for the user, the message , and the 'unix time' ( hashed or not by the way )
if already in the db : do nothing
if not in db : add the new message

to comment about 'refresh' , it's a "common action" from users, often not an attempt ( to flood )

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question