• Revista PROGRAMAR: Já está disponível a edição #53 da revista programar. Faz já o download aqui!

zerocool

[resolvido]Ajuda neste erro sff urgente

3 mensagens neste tópico

Se alguém me podes explicar este erro que esta a acontecer já estou a dar em maluco. Tem código inserido pelo Dreamweaver.

no servidor no meu pc esta a funcionar online esta a dar esse erro.

Warning: Cannot modify header information - headers already sent by (output started at /home/gatherg/public_html/coolt/index.php:59) in /home/gatherg/public_html/coolt/log.php on line 58

Error setting cookie.

código da pagina index.php

<?php require_once('Connections/ligacao.php'); ?>
<?php 
session_start();

[...]

if ( isset($_COOKIE['iduser']) && isset($_COOKIE['password']) ) {
  $username=$_COOKIE['iduser'];
  $password=$_COOKIE['password'];
mysql_select_db($database_ligacao, $ligacao);
$query_chechauth="SELECT auth, password FROM users WHERE auth='$username' AND password='$password'";
$chechauth=mysql_query($query_chechauth, $ligacao) or die(mysql_error("a"));
$totalRows_chechauth = mysql_num_rows($chechauth);
  $logged = $totalRows_chechauth;
  if ($logged==1) {
    $username=$_COOKIE['iduser'];
mysql_select_db($database_ligacao, $ligacao);
$query_Recordset1="SELECT level FROM users WHERE auth='$username'";
$Recordset1=mysql_query($query_Recordset1, $ligacao) or die(mysql_error());
$getu=mysql_fetch_assoc($Recordset1);
    $level=$getu['level'];
   }
}else{ 
$logged=0; 
}
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Gather PT - www.Gather-pt.eu</title>
<link rel="shortcut icon" href="imagens/icon.ico">
<style type="text/css">
#header {
background-image:url(imagens/banner_1.png);
}
</style>
<link href="css.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
[...]
</script>
</head>
<body onLoad="MM_preloadImages('imagens/HOME_2.png','imagens/SERVICES_2.png','imagens/CHANNEL_2.png','imagens/RANKINGS_2.png','imagens/SPONSORS_2.png','imagens/web-fusion_2.png')">
<?php session_start(); ?>
<div id="loginbox">
<?php
     if ($logged == 0){include('log.php'); }
     if ($logged == 1){include('user.php'); }
?>
</div>
<table width="910" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><div id="layout">
  <div id="header">
  <div id="logo"></div>
  <div id="nav-bar">
    <table border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td><a href="index.php?id=0" target="_top" onClick="MM_nbGroup('down','group1','home','imagens/HOME_2.png',1)" onMouseOver="MM_nbGroup('over','home','imagens/HOME_2.png','',1)" onMouseOut="MM_nbGroup('out')"><img src="imagens/HOME_1.png" alt="Home" name="home" border="0" onload=""></a></td>
        <td><a href="index.php?id=1" target="_top" onClick="MM_nbGroup('down','group1','channel','imagens/CHANNEL_2.png',1)" onMouseOver="MM_nbGroup('over','channel','imagens/CHANNEL_2.png','imagens/CHANNEL_2.png',1)" onMouseOut="MM_nbGroup('out')"><img src="imagens/CHAMMEL_1.png" alt="Channels" name="channel" border="0" onload=""></a></td>
        <td><a href="index.php?id=2" target="_top" onClick="MM_nbGroup('down','group1','Rankings','imagens/RANKINGS_2.png',1)" onMouseOver="MM_nbGroup('over','Rankings','imagens/RANKINGS_2.png','imagens/RANKINGS_2.png',1)" onMouseOut="MM_nbGroup('out')"><img src="imagens/RANKINGS_1.png" alt="" name="Rankings" border="0" onload=""></a></td>
        <td><a href="index.php?id=3" target="_top" onClick="MM_nbGroup('down','group1','Services','imagens/SERVICES_2.png',1)" onMouseOver="MM_nbGroup('over','Services','imagens/SERVICES_2.png','imagens/SERVICES_2.png',1)" onMouseOut="MM_nbGroup('out')"><img src="imagens/SERVICES_1.png" alt="Services" name="Services" border="0" onload=""></a></td>
        <td><a href="index.php?id=4" target="_top" onClick="MM_nbGroup('down','group1','sponsors','imagens/SPONSORS_2.png',1)" onMouseOver="MM_nbGroup('over','sponsors','imagens/SPONSORS_2.png','imagens/SPONSORS_2.png',1)" onMouseOut="MM_nbGroup('out')"><img src="imagens/SPONSORS_1.png" alt="Sponsors" name="sponsors" border="0" onload=""></a></td>
      </tr>
    </table>
  </div>
