Ver Mensaje Individual
  #1 (permalink)  
Antiguo 29/07/2008, 08:28
RJD
 
Fecha de Ingreso: enero-2006
Mensajes: 64
Antigüedad: 18 años, 3 meses
Puntos: 0
Exclamación Error con sesiones

Buenas, me estoy volviendo loco...... Tengo el siguiente script para loguear a los usuarios de mi web y me da el error que enmarco al final del post. Este es el script:

Código HTML:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>MI WEB</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head><body>
<div class="fondo">
<div class="logotipo"><img src="images/top.jpg" width="600" height="300" /></div>
<div class="publicidad"><img src="images/publi-top.jpg" width="300" height="15" />
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','299','height','144','src','publi/7','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','publi/CU07' ); //end AC code
</script><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="299" height="144">
      <param name="movie" value="publi/7.swf" />
      <param name="quality" value="high" />
      <embed src="publi/7.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="299" height="144"></embed>
    </object>
</div>
<div class="menu">
<ul id="menu">
		<li><a href="/index.php" target="_self"><span class="inicio">INICIO</span></a></li>
		</li>
</ul>
</div>
<div class="login Estilo1"><strong>LOGIN USUARIOS </strong><br>
<? 
if (isset($_SESSION['s_username'])) {
echo "Bienvenido a mi sitio has ingresado como ".$_SESSION['s_username'].", gracias por la visita!";
}else{
if (!$HTTP_POST_VARS){ 
?> 
 <FORM ACTION="" target="_self" METHOD="post" name="login" enctype="multipart/form-data">
  <table width="100%" border="0" cellspacing="0" cellpadding="2">
    <tr>
      <td width="30%">NICK:</td>
      <td width="70%"><label>
        <input name="nick" type="text" id="nick" size="15">
      </label></td>
    </tr>
    <tr>
      <td>PASSWORD:</td>
      <td><label>
        <input type="password" name="password" id="password">
      </label></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><input name="enviar" type="submit" style="BORDER: rgb(128,128,128) 1px solid; FONT-SIZE: 8pt; FONT-FAMILY: Verdana; BACKGROUND-COLOR: rgb(233,233,233);" value="LOGIN"></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><span class="Estilo1"><strong><a href="/registro.php">NUEVO USUARIO</a></strong></span></td>
    </tr>
  </table>
  </FORM>
<? 
}else{ 
session_start();
include("config.php");
         if ($_POST['nick']) {
//Comprobacion del envio del nombre de usuario y password
$username=$_POST['nick'];
$password=$_POST['password'];
if ($password==NULL) {
echo "Error en la contraseña";
}else{
$query = mysql_query("SELECT nick,password FROM usuarios WHERE nick = '$username'") or die(mysql_error());
$data = mysql_fetch_array($query);
if($data['password'] != $password) {
echo "Login incorrecto";
}else{
$query = mysql_query("SELECT nick,password FROM usuarios WHERE nick = '$username'") or die(mysql_error());
$row = mysql_fetch_array($query);
$_SESSION["s_username"] = $row['username'];
echo "Has sido logueado correctamente ".$_SESSION['s_username']." y puedes acceder al index.php.";
}
}
}
}		 
}
?></div>
</div>
</body></html> 


y la cosa es que me da el siguiente error:
Cita:
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/blabla/www/head.php:10) in /home/blabla/www/head.php on line 64
Y por tanto no crea la sesion de los usuarios

Cómo puedo arreglarlo? llevo mas de una semana con el mismo error y no consigo solucionarlo


GRACIAS MIL