I want to know how to encrypt links in PHP. I want the links to show up as normal to anyone viewing the site and be normal links as far as google or other search engines are concerned, but I want the links encrypted if anyone were to look at the actual PHP code file. Thanks in advance.
Good question..I do not know how to do this, but I am interested in how this would be done too. Can I assume this is for a Wordpress theme that you will be releasing?
I'm confused. You want the URLs in the PHP source to be stored in an encrypted format, and only decrypted when outputted to the user? Why? Anyone with access to the PHP source will likely have the encryption key as well. Or did I totally miss the objective?
If I release a template and I want some links to be impossible to alter by the user of the template. The only way would be to delete the encrypted code altogether.
Maybe possible using some javascript. I suck at crypto tho. I can whip you up a BASE64 encoder if ya want . But then someone determined enough can crack it. Since if you use a keyed encryption, you got to have the key somewhere .. ~ Thomas
Base 64 isn't encryption, it's encoding, and thus designed to be easily reversed. It's used for representing binary data in an ASCII string.
Here's a easy way to encrypt an email link, it's not in php though. I've used it and it works. Maybe it can be easily modified for regular links: http://www.dynamicdrive.com/emailriddler/ If you need it to be in php, I just found out that "php designer 2005" (was freeware) has a feature "convert to php" that turn the script into php real easily.