Jump to content


Leandro Galis

Member Since 24/05/2008
Offline Last Active 10/09/2011, 13:57
-----

Topics I've Started

Opção De Excluir Somente Para O Adm

27/08/2011, 12:05

a Noite Pessoal,

Tenho um sistema na qual todas as operadoras podem excluir um contato da administração, só que eu gostaria de restringir somente para o adm do sistema seria possivel? Alguem pode me ajudar ?

o Perfil do Adm esta cadastrado no banco de dados como "ADMGeral"

Segue o código da página que eu gostaria de alterar

<!--#include file="includes/funcoes.asp"-->
<%
checa_senha()
id = request("id")
if id = "" then
id = session("id")
end if
If (LCase(Request.QueryString("acao")) = "excluir") Then
   id = request("idexc")
        ConexaoDB(true)
   Conexao.Execute("DELETE FROM atendimento WHERE id ="& id)
   COnexaodb(false)
  
  msg_resultado = "Contato excluído com sucesso"
        Response.redirect ("painel.asp?secao=contatos&msg_resultado="&msg_resultado)
End if
%>
<script type="text/javascript">
//###################################################################################
// Excluir
//###################################################################################
function EXCluderz(id)
{
if (window.confirm("Você realmente deseja excluir o registro?"))
{
  window.location.href += "&acao=excluir&idexc="+ id +"";
}
}
</script>
<meta HTTP-EQUIV="refresh" CONTENT="60">
<script type="text/javascript">
setLocal("Contatos", 1);
setLocal("Agenda de contatos do atendente: <strong><%= session("nome_usuario") %></strong>", 2);
</script>
<table width="572" border="0" cellspacing="0" cellpadding="0">
  <tr>
        <td>
        <table width="572" border="0" cellspacing="1" cellpadding="4" bgcolor="#D5D5D6" class="listagem">
        <% if Request("msg_resultado") <> "" then %>
                <tr>
                <td colspan="4" bgcolor="#EAEAEA" style="color:#FF0000; font-weight:bold; font-style:italic;" align="center"><%= Request("msg_resultado") %></td>
                </tr>
                <% end if %>
                <form method="post" action="">
        </form>
        <tr>
        <th width="301" align="center">Nome</th>
        <th width="154" align="center">Agendamento:</th>
        <th width="89" align="center">Ação</th>
        </tr>
        <%
  Conexaodb(true)
        Set rs = Conexao.Execute("SELECT COUNT(id) AS total_registros FROM atendimento WHERE  atendente = "& id)
        total_registros = CInt(rs("total_registros"))
        rs.Close
        Set rs = Nothing
        reg_pagina = 30
        total_paginas = total_registros / reg_pagina
        total_paginas = IIf(Instr(total_paginas, ",") = 0, Int(total_paginas), Int(total_paginas + 1))
        pagina = Request.QueryString("pag")
        If Not IsNumeric(pagina) Then
        pagina = 1
        ElseIf (pagina < 1) OR (total_paginas = 0) Then
        pagina = 1
        ElseIf (Int(pagina) > Int(total_paginas)) Then
        pagina = total_paginas
        Else
        pagina = Int(pagina)
        End If
        reg_inicio = (pagina * reg_pagina) - reg_pagina
 
 
   Set rsatendido = Conexao.Execute("SELECT COUNT(id) AS total_registros FROM atendimento  where status = 2 and  atendente = "& id &" ")
        qtdatendido = CInt(rsatendido("total_registros"))
        rsatendido.Close
        Set rsatendido = Nothing
 
   Set rsnao = Conexao.Execute("SELECT COUNT(id) AS total_registros FROM atendimento  where status = 1 and  atendente = "& id &" ")
        qtdnaoatendido = CInt(rsnao("total_registros"))
        rsnao.Close
        Set rsnao = Nothing
 
  Set rsnovo = Conexao.Execute("SELECT COUNT(id) AS total_registros FROM atendimento where status = 0 and  atendente = "& id &" ")
        qtdnovo = CInt(rsnovo("total_registros"))
        rsnovo.Close
        Set rsnovo = Nothing
 
 
 
 
  if not request.Form("statuscontato") = "" then
 
        cod_status = request.Form("statuscontato")
    
                Set rs = Conexao.Execute("SELECT * FROM `atendimento` WHERE `atendente` = "+cstr(id)+" AND      `status` = "&cod_status&" Limit "& reg_inicio &", "& reg_pagina &"")
 
  else
                Set rs = Conexao.Execute("SELECT * FROM atendimento where atendente = "& cstr(id) &" order by status ASC, id desc Limit "& reg_inicio &", "& reg_pagina &"")
 
  end if
  
        If rs.EOF Then
        Response.Write "<tr>" & VbCrLf
        Response.Write "  <td align=""center"" colspan=""5"">Nenhum atendimento agendado.</td>" & VbCrLf
        Response.Write "</tr>" & VbCrLf
        Else
        While Not rs.EOF
  
        id_guaru = rs("id")
  
    
      
  
  
                Response.Write "<tr>" & VbCrLf
                Response.Write "  <td align=""left"">"& rs("nome") &"</td>" & VbCrLf
                Response.Write "  <td align=""center"">"& rs("data_agendamento") &"</td>" & VbCrLf
                Response.Write "  <td align=""center"">" & VbCrLf
                Response.Write "        <a href=""painel.asp?secao=contatos_ver&id="& id_guaru &"&idat="&id&"""><img src=""imagens/ver.png"" width=""16"" height=""16"" border=""0"" alt=""Alterar"" /></a>" & VbCrLf
   Response.Write "     <a href=""javascript:EXCluderz('"& rs("id") &"');""><img src=""imagens/ico_excluir.gif"" width=""16"" height=""16"" border=""0"" alt=""Excluir"" /></a>" & VbCrLf
                Response.Write "  </td>" & VbCrLf
                Response.Write "</tr>" & VbCrLf
                rs.MoveNext
        Wend
        End If
        rs.Close
        Set rs = Nothing
        ConexaoDB(false)
  strPagina = "painel.asp?secao=novidades&pag="
        %>
        </table>
 
        <table width="572" border="0" cellspacing="1" cellpadding="4" bgcolor="#D5D5D6" class="listagem">
        </table>
        <%
        If (total_paginas > 1) Then
        Response.Write "<table width=""100%"" height=""20"" border=""0"" cellspacing=""0"" cellpadding=""0""><tr><td valign=""bottom"">" & VbCrLf
        Call admPaginacao(strPagina)
        Response.Write "</td></tr></table>" & VbCrLf
        End If
        %>
        </td>
  </tr>
  <tr>
   <td> </td></tr>
  <tr>
   <td>
  <table width="302" border="0" cellspacing="1" cellpadding="4" bgcolor="#D5D5D6" class="listagem">
                <tr >
                                <th colspan="3" align="center">RESUMO DESTA CONSULTA</th>
                                </tr>
                                <!-- <tr>
                                <td width="63%" height="20"><strong>Contatos Novos:</strong></td>
                                <td width="14%" height="20" align="center"><img src="imagens/novo.png" width="24" height="24"></td>
                                <td width="23%"><%= qtdnovo %></td>
                                </tr>
                                <tr>
                                <td height="20"><strong>Contatos Não Atendidos:</strong></td>
                                <td height="20" align="center"><img src="imagens/nao_atendido.png" width="24" height="24"></td>
                                <td height="20"><%= qtdnaoatendido %></td>
                                </tr>
                                <tr>
                                <td height="20"><strong>Contatos Atendidos:</strong></td>
                                <td height="20" align="center"><img src="imagens/atendido.png" width="24" height="24"></td>
                                <td height="20"><%= qtdatendido %></td>
                                </tr> -->
                                <tr>
                                <td height="20"><B>Total de Atendimentos:</B></td>
                                <td height="20" align="center"><img src="imagens/total.png" width="24" height="24"></td>
                                <td height="20"><%=total_registros%></td>
                                </tr>
                                <tr>
                                <td height="20"><B>Total de Páginas:</B></td>
                                <td height="20" align="center"><img src="imagens/pagina.png" width="24" height="24"></td>
                                <td height="20"><%=total_paginas%>
        
        
        
        
        
        
        
   <%
   if session("novo") = "" then
        session("novo") = primeronovo
   end if  
  
   if session("novo") <> primeronovo then
   %>
                          
                <div>
   <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="5" height="5">
        <param name="movie" value="som/som.swf">
        <param name="quality" value="high">
        <param name="wmode" value="opaque">
        <embed src="som/som.swf" quality="high" wmode="opaque" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="5" height="5"></embed>
</object>
</div>
              
                <%
   session("novo") = primeronovo  
   end if
        %>
          
          
          
          
          
                </td>
                                </tr>
                        </table>
   </td>
   </tr>
</table>

Se alguém puder me ajudar eu agradeço.

IPB Skin By Virteq