Kamis, 17 November 2011 di 10.18 |  
<title>Simple Encryption</title>
<style type="text/css">
<!--
.style2 {color: #666666}
-->
</style>
<form method=post action=<?php echo $_SERVER['PHP_SELF']?>>
<table>
<tr>
  <td><strong>Input Plaintext</strong> </td>
  <td><strong>:</strong></td><td><input type=text name=teks></td><tr>
<tr><td><span class="style2"></span></td>
<td></td><td><input name=submit type=submit value=Submit> <label>
<input type="reset" name="Reset" value="Reset">
</label></td>
</tr>
</table>
</form>
<?php
$teks=$_POST['teks'];
echo"<b>Plaintext :</b> $teks";
echo "<p><b>Ciphertext :</b> ";
$teks=strrev($teks);
for($i=0; $i<strlen($teks); $i++)
{
    $nil_ascii=ord($teks[$i]);
    $encrypt=chr($nil_ascii+2);
    echo"$encrypt";
}
?>

//simpan dengan format ecryption.php

<title>Descryption</title>
<style type="text/css">
<!--
-->
</style>
<form method=post action=<?php echo $_SERVER['PHP_SELF']?>>
<table>
<tr>
  <td><strong>Input Ciphertext  </strong></td>
  <td><strong>:</strong></td><td><input type=text name=teks></td><tr>
<tr><td></td>
<td></td><td><input name=submit type=submit value=Submit>
  <label>
  <input type="reset" name="Reset" value="Reset">
  </label></td></tr>
</table>
</form>
<?php
$teks=$_POST['teks'];
echo"<b>Ciphertext :</b> $teks";
echo "<p><b>Plaintext :</b> ";
$teks=strrev($teks);
for($i=0; $i<strlen($teks); $i++)
{
    $nil_ascii=ord($teks[$i]);
    $dencrypt=chr($nil_ascii-2);
    echo"$dencrypt";
}
?>

//simpan dengan format descryption.php

//untuk index nya, ketikan skrip sebagai berikut

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Simple Encryption and Descryption</title>
<style type="text/css">
<!--
@import url("style sheet.css");
.style1 {
    color: #FF9900;
    font-weight: bold;
    font-size: large;
}
.style2 {
    color: #999999;
    font-weight: bold;
    font-style: italic;
}
.style6 {color: #FF9933}
body {
    background-color: #FFFFFF;
}
-->
</style>
</head>

<body>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<table width="466" border="0" align="center" cellpadding="2" cellspacing="2">
  <tr>
    <td height="24" colspan="2"><marquee behavior="scroll" scrollamount="6"><span class="style1">SIMPLE CRYPTOGRAPHY WITH PHP </span></marquee></td>
  </tr>
  <tr>
    <td bgcolor="#99FFCC"><div align="center"><strong><a href="#">ENCRYPTION</a></strong></div></td>
    <td bgcolor="#99FFCC"><div align="center"><strong><a href="#">DESCRYPTION</a></strong></div></td>
  </tr>
  <tr>
    <td width="223" height="76" bgcolor="#FFCC99"><iframe src="ecryption.php" frameborder="0" scrolling="no"></iframe></td>
    <td width="223" bgcolor="#99FF99"><iframe src="descryption.php" frameborder="0" scrolling="no"></iframe></td>
  </tr>
</table>
<p>&nbsp;</p>
<p align="center" class="style2"><blink><span class="style6">Created by <a href="#">2F</a> Teknik Informatika UNP Kediri &copy; 2011</span></blink> </p>
</body>
</html>

hasilnya adalah sebagai berikut
Diposting oleh John

1 komentar:

John mengatakan...

//ada yang kelupaan. biar lebih bagus tambahkan skrip berikut, simpan dengan format .css

@charset "utf-8";
/* CSS Document */
body {
background: no-repeat;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
line-height: 14px;
color: #F90;
}

td, th {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 13px;
line-height: 10px;
color: #0099FF;
}
a:active {
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #0099FF;
}
a:link {
color: #0099FF;

}
a:visited {
color: #0099FF;
}
a {
color: #0099FF;
text-decoration: none;
}
a:hover {
font-size:large;
}

17 November 2011 pukul 10.38