I was wondering how to encrypt links using php? I have a few links to images etc that I don't want others hotlinking to. For example Myspace used msplink to encrypt their links. Is something similar possible with php?
Thanks!
Link Encrypting
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Link Encrypting
Instead you could generate a unique ID each request and save it in the session. Then use a script as your image and pass it the ID. Check if they are the same, if yes display the image, if not show an error image.
Code: Select all
<?php
session_start();
$_SESSION['verify'] = uniqid();
?>
<img src="showimage.php?file=foo.jpg&verify=<?php echo $_SESSION['verify']; ?>"/>(#10850)
Re: Link Encrypting
Hi arborint. I am pretty new at this php stuff so i don't know how to do that. To clearify, I am wanting to just encrypt links and not the actual file location. The links are on my phpbb3 forum. Not sure if that will make a difference.
Re: Link Encrypting
He made should have told you what to add to the showimage.php
but what happens in his code is that on the main page load he generates a php session with a unique id.
Then in the showimage you output image data IF the session is equvilent.
but what happens in his code is that on the main page load he generates a php session with a unique id.
Then in the showimage you output image data IF the session is equvilent.