16.11.10

Encode dan Decode

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Encode dan Decode</title>
</head>

<body>


<font face ="Verdana" size="2">
<form name="form1"method="post" action="Endode dan Decode.php">
<b> Input nilai string yang akan diproses</b><p>
<input type="text" name="code" size="40" maxlength="80"><br>
<b> Masukkan metode yang ingin anda lakukan [Encode atau Decode]</b><br>
<input type="text" name="action" size="6" maxlength="6"><br>
<input type="submit" name="submit" value="Eksekusi">
</form><br>
<?php

$code=$_POST['code'];
$action=$_POST['action'];

if ($action == "Encode") {
echo "<B><font>Hasil : </font></B><br>";
echo "Dengan fungsi base64 :".base64_encode ($code)."<br>";
echo "Dengan fungsi md5    :".md5($code)."<br>";
echo "Dengan fungsi crypt  :".crypt($code)."<br>";
echo "Dengan fungsi sha1   :".sha1($code)."<br>";
} else if ($action == "Decode") {
echo "<B><font>Hasil : </font></B><br>";
echo base64_decode($code);
}
?>

</body>
</html>

Tidak ada komentar: