cancel
Showing results for 
Search instead for 
Did you mean: 

Encode/Decode base64 php function

N/A

Encode/Decode base64 php function

<FORM>

<INPUT TYPE=TEXT NAME=code VALUE="<?echo $code?>">
<INPUT TYPE=SUBMIT NAME=action VALUE="Encode">
<INPUT TYPE=SUBMIT NAME=action VALUE="Decode">
</FORM><BR>
<?
if($action == "Encode") {
echo "<B><FONT FACE=Arial>Encoded Output:</FONT></B><BR>";
echo base64_encode($code);
} elseif($action == "Decode") {
echo "<B><FONT FACE=Arial>Decoded Output:</FONT></B><BR>";
echo base64_decode($code);
}
?>


The above code will encode/decode a text string using the base64 php function

Intresting for those that use base64 encoded cookies/sessions.
check out working copy Here