Avatar Image
Okupa del foro
Okupa del foro

Hola amigos, tengo un sistema de foros aún sin terminar, y me da este error:

Codigo:
Warning: Cannot modify header information - headers already sent by (output started at /home/zeolab/public_html/zforos/prev/includes/login2.php:28) in /home/zeolab/public_html/zforos/prev/index.php on line 915

Warning: Cannot modify header information - headers already sent by (output started at /home/zeolab/public_html/zforos/prev/includes/login2.php:28) in /home/zeolab/public_html/zforos/prev/index.php on line 916


En login2.php tengo esto:

Codigo:
<?php
$loginCorrecto = false;
$idUsuarioL;
$nickUsuarioL;
$emailUsuarioL;
$nombreUsuarioL;
if(isset($HTTP_COOKIE_VARS["usuario"]) && isset($HTTP_COOKIE_VARS["contrasena"]))
{
$result = mysql_query("SELECT * FROM usuarios WHERE usuario='".$HTTP_COOKIE_VARS["usuario"]."' AND contrasena='".$HTTP_COOKIE_VARS["contrasena"]."'");

if($rowz6 = mysql_fetch_array($result))
{

$loginCorrecto = "true";
$idUsuarioL = $rowz6["id"];
$nickUsuarioL = $rowz6["usuario"];
$emailUsuarioL = $rowz6["email"];
$nombreUsuarioL = $rowz6["nombre"];
}
else
{

}
mysql_free_result($result);
}
?>

Y en las lineas del Index.php

Codigo:
915 setcookie("zforos_usuario",$usuario,time()+7776000);
916 setcookie("zforos_contrasena",$password,time()+7776000);



Bye amigos!
Avatar Image
@man / @woman
@man / @woman

Tienes un problema de header... es típico.

Ciertas funciones no pueden usarse después de haber sacado código por pantalla, cuando se dice código por pantalla se refiere al html, que puede ser un simple intro.

Las funciones que dan ese problema son header y las de cookies. La solución es rehacer el script para que ponga primero estas funciones.
Otra solución es leerte el post con chincheta de errores del nuke y abajo comento como pasarlo todo por un buffer con ob_start(); al inicio.

Avatar Image
Okupa del foro
Okupa del foro

Bueno mira ahora he kitado eso de setcookie y e puesto esto:

<script language="javascript">
location.href="includes/redirLGN.php?usuario=<?= $usuario; ?>&password=<?= $password; ?>&id=<?= $idforo ?>";
</script>

y redirLGN.php tiene:

<?
$usuario=$_GET['usuario'];
$password=$_GET['password'];
setcookie("zforos_usuario",$usuario,time()+7776000);
setcookie("zforos_contrasena",$password,time()+7776000);

?>
<script language="javascript">
location.href="../index.php?id=<?= $_GET['id']; ?>";
</script>
No tienes javascript activado!


Asta ahora todo bién, pero no me funciona!
mira, pruebalo.
http://zforos.zeolab.com/prev/index.php?modo=login&id=1

Veras, todo va ok, (lo he comprobado kitando los JS) pero luego no te deja logueado.

Y encambio en mi server local (IIS) sí!
como puede ser!
bye.

Avatar Image
Okupa del foro
Okupa del foro

Los datos de prueba son:
Usuario: usuario
Contraseña: contrasena

Bye.

Atomo64
Machacateclados
Machacateclados

verifica que no haya algún espacio o \n(o equivalente) antes del <?php o verifica alguna salida como print o echo, pero por la cookie no hay problema, pero la tienes que enviar antes del header

Avatar Image
Okupa del foro
Okupa del foro

Esta todo bién
hay algun dato del php.ini que haga que no funcionen las cookies ?
esque en modo local me funciona de todas las maneras, i así, envia la cookie, sin errores, PERO NO LO RECONOCE!

Bye.

Atomo64
Machacateclados
Machacateclados

si quieres envíame el código completo para que lo analize y te diga, además creo que deberías cambiar la manera en que se envía el user y el pass a post

Avatar Image
Okupa del foro
Okupa del foro

Bueno Ok, dame tu MSN, pero no te podre dar el código completo... tansolo esas lineas, jeje, el código tiene cerca de 1500 Líneas de código y es demasiado importante para mi

Bye.

TheOneProgrammer
Usuario Novato
Usuario Novato

yo tengo el mismo problema... lo curioso que tengo dos casos...

1. www.theoneprogrammer.com

Funciona correctamente... No hay ningun problema..

2. www.universalcable.com.sv

no me trabaja...

--------------------------------------------------------------------------- ------

El problema es el siguiente...

Trato de colocar una cookie..

http://www.universalcable.com.sv/prueba.php

<?php 
$Username = "test";
setcookie('Cookie', $Username);
?>

error: Warning: Cannot modify header information - headers already sent by (output started at /home/univers4/public_html/prueba.php:6)

in /home/univers4/public_html/prueba.php on line 104

Ya trate de varias forma, he leido en todas partes y tratado con la mayoria y nada..

mi codigo completo es:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/universal.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Universal Cable S.A. de C.V.</title>
<!-- InstanceEndEditable -->

