Просмотр файла edit.php

Размер файла: 1.85Kb
<?php
@$pas=$_GET['pas'];
@$t=$_GET['t'];
@$n=$_GET['n'];
@$do=$_POST['do'];
require('ini.php');
require('smiles.ini.php');
Header('Content-Type: application/xhtml+xml;charset=utf-8');
Header('Cache-Control: no-cache, must-revalidate');
print '<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru"><head><title>Edit</title>
<link rel="stylesheet" type="text/css" href="style.css" /></head><body><div>';
$tarr=file('themes.dat');
$tf=strtok($tarr[$t],':||:');
$marr=file('data/'.$tf);
$sa=explode(':||:',$marr[$n]);
if($do!='' and $pas==$admp and $t!='' and $n!=''){
@$nick=htmlspecialchars($_POST['nick']);
@$text=htmlspecialchars($_POST['text']);
if($nick=='' || $text=='') die('Ошибка. Не заполнено поле.</div></body></html>');
$nick=str_replace(':||:','',$nick);
$text=str_replace(':||:','',$text);
$text=str_replace($sstr,$simg,$text);
$sa[0]=trim($nick);
$sa[1]=trim($text);
$marr[$n]=implode(':||:',$sa);
$f=fopen('data/'.$tf,'w');
$d=implode('',$marr);
fputs($f,$d);
fclose($f);
echo 'Изменено.<hr />';
}elseif($pas==$admp and $t!='' and $n!=''){
$sa[1]=str_replace($simg,$sstr,$sa[1]);
echo '<form action="edit.php?pas='.$pas.'&amp;t='.$t.'&amp;n='.$n.'" method="post"><div>
<span class="bl">Имя:</span>
<input type="text" name="nick" value="'.htmlspecialchars($sa[0]).'" maxlength="20" size="8" /><br />
<span class="bl">Сообщение:</span>
<input type="text" name="text" value="'.htmlspecialchars($sa[1]).'" size="12" /><br />
<input type="submit" name="do" value="Изменить" />
</div></form><hr />';
}else echo 'Ошибка.<hr />';
print '[<a href="view.php?pas='.$pas.'&amp;n='.$t.'">Вернуться</a>]</div></body></html>';
?>