Ir para conteúdo
Fórum Script Brasil
  • 0

Erros no Script PHP Preciso de Ajuda


Henrique Nascimento

Pergunta

Quando eu logo no sistema aparece varios erros esse é um deles , notifica que a linha 3 ta errado ou coisa do genero a mensagem é essa : Notice: A session had already been started - ignoring session_start() in C:\xampp\htdocs\controle\admincontrole\status.php on line 3 , Notice: A session had already been started - ignoring session_start() in C:\xampp\htdocs\controle\admincontrole\valida_session.php on line 2 , Notice: Undefined variable: begin in C:\xampp\htdocs\controle\admincontrole\ler_abertos.php on line 53 .

Esse codigo é do status.php

<?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; ?>

<?php
session_start();
if (isset($_SESSION["login_usuario"]) AND isset($_SESSION["senha_usuario"])) {
$login_usuario = $_SESSION["login_usuario"];
$senha_usuario = $_SESSION["senha_usuario"];
}else{
header("Location: logar.php");
exit();/*caso não tinha session.. quer dizer.. ele não logou*/
} /*aqui primeiro ele checa para ver se exite essas Sessoes, e depois ele coloca o valor das sessoes nessas variaveis... para fazermos os testes!*/
if(!(empty($login_usuario) OR empty($senha_usuario)))
{
//acessa ao banco de dados
$cn = mysql_connect("localhost", "root", "1qaz2wsx");
mysql_select_db("suporte");
$resultado = mysql_query("select * from adm where username = '$login_usuario'");
if (mysql_num_rows($resultado) == 1)/*caso exista esse login.. vamos testar a senha então*/
{
if ($senha_usuario != mysql_result($resultado, 0, "senha"))
{
unset ($_SESSION["nome_usuario"]);/*apaga a session que existia mas era errada..*/
unset ($_SESSION["sehna_usuario"]);
header("Location: logar.php");
exit();
}
}else {
unset ($_SESSION["nome_usuario"]);
unset ($_SESSION["sehna_usuario"]);
header("Location: logar.php");
exit();
}
}else{
header("Location: logar.php");
exit();/*caso das sessions estarem vazias*/
}
mysql_close($cn);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- DW6 -->
<head>
<!-- Copyright 2005 Macromedia, Inc. All rights reserved. -->
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="style/mm_health_nutr.css" type="text/css" />
<script language="JavaScript" type="text/javascript">
//--------------- LOCALIZEABLE GLOBALS ---------------
var d=new Date();
var monthname=new Array("Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro");
//Ensure correct for language. English is "January 1, 2004"
var TODAY = monthname[d.getMonth()] + " " + d.getDate() + ", " + d.getFullYear();
var HOJE = d.getDate() + " de " + monthname[d.getMonth()] + " de " + d.getFullYear();
//--------------- END LOCALIZEABLE ---------------
</script>
<style type="text/css">
<!--
.style1 {
font-size: 12px;
font-weight: bold;
}
.botoes {
background-color: #F4FFE4;
text-align: center;
list-style-type: square;
font-weight: bold;
color: #993300;
}
-->
</style>
</head>
<body bgcolor="#F4FFE4" link="#666666" vlink="#666666" alink="#666666">
<tr>
<td height="490"> <div align="right"></div>
<table width="116" border="0" align="left" cellpadding="2" cellspacing="0" bordercolor="#993300">
<tr>
<td width="79" height="20" class="bodyText">
<div align="center"><?php echo "$login_usuario"; ?></div></td>
<td width="29" class="bodyText">
<div align="center">
<p><a href="logout.php"><font color="#666666">logout</font></a></p>
</div></td>
</tr>
</table>
<p>&nbsp;</p>
<?php
include "cfonte.php";
?>
</html>
Script do Valida_session.php
<?php
session_start();
if (isset($_SESSION["login_usuario"]) AND isset($_SESSION["senha_usuario"])) {
$login_usuario = $_SESSION["login_usuario"];
$senha_usuario = $_SESSION["senha_usuario"];
}else{
header("Location: logar.php");
exit();/*caso não tinha session.. quer dizer.. ele não logou*/
} /*aqui primeiro ele checa para ver se exite essas Sessoes, e depois ele coloca o valor das sessoes nessas variaveis... para fazermos os testes!*/
if(!(empty($login_usuario) OR empty($senha_usuario)))
{
//acessa ao banco de dados
$cn = mysql_connect("localhost", "root", "root");
mysql_select_db("suporte");
$resultado = mysql_query("select * from adm where username = '$login_usuario'");
if (mysql_num_rows($resultado) == 1)/*caso exista esse login.. vamos testar a senha então*/
{
if ($senha_usuario != mysql_result($resultado, 0, "senha"))
{
unset ($_SESSION["nome_usuario"]);/*apaga a session que existia mas era errada..*/
unset ($_SESSION["sehna_usuario"]);
header("Location: logar.php");
exit();
}
}else {
unset ($_SESSION["nome_usuario"]);
unset ($_SESSION["sehna_usuario"]);
header("Location: logar.php");
exit();
}
}else{
header("Location: logar.php");
exit();/*caso das sessions estarem vazias*/
}
mysql_close($cn);
?>
<?php
include "cfonte.php";
?>
Script do Lerabertos.php
<?php
include "valida_session.php";
?>
<?php
include "status.php";
?>
<?php
include "connect.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- DW6 -->
<head>
<!-- Copyright 2005 Macromedia, Inc. All rights reserved. -->
<title>Chamados em &quot;Aberto&quot;</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="style/mm_health_nutr.css" type="text/css" />
<script language="JavaScript" type="text/javascript">
//--------------- LOCALIZEABLE GLOBALS ---------------
var d=new Date();
var monthname=new Array("Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro");
//Ensure correct for language. English is "January 1, 2004"
var TODAY = monthname[d.getMonth()] + " " + d.getDate() + ", " + d.getFullYear();
var HOJE = d.getDate() + " de " + monthname[d.getMonth()] + " de " + d.getFullYear();
//--------------- END LOCALIZEABLE ---------------
</script>
<style type="text/css">
<!--
.style1 {
font-size: 12px;
font-weight: bold;
}
.botoes {
background-color: #F4FFE4;
text-align: center;
list-style-type: square;
font-weight: bold;
color: #993300;
}
.style3 {font-size: 12px; font-weight: bold; color: #FF0000; }
.style8 { font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #000066;
font-weight: bold;
}
-->
</style>
</head>
<body bgcolor="#F4FFE4">
<?php
$begin = $_GET['begin'];
if (!$begin) { $begin = 0; }
$query = 'SELECT COUNT(*) FROM registros WHERE (estado = "ABERTO")';
$query = mysql_query($query,$conexao);
$query = mysql_fetch_array($query);
$total = $query[0];
?>
<?php
if (($begin > 0) and ($begin <= 10)) {
$anteriores = '<a href="ler2.php?begin=0">Anteriores</a>';
} elseif (($begin > 0) and ($begin > 10)) {
$anteriores = '<a href="ler2.php?begin=' . ($begin-10) . '">Anteriores</a>';
} else {
$anteriores = 'Anteriores';
}
if (($begin < $total) and (($begin+10) >= $total)) {
$proximos = 'Próximos';
} else {
$proximos = '<a href="ler2.php?begin=' . ($begin+10) . '">Próximos</a>';
}
?>
<tr>
<td height="490">&nbsp;
<span class="bodyText">
</span>
<table width="526" border="0" align="center" cellpadding="2" cellspacing="0">
<tr>
<td height="46" class="pageName"><div align="center">
<p>Chamados Abertos </p>
</div></td>
</tr>
<tr>
<td height="19" class="bodyText"><p align="center" class="style1">TOTAL DE CHAMADOS ABERTOS: <span class="style3"><?php echo $total; ?></span></p> </td>
</tr>
<tr>
<td height="20" align="center" class="bodyText"><span class="style1">Clique em &quot;ATENDER&quot; para atender o chamado.</span></td>
</tr>
</table>
<table width="526" border="0" align="center" cellpadding="2" cellspacing="0">
<tr>
<td height="20" class="bodyText">&nbsp;
<div align="center"></div></td>
</tr>
</table>
<p align="center" class="pageName">
<?php
$query = 'SELECT DISTINCT * FROM registros WHERE (estado = "ABERTO") ORDER BY data_aber DESC';
$query = mysql_query($query,$conexao);
while ($linha = mysql_fetch_array($query)) {
$var = $linha['data_aber'];
$var = explode(" ",$var);
$dia = $var[0];
$hora = $var[1];
$dia = explode("-",$dia);
$data = "$dia[2]/$dia[1]/$dia[0] às $hora";
?></p>
<table width="526" border="0" align="center" cellpadding="2" cellspacing="0">
<tr>
<td class="subHeader" id="monthformat">Setor</td>
<td colspan="3" class="subHeader" id="monthformat"><span class="style8"><?php echo $linha['setor']; ?></span> <div align="right"></div></td>
<td width="126" class="subHeader" id="monthformat"><div align="right">ID</div></td>
<td width="59" class="subHeader" id="monthformat"><div align="right"><span class="style8"><?php echo $linha['id']; ?></span></div></td>
</tr>
<tr>
<td width="111" class="subHeader" id="monthformat">Andar</td>
<td width="41" class="subHeader" id="monthformat"><span class="style8"><?php echo $linha['andar']; ?></span></td>
<td width="43" class="subHeader" id="monthformat"><div align="center">Ramal</div></td>
<td colspan="3" class="subHeader" id="monthformat"><span class="style8"><?php echo $linha['ramal']; ?></span></td>
</tr>
<tr>
<td class="subHeader" id="monthformat">Contato</td>
<td colspan="5" class="subHeader" id="monthformat"><span class="style8"><?php echo $linha['contato']; ?></span></td>
</tr>
<tr>
<td class="subHeader" id="monthformat">Equipamento</td>
<td colspan="5" class="subHeader" id="monthformat"><span class="style8"><?php echo $linha['equip']; ?></span></td>
</tr>
<tr>
<td class="subHeader" id="monthformat">Problema</td>
<td colspan="5" class="subHeader" id="monthformat"><span class="style8"><?php echo $linha['prob_rep']; ?></span></td>
</tr>
<tr>
<td valign="top" class="subHeader" id="monthformat">Aberto em </td>
<td colspan="5" class="subHeader" id="monthformat"><span class="style8"><?php echo $data; ?></span></td>
</tr>
<tr valign="top">
<td height="32" class="subHeader" id="monthformat">STATUS</td>
<td class="subHeader" id="monthformat"><span class="style3"><?php echo $linha['estado']; ?></span></td>
<td class="subHeader" id="monthformat">&nbsp;</td>
<td colspan="3" align="right" class="subHeader" id="monthformat"><form id="atender" name="atender" method="post" action="update_atender.php">
<label>
<input name="id" type="hidden" id="id" value="<?php echo $linha['id']; ?>" />
</label>
<label>
<input name="Submit" type="submit" class="botoes" value="ATENDER" />
</label>
&nbsp;</form></td>
</tr>
<tr align="right">
<td colspan="6" valign="top" class="subHeader" id="monthformat"></td>
</tr>
<tr>
<td height="21" colspan="6" align="right" valign="top" class="subHeader" id="monthformat">&nbsp;</td>
</tr>
</table>
<p>
<?php
}
?>
</p>
<p>&nbsp;</p>
<p>&nbsp; </p>
<p>&nbsp;</p>
</html>

Editado por Henrique Nascimento
Link para o comentário
Compartilhar em outros sites

1 resposta a esta questão

Posts Recomendados

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,1k
    • Posts
      651,8k
×
×
  • Criar Novo...