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

Размер файла: 1.61Kb
<?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>Админка</title>
<link rel="stylesheet" href="style.css" type="text/css" /></head><body><div>';
if(!isset($_GET['p'])) die('
Пароль:
<form action="admin.php" method="get">
<input type="text" name="p" />
<input type="submit" value="OK" />
</form></div></body></html>');
include('ini.php');
if($_GET['p']!=$PASS) die('Доступ запрещён</div></body></html>');
@$mod=$_GET['mod'];
$arr=file('data.dat');
switch($mod){
case 'del':
include('incs/del.php');
break;

case 'new':
include('incs/new.php');
break;

case 'add':
include('incs/add.php');
break;

case 'update':
include('incs/update.php');
break;

case 'edit':
include('incs/edit.php');
break;

default:
$c=count($arr);
print '[<a href="admin.php?p='.$_GET['p'].'&amp;mod=new">Добавить</a>]<hr />
';
if($c==0) echo 'Пусто<hr />';
for($i=0;$i<$c;$i=$i+3){
$na=explode('||',$arr[$i+1]);
$ca=count($na);
print '[<a href="admin.php?p='.$_GET['p'].'&amp;mod=del&amp;n='.$i.'">del</a>-'.
'<a href="admin.php?p='.$_GET['p'].'&amp;mod=edit&amp;n='.$i.'">edit</a>] '.$arr[$i].'<br /><small>';
for($n=0;$n<$ca;$n++){
print($na[$n]);
if($n!=$ca-1) print ', ';
}
print '</small><hr />';
}
break;
}
print '[<a href="..">На главную</a>]</div></body></html>';
?>