Foros del Web » Programando para Internet » PHP »

$MM_redirectLoginSuccess

Estas en el tema de $MM_redirectLoginSuccess en el foro de PHP en Foros del Web. buenas, lo que quiero hacer es que $MM_redirectLoginSuccess en cambio de llevarme a una url en concreto, quiero que me lleve a la web que ...
  #1 (permalink)  
Antiguo 11/06/2009, 01:53
 
Fecha de Ingreso: agosto-2006
Mensajes: 26
Antigüedad: 17 años, 8 meses
Puntos: 0
$MM_redirectLoginSuccess

buenas, lo que quiero hacer es que $MM_redirectLoginSuccess en cambio de llevarme a una url en concreto, quiero que me lleve a la web que le corresponde al user y pass que tengo en la basedatos.
La base de datos tiene los siguientes campos user_id, user, pass, nivel, web, modificando un poco el código de dreamweaver en $MM_redirectLoginSuccess ="user3.php"; le he dicho.... .$row_registros00['web']; dónde registros00 (es un juego de registros que he hecho), el problema está en que al validar cualquier user con su pass, me lleva a la URL primera en la columna web, no se como hacer que al pasar el user y pass lleve consigo el id que le haga ir a su url correspondiente.
Muchas gracias

salu2

<?php require_once('../Connections/arq_web.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;
}
}

mysql_select_db($database_arq_web, $arq_web);
$query_registros00 = "SELECT * FROM aweb";
$registros00 = mysql_query($query_registros00, $arq_web) or die(mysql_error());
$row_registros00 = mysql_fetch_assoc($registros00);
$totalRows_registros00 = mysql_num_rows($registros00);
?>
<?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'])) {
$loginUsername=$_POST['usuario'];
$password=$_POST['contrase'];
$MM_fldUserAuthorization = "nivel";
$MM_redirectLoginSuccess = $row_registros00['web'];
$MM_redirectLoginFailed = "fal_user00.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_arq_web, $arq_web);

$LoginRS__query=sprintf("SELECT `user`, pass, nivel, web FROM aweb WHERE `user`=%s AND pass=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));

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

$loginStrGroup = mysql_result($LoginRS,0,'nivel');

//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 );
}
}
?>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
</head>

<body>
<form id="form1" name="form1" method="POST" action="<?php echo $loginFormAction; ?>">
<p>
<label>ARQuser
<input type="text" name="usuario" id="usuario" />
</label>
</p>
<p>
<label>ARQpass
<input type="text" name="contrase" id="contrase" />
</label>
</p>
<p>
<label>
<input type="submit" name="button" id="button" value="login" />
</label>
</p>
</form>
</body>
</html>
<?php
mysql_free_result($registros00);
?>
  #2 (permalink)  
Antiguo 12/09/2009, 14:26
Avatar de mortiprogramador
Colaborador
 
Fecha de Ingreso: septiembre-2009
Ubicación: mortuoria
Mensajes: 3.805
Antigüedad: 14 años, 8 meses
Puntos: 214
Respuesta: $MM_redirectLoginSuccess

Hola
Creo que estal mal tu if
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}//aqui te sobra esto no?
else {
header("Location: ". $MM_redirectLoginFailed );
}
Bueno, prueba y cuentas
Saludos
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 12:18.