Ver Mensaje Individual
  #10 (permalink)  
Antiguo 10/03/2013, 13:17
servidoresmc
 
Fecha de Ingreso: febrero-2013
Mensajes: 34
Antigüedad: 11 años, 1 mes
Puntos: 1
De acuerdo Respuesta: Panel de administracion para el usuario

En este codigo es donde ingresa el usuario:
Código:
<?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['Email'])) {
  $loginUsername=$_POST['Email'];
  $password=$_POST['Password'];
  $MM_fldUserAuthorization = "";
  $MM_redirectLoginSuccess = "client_area.php";
  $MM_redirectLoginFailed = "alta_usuario.php";
  $MM_redirecttoReferrer = false;
  mysql_select_db($database_Hostings, $Hostings);
  
  $LoginRS__query=sprintf("SELECT Email, Password FROM tblusuario WHERE Email=%s AND Password=%s",
    GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text")); 
   
  $LoginRS = mysql_query($LoginRS__query, $Hostings) 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 );
  }
}
?>

En el siguiente codigo pongo el panel de administracion del usuario, por ahora solo quiero que muestre sus datos personales que ya ingreso en el area de registro el usuario:
Código:
{
  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_Hostings, $Hostings);
$query_Datos = ('SELECT * FROM tblusuario WHERE tblusuario.Email = "'.$_SESSION['Email'].'"');
$Datos = mysql_query($query_Datos, $Hostings) or die(mysql_error());
$row_Datos = mysql_fetch_assoc($Datos);
$totalRows_Datos = mysql_num_rows($Datos);
 if (!isset($_SESSION)) {
  session_start();
}
?>
Y finalmente por si se ocupa dejo en donde el usuario se registra por primera vez:

Código:
<?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;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  $insertSQL = sprintf("INSERT INTO tblusuario (strNombre, strApellido, Empresa, Email, Password, rePassword, Pais, Estado) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
                       GetSQLValueString($_POST['strNombre'], "text"),
                       GetSQLValueString($_POST['strApellido'], "text"),
                       GetSQLValueString($_POST['Empresa'], "text"),
                       GetSQLValueString($_POST['Email'], "text"),
                       GetSQLValueString($_POST['Password'], "text"),
                       GetSQLValueString($_POST['rePassword'], "text"),
                       GetSQLValueString($_POST['Pais'], "text"),
                       GetSQLValueString($_POST['Estado'], "text"));

  mysql_select_db($database_Hostings, $Hostings);
  $Result1 = mysql_query($insertSQL, $Hostings) or die(mysql_error());

  $insertGoTo = "index.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}
?>

Espero me de a entender y me puedan ayudar. Gracias por sus anteriores respuestas, me han sido de utilidad.
__________________
¿Hay algo en que te pueda ayudar? ¿No conteste bien a tu pregunta? ¿Te quedaron dudas? Mandame un mensaje, lo respondere a la brevedad o visita mi canal:
youtube.com/user/letleopard