Foros del Web » Programando para Internet » PHP »

problema con la redireccion al hacer login

Estas en el tema de problema con la redireccion al hacer login en el foro de PHP en Foros del Web. Hola , tengo un problema , cuando hago el login, me gustaría comentar que se redirecciona tal cual lo pongo http://img75.xooimage.com/files/6/7/d/imagenes123-2da51e4.png Pero no se abre ...
  #1 (permalink)  
Antiguo 11/10/2011, 09:50
 
Fecha de Ingreso: octubre-2011
Mensajes: 129
Antigüedad: 12 años, 6 meses
Puntos: 1
problema con la redireccion al hacer login

Hola , tengo un problema , cuando hago el login, me gustaría comentar que se redirecciona tal cual lo pongo

http://img75.xooimage.com/files/6/7/d/imagenes123-2da51e4.png

Pero no se abre el index.php del usuario que hace sesión

if (isset($_POST['email1'])) {
$loginUsername=$_POST['email1'];
$password=$_POST['password1'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = ".users/$alias/index.php";
$MM_redirectLoginFailed = "redireccionar.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_localhost, $localhost);
  #2 (permalink)  
Antiguo 11/10/2011, 10:17
 
Fecha de Ingreso: febrero-2010
Mensajes: 818
Antigüedad: 14 años, 2 meses
Puntos: 55
Respuesta: problema con la redireccion al hacer login

tienes mal la url
  #3 (permalink)  
Antiguo 11/10/2011, 10:30
 
Fecha de Ingreso: octubre-2011
Mensajes: 129
Antigüedad: 12 años, 6 meses
Puntos: 1
Respuesta: problema con la redireccion al hacer login

pero si cada usuario tiene un $alias con su nombre de usuario y un index.php

se tendira que abir no?
  #4 (permalink)  
Antiguo 11/10/2011, 10:34
 
Fecha de Ingreso: diciembre-2010
Mensajes: 788
Antigüedad: 13 años, 4 meses
Puntos: 51
Respuesta: problema con la redireccion al hacer login

El punto con el que comienza la url esta demas, trata siempre de usar url absolutas para evitar problemas.
  #5 (permalink)  
Antiguo 11/10/2011, 10:47
 
Fecha de Ingreso: octubre-2011
Mensajes: 129
Antigüedad: 12 años, 6 meses
Puntos: 1
Respuesta: problema con la redireccion al hacer login

Haber la redirección es a una carpeta, creada a traves de codigo php con un $alias que se guarda a la bd y tonces quiero redireccionar a esa carpeta cada vez que inicie sesión, cada uno con su carpeta correespondiente a su directorio personal que se crea ala vez que esto

<?php require_once('../Connections/localhost.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;
}
}
?>
<?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['email1'])) {
$loginUsername=$_POST['email1'];
$password=$_POST['password1'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "/users/$alias/index.php/";
$MM_redirectLoginFailed = "redireccionar.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_localhost, $localhost);

$LoginRS__query=sprintf("SELECT email1, password1 FROM web WHERE email1=%s AND password1=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));

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

if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
//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 );
}
}
?>

Etiquetas: login, mysql, 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 13:45.