Source Program :
<html> <head> <title>Program Enkripsi</title> </head> <body background="abc.jpg"><center> <h1>Program Enkripsi dengan<br>PHP HTML</h1> <form action="index.php" method="POST"> <table cellpadding="4"> <tr> <td>Masukan kata <br>(max 20 char) </td><td>: <input type="text" name="kalimat" size="30"maxlength="20"></td> </tr> <tr> <td align="center" colspan="2"><select name="enkripsi"> <option value="pilih">- Pilih Enkripsi -</option> <option value="a">Balik Kata</option> <option value="b">ASCII Hex</option> <option value="c">Tukar Huruf</option> <option value="d">Base64</option> </select> <select name="dekripsi"> <option value="pilih">- Pilih Dekripsi -</option> <option value="a">Balik Kata</option> <option value="b">ASCII Hex</option> <option value="c">Tukar Huruf</option> <option value="d">Base64</option> </select></td> </tr> <tr> <td>Hasil Enkripsi</td><td>: <?php $kalimat = $_POST['kalimat']; $enkripsi = $_POST['enkripsi']; $dekripsi = $_POST['dekripsi']; //enkripsi 1 dan 3 $a1 = substr($kalimat,0,1); $a2 = substr($kalimat,1,1); $a3 = substr($kalimat,2,1); $a4 = substr($kalimat,3,1); $a5 = substr($kalimat,4,1); $a6 = substr($kalimat,5,1); $a7 = substr($kalimat,6,1); $a8 = substr($kalimat,7,1); $a9 = substr($kalimat,8,1); $a10 = substr($kalimat,9,1); $a11 = substr($kalimat,10,1); $a12 = substr($kalimat,11,1); $a13 = substr($kalimat,12,1); $a14 = substr($kalimat,13,1); $a15 = substr($kalimat,14,1); $a16 = substr($kalimat,15,1); $a17 = substr($kalimat,16,1); $a18 = substr($kalimat,17,1); $a19 = substr($kalimat,18,1); $a20 = substr($kalimat,19,1); //decrypt ascii $b1 = substr($kalimat,0,2); $b2 = substr($kalimat,2,2); $b3 = substr($kalimat,4,2); $b4 = substr($kalimat,6,2); $b5 = substr($kalimat,8,2); $b6 = substr($kalimat,10,2); $b7 = substr($kalimat,12,2); $b8 = substr($kalimat,14,2); $b9 = substr($kalimat,16,2); $b10 = substr($kalimat,18,2); if ($enkripsi == "pilih"){ echo (" "); }elseif ($enkripsi == "a"){ echo $a20.$a19.$a18.$a17.$a16.$a15.$a14.$a13.$a12.$a11.$a10.$a9.$a8.$a7.$a6.$a5.$a4.$a3.$a2.$a1; }elseif ($enkripsi == "b"){ echo bin2hex($b1); }elseif ($enkripsi == "c"){ echo $a2.$a1.$a4.$a3.$a6.$a5.$a8.$a7.$a10.$a9.$a12.$a11.$a14.$a13.$a16.$a15.$a18.$a17.$a20.$a19;} elseif ($enkripsi == "d"){ echo base64_encode($kalimat); }else{ echo " ";} ?></td></tr> <tr><td> Hasil Dekripsi </td><td>: <?php if ($dekripsi == "pilih"){ echo (" "); }elseif ($dekripsi == "a"){ echo $a20.$a19.$a18.$a17.$a16.$a15.$a14.$a13.$a12.$a11.$a10.$a9.$a8.$a7.$a6.$a5.$a4.$a3.$a2.$a1; }elseif ($dekripsi == "b"){ echo hex2bin($kalimat); }elseif ($dekripsi == "c"){ echo $a2.$a1.$a4.$a3.$a6.$a5.$a8.$a7.$a10.$a9.$a12.$a11.$a14.$a13.$a16.$a15.$a18.$a17.$a20.$a19;} elseif ($dekripsi == "d"){ echo base64_decode($kalimat); }else{ echo " ";} ?></td></tr></table><br><br> <input type="submit" value="Proses"> <input type="reset" value="Reset"> <br><br><br><br> Nama Kelompok : <table> <tr><td>Fathia Nurul Huda</td><td>23113322</td></tr> <tr><td>Ferdo Eko Christanto</td><td>23113421</td></tr> <tr><td>Sarah Faradita</td><td>28113259</td></tr> <tr><td>Yessi Herlistiana</td><td>29113434</td></tr> </table> </form> </body> </html>