<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<script src="Scripts/swfobject_modified.js" type="text/javascript"></script>
<!-- InstanceParam name="contenido" type="boolean" value="true" -->
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
<style type="text/css">
<!--
body,td,th {
 color: #FFF;
 font-family: tahoma;
 font-size: 12px;
}
body {
 background-color: #02136c;
}
.font {
 font-size: 11px;
 color:#FFF;
}
img{
border:none;
}
a:link {text-decoration: none}
a:visited {text-decoration: none}
a:hover {text-decoration: none}
a {text-decoration: none}
-->
</style>
<?php
include ('_vti_txt/9head.txt');
?>
</head>
<body>
<table width="980" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td width="980" height="300"><table width="980" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="179" background="sis/pictures/derecha.png"><table width="179" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td width="179" height="124"><div align="center">
              <object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="110" height="95">
                <param name="movie" value="sis/animaciones/logo.swf" />
                <param name="quality" value="high" />
                <param name="wmode" value="transparent" />
                <param name="swfversion" value="9.0.45.0" />
                <!-- Esta etiqueta param indica a los usuarios de Flash Player 6.0 r65 o posterior que descarguen la versión más reciente de Flash Player. Elimínela si no desea que los usuarios vean el mensaje. -->
                <param name="expressinstall" value="Scripts/expressInstall.swf" />
                <!-- La siguiente etiqueta object es para navegadores distintos de IE. Ocúltela a IE mediante IECC. -->
                <!--[if !IE]>-->
                <object type="application/x-shockwave-flash" data="sis/animaciones/logo.swf" width="110" height="95">
                  <!--<![endif]-->
                  <param name="quality" value="high" />
                  <param name="wmode" value="transparent" />
                  <param name="swfversion" value="9.0.45.0" />
                  <param name="expressinstall" value="Scripts/expressInstall.swf" />
                  <!-- El navegador muestra el siguiente contenido alternativo para usuarios con Flash Player 6.0 o versiones anteriores. -->
                  <div>
                    <h4>El contenido de esta página requiere una versión más reciente de Adobe Flash Player.</h4>
                    <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Obtener Adobe Flash Player" width="112" height="33" /></a></p>
                  </div>
                  <!--[if !IE]>-->
                </object>
                <!--<![endif]-->
              </object>
            </div></td>
          </tr>
          <tr>
            <td height="415">&nbsp;</td>
          </tr>
        </table></td>
        <td width="631" background="sis/pictures/lih.png"><table width="631" height="481" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td height="50" ><table width="631" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="572"><p><?php
include ('_vti_txt/9ini.txt');
?></p></td>
                </tr>
              </table>
<table width="630" border="0" cellspacing="0" cellpadding="0">
  <tr>
                <td width="59"><a href="index.php"><img src="sis/pictures/barhome.png" alt="" width="59" height="46" /></a></td>
                <td width="125" background="sis/pictures/barc.png"><a href="canales.php"><img src="sis/pictures/botoncanales.png" width="125" height="46" /></a></td>
                <td width="125" background="sis/pictures/barc.png"><a href="cobertura.php"><img src="sis/pictures/botoncobertura.png" width="125" height="46" /></a></td>
                <td width="125" background="sis/pictures/barc.png"><a href="promociones.php"><img src="sis/pictures/botoncpromocion.png" width="125" height="46" /></a></td>
                <td width="125" background="sis/pictures/barc.png"><a href="contacto.php"><img src="sis/pictures/botoncontacto.png" width="125" height="46" /></a></td>
                <td width="60" background="sis/pictures/barc.png"><a href="email/"><img src="sis/pictures/botonemail.png" width="60" height="46" /></a></td>
                <td width="12" height="42" ><img src="sis/pictures/barfin.png" width="12" height="46" /></td>
              </tr>
            </table><br /></td>
          </tr>
          <tr>
            <td width="600" height="421" background="sis/pictures/contenido.png"><table width="600" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td width="600" height="44"><!-- InstanceBeginEditable name="EditRegion1" -->

<?php 
$Username = "test";
setcookie('Cookie', $Username); //linea 104.
?>

<!-- InstanceEndEditable --></td>
              </tr>
            </table></td>
            </tr>
        </table></td>
        <td width="179"  background="sis/pictures/izquierda.png"><table width="179" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td width="179" height="124"><div align="center"> <img src="sis/imagenes/logotipocanal29sinfondo.png" width="95" height="100" /></div></td>
          </tr>
          <tr>
            <td height="415">&nbsp;</td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td  height="89" bgcolor="#000e25"><table width="631" height="88" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td width="333" height="88" background="sis/pictures/panel1.png"><table width="314" height="59" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td width="173" height="59" class="font">Mantengase informado de las promociones de Universal Cable solo tienes que subcribirte!!!<br><br></td>
            <td width="141"><form id="subcri" name="subcri" method="post" action="registro.php">
              <label>
             <input name="emailsub" type="text" id="mailtop" onclick="document.forms.subcri.mailtop.value='', document.forms.subcri.submit.disabled=false"  maxlength="100" style="font-size:11px" value="Su Email..." />
              </label>
              <label>
                <input type="submit" name="submit" id="submit" value="Suscripcion" style="font-size:10px" disabled=true />
            </form></td>
          </tr>
        </table></td>
        <td background="sis/pictures/panel2.png" width="298"><?php
 include ('_vti_txt/9encuesta.txt');
        ?></td>
        </tr>
    </table>
      <table width="631" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td height="78"><div align="center"><a href="visionafondo/"><img src="sis/imagenes/visonafondo.png" width="300" height="60" /></a></div></td>
          <td><div align="center"></div></td>
        </tr>
      </table>
      <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p></td>
  </tr>
