Foros del Web » Programando para Internet » PHP »

Dreamweaver Cs y conectar usuarios

Estas en el tema de Dreamweaver Cs y conectar usuarios en el foro de PHP en Foros del Web. Hola!, gracias de antemano por la ayuda. Vereis estoy realizando con wamp una página para validar usuarios mediante el comportamiento de servidor "conectar a usuario". ...
  #1 (permalink)  
Antiguo 25/01/2010, 19:32
 
Fecha de Ingreso: diciembre-2007
Mensajes: 18
Antigüedad: 16 años, 3 meses
Puntos: 0
Dreamweaver Cs y conectar usuarios

Hola!, gracias de antemano por la ayuda.

Vereis estoy realizando con wamp una página para validar usuarios mediante el comportamiento de servidor "conectar a usuario". Aunque lo implemento bien cuando ejecuto me sale el siguiente error en la pagina:

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\wamp\www\Blog2\base_login.php:1) in C:\wamp\www\Blog2\base_login.php on line 0

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\wamp\www\Blog2\base_login.php:1) in C:\wamp\www\Blog2\base_login.php on line 0

El codigo de la página es:

<?php virtual('/Blog2/Connections/blog_con.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;
}
}

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['usuario_frm'])) {
$loginUsername=$_POST['usuario_frm'];
$password=$_POST['pass_frm'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "/Blog2/ok_pass.php";
$MM_redirectLoginFailed = "/Blog2/error_pass.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_blog_con, $blog_con);

$LoginRS__query=sprintf("SELECT usuario, password FROM usuarios WHERE usuario=%s AND password=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));

$LoginRS = mysql_query($LoginRS__query, $blog_con) 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 );
}
}
?>

¿Podríais ayudarme?, no tengo mucha experiencia y empiezo a desesperarme.

Gracias
  #2 (permalink)  
Antiguo 25/01/2010, 19:53
 
Fecha de Ingreso: abril-2005
Ubicación: Ciudad de México
Mensajes: 50
Antigüedad: 19 años
Puntos: 2
Respuesta: Dreamweaver Cs y conectar usuarios

Ok, Antes de crear los header no estas imprimiendo nada no hay un echo por ahi?
Si imprimes algo antes de llamar un header te va a mandar este error debido a que los header se envian desde el inicio de la peticion. Lo puedes solucionar llamando al inicio de tu archivo ob_start();

Saludos

Etiquetas: dreamweaver, usuarios
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 15:39.