View file load/stol.php

File size: 1.75Kb
<?
Error_Reporting(E_ALL & ~E_NOTICE);
Error_Reporting (ERROR | WARNING);
include("func.php");
include("set.php");
include("start.php");

if($mode=="add" && $name!="" && $zakaz!="")
{
  $name=htmlspecialchars($name);
  $zakaz=htmlspecialchars($zakaz);
  $f=@fopen("stol.dat","a+");
  $time=time();
  @fwrite($f,"|$name|$zakaz|$time|\r\n");
  @fclose($f);
  header("Location: stol.php");
  exit;
}

include("modul/head.php");

$base=file("stol.dat");
$b_c=count($base);
$file=fopen("stol.dat","a+");

if($ver!="wml") print "<div class=\"a\">Стол заказов</div>";

if(!$admin_ok);
elseif($mode=="del_id" && $code!="")
{
  $msv=explode("|",$base[$b_c-$del_id-1]);
  $fl=$base;
  if($code==$msv[3])
  {
    unset($fl[$b_c-$del_id-1]);
    ftruncate($file,0);
    fwrite($file,@implode("",$fl));
    $base=file("stol.dat");
    $b_c=count($base);
  }
}

for($i=$pg_b;$i<$pg_e;$i++)
{
  if(!isSet($base[$b_c-$i-1])) continue;
  $msv=explode("|",$base[$b_c-$i-1]);
  $date=date("d.m.y H:i",$msv[3]);
  if($ver!="wml") print "<div class=\"b\">";
  if($admin_ok) $link_del="<a href=\"stol.php?mode=del_id&amp;del_id=$i&amp;code=$msv[3]&amp;pg=$pg\">Удалить</a><br/>"; else $link_del="";
  print "<b>$msv[1]</b><br/>$date<br/>$msv[2]<br/>$link_del";
  if($ver!="wml") print "</div>";
}

if($ver!="wml")
{
  print "<form action=\"stol.php\">
         <input name=\"mode\" value=\"add\" type=\"hidden\"/>
         Имя:<br/><input name=\"name\"/><br/>
         Заказ:<br/><input name=\"zakaz\"/><br/>
         <input value=\"Написать\" class=\"ibutton\" type=\"submit\"/><br/>
         </form>";
}

print "<a href=\"index.php\">Загрузки</a><br/>";

fclose($file);
include("modul/foot.php");
?>