I am using a URL to query some posts by their ID.
http://domain.com/page-name/?id=123
Visitors click the URL and will open the page and get the right post.
However, if anybody want, he can input this URL in browser and get the post, he can even get a lot of different posts if he knows other IDs. How can I reject this kind of query?
By the way, my site provide embed code for post. So, I need to enable access from other website.
I am using a URL to query some posts by their ID. http://domain.com/page-name/?id=123 Visitors
Share
$_SERVER['HTTP_REFERER']and make sure the visitor clicked the link on one of your pages. This will, however, prevent any kind of bookmarking as well.http://domain.tld/post/*to a PHP file and over there check if the string after/post/is in your database. This might look a little nicer than MD5 hashes, but you would have to ensure URL strings are not used several times.