Olá pessoal segue o código do index.php, login.php, config.php e index_2.php Bom explicando melhor. Eu instalei o Apache 2.0, PHP 4.0, MySQL 4.1 no Sistema Operacional Windows XP Professional. As páginas estão funcionando corretamente fiz os testes nomais. Coloquei o sistema de helpdesk, e está funcionando perfeitamente. Só lembrando o meu micro faz parte de um domínio da empresa e em todas as estações estão funcionando o meu sistema colocando o IP do meu micro e direcionando a pasta ficando assim "http://172.17.1.26/helpdesk" já coloquei até um nome para ele. O problema é o seguinte, tem alguns servidores que eu acesso via TS (aqui na empresa), que o sistema não funciona, lembrando que hoje eu testei e com outro usuário do Windows funcionava neste servidor, somente o meu usuário do Windows que não dava certo. Também um mês atrás eu configurei o Servidor Web no Linux SUSE10, o sistema não funcionava no proprio Linux, ocorrendo o mesmo problema, mas outras páginas PHP funcionava normal. Quanto as versões de internet explorer, usamos a 6 e 7 e ambos funcionam. Index.php
<html>
<head>
<title>helpdesk Telasul</title>
<style type="text/css">
<!--
.style1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
font-size: 12px;
color: #211C3C;
}
.style3 {font-size: 9px; color: #221E39; font-family: Verdana, Arial, Helvetica, sans-serif;}
body {
background-color: #F3F3F3;
scrollbar-face-color: #CCCCCC;
scrollbar-shadow-color: #666666;
scrollbar-highlight-color: #666666;
scrollbar-3dlight-color: #666666;
scrollbar-darkshadow-color: #666666;
scrollbar-track-color: #CCCCCC;
scrollbar-arrow-color: #666666;
}
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
<body onLoad="document.form1.username.focus()">
<p> </p>
<p> </p>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" bgcolor="white" style="border-collapse: collapse; border: 1px solid silver" bordercolor="#111111" width="500">
<tr>
<td width="50" height="50"> </td>
<td height="50" width="420"> </td>
<td width="50" height="50"> </td>
</tr>
<tr>
<td width="50" height="205"> </td>
<td width="420" height="205">
<form name="form1" method="POST" action="login.php">
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="400" height="205" background="img/logon2.jpg">
<tr>
<td>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="390">
<tr>
<td width="85"> </td>
<td width="160"> </td>
<td width="145"> </td>
</tr>
<tr>
<td width="85"> </td>
<td width="160"> </td>
<td width="145"> </td>
</tr>
<tr>
<td width="85"> </td>
<td width="160"> </td>
<td width="145"> </td>
</tr>
<tr>
<td width="85"><font face="verdana" size="1" color="silver"><span class="style1">Usuário:</span></td>
<td width="160"><input type="text" name="username" size="20" tabindex="1"></td>
<td width="145"><input type="submit" value="Entrar" name="B1" tabindex="3"></td>
</tr>
<tr>
<td width="85"><font face="verdana" size="1" color="silver"><b class="style1">Senha:</b></td>
<td width="160"><input type="password" name="senha" size="20" tabindex="2"></td>
<td width="145"><input type="reset" value="Limpar" name="B2" tabindex="4"></td>
</tr>
<tr>
<td width="85"> </td>
<td width="160"> </td>
<td width="145"> </td>
</tr>
<tr>
<td width="85"> </td>
<td width="160"> </td>
<td width="145"> </td>
</tr>
<tr>
<td width="390" colspan="3"><font face="verdana" size="1" color="silver">
<div align="center" class="style3">Entre com o nome de usuário e senha para efetuar o login no sistema.</div></td>
</tr>
</table>
</center>
</div>
</td>
</tr>
</table>
</center>
</div>
</form>
</td>
<td width="50" height="205"> </td>
</tr>
<tr>
<td width="50" height="50"> </td>
<td height="50" width="420"> </td>
<td width="50" height="50"> </td>
</tr>
</table>
</center>
</div>
</body>
</html>
Login.php
<?
include "config.php";
$date = date("d/m/y");
$hora = date("H:i");
@session_start(); // Inicializa a sessão
if (!mysql_connect($Host, $Usuario, $Senha)) {
echo mysql_error();
exit();
}
mysql_select_db($Base);
$user = $HTTP_POST_VARS["username"];
$pwd = $HTTP_POST_VARS["senha"];
$sQuery = "select cod_usuario, nom_usuario, login, pwd_usuario, nivel
from usuarios
where login = '" . $user . "'";
$oUser = mysql_query($sQuery)
or die("Query invalida: " . mysql_error());
$row = mysql_fetch_object($oUser);
if ($num_rows = mysql_num_rows($oUser) == 1) {
if ($row->pwd_usuario == $pwd) {
if ($row->nivel == $Nivel) {
$_SESSION["log_usuario"] = $user;
$_SESSION["pwd_usuario"] = $pwd;
$_SESSION["nom_usuario"] = $row->nom_usuario;
$_SESSION["cod_usuario"] = $row->cod_usuario;
///////////////////////grava o acesso ao sistema na tabela acesso.
$sQuery1 = "insert into acesso (cod_user, nome_user, nome, data, hora)
values ('" . $row->cod_usuario . "',
'" . $user . "',
'" . $row->nom_usuario . "',
'" . $date . "',
'" . $hora . "')";
mysql_query($sQuery1);
echo "<script>window.location='index_2.php'</script>";
} else {
$_SESSION["log_usuario"] = $user;
$_SESSION["pwd_usuario"] = $pwd;
$_SESSION["nom_usuario"] = $row->nom_usuario;
$_SESSION["cod_usuario"] = $row->cod_usuario;
///////////////////////grava o acesso ao sistema na tabela acesso.
$sQuery1 = "insert into acesso (cod_user, nome_user, nome, data, hora)
values ('" . $row->cod_usuario . "',
'" . $user . "',
'" . $row->nom_usuario . "',
'" . $date . "',
'" . $hora . "')";
mysql_query($sQuery1);
echo "<script>window.location='index_3.php'</script>";
?>
}
<?php
}
} else {
?>
<script language="JavaScript">
<!--
alert("Senha incorreta!");
window.location = 'index.php';
//-->
</script>
<?php
}
} else {
?>
<script language="JavaScript">
<!--
alert("Usuário não encontrado!");
window.location = 'index.php';
//-->
</script>
<?php
}
?>
Config.php
<?php
// Sistema de HelpDesk
// Base = MySQL
$Host= "localhost"; //<----aqui você deve configurar o caminho para o host
// helpdesk
$Base= "helpdesk"; //não mude
$Usuario= "root"; //<---------aqui você deve colocar o usuario do mysql
$Senha= ""; //<---------aqui você deve colocar a senha do mysql
$Nivel= "adm";
$Nivelusr= "padrão";
?>
index_2.php
<?php
include "config.php";
include "valida_user.inc";
include "layout.php";
$date = date("d/m/y");
$hora = date("H:i");
?>
<?php //contador de vezes que o usuario acessou o sistema...
mysql_connect($Host, $Usuario, $Senha);
mysql_select_db($Base);
$sQuery = " select nome_user, nome
from acesso
where nome_user like '$nome_usuario'
order by nome_user";
$oUsers = mysql_query($sQuery);
$num_registros = mysql_num_rows($oUsers);
$oRow = mysql_fetch_object($oUsers);
// fim ?>
<html>
<head>
<title><?php echo $Title ?></title>
<?php echo "<script>window.defaultStatus='Seja Bem Vindo(a) $oRow->nome. Você está logado desde as $hora hrs. Acesso número $num_registros.'</script>" ?>
</head>
<frameset framespacing="0" border="0" frameborder="0" rows="92,*">
<frame name="faixa" scrolling="no" noresize target="conteúdo" src="superior.php">
<frameset cols="220,*">
<frame src="menu.php" name="conteúdo" scrolling="no" noresize target="principal">
<frame name="principal" src="corpo_do_sistema.php" scrolling="auto">
</frameset>
<noframes>
<body>
<p>Esta página usa quadros mas seu navegador não aceita quadros.</p>
</body>
</noframes>
</frameset>
</html>