</table>
<script type="text/javascript">
<!--
swfobject.registerObject("FlashID");
//-->
</script>
</body>
<!-- InstanceEnd --></html>

--------------------------------------------------------------------------

Ayuda!!!!

TheOneProgrammer
Usuario Novato
Usuario Novato

los include son los siguientes:

9head.txt

<?
ob_start();
?>
<script type="text/javascript" language="javascript">
function popup(url) {
eval("page" +  " = window.open(url, '" +  "', \'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width =240,height=240\');");
}
</script>

9ini.txt

<marquee style="WIDTH: 630px; HEIGHT: 12px" scrollamount="3" scrolldelay="0" direction="LEFT" width="690" height="12">
<font size="-2"><strong>Entra y envia tus mensajes a VISION A FONDO. Promocion: Instalación Gratis.</strong>
</MARQUEE>

9encuesta.txt

<table width="280" height="70" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td width="148" height="70" rowspan="2" class="font">¿Representa el nuevo gobierno electo, un cambio para usted?<br><br><br>
</td>
            <td width="17" rowspan="2" class="font">&nbsp;</td>
            <td width="52"><form id="encuesta" name="encuesta" method="post" action="opinion.php">
          Si<br />
           No
</td>
            <td width="63"><input name="mivoto" type="radio" value="res1" checked />
              <br />
            <input name="mivoto" type="radio" value="res2"/></td>
          </tr>
          <tr>
            <td height="10" colspan="2">
                  <input type="submit" name="submit" id="submit" value="Enviar" />
            </form></td>
          </tr>
        </table>
  <?
ob_end_flush();
?>

--------------------------------------------------------------------------- ---------------

si notan e tratado hasta de poner el <? ob_start(); ?> & <? ob_end_flush(); ?> en los script php. primero y ultimo!!! y nada!!

donde esta setcookie.. y nada.. he tratado de muchas maneras en este servidor..!!!

--------------------------------------------------------------------------- --------------

php server 5.2.8

Language Optionsasp_tagsAllow ASP-style <% %> tags.Off
File Uploadsfile_uploadsWhether to allow HTTP file uploads.On
Paths and Directoriesinclude_pathWindows: "\path1;\path2" c:\php\includes".:/usr/lib/php:/usr/local/lib/php
Resource Limitsmax_execution_timeMaximum execution time of each script, in seconds30
Resource Limitsmax_input_timeMaximum amount of time each script may spend parsing request data60
Resource Limitsmemory_limitMaximum amount of memory a script may consume (32MB)32M
Data Handlingregister_globalsYou should do your best to write your scripts so that they do not require register_globals to be on; Using form variables as globals can easily lead to possible security problems, if the code is not very well thought of.Off
Language Optionssafe_modeOff
mainsession.save_pathwhere N is an integer. Instead of storing all the session files in /path, what this will do is use subdirectories N-levels deep, and store the session data in those directories. This is useful if you or your OS have problems with lots of files in one directory, and is a more efficient layout for servers that handle lots of sessions. NOTE 1: PHP will not create this directory structure automatically. You can use the script in the ext/session dir for that purpose. NOTE 2: See the section on garbage collection below if you choose to use subdirectories for session storageN;/path
File Uploadsupload_max_filesizeMaximum allowed size for uploaded files.2M
mainzend_optimizer.version3.3.3

--------------------------------------------------------------------------- -------------------------------------------

ayuda!!! porfavor!!!

Avatar Image
@man / @woman
@man / @woman

Dependiendo de su ejecución, ob_start() y ob_end_flush() devuelven un bool, carga este retorno en una variable y visualiza un mensaje para testear (y asegurarte) que se están ejecutando correcteamente.

Luego decide en consecuencia.

ATENCIÓN: Este tema no tiene actividad desde hace más de 6 MESES,
te recomendamos abrir un nuevo tema en lugar de responder al actual
Opciones:
Ir al subforo:
Permisos:
TU NO PUEDES Escribir nuevos temas
TU NO PUEDES Responder a los temas
TU NO PUEDES Editar tus propios mensajes
TU NO PUEDES Borrar tus propios mensajes
Temas similares
TemaUsuariosRespuestasVisitasActividad
Por: , el 24/Nov/2016, 00:09
danitarnnn GestionXls12kDec/16
Por: , el 20/Jun/2004, 23:54
flipacadiz NoSetup.org53kJun/04
Por: , el 23/Ago/2008, 05:46
GAmEOvEr_26CPC NoSetup.org User 356600132kAug/08