Foros del Web » Programando para Internet » PHP »

problema php

Estas en el tema de problema php en el foro de PHP en Foros del Web. Estoy haciendo una pagina php con dreamweaver, he puesto fondo imagenes..., estoy conectado al servidor mediante ftp y a mysql(me ofrece la base de datos ...
  #1 (permalink)  
Antiguo 02/03/2008, 02:25
 
Fecha de Ingreso: febrero-2008
Mensajes: 14
Antigüedad: 16 años, 2 meses
Puntos: 0
problema php

Estoy haciendo una pagina php con dreamweaver, he puesto fondo imagenes...,
estoy conectado al servidor mediante ftp y a mysql(me ofrece la base de datos el servidor) y ahora estoy haciendo lo de autentificacion de usuarios, conectar usuario, creo los campos de texto, el boton... y luego al colgar la pagina salen estos errores:


Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/webcindario/c/d/cdin/index.php:1) in /home/webcindario/c/d/cdin/index.php on line 10

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/webcindario/c/d/cdin/index.php:1) in /home/webcindario/c/d/cdin/index.php on line 1701601536
  #2 (permalink)  
Antiguo 02/03/2008, 05:06
Avatar de jaronu  
Fecha de Ingreso: febrero-2008
Mensajes: 2.183
Antigüedad: 16 años, 2 meses
Puntos: 52
Re: problema php

muestra el codigo completo, a si no se puede ver el fallo,

pero suena aque abres dos sesiones o algo asi
una sesion en la linea 10 y otra en la 1701601536, esta ultima linea es de codigi?
me parecen exageradas,
conoces las funcione require_once(""); e include
para no hacer codigos muy largos, o a lo mejor hau mas html de lo que parece.

muestra algo de codigo, asi es como llevar al medico un paciente invisible.
  #3 (permalink)  
Antiguo 02/03/2008, 05:40
 
Fecha de Ingreso: febrero-2008
Mensajes: 14
Antigüedad: 16 años, 2 meses
Puntos: 0
Re: problema php