</div>
<div id="corpo">
<div id="corpo1"></div>
    <div id="corpo2">
    <table width="700" cellspacing="0" cellpadding="0" >
      <tr>
        <td width="487" valign="top" id="main2"><div id="main">
          <table width="480" cellpadding="0" cellspacing="0" id="main">
            <tr>
              <td class="box1"> </td>
              </tr>
            <tr>
              <td class="box2"></td>
              </tr>
            <tr>
              <td class="box3"> </td>
              </tr>
            </table>
          </div> </td>
        <td width="200" valign="top">
              <?php include ('top3.php'); ?>          
              <table width="200" align="right" cellpadding="0" cellspacing="0">
              <tr>
                <td class="boxmenu1"> </td>
                </tr>
              <tr>
                <td class="boxmenu2"></td>
                </tr>
              <tr>
                <td align="center" valign="top" class="boxmenu2"><a href="index.php?id=7">Commands</a></td>
                </tr>
              <tr>
                <td align="center" valign="top" class="boxmenu2"><a href="index.php?id=8">Servers</a></td>
                </tr>
              <tr>
                <td align="center" valign="top" class="boxmenu2"><a href="index.php?id=9">Rules</a></td>
              </tr>
              <tr>
                <td align="center" valign="top" class="boxmenu2"><a href="index.php?id=10">Downloads</a></td>
              </tr>
              <tr>
                <td align="center" valign="top" class="boxmenu2"><a href="index.php?id=11">AntiCheats</a></td>
                </tr>
              <tr>
                <td align="center" valign="top" class="boxmenu2"><a href="index.php?id=12">Viideos</a></td>
              </tr>
              <tr>
                <td align="center" valign="top" class="boxmenu2"></td>
              </tr>
              <tr>
                <td class="boxmenu3"> </td>
                </tr>
              </table><?php if($level > 1){ ?>
            <table width="200" align="right" cellpadding="0" cellspacing="0">
              <tr>
                <td> </td>
              </tr>
              <tr>
                <td class="boxmenu13"> </td>
                </tr>
              <tr>
                <td class="boxmenu2"></td>
                </tr>
              <tr>
                <td align="center" valign="top" class="boxmenu2"><a href="index.php?id=">Web-Admin</a></td>
              </tr>
              <tr>
                <td class="boxmenu3"> </td>
              </tr>
              </table> <?php } ?>
    <table width="200" align="right" cellpadding="0" cellspacing="0">
                    <tr>
                      <td> </td>
                  </tr>
                    <tr>
                      <td class="boxmenu12"> </td>
                    </tr>
                    <tr>
                      <td align="center" valign="top" class="boxmenu2"><a href="http://www.web-fusion.eu" target="_blank" onMouseOver="MM_swapImage('Image7','','imagens/web-fusion_2.png',1)" onMouseOut="MM_swapImgRestore()"><img src="imagens/web-fusion.png" name="Image7" width="183" height="49" border="0"></a></td>
                    </tr>
                    <tr>
                      <td class="boxmenu3"> </td>
                    </tr>
            </table>
          </td>
      </tr>
      </table>
