rendered paste body<?php
/*
Caesar Shift Program
oxgb obwb obvb cnebnl vtxltk
Created by dcc
*/
?>
<html>
<head>
<title>Caesar Shift</title>
<link href="http://www.austourney.com/et-pug/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="100%">
<tr>
<td width="5%"> </td>
<td width="95%" align="left">
<p>Just enter the text you want to shift into this program.</p>
<form method="POST">
<input type="text" name="text" value="<?php
if (empty($_POST['text'])) {
echo "oxgb obwb obvb cnebnl vtxltk";
} else {
echo $_POST['text'];
}
?>">
</form>
<script language="JavaScript">
<!--
function disp(shw)
// Function that will swap the display/no display for
// all content within span tags
{
if (shw.style.display == "none")
{
shw.style.display = "";
}
else
{
shw.style.display = "none";
}
}
function hideall()
{
<?php
$i = 1;
while ($i < 27) {
?>
var shift<?php echo $i; ?> = document.getElementById("shift<?php echo $i; ?>");
<?
$i++;
}
$i = 1;
while ($i < 27) {
?>
shift<?php echo $i; ?>.style.display = "none";
<?php
$i++;
}
?>
}
function showall()
{
<?php
$i = 1;
while ($i < 27) {
?>
var shift<?php echo $i; ?> = document.getElementById("shift<?php echo $i; ?>");
<?
$i++;
}
$i = 1;
while ($i < 27) {
?>
shift<?php echo $i; ?>.style.display = "";
<?php
$i++;
}
?>
}
-->
</script>
<?php
$text = $_POST['text'];
if (!empty($text)) {
echo "<p>Results: Click on any of the lower links to display that particular shift</p>";
echo "<a href=\"javascript:hideall()\">Hide All</a> - <a href=\"javascript:showall()\">Show All</a><br />";
$cipher = strtolower($text);
$i = strlen($cipher);
$o = 0;
$b = "";
while ($o < $i) {
$l = substr($cipher,$o,1);
if ($l == " ") {
$b[] = 32;
} else {
$ol = ord($l);
$p = 97;
$q = 1;
while ($p < 123) {
if ($p == $ol) {
$a = $q;
}
$p++;
$q++;
}
$b[] = $a;
}
$o++;
}
$o = 1;
while ($o < 26) {
echo "<a href=\"javascript:disp(shift".$o.")\">Shift: $o </span><br /><div id=\"shift".$o."\" style=\"display:none\">";
foreach ($b as $val) {
if ($val !== 32) {
$nl = $val + $o;
if ($nl > 26) {
$nl = $nl - 26;
}
$nl = $nl + 96;
echo chr($nl);
} else {
echo " ";
}
}
echo "</div>";
$o++;
}
}
?>
</td>
</tr>
</table>
</body>
</html>