At the simplest level, you could base64 encode.
So...
to create a link in your page you would spit it out from php as something like:
echo '<a href="?id='.base64_encode('http://www.amazon.com/gp/bestsellers/').'">Buy this shit</a>';
which will spit out:
<a href="?id=aHR0cDovL3d3dy5hbWF6b24uY29tL2dwL2Jlc3RzZWxsZXJzLw==">Buy this shit[/url]
Clicking that link of course just drops you back on the same page with an id in the getstring now.
so... to redirect:
header("Location: ".base64_decode($_GET['id']));
note, this is not secure at all. Since afterall, anyone can decode a base64 string, and therefor, could use your site for forwarding redirects. but you get the idea.
for more advanced stuff, you have mcrypt_encrypt and mcrypt_decrypt. but those will make your head hurt.
I did just realize though that you might not be pulling this stuff from a database. I guess really the way you did it is just as good technically in that case. And if you did use a database, you could just store the affiliate URL in there, and lookup by a numeric ID like you have in $das.
So i probably overthought your post. lol big surprise. (perk just rolled his eyes im sure)