</div>
<div id="corpo4"></div>
</div>
<div id="flooder">Gather©copyright and all right reserved<p>©Designer by <a href="#">coolt</a></div></div>
 </td>
  </tr>
</table>
</body>
</html>

codigo do log.php

<link href="css.css" rel="stylesheet" type="text/css">
<?php require_once('Connections/ligacao.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
if(isset($_POST['button_log'])) {

		$username_Recordset1 = "-1";
		$pass_Recordset1 = "-1";
	if (isset($_POST['user'])) {
	  $username_Recordset1 = $_POST['user'];
	  if (isset($_POST['pass'])) {
	 	 $pass_Recordset1 = md5($_POST['pass']);
		 mysql_select_db($database_ligacao, $ligacao);
		$query_Recordset1 = sprintf("SELECT * FROM users  WHERE users.auth=%s  AND users.password=%s", GetSQLValueString($username_Recordset1, "text"),GetSQLValueString($pass_Recordset1, "text"));
	$Recordset1 = mysql_query($query_Recordset1, $ligacao) or die(mysql_error());
	$row_Recordset1 = mysql_fetch_assoc($Recordset1);
	$totalRows_Recordset1 = mysql_num_rows($Recordset1);
	  }
	}
	if($totalRows_Recordset1 == 0){
		$erro = '<img src="imagens/Critical.png" width="18" height="19" /><font color="#FF0000" size="+1" style="font-style:inherit">Auth e password errados.</font>';
	}elseif($totalRows_Recordset1 ==1){
		$_SESSION["iduser"] = $row_Recordset1['auth']; 
		$_SESSION["password"] = $row_Recordset1['password'];
		$_SESSION["grupo"] = $row_Recordset1['level'];
		$iduser = $_SESSION["iduser"];
		$password = $_SESSION["iduser"];
		$grupo = $_SESSION["iduser"];
		setcookie("iduser",$iduser, time()+60*60*24*100, "/") or die("Error setting cookie."); 
		setcookie("password",$password, time()+60*60*24*100, "/") or die("Error setting cookie."); 
		setcookie("grupo",$grupo, time()+60*60*24*100, "/") or die("Error setting cookie."); 
		echo '<META HTTP-EQUIV="Refresh" CONTENT="1; URL=index.php">';
		exit();
	}
}else{
?>
<form id="tablog" name="form1" method="POST" action="<?php $_SERVER['PHP_SELF']; ?>">
<div class="logerro"><?php echo $erro; ?></div>
  <table width="900" align="center"  cellpadding="0" cellspacing="0" id="tablog">
  <tr align="left" valign="top">
        <td width="60"><img src="imagens/02.gif" width="20" height="21"></td>
<td width="60">Username:</td>
        <td width="162">
            <input name="user" type="text" id="user" value="">
      </td>
        <td width="56">Password:</td>
        <td width="162"><input name="pass" type="password" id="pass"></td>
        <td width="74"><input type="submit" name="button_log" id="button_ok" value=""></td>
        <td width="162"><a href="index.php?id=5"><input type="button" name="button_log2" id="button_log" value="Register"></a></td>
        <td width="162"><a href="index.php?id=6"><input type="button" name="button_log2" id="button_log" value="Lost Password"></a></td>
      </tr>
    </table>
</form>
<?php } ?>

0

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites

eu não estou a entender mas eu estou a usar session_start() la no inicio no index.php não entendo é porque no servidor wamp k tenho da 5* e no servidor online da o raio do erro.!! :D

pagina index.php

session_start();
if ( isset($_COOKIE['iduser']) && isset($_COOKIE['password']) ) {
  $username=$_COOKIE['iduser'];
  $password=$_COOKIE['password'];
mysql_select_db($database_ligacao, $ligacao);
$query_chechauth="SELECT auth, password FROM users WHERE auth='$username' AND password='$password'";
$chechauth=mysql_query($query_chechauth, $ligacao) or die(mysql_error("a"));
$totalRows_chechauth = mysql_num_rows($chechauth);
  $logged = $totalRows_chechauth;
  if ($logged==1) {
    $username=$_COOKIE['iduser'];
mysql_select_db($database_ligacao, $ligacao);
$query_Recordset1="SELECT level FROM users WHERE auth='$username'";
$Recordset1=mysql_query($query_Recordset1, $ligacao) or die(mysql_error());
$getu=mysql_fetch_assoc($Recordset1);
    $level=$getu['level'];
   }
}else{ 
$logged=0; 
}
....
<?php
     if ($logged == 0){include('log.php'); }
     if ($logged == 1){include('user.php'); }
?>

pagina do log.php

if(isset($_POST['button_log'])) {

		$username_Recordset1 = "-1";
		$pass_Recordset1 = "-1";
	if (isset($_POST['user'])) {
	  $username_Recordset1 = $_POST['user'];
	  if (isset($_POST['pass'])) {
	 	 $pass_Recordset1 = md5($_POST['pass']);
		 mysql_select_db($database_ligacao, $ligacao);
		$query_Recordset1 = sprintf("SELECT * FROM users  WHERE users.auth=%s  AND users.password=%s", GetSQLValueString($username_Recordset1, "text"),GetSQLValueString($pass_Recordset1, "text"));
	$Recordset1 = mysql_query($query_Recordset1, $ligacao) or die(mysql_error());
	$row_Recordset1 = mysql_fetch_assoc($Recordset1);
	$totalRows_Recordset1 = mysql_num_rows($Recordset1);
	  }
	}
	if($totalRows_Recordset1 == 0){
		$erro = '<img src="imagens/Critical.png" width="18" height="19" /><font color="#FF0000" size="+1" style="font-style:inherit">Auth e password errados.</font>';
	}elseif($totalRows_Recordset1 ==1){
		$_SESSION["iduser"] = $row_Recordset1['auth']; 
		$_SESSION["password"] = $row_Recordset1['password'];
		$_SESSION["grupo"] = $row_Recordset1['level'];
		$iduser = $_SESSION["iduser"];
		$password = $_SESSION["iduser"];
		$grupo = $_SESSION["iduser"];
		setcookie("iduser",$iduser, time()+60*60*24*100, "/") or die("Error setting cookie."); 
		setcookie("password",$password, time()+60*60*24*100, "/") or die("Error setting cookie."); 
		setcookie("grupo",$grupo, time()+60*60*24*100, "/") or die("Error setting cookie."); 
		echo '<META HTTP-EQUIV="Refresh" CONTENT="1; URL=index.php">';
		exit();
	}
}else{
?>
<form id="tablog" name="form1" method="POST" action="<?php $_SERVER['PHP_SELF']; ?>">
<div class="logerro"><?php echo $erro; ?></div>
  <table width="900" align="center"  cellpadding="0" cellspacing="0" id="tablog">
  <tr align="left" valign="top">
        <td width="60"><img src="imagens/02.gif" width="20" height="21"></td>
<td width="60">Username:</td>
        <td width="162">
            <input name="user" type="text" id="user" value="">
      </td>
        <td width="56">Password:</td>
        <td width="162"><input name="pass" type="password" id="pass"></td>
        <td width="74"><input type="submit" name="button_log" id="button_ok" value=""></td>
        <td width="162"><a href="index.php?id=5"><input type="button" name="button_log2" id="button_log" value="Register"></a></td>
        <td width="162"><a href="index.php?id=6"><input type="button" name="button_log2" id="button_log" value="Lost Password"></a></td>
      </tr>
    </table>
</form>
<?php } ?>

0

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites

Crie uma conta ou ligue-se para comentar

Só membros podem comentar

Criar nova conta

Registe para ter uma conta na nossa comunidade. É fácil!


Registar nova conta

Entra

Já tem conta? Inicie sessão aqui.


Entrar Agora