como fazer o logout
17/05/2012
0
Paulo César
Posts
17/05/2012
Joel Rodrigues
17/05/2012
Paulo César
ela nao exiba e mostra a tela de login mais nao consigo ja usei a função do use atenticacion mais nao funciou e fazer o botão sair , sair mesmo do sistema e montra uma menssagem de na tela voce saiu do sistema volte sempre
mais nao to conseguindo, da uma erro na linha 74. e nao sei qual é o erro. to desiperado ja.
17/05/2012
Paulo César
2 //initialize the session
3 if (!isset($_SESSION)) {
4 session_start();
5 }
6
7 // ** Logout the current user. **
8 $logoutAction = $_SERVER[PHP_SELF].?doLogout=true;
9 if ((isset($_SERVER[QUERY_STRING])) && ($_SERVER[QUERY_STRING] != )){
10 $logoutAction .=&. htmlentities($_SERVER[QUERY_STRING]);
11 }
12
13 if ((isset($_GET[doLogout])) &&($_GET[doLogout]==true)){
14 //to fully log out a visitor we need to clear the session varialbles
15 $_SESSION[MM_Username] = NULL;
16 $_SESSION[MM_UserGroup] = NULL;
17 $_SESSION[PrevUrl] = NULL;
18 unset($_SESSION[MM_Username]);
19 unset($_SESSION[MM_UserGroup]);
20 unset($_SESSION[PrevUrl]);
21
22 $logoutGoTo = ../sistema/index.php?erro=voce saiu do sistema;
23 if ($logoutGoTo) {
24 header(Location: $logoutGoTo);
25 exit;
26 }
27 }
28 ?>
29 <?php
30 if (!isset($_SESSION)) {
31 session_start();
32 }
33 $MM_authorizedUsers = ;
34 $MM_donotCheckaccess = true;
35
36 // *** Restrict Access To Page: Grant or deny access to this page
37 function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
38 // For security, start by assuming the visitor is NOT authorized.
39 $isValid = False;
40
41 // When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
42 // Therefore, we know that a user is NOT logged in if that Session variable is blank.
43 if (!empty($UserName)) {
44 // Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
45 // Parse the strings into arrays.
46 $arrUsers = Explode(,, $strUsers);
47 $arrGroups = Explode(,, $strGroups);
48 if (in_array($UserName, $arrUsers)) {
49 $isValid = true;
50 }
51 // Or, you may restrict access to only certain users based on their username.
52 if (in_array($UserGroup, $arrGroups)) {
53 $isValid = true;
54 }
55 if (($strUsers == ) && true) {
56 $isValid = true;
57 }
58 }
59 return $isValid;
60 }
61
62 $MM_restrictGoTo = ../sistema/index.php?erro=Acesso Negado, efetue login e senha;
63 if (!((isset($_SESSION[MM_Username])) && (isAuthorized(,$MM_authorizedUsers, $_SESSION[MM_Username], $_SESSION[MM_UserGroup])))) {
64 $MM_qsChar = ?;
65 $MM_referrer = $_SERVER[PHP_SELF];
66 if (strpos($MM_restrictGoTo, ?)) $MM_qsChar = &;
67 if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
68 $MM_referrer .= ? . $QUERY_STRING;
69 $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . accesscheck= . urlencode($MM_referrer);
70 header(Location: . $MM_restrictGoTo);
71 exit;
72 }
73 ?>
74 <!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd>
75 <html xmlns=http://www.w3.org/1999/xhtml>
76 <head>
77 <meta http-equiv=Content-Type content=text/html; charset=utf-8 />
78
79 <title>Área de gerenciamento</title>
80
81 <!-- TemplateBeginEditable name=head -->
82 <!-- TemplateEndEditable -->
83 <style type=text/css>
84 <!--
85 body {
86 background-color: #666;
87 }
88 -->
89 </style></head>
90
91 <body>
92 <table width= 100% border=0 cellspacing=3 cellpadding=3 bgcolor=#FFFFFF>
93 <tr align=center>
94 <td><h3>Sistema de Gerênciamento de Conteúdo</h3></td>
95 </tr>
96 <tr>
97 <td><table width=410 height=35 border=0 align=center cellpadding=3 cellspacing=3 bgcolor=#F3F3F5>
98 <tr align=center>
99 <td>Usuários</td>
100 <td>Categorias</td>
101 <td>Produtos</td>
102 <td><a href=<?php echo $logoutAction ?>>Sair</a></td>
103 </tr>
104 </table></td>
105 </tr>
106 <tr align=justify>
107 <td><!-- TemplateBeginEditable name=conteudo -->conteudo<!-- TemplateEndEditable --></td>
108 </tr>
109 <tr align=center>
110 <td>Todo os direitos resevados a Paulo César</td>
111 </tr>
112 </table>
113 </body>
114 </html>
da erro na linha 74 e nao funciona o redirecionamento quando acessa a pagina sistema_incial, devia ser redirecionado para index.
17/05/2012
Joel Rodrigues
17/05/2012
Joel Rodrigues
<html>
<head>
<?php
echo hello;
?>
</head>
<body>
</body>
</html>
17/05/2012
Paulo César
17/05/2012
Joel Rodrigues
18/05/2012
Ricardo Arrigoni
Então você pode pegar o código e sempre colocar dentro do <head>, agora automaticamente não tem como colocar não.
abs
12/06/2012
Fernando Alves.
Clique aqui para fazer login e interagir na Comunidade :)