<?php 
session_start();
if (is_file("../db/zagl")) include_once("../db/zagl");
if (trim($indx)=='') {$viewsite='';}
elseif (is_file('../../../'.$indx.'.php')) $viewsite=$indx.'.php';
elseif(is_file('../../../'.$indx.'.html'))  $viewsite=$indx.'.html';
else $viewsite='';
$w=file("ac/sess");
$id="";

foreach($w as $line)
 {
   $expl=explode("*",$line);
   $line=trim($line);
   if(session_id()==$expl[1])
      {
        $id=$expl[2];
        $name=$expl[3];
        break;
      }
 }
if($id=="")
  {
    echo "<meta http-equiv=refresh content='0; url=index.php'>";
    exit();
  }

if(!file_exists("cons/$id"))
  {
    echo "<meta http-equiv=refresh content='0; url=index.php'>";
    exit();
  }

if (@$_POST['list_navig']=='1')  echo "<meta http-equiv=refresh content='0; url=admin1.php?sel1=selected'>";
if (@$_POST['list_navig']=='2')  echo "<meta http-equiv=refresh content='0; url=admin2.php?sel2=selected'>";
if (@$_POST['list_navig']=='3')  echo "<meta http-equiv=refresh content='0; url=admin3.php?sel3=selected'>";


if(isset($_GET['quit']))
  {
    $w=file("ac/sess");
    $f=fopen("ac/sess","w");
     foreach($w as $line)
      {
        $expl=explode("*",$line);
        if($expl[2]==$id) fwrite($f,$expl[0]."*111*".$expl[2]."*".$expl[3]);
        else fwrite($f,$line);
      }
    fclose($f);
     echo "<meta http-equiv=refresh content='0; url=../../../'>";
     exit();

  }

?>
<!DOCTYPE html>
<html>
	<head>
	<meta charset="utf-8" />
  <title>Панель управления для консультантов</title>

<style>
	
.consTable {width:85%; max-width:1200px;}
A:Link,A:Visited,A:Active { Color: #0000cc; Text-decoration: none}
A:Hover{ Color: #0000cc; Text-decoration: none}
   #tabcap
        {
          font-family:"Times New Roman", "serif";
          font-size:11pt;
          font-style:normal;
          color:#595959;
		  }
  #hy {
         font-family: Arial, sans-serif;
         font-size:10pt;
          color:#408080;
 	     font-size:11pt;
      }
 #hyd {
         
vertical-align: top;
      }
  #hy a {
         font-family: Arial, sans-serif;
         font-size:10pt;
          color:#0061C1;
 	     font-size:11pt;
      }

   #cit
         {
          color:#808080;
          font-size:11pt;
          font-family: Arial, sans-serif;
          border-style:solid;
          border-width: 1px;
          border-color:#C0C0C0;
          top-margin:20px;
          bottom-margin:20px;

         }
    #cit a
         {
          color:#0061C1;
          font-size:9pt;
          font-family: Arial, sans-serif;

         }
    table
       {
       	 color:#595959;
         font-size:11pt;
         font-family: Arial, sans-serif;

       }

        #quest
         {
          font-family:"Times New Roman", "serif";
 	      font-size:11pt;
          font-weight:300;
          color:#005F8C;
          border-style:solid;
          border-left-width: 0px;
          border-right-width: 0px;
          border-top-width: 1px;
          border-bottom-width:0px;
          border-color: #C0C0C0;
         }

         .navig_activ
         {
          font-family: Arial, sans-serif;
          font-size:10pt;
          border-style:solid;
          border-width: 1px;
          border-color:#D2D2D2;
          background-color:#800040;
          padding:5px;
          text-align:center;
          color:#ffffff;

         }

 .navig_passiv
        {

          fontfont-family: Arial, sans-serif;
          font-size:10pt;
          border-style:solid;
          border-width: 1px;
          border-color:#D2D2D2;
          background-color:#F0F0F0;
          padding:5px;
          text-align:center;
          color:#676767;
       }

   a.navig_activ
     {
      text-decoration:none;
     }
   a.navig_passiv
      {
      text-decoration:none;
      }

     #button {

       font-family:"Times New Roman", "serif";
       color:#408080;
       font-size:9pt;
       background-color:#C0C0C0;
      font-weight:600;
      text-align:center;
      width:120px;
      }
</style>
</head>

<body>
<br/>
<table align=center class=consTable>
  <tr>
    <td id=hyd>
         <span id=hy>Здравствуйте, <?php echo $name ?>&nbsp;&nbsp;
          <!--a href=<?php echo "$_SERVER[PHP_SELF]?quit=1" ?>>выход</a--></span>
    </td>
    <td  id=tabcap align=right>
                   <form action='cap.php' method='post' name='cap'>
                    <SELECT NAME="list_navig" onchange="cap.submit();">
<OPTION value="1" <? echo @$_GET['sel1']; ?> >Неотвеченные вопросы</option>
<OPTION value="2" <? echo @$_GET['sel2']; ?> >Все ответы</option>
<OPTION value="3" <? echo @$_GET['sel3']; ?> >Ваши данные</option>

</SELECT>
                   </form>
<a href=# onClick="{var mainwin=window.open('<?php echo '../../../'.$viewsite;?>','VIEW_SITE','Width=1300, height=3000,left=2,top=2,status=no,toolbar=yes,menubar=no,scrollbars=yes,resizable=yes'); mainwin.focus(); return false;}">Просмотр сайта (в новом окне)</a><br/>
<a target="_blank" href=../admin4.php>Вход для администратора</a><br/>
 <a href=<?php echo "$_SERVER[PHP_SELF]?quit=1" ?> target="_parent">Выход</a>
    </td>

  </tr>
</table>