<?
session_start();
include 'cnn.php';
@$login = $_SESSION['login'];
@$senha = $_SESSION['senha'];
if(!isset($_SESSION['login'])) { echo "Para acessar essa pagina é preciso esta logado!"; }
else{
$Gms = mssql_fetch_row(mssql_query("select painelgm from memb_info where memb___id='".$login."'"));
if($Gms[0] <= 0) { echo "Você não faz parte da Administração"; }
else{ 
?>
<h1>Tickets</h1>
<div class="quadros">
<table width="96%" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr bgcolor="#E2DEC5"> 
			    <td bgcolor="#CCCCCC"><div align="center"><b>Id</b></div></td>
                <td bgcolor="#CCCCCC"><b>Status</b></td>
				<td bgcolor="#CCCCCC"><b>Character</b></td>
                <td bgcolor="#CCCCCC"><b>Titulo</b></td>
                <td bgcolor="#CCCCCC"><b>Data do envio</b></td>
  </tr>
<?   
  $Query = mssql_query("select titulo,status,id,data,name from site_ticket order by data desc");
  for($i=0;$i<mssql_num_rows($Query);$i++) {
  $rank = $i+1;
  $Array = mssql_fetch_row($Query);			  
	    if($i % 2)
{
$cor="#EDEBDC";
}
else
{
$cor="#EDEBDC";
}
if ($Array[1] == 0) { $status = "Aberto"; }
if ($Array[1] == 1) { $status = "Fechado"; }
  ?>
              <tr bgcolor="#EDEBDC"> 
			  <td width="30" bgcolor="#E5E5E5" <? echo" bgcolor='$cor'"; ?> > 
                  <strong>
                  <?=$Array[2]?>
                 </strong></td>
                <td width="92" bgcolor="#E5E5E5" <? echo" bgcolor='$cor'"; ?> > 
              
                  <?=$status?>                </td>
				<td width="117" bgcolor="#E5E5E5" <? echo" bgcolor='$cor'"; ?>> 
                 
                  <?=$Array[4]?>                </td>
                <td width="425" bgcolor="#E5E5E5" <? echo" bgcolor='$cor'"; ?>> 
                  <?=$Array[0]?>
[<a href="index.php?go=painel/tickets&id=<?=$Array[2]?>">Ver</a>] [<a href="index.php?go=painel/ticket_del&id=<?=$Array[2]?>">Deletar</a>] 
                  [<a href="index.php?go=painel/ticket_fechar&id=<?=$Array[2]?>">Fechar</a>] [<a href="index.php?go=painel/ticket_abrir&id=<?=$Array[2]?>">Reabrir</a>]</td>
                <td width="290" bgcolor="#E5E5E5" <? echo" bgcolor='$cor'"; ?>> 
                 
                  <?=$Array[3]?>                </td>
		<? } ?>
              </tr>
</table>
</div>
<? } } ?>