print(urldecode("mail%20leon%40clearink.com"));
?>
string urlencode(string url_text)
The urlencode function returns the url_text string translated into URL format.
This format uses percent signs (%) to specify characters by their ASCII code. This
function is not safe for use with binary data.
<?
print(urlencode("mail [email protected]"));
?>
Encryption
Encryption is the process of transforming information to and from an unreadable format.
Some algorithms simply scramble text; others allow for reversing the process. PHP offers
a wrapper to C's crypt function, plus an extension that wraps the mcrypt library.
The mcrypt functions rely on a library of the same name written by Nikos
Mavroyanopoulos, which provides an advanced system for encrypting data. The URI for
the project is <ftp: //argeas.cs-net.gr/pub/unix/mcrypt/>. Sascha Schumann
added mycrypt functionality to PHP.
Cryptography is a topic beyond the scope of this text. Some concepts discussed in this
section require familiarity with advanced cryptographic theories. A great place to start
learning about cryptography is the FAQ file for the sci.crypt Usenet newsgroup. The URI
is < http://www.faqs.org/faqs/cryptography-faq/>. Another resource is a
book Prentice Hall publishes called Cryptography and Network Security: Principles and
Practice by William Stallings. The PHP manual suggests Applied Cryptography by Bruce
Schneier.
string crypt(string text, string salt)
The crypt function encrypts a string using C's crypt function, which usually uses
standard DES encryption, but depends on your operating system. The text argument is
returned encrypted. The salt argument is optional. PHP will create a random salt
value if one is not provided. You may wish to read the man page on crypt to gain a
better understanding.
Note that data encrypted with the crypt function cannot be decrypted. The function is
usually used to encrypt a password that is saved for when authorization is necessary. At