Saludos, tengan un buen dia, mi problema es que necesito logearme con 3 datos todos estan encriptados con md5 desde un formulario de registro, lo datos son estos_ [usuario, pin y contraseña] pero me lanza error al intentarme logearme, tengo el siguiente código:
Código PHP:
<?php require_once('../cnn/config.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['usuario'])) {
$loginUsername=md5($_POST['usuario']);
$pin=md5($_POST['pin']);
$password=md5($_POST['contrasena']);
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "pastes.php";
$MM_redirectLoginFailed = "ingreso.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_config, $config);
$LoginRS__query=sprintf("SELECT micro_p_us, micro_p_pin, micro_p_co FROM micro_p_user_adm WHERE micro_p_us=%s micro_p_pin=%s AND micro_p_co=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($pin, "text"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $config) 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 );
}
}
?>
me sale el siguiente error: