sisber Dokumentasi Colum

butuh dua file :
columHome.php
atau columHome.html (yg ini jg ga papa)

[php]
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”&gt;
<html xmlns=”http://www.w3.org/1999/xhtml”&gt;
<head>
<title>Colum!</title>
</head>
<body>
<h2>input : </h2>
<form action=”columEncode.php” method=”POST”>
key  : <input type=”text” name=”key”><br>
input  : <input type=”text” name=”input”><br>
<input type=”submit” value=”Encode”>
</form>
</body>
</html>
[/php]

satunya lg ColumEncoder.php isinnya :

[php]
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”&gt;
<html xmlns=”http://www.w3.org/1999/xhtml”&gt;
<head>
<title>Encode!</title>
</head>
<body>
<?php
$key=$_POST[‘key’];
$input=$_POST[‘input’];
if($key==null || $input==null)
{
echo “Warning, ada yang belum anda isi<br>”;
}
echo ‘key : ‘.$key.'<br>’;
echo ‘input : ‘.$input.'<br>’;
$input=hapusSP($input);
$input=addStar($input,$key);
function hapusSP($input)
{
$input=str_replace(” “,”,$input);
return $input;
}
function addStar($input,$key)
{
$mod=strlen($input)%strlen($key);
if($mod>0)
{
for($i=1;$i<=strlen($key)-$mod;$i++)
{
$input=$input.’*’;
}
}
return $input;
}
?>
<table border=’1′ cellspacing=’5′ cellpadding=’3′>
<tr>
<?php for($i=0;$i<strlen($key);$i++)
{
echo ‘<td>’.$key[$i].'</td>’;
}?>
</tr>
</table>
<br>
<table border=’1′ cellspacing=’5′ cellpadding=’3′>
<?php $i=0;
while ($i<strlen($input))
{
echo “<tr>”;
for ($j=1;$j<=strlen($key);$j++)
{
echo ‘<td>’.$input[$i].'</td>’;
$i++;
}
echo “</tr>”;
}?>
</table>
<br>
<?php
function chiper($input,$key)
{
$insert=array();
for ($i=0;$i<strlen($key);$i++)
{
$j=$i;
$insert[$i]=”;
while ($j<strlen($input))
{
$insert[$i]=$insert[$i].”.$input[$j];
$j=$j+strlen($key);
}
}
$chip=”;
for($i=0;$i<=127;$i++)
{
for($j=0;$j<strlen($key);$j++)
{
$ord=ord($key[$j]);
if($ord==$i)
{
$chip=$chip.$insert[$j];
}
}

}
return $chip;
}
$cheap=chiper($input,$key);
echo ‘<h2>’.$cheap.'</h2>’;
?>
</body>
</html>
[/php]

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s