Jump to content
Fórum Script Brasil
  • 0

Erros no Script PHP Preciso de Ajuda


Henrique Nascimento

Question

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>

Edited by Henrique Nascimento
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.1k
    • Total Posts
      652k
×
×
  • Create New...