Ver Mensaje Individual
  #1 (permalink)  
Antiguo 28/08/2012, 04:34
Aurumque
 
Fecha de Ingreso: julio-2012
Ubicación: Donostia
Mensajes: 7
Antigüedad: 11 años, 9 meses
Puntos: 0
Pregunta Hacer Login con md5 en Dreamweaver

Hola a todos. Espero que me puedan ayudar con lo siguiente. He creado un sistema de usuarios en Dreamweaver. Las contraseñas se envian encriptadas en md5 en el registro sin problema pero en la página de login no acierto a configurar el código que genera Dreamweaver para encritar la contraseña. Les dejo el código php para si alguien me puede decir cómo lo soluciono.

Código PHP:
 <?php require_once('Connections/conexion_ondartxo.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['email'])) {
 
$loginUsername=$_POST['email'];
 
$password=md5($_POST['pass']);
 
$MM_fldUserAuthorization "permisos";
 
$MM_redirectLoginSuccess "usuario_acceso_ok.php";
 
$MM_redirectLoginFailed "usuario_acceso_error.php";
 
$MM_redirecttoReferrer false;
 
mysql_select_db($database_conexion_ondartxo$conexion_ondartxo);

 
$LoginRS__query=sprintf("SELECT id, nombre, apellidos, email, pass, permisos FROM usuarios WHERE email=%s AND pass=%s",
 
GetSQLValueString($loginUsername"text"), GetSQLValueString($password"text")); 

 
$LoginRS mysql_query($LoginRS__query$conexion_ondartxo) or die(mysql_error());
 
$row_LoginRS mysql_fetch_assoc($LoginRS);
 
$loginFoundUser mysql_num_rows($LoginRS);
 if (
$loginFoundUser) {

 
$loginStrGroup mysql_result($LoginRS,0,'permisos');

 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;
 
$_SESSION['MM_IdUsuario'] = $row_LoginRS["id"];
 
$_SESSION['MM_Nombre'] = $row_LoginRS["nombre"];
 
$_SESSION['MM_Apellidos'] = $row_LoginRS["apellidos"];
 
$_SESSION['MM_Pass'] = $row_LoginRS["pass"];
 
$_SESSION['MM_Permiso'] = $row_LoginRS["permisos"]; 

 if (isset(
$_SESSION['PrevUrl']) && false) {
 
$MM_redirectLoginSuccess $_SESSION['PrevUrl']; 
 }
 
header("Location: " $MM_redirectLoginSuccess );
 }
 else {
 
header("Location: "$MM_redirectLoginFailed );
 }
 }
 
?>