/** * Secret Decoder Ring * * (c) Copyright Leon Blackwell 2003/2004 * * Feel free to pick on my code :) */ // Grab the important POST var $m = $_POST['m']; // Title and heading $heading = $title = 'Secret Decoder Ring'; // Default message $message = "4F6E65204F5320746F2072756C65207468656D20616C6C2C204F6E65204F5320746F2066696E\n" ."64207468656D2C0D0A4F6E65204F5320746F206272696E67207468656D20616C6C20616E6420\n" ."696E20746865206461726B6E6573732062696E64207468656D"; // Do we have an argument if(isSet($m) && ($m != '')) { // If we need to, strip slashes if(get_magic_quotes_gpc()) { $m = stripslashes($m); } // If we're encoding if($_POST['mode'] == 'Encode') { // Encode it $message = bin2hex($m); // Hide special chars $message = htmlspecialchars($message); // Wrap it $message = wordwrap($message, 40, "\n", 1); // Output the encoded message $content = "
Your secret message is:
$message\n"; } else { // Remove anything funny $m = preg_replace('/[^a-fA-F0-9]/', '', $m); // Decode $message = pack('H*', $m); // Hide special chars $message = htmlspecialchars($message); // Output the decoded message $content = "
Your secret message was:
$message\n"; } } // Produce a form for input $content .= "\n" ."\n"; echo "\n"; ?>
# If we have a heading
if(isSet($heading))
{
echo "$heading\n"; echo "A product of The Lost Realm. "; } ?> =$content?> |