<?php virtual('/Connections/bd.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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;
}
}
?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
}

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset($_POST['nombre'])) {
$loginUsername=$_POST['nombre'];
$password=$_POST['contraseña'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "/admin2.php";
$MM_redirectLoginFailed = "/error.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_bd, $bd);

$LoginRS__query=sprintf("SELECT Nombre, Contraseña FROM administrador WHERE Nombre=%s AND Contraseña=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));

$LoginRS = mysql_query($LoginRS__query, $bd) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";

//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;

if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>naruto kage</title>
<style type="text/css">
<!--
.Estilo1 {
font-family: "Ninja Naruto";
border-top-style: outset;
border-right-style: outset;
border-bottom-style: outset;
border-left-style: outset;
color: #000000;
border-top-color: #000000;
border-right-color: #000000;
border-bottom-color: #000000;
border-left-color: #000000;
background-color: #FF6600;
}
.ESTILO2 {
font-family: "Ninja Naruto";
font-size: 12px;
font-style: normal;
font-weight: normal;
color: #FF0000;
text-decoration: none;
background-color: #000000;
border: 1px outset #000000;
}
.Estilo3 {font-size: 9px}
body {
background-image: url();
background-color: #999999;
}
.Estilo4 {
font-family: "Ninja Naruto";
font-size: 36px;
color: #990000;
background-color: #000000;
}
-->
</style>
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>

<body>
<table width="758" height="147" border="0" cellpadding="3">
<tr>
<td width="748" height="132"><p><img src="/portada01copiaeu9.jpg" width="748" height="150" /></p>
<hr />
<p>&nbsp;</p>
<p align="center"><span class="Estilo4">naruto kage</span></p></td>
</tr>
</table>
<table width="759" height="295" border="0" cellpadding="3" class="Estilo1">
<tr>
<td width="566" rowspan="5"><div align="center">
<p>:: inauguracion de la pagina</p>
</div>
<p>HOY DIA 29 de febrero EMPIEZA A FUNCIONAR LA PAGINA NARUTO KAGE</p>
<p align="center">servidor de prueba</p>
<p align="center">&nbsp;</p>
<p align="center">por edueduppp</p>
<p align="center">hay problemas con la conexion de la base de datos, por ahora nadie podra iniciar sesion</p></td>
<td width="175" height="37" class="Estilo1"><script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0','width','105','height ','23','src','button3','quality','high','pluginspa ge','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','bgco lor','','movie','button3' ); //end AC code
</script>
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="105" height="23">
<param name="BGCOLOR" value="" />
<param name="movie" value="button3.swf" />
<param name="quality" value="high" />
<embed src="button3.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="105" height="23" ></embed>
</object>
</noscript></td>
</tr>
<tr>
<td class="Estilo1"><script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0','width','105','height ','23','src','button4','quality','high','pluginspa ge','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','bgco lor','#000000','movie','button4' ); //end AC code
</script>
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="105" height="23">
<param name="movie" value="button4.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#000000" />
<embed src="button4.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="105" height="23" bgcolor="#000000"></embed>
</object>
</noscript></td>
</tr>
<tr>
<td class="Estilo1"><script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0','width','105','height ','23','src','button2','quality','high','pluginspa ge','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','bgco lor','','movie','button2' ); //end AC code
</script>
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="105" height="23">
<param name="BGCOLOR" value="" />
<param name="movie" value="button2.swf" />
<param name="quality" value="high" />
<embed src="button2.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="105" height="23" ></embed>
</object>
</noscript></td>
</tr>
<tr>
<td height="44" class="Estilo1"><script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0','width','105','height ','23','src','button1','quality','high','pluginspa ge','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','bgco lor','#000000','movie','button1' ); //end AC code
</script>
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="105" height="23">
<param name="movie" value="button1.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#000000" />
<embed src="button1.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="105" height="23" bgcolor="#000000"></embed>
</object>
</noscript></td>
</tr>
<tr>
<td class="Estilo1"><form action="<?php echo $loginFormAction; ?>" id="form1" name="form1" method="POST">
<label>
<input type="text" name="nombre" id="nombre" />
</label>
<p>
<label>
<input type="password" name="contraseña" id="contraseña" />
</label>
</p>
<p>
<label>
<input type="submit" name="login" id="login" value="Enviar" />
</label>
<span class="Estilo3">REGISTRARSE</span> </p>
</form></td>
</tr>
</table>
</body>
</html>

ese es el codigo
  #4 (permalink)  
Antiguo 02/03/2008, 05:53
Avatar de jaronu  
Fecha de Ingreso: febrero-2008
Mensajes: 2.183
Antigüedad: 16 años, 2 meses
Puntos: 52
Re: problema php

a si por encima, en la linea siguiente quitale la sesion y la colocas al principio del codigo


if (!isset($_SESSION)) {
session_start();
}

dejalo asi:





<?php virtual('/Connections/bd.php');
session_start();
?>


y si tienes mas sesion_start(); los quitas y dejas solo el de la cabecera como te he puesto y a ver ahora que error te arroja al colgar la pagina, borra tambien los archivos temporeles de internet cuando subas de nuevo la pagina antes de cargarla de nuevo
  #5 (permalink)  
Antiguo 02/03/2008, 05:59
Avatar de jaronu  
Fecha de Ingreso: febrero-2008
Mensajes: 2.183
Antigüedad: 16 años, 2 meses
Puntos: 52
Re: problema php

de todas formas yo utiliza este if para la sesion:

if (isset($_SESSION['k_username']))
{
echo 'Hola, ';
echo '<b>'.$_SESSION['k_username']. '</b>.';
?>

con tu if no le inquicas quien es el que ocupa la variable de sesion
con este si
  #6 (permalink)  
Antiguo 02/03/2008, 06:34
Avatar de jaronu  
Fecha de Ingreso: febrero-2008
Mensajes: 2.183
Antigüedad: 16 años, 2 meses
Puntos: 52
Re: problema php

mira, yo uso este sistema de autentificacion de user, puedes adaptarlo a tu pagina, este codigo en mi pagina va bien:



Código PHP:
<?

//datos para establecer la conexion con la base de mysql.
mysql_connect('localhost','user','9999')or die ('Ha fallado la conexión: '.mysql_error());
mysql_select_db('registro')or die ('Error al seleccionar la Base de Datos: '.mysql_error());

function 
quitar($mensaje)
{
    
$nopermitidos = array("'",'\\','<','>',"\"");
    
$mensaje str_replace($nopermitidos""$mensaje);
    return 
$mensaje;
}
if(
trim($HTTP_POST_VARS["usuario"]) != "" && trim($HTTP_POST_VARS["password"]) != "")
{
    
// Puedes utilizar la funcion para eliminar algun caracter en especifico
    //$usuario = strtolower(quitar($HTTP_POST_VARS["usuario"]));
    //$password = $HTTP_POST_VARS["password"];
    // o puedes convertir los a su entidad HTML aplicable con htmlentities
    
$usuario strtolower(htmlentities($HTTP_POST_VARS["usuario"], ENT_QUOTES));
    
$password $HTTP_POST_VARS["password"];
    
$result mysql_query('SELECT password, usuario FROM usuarios WHERE usuario=\''.$usuario.'\'');
    if(
$row mysql_fetch_array($result)){
        if(
$row["password"] == $password){
            
$_SESSION["k_username"] = $row['usuario']; //esta es mi variable de sesion para su posterior seguimiento
            
echo 'Has entrado correctamente '.$_SESSION['k_username'].' <p>';
            echo 
'<a href="principal2.php">Miembros</a></p>';
            
//con el siguiente comentario si quieres que re-dirigir automáticamente a index.php o donde quieras
            
        
        
?>
            <SCRIPT LANGUAGE="javascript">
            location.href = "principal2.php";
            </SCRIPT>
            <?
        
        
}else{
            echo 
'<span class="Estilo5">Password incorrecto</span>';
        }
    }else{
        echo 
'<span class="Estilo5">Usuario no existente</span>';
    }
    }
    
mysql_close();

?>
  #7 (permalink)  
Antiguo 02/03/2008, 09:37
 
Fecha de Ingreso: febrero-2008
Mensajes: 14
Antigüedad: 16 años, 2 meses
Puntos: 0
Re: problema php

he probado con los codigo y no me funcionan
  #8 (permalink)  
Antiguo 02/03/2008, 09:45
Avatar de jaronu  
Fecha de Ingreso: febrero-2008
Mensajes: 2.183
Antigüedad: 16 años, 2 meses
Puntos: 52
Re: problema php

has cambiado de sitio

session_star ()

y si la has cambiado, que error te arroja?


ah! y mi codigo de autentificacion esta en uso, puede ser problema de tus variables

dime el error despues de cambiar de sitio session_start
  #9 (permalink)  
Antiguo 02/03/2008, 09:52
Avatar de jaronu  
Fecha de Ingreso: febrero-2008
Mensajes: 2.183
Antigüedad: 16 años, 2 meses
Puntos: 52
Re: problema php

prueba asi:


Código PHP:
<?php 

virtual
('/Connections/bd.php');

session_start();

if (!
function_exists("GetSQLValueString")) {
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
$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;
}
}
?>
<?php
// *** Validate request to login to this site.




$loginFormAction $_SERVER['PHP_SELF'];
if (isset(
$_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset(
$_POST['nombre'])) {
$loginUsername=$_POST['nombre'];
$password=$_POST['contraseña'];
$MM_fldUserAuthorization "";
$MM_redirectLoginSuccess "/admin2.php";
$MM_redirectLoginFailed "/error.php";
$MM_redirecttoReferrer false;
mysql_select_db($database_bd$bd);

$LoginRS__query=sprintf("SELECT Nombre, Contraseña FROM administrador WHERE Nombre=%s AND Contraseña=%s",
GetSQLValueString($loginUsername"text"), GetSQLValueString($password"text")); 

$LoginRS mysql_query($LoginRS__query$bd) or die(mysql_error());
$loginFoundUser mysql_num_rows($LoginRS);
if (
$loginFoundUser) {
$loginStrGroup "";

//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup

if (isset(
$_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess $_SESSION['PrevUrl']; 
}
header("Location: " $MM_redirectLoginSuccess );
}
else {
header("Location: "$MM_redirectLoginFailed );
}
}
?>
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>naruto kage</title>
<style type="text/css">
<!--
.Estilo1 {
font-family: "Ninja Naruto";
border-top-style: outset;
border-right-style: outset;
border-bottom-style: outset;
border-left-style: outset;
color: #000000;
border-top-color: #000000;
border-right-color: #000000;
border-bottom-color: #000000;
border-left-color: #000000;
background-color: #FF6600;
}
.ESTILO2 {
font-family: "Ninja Naruto";
font-size: 12px;
font-style: normal;
font-weight: normal;
color: #FF0000;
text-decoration: none;
background-color: #000000;
border: 1px outset #000000;
}
.Estilo3 {font-size: 9px}
body {
background-image: url();
background-color: #999999;
}
.Estilo4 {
font-family: "Ninja Naruto";
font-size: 36px;
color: #990000;
background-color: #000000;
}
-->
</style>
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>

<body>
<table width="758" height="147" border="0" cellpadding="3">
<tr>
<td width="748" height="132"><p><img src="/portada01copiaeu9.jpg" width="748" height="150" /></p>
<hr />
<p>&nbsp;</p>
<p align="center"><span class="Estilo4">naruto kage</span></p></td>
</tr>
</table>
<table width="759" height="295" border="0" cellpadding="3" class="Estilo1">
<tr>
<td width="566" rowspan="5"><div align="center">
<p>:: inauguracion de la pagina</p>
</div>
<p>HOY DIA 29 de febrero EMPIEZA A FUNCIONAR LA PAGINA NARUTO KAGE</p>
<p align="center">servidor de prueba</p>
<p align="center">&nbsp;</p>
<p align="center">por edueduppp</p>
<p align="center">hay problemas con la conexion de la base de datos, por ahora nadie podra iniciar sesion</p></td>
<td width="175" height="37" class="Estilo1"><script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0','width','105','height ','23','src','button3','quality','high','pluginspa ge','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','bgco lor','','movie','button3' ); //end AC code
</script>
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="105" height="23">
<param name="BGCOLOR" value="" />
<param name="movie" value="button3.swf" />
<param name="quality" value="high" />
<embed src="button3.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="105" height="23" ></embed>
</object>
</noscript></td>
</tr>
<tr>
<td class="Estilo1"><script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0','width','105','height ','23','src','button4','quality','high','pluginspa ge','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','bgco lor','#000000','movie','button4' ); //end AC code
</script>
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="105" height="23">
<param name="movie" value="button4.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#000000" />
<embed src="button4.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="105" height="23" bgcolor="#000000"></embed>
</object>
</noscript></td>
</tr>
<tr>
<td class="Estilo1"><script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0','width','105','height ','23','src','button2','quality','high','pluginspa ge','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','bgco lor','','movie','button2' ); //end AC code
</script>
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="105" height="23">
<param name="BGCOLOR" value="" />
<param name="movie" value="button2.swf" />
<param name="quality" value="high" />
<embed src="button2.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="105" height="23" ></embed>
</object>
</noscript></td>
</tr>
<tr>
<td height="44" class="Estilo1"><script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0','width','105','height ','23','src','button1','quality','high','pluginspa ge','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','bgco lor','#000000','movie','button1' ); //end AC code
</script>
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="105" height="23">
<param name="movie" value="button1.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#000000" />
<embed src="button1.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="105" height="23" bgcolor="#000000"></embed>
</object>
</noscript></td>
</tr>
<tr>
<td class="Estilo1"><form action="<?php echo $loginFormAction?>" id="form1" name="form1" method="POST">
<label>
<input type="text" name="nombre" id="nombre" />
</label>
<p>
<label>
<input type="password" name="contraseña" id="contraseña" />
</label>
</p>
<p>
<label>
<input type="submit" name="login" id="login" value="Enviar" />
</label>
<span class="Estilo3">REGISTRARSE</span> </p>
</form></td>
</tr>
</table>
</body>
</html>
  #10 (permalink)  
Antiguo 02/03/2008, 09:57
Avatar de jaronu  
Fecha de Ingreso: febrero-2008
Mensajes: 2.183
Antigüedad: 16 años, 2 meses
Puntos: 52
Re: problema php

yo uso este codigo de autentificacion y es mas sencillo que el tuyo:

Código PHP:
<?php
 
require_once("bookmark_fns.php");
session_start();




//datos para establecer la conexion con la base de mysql.
mysql_connect('localhost','user','9999')or die ('Ha fallado la conexión: '.mysql_error());
mysql_select_db('registro')or die ('Error al seleccionar la Base de Datos: '.mysql_error());

function 
quitar($mensaje)
{
    
$nopermitidos = array("'",'\\','<','>',"\"");
    
$mensaje str_replace($nopermitidos""$mensaje);
    return 
$mensaje;
}
if(
trim($HTTP_POST_VARS["usuario"]) != "" && trim($HTTP_POST_VARS["password"]) != "")
{
    
// Puedes utilizar la funcion para eliminar algun caracter en especifico
    //$usuario = strtolower(quitar($HTTP_POST_VARS["usuario"]));
    //$password = $HTTP_POST_VARS["password"];
    // o puedes convertir los a su entidad HTML aplicable con htmlentities
    
$usuario strtolower(htmlentities($HTTP_POST_VARS["usuario"], ENT_QUOTES));
    
$password $HTTP_POST_VARS["password"];
    
$result mysql_query('SELECT password, usuario FROM usuarios WHERE usuario=\''.$usuario.'\'');
    if(
$row mysql_fetch_array($result)){
        if(
$row["password"] == $password){
            
$_SESSION["k_username"] = $row['usuario']; //esta es mi variable de sesion para su posterior seguimiento
            
echo 'Has entrado correctamente '.$_SESSION['k_username'].' <p>';
            echo 
'<a href="principal2.php">Miembros</a></p>';
            
//con el siguiente javaScript rediriges automáticamente a index.php o donde quieras
            
        
        
?>
            <SCRIPT LANGUAGE="javascript">
            location.href = "principal2.php";
            </SCRIPT>
            <?
        
        
}else{
            echo 
'<span class="Estilo5">Password incorrecto</span>';
        }
    }else{
        echo 
'<span class="Estilo5">Usuario no existente</span>';
    }
    }
    
mysql_close();

?>
  #11 (permalink)  
Antiguo 02/03/2008, 12:29
 
Fecha de Ingreso: febrero-2008
Mensajes: 14
Antigüedad: 16 años, 2 meses
Puntos: 0
Re: problema php

lo siento me sigue saliendo el error:

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/webcindario/c/d/cdin/index.php:1) in /home/webcindario/c/d/cdin/index.php on line 10

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/webcindario/c/d/cdin/index.php:1) in /home/webcindario/c/d/cdin/index.php on line 1701601536

lo unico q ahora me salen 2 concectar usuario y 8 show region(@@auth@@)
en comportamientos del servidor

Última edición por edueduppp; 02/03/2008 a las 12:54
  #12 (permalink)  
Antiguo 02/03/2008, 13:42
Avatar de jaronu  
Fecha de Ingreso: febrero-2008
Mensajes: 2.183
Antigüedad: 16 años, 2 meses
Puntos: 52
Re: problema php

cual es la linea 10
Y la linea : line 1701601536 sobre todo cual es esta


y session_start creo que ha de ir lo primero del codigo
  #13 (permalink)  
Antiguo 02/03/2008, 14:45
 
Fecha de Ingreso: febrero-2008
Mensajes: 14
Antigüedad: 16 años, 2 meses
Puntos: 0
Re: problema php

no existe la linea 1701601536
  #14 (permalink)  
Antiguo 02/03/2008, 14:52
Avatar de jaronu  
Fecha de Ingreso: febrero-2008
Mensajes: 2.183
Antigüedad: 16 años, 2 meses
Puntos: 52
Re: problema php

creo que haces referencia en tu codigo a la "magic cuotes" es esa la linea del error la numero 10
  #15 (permalink)  
Antiguo 13/03/2008, 10:31
 
Fecha de Ingreso: febrero-2008
Mensajes: 14
Antigüedad: 16 años, 2 meses
Puntos: 0
Re: problema php

parece ser q es cosa del servidor, sin embargo le he metido drupal y en la instalacion sale el siguiente error
register_globals is enabled. Drupal requires this configuration directive to be disabled. Your site may not be secure when register_globals is enabled. The PHP manual has instructions for how to change configuration settings. (Currently using PHP register globals Enabled ('1'))
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 16:17.