Показать сообщение отдельно

  #4  
Старый 29.01.2009, 00:54
mailbrush
Познавший АНТИЧАТ
Регистрация: 24.06.2008
Сообщений: 1,996
Провел на форуме:
6075534

Репутация: 2731


Отправить сообщение для mailbrush с помощью ICQ
По умолчанию

PHP код:
<?
error_reporting
(0);
echo 
'<title>Encoder/Decoder</title>';
$do=$_GET['do'];
switch(
$do)
{
default:
echo 
'Выберите тип:';
echo 
'<form name="" action="" method="post">
<input name="type" type="radio" value="1" checked> Encode <br />
<input name="type" type="radio" value="2"> Decode   <br />
<input type="submit" value="Перейти">
</form>'
;
if (
$_POST['type']==1)
{
echo 
'<script>document.location="?do=encode"</script>';
}
if (
$_POST['type']==0)
{
echo 
'<script>document.location="?do=decode"</script>';
}
break;

case
"decode":
echo 
'<form action="" method="post">
Файл, который декодируем: <input name="in" type="" value=""> <br />
Файл, куда декодируем: <input name="out" type="" value="">   <br />
<input type="submit" value="Send">
</form>'
;
if (isset(
$_POST['in']))
{
    if (isset(
$_POST[out]))
{
$in=$_POST[in];
$out=$_POST[out];
$a=file_get_contents($in);
$r=base64_decode($a);
if (
file_put_contents($out$r))
echo 
'<b>Декодировано успешно!</b>';
}
}
break;

case
"encode":
echo 
'<form action="" method="post">
Файл, который кодируем: <input name="in" type="" value=""> <br />
Файл, куда кодируем: <input name="out" type="" value="">   <br />
<input type="submit" value="Send">
</form>'
;
if (isset(
$_POST['in']))
{
    if (isset(
$_POST[out]))
{
$in=$_POST[in];
$out=$_POST[out];
$a=file_get_contents($in);
$r=base64_encode($a);
if (
file_put_contents($out$r))
echo 
'<b>Закодировано успешно!</b>';
}
}
break;
}
?>
Просьба сильно не пинать, я в пхп новичек.