<?php
session_start();
$content=file("../../sg_cm/conf/conf/conf.php");
if (session_id()!=$content[2])
 {
  $url=urlencode("Пройдите_авторизацию!");
  echo "<meta http-equiv=refresh content='0; url=../../sg_cm/admin/index.php?acc=$url'>";
  exit();
 }

 if(!isset($_GET['id']))
   {
   	 echo "<meta http-equiv=refresh content='0; url=admin3.php?sel3=selected'>";
     exit();
   }

 if(!file_exists("cons/cons/$_GET[id]"))
   {
   	 echo "<meta http-equiv=refresh content='0; url=admin3.php?sel3=selected'>";
     exit();
   }

//Фото, если есть
$foto=array();
 $d=opendir("cons/foto");
   while(($e=readdir($d))!=false)
     {
       if($e =="." || $e ==".." || $e==".htaccess" ) continue;
       $foto[]=$e;
     }
  closedir($d);

foreach($foto as $line)
 {
 	 $expl=explode(".",$line);
 	 if($expl[0]==$_GET['id'])
 	    {
 	      unlink("cons/foto/$line");
 	      break;
 	    }
 }

 echo "<meta http-equiv=refresh content='0; url=red_cons.php?id=$_GET[id]'>";
 exit();



?>