Foros del Web » Programando para Internet » PHP »

autenticacion de usuarios otras variables

Estas en el tema de autenticacion de usuarios otras variables en el foro de PHP en Foros del Web. he creado un formulario para autenticacion de usuarios y me funciona muy bien, lee cedula y password. Mi duda es como obtener el valor de ...
  #1 (permalink)  
Antiguo 16/06/2009, 18:04
 
Fecha de Ingreso: junio-2009
Mensajes: 4
Antigüedad: 14 años, 10 meses
Puntos: 0
autenticacion de usuarios otras variables

he creado un formulario para autenticacion de usuarios y me funciona muy bien, lee cedula y password.

Mi duda es como obtener el valor de cedula y poderlo utilizar en la pagina autenticada para obtener los datos restantes de la tabla y que pertenecen a dicha cedula....

el formulario es..............

</form>
<h3>Ingreso de Afiliados </h3>
<form action="<?php echo $loginFormAction; ?>" method="POST" name="Afiliados" target="_parent"><table width="200" border="4">
<tr>
<td width="80" bgcolor="#FFFF00"><strong>Cédula</strong></td>
<td width="98" bgcolor="#FFFF00"><label>
<input name="cedula" type="text" id="cedula" size="12" maxlength="10" />
</label></td>
</tr>
<tr>
<td bgcolor="#FFFF00"><strong>Contraseña</strong></td>
<td bgcolor="#FFFF00"><label>
<input name="password" type="password" id="password" size="12" />
</label></td>
</tr>
<tr>
<td colspan="2" bgcolor="#FFFF00"><label>
<input type="submit" name="button" id="button" value="Ingresar" />
</label></td>
</tr>
</table>
</form>

ahora.... en la pagina php donde me lleva el formulario quiero rescatar la variable cedula para hacer la consulta a la tabla select * from tabla where cedula=????

con: $cedula = $_POST['cedula'] ; no me funciona.....

el codigo de la pagina php es el siguiente.....

<?php
//initialize the session
if (!isset($_SESSION)) {
session_start();
}

// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
$logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
//to fully log out a visitor we need to clear the session varialbles
$_SESSION['MM_Username'] = NULL;
$_SESSION['MM_UserGroup'] = NULL;
$_SESSION['PrevUrl'] = NULL;
unset($_SESSION['MM_Username']);
unset($_SESSION['MM_UserGroup']);
unset($_SESSION['PrevUrl']);

$logoutGoTo = "index.php";
if ($logoutGoTo) {
header("Location: $logoutGoTo");
exit;
}
}
?>
<?php

$cedula = $_POST[$loginUsername] ;
?>
<?php
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;

// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && true) {
$isValid = true;
}
}
return $isValid;
}

$MM_restrictGoTo = "index.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<?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;
}
}


de donde cojo el valor de cedula??????????

gracias....
  #2 (permalink)  
Antiguo 16/06/2009, 19:04
Avatar de Ronruby  
Fecha de Ingreso: julio-2008
Ubicación: 18°30'N, 69°59'W
Mensajes: 4.879
Antigüedad: 15 años, 9 meses
Puntos: 416
Respuesta: autenticacion de usuarios otras variables

Código php:
Ver original
  1. <?php
  2.  
  3. $cedula = $_POST[$loginUsername] ;
  4. ?>

:S No defines $cedula como $_POST['cedula']

El codigo que genera Dreamweaver me da dolor de cabeza, que horror.
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 14:57.