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

Joined
Sep 4, 2022
Messages
128
Reaction score
16
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.
http://www.website.com/post/comment?id=34&text=test+message&hash=654654654654 <- ( 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

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top