What I am trying to achieve is to create a one-time video link for the user. Ones they watch the video the link expires lets say the link expires in 1h after its original creation.
The problem is how to go about it. I can use mod_rewrite to dynamically pass values to PHP and SQL
So lets say
mysite.ltd/get_video/Jn12lM2NMZ21oMW312/11111111/The-Amazing-Spider-Man.mp4
Breakdown: get_video
is get_video.php
, Jn12lM2NMZ21oMW312
is a temporary token and 11111111
is a time stamp, The-Amazing-Spider-Man.mp4
is the file name.
Based on my conclusion the token + time stamp would be generated on video page visit and inserted into SQL, if the user shared the video link others wont be able to access it as it would fail on token validation which is get_video comparing hashed IP of current user and to the hash token in SQL.
This is my view on how to do it, but I was wondering if any one got a better solution.