This example uses the MySQL functions to encode and decode a string. The first
segment of the code encodes the string "testing" and stores the result in a
variable, while the second segment, decodes the coded variable back to its
original state.
A user should save this code as a PHP file and access it through a browser.
A use might be if you wanted to create a encoded password or something like
that, or store a code in a database instead of storing the actual word. The
decode part would then decode the stored information. You might notice that
the script:
Select ENCODE('testing','');
has a second argument that I left empty. You can use an additional password
or key in the second argument if you want to, but when you use the decode
function, the second argument or key must be the same as when it was encoded
or you will not get back the correctly decoded word.
//Sample by Daniel P. Johnson
//www.eyelightmedia.org