sNt
29.06.2009, 20:08
Есть шифровщик символов. Но, дешифровщик выдает пустую страницу, если скормить ему <[любой символ]>. Помогите, пожалуйста.
Кодировщик символов:
<?php
if($_POST['string']) {
$str=preg_replace("/q/i", "%11", $_POST['string']);
$str=preg_replace("/w/i", "%12", $str);
$str=preg_replace("/e/i", "%13", $str);
$str=preg_replace("/r/i", "%14", $str);
$str=preg_replace("/t/i", "%15", $str);
$str=preg_replace("/y/i", "%16", $str);
$str=preg_replace("/u/i", "%17", $str);
$str=preg_replace("/i/i", "%18", $str);
$str=preg_replace("/o/i", "%19", $str);
$str=preg_replace("/p/i", "%20", $str);
$str=preg_replace("/a/i", "%21", $str);
$str=preg_replace("/s/i", "%22", $str);
$str=preg_replace("/d/i", "%23", $str);
$str=preg_replace("/f/i", "%24", $str);
$str=preg_replace("/g/i", "%25", $str);
$str=preg_replace("/h/i", "%26", $str);
$str=preg_replace("/j/i", "%27", $str);
$str=preg_replace("/k/i", "%28", $str);
$str=preg_replace("/l/i", "%29", $str);
$str=preg_replace("/z/i", "%30", $str);
$str=preg_replace("/x/i", "%31", $str);
$str=preg_replace("/c/i", "%32", $str);
$str=preg_replace("/v/i", "%33", $str);
$str=preg_replace("/b/i", "%34", $str);
$str=preg_replace("/n/i", "%35", $str);
$str=preg_replace("/m/i", "%36", $str);
$str=preg_replace("/,/i", "%37", $str);
$str=preg_replace("/'/i", "%38", $str);
$str=str_replace('"', "%39", $str);
$str=str_replace("/", "%40", $str);
$str=str_replace(".", "%41", $str);
$str=str_replace(";", "%42", $str);
$str=str_replace(":", "%43", $str);
$str=str_replace("<", "%44", $str);
$str=str_replace(">", "%45", $str);
$str=str_replace("\%", "%", $str);
echo $str;
} else {
echo "<form action='index.php' method='POST'>";
echo "<tr><td align='right'>Строка: </td><td><input type='text' name='string' size=20></td></tr>";
echo "<tr><td></td><td><input type='submit' value='Обработать'></td></tr>";
}
?>
Дешифровщик:
<?php
if($_POST['string']) {
$str=preg_replace("/%11/i", "q", $_POST['string']);
$str=preg_replace("/%12/i", "w", $str);
$str=preg_replace("/%13/i", "e", $str);
$str=preg_replace("/%14/i", "r", $str);
$str=preg_replace("/%15/i", "t", $str);
$str=preg_replace("/%16/i", "y", $str);
$str=preg_replace("/%17/i", "u", $str);
$str=preg_replace("/%18/i", "i", $str);
$str=preg_replace("/%19/i", "o", $str);
$str=preg_replace("/%20/i", "p", $str);
$str=preg_replace("/%21/i", "a", $str);
$str=preg_replace("/%22/i", "s", $str);
$str=preg_replace("/%23/i", "d", $str);
$str=preg_replace("/%24/i", "f", $str);
$str=preg_replace("/%25/i", "g", $str);
$str=preg_replace("/%26/i", "h", $str);
$str=preg_replace("/%27/i", "j", $str);
$str=preg_replace("/%28/i", "k", $str);
$str=preg_replace("/%29/i", "l", $str);
$str=preg_replace("/%30/i", "z", $str);
$str=preg_replace("/%31/i", "x", $str);
$str=preg_replace("/%32/i", "c", $str);
$str=preg_replace("/%33/i", "v", $str);
$str=preg_replace("/%34/i", "b", $str);
$str=preg_replace("/%35/i", "n", $str);
$str=preg_replace("/%36/i", "m", $str);
$str=preg_replace("/%37/i", ",", $str);
$str=preg_replace("/%38/i", "'", $str);
$str=str_replace("%39", '"', $str);
$str=str_replace("%40", "/", $str);
$str=str_replace("%41", ".", $str);
$str=str_replace("%42", ";", $str);
$str=str_replace("%43", ":", $str);
$str=preg_replace("/%44/i", "<", $str);
$str=preg_replace("/%45/i", ">", $str);
echo $str;
} else {
echo "<form action='test.php' method='POST'>";
echo "<tr><td align='right'>Строка для расшифровки: </td><td><input type='text' name='string' size=20></td></tr>";
echo "<tr><td></td><td><input type='submit' value='Обработать'></td></tr>";
}
?>
Кодировщик символов:
<?php
if($_POST['string']) {
$str=preg_replace("/q/i", "%11", $_POST['string']);
$str=preg_replace("/w/i", "%12", $str);
$str=preg_replace("/e/i", "%13", $str);
$str=preg_replace("/r/i", "%14", $str);
$str=preg_replace("/t/i", "%15", $str);
$str=preg_replace("/y/i", "%16", $str);
$str=preg_replace("/u/i", "%17", $str);
$str=preg_replace("/i/i", "%18", $str);
$str=preg_replace("/o/i", "%19", $str);
$str=preg_replace("/p/i", "%20", $str);
$str=preg_replace("/a/i", "%21", $str);
$str=preg_replace("/s/i", "%22", $str);
$str=preg_replace("/d/i", "%23", $str);
$str=preg_replace("/f/i", "%24", $str);
$str=preg_replace("/g/i", "%25", $str);
$str=preg_replace("/h/i", "%26", $str);
$str=preg_replace("/j/i", "%27", $str);
$str=preg_replace("/k/i", "%28", $str);
$str=preg_replace("/l/i", "%29", $str);
$str=preg_replace("/z/i", "%30", $str);
$str=preg_replace("/x/i", "%31", $str);
$str=preg_replace("/c/i", "%32", $str);
$str=preg_replace("/v/i", "%33", $str);
$str=preg_replace("/b/i", "%34", $str);
$str=preg_replace("/n/i", "%35", $str);
$str=preg_replace("/m/i", "%36", $str);
$str=preg_replace("/,/i", "%37", $str);
$str=preg_replace("/'/i", "%38", $str);
$str=str_replace('"', "%39", $str);
$str=str_replace("/", "%40", $str);
$str=str_replace(".", "%41", $str);
$str=str_replace(";", "%42", $str);
$str=str_replace(":", "%43", $str);
$str=str_replace("<", "%44", $str);
$str=str_replace(">", "%45", $str);
$str=str_replace("\%", "%", $str);
echo $str;
} else {
echo "<form action='index.php' method='POST'>";
echo "<tr><td align='right'>Строка: </td><td><input type='text' name='string' size=20></td></tr>";
echo "<tr><td></td><td><input type='submit' value='Обработать'></td></tr>";
}
?>
Дешифровщик:
<?php
if($_POST['string']) {
$str=preg_replace("/%11/i", "q", $_POST['string']);
$str=preg_replace("/%12/i", "w", $str);
$str=preg_replace("/%13/i", "e", $str);
$str=preg_replace("/%14/i", "r", $str);
$str=preg_replace("/%15/i", "t", $str);
$str=preg_replace("/%16/i", "y", $str);
$str=preg_replace("/%17/i", "u", $str);
$str=preg_replace("/%18/i", "i", $str);
$str=preg_replace("/%19/i", "o", $str);
$str=preg_replace("/%20/i", "p", $str);
$str=preg_replace("/%21/i", "a", $str);
$str=preg_replace("/%22/i", "s", $str);
$str=preg_replace("/%23/i", "d", $str);
$str=preg_replace("/%24/i", "f", $str);
$str=preg_replace("/%25/i", "g", $str);
$str=preg_replace("/%26/i", "h", $str);
$str=preg_replace("/%27/i", "j", $str);
$str=preg_replace("/%28/i", "k", $str);
$str=preg_replace("/%29/i", "l", $str);
$str=preg_replace("/%30/i", "z", $str);
$str=preg_replace("/%31/i", "x", $str);
$str=preg_replace("/%32/i", "c", $str);
$str=preg_replace("/%33/i", "v", $str);
$str=preg_replace("/%34/i", "b", $str);
$str=preg_replace("/%35/i", "n", $str);
$str=preg_replace("/%36/i", "m", $str);
$str=preg_replace("/%37/i", ",", $str);
$str=preg_replace("/%38/i", "'", $str);
$str=str_replace("%39", '"', $str);
$str=str_replace("%40", "/", $str);
$str=str_replace("%41", ".", $str);
$str=str_replace("%42", ";", $str);
$str=str_replace("%43", ":", $str);
$str=preg_replace("/%44/i", "<", $str);
$str=preg_replace("/%45/i", ">", $str);
echo $str;
} else {
echo "<form action='test.php' method='POST'>";
echo "<tr><td align='right'>Строка для расшифровки: </td><td><input type='text' name='string' size=20></td></tr>";
echo "<tr><td></td><td><input type='submit' value='Обработать'></td></tr>";
}
?>