Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/05/2015, 00:03
GerardoWolfheart
 
Fecha de Ingreso: mayo-2015
Mensajes: 1
Antigüedad: 8 años, 10 meses
Puntos: 0
Exclamación Redireccionar usuario por nivel PHP & Dreamweaver

¡Hola!
Estoy haciendo un login de inicio de sesión PHP y Dreamweaver, pero no se como redireccionar a un usuario a paginas diferentes por nivel, he intentado varias cosas y hacer un if, pero sale error, y DW solo me da la opción de redireccionar a una sola página.
aquí el código, ¡Gracias!

<?php require_once('Connections/soccer.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['rut'])) {
$loginUsername=$_POST['rut'];
$password=$_POST['password'];
$MM_fldUserAuthorization = "Rol";
$MM_redirectLoginSuccess = "user/indexuser.php";
$MM_redirectLoginFailed = "user/error.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_soccer, $soccer);


$LoginRS__query=sprintf("SELECT rut, password, Rol FROM persons WHERE rut=%s AND password=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));

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

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

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