View file del.php

File size: 1.15Kb
<?php
@$pas=$_GET['pas'];
@$t=$_GET['t'];
@$n=$_GET['n'];
require('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>Delete</title>
<link rel="stylesheet" type="text/css" href="style.css" /></head><body><div>';
if($pas==$admp and $t!='' and $n!=''){
$arr=file('themes.dat');
$sarr=explode(':||:',$arr[$t]);
$arr2=file('data/'.$sarr[0]);
$cnt=count($arr2);
if($n==$cnt-1){
 $lna=explode(':||:',$arr2[$cnt-2]);
 $sarr[2]=$lna[0];
}
$sarr[4]=($cnt-1)."\n";
$arr[$t]=implode(':||:',$sarr);
$f=fopen('themes.dat','w');
$d=implode('',$arr);
fputs($f,$d);
fclose($f);
unset($arr2[$n]);
$f=fopen('data/'.$sarr[0],'w');
$d=implode('',$arr2);
fputs($f,$d);
fclose($f);
echo 'Сообщение удалено.';
}
else echo 'Ошибка.';
print '<br />[<a href="view.php?pas='.$pas.'&amp;n='.$t.'">Вернуться</a>]</div></body></html>';
?>