Ver Mensaje Individual
  #4 (permalink)  
Antiguo 21/01/2007, 10:43
bellacord
 
Fecha de Ingreso: junio-2003
Ubicación: Frente al monitor
Mensajes: 508
Antigüedad: 20 años, 10 meses
Puntos: 0
Re: Autentificacion De Usuaris

a ver si te sirve eso

Código PHP:
<?php require_once('coneccion.php'); ?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) { nmbre de la seccion 
  session_start
();
}

$loginFormAction $_SERVER['PHP_SELF'];
if (isset(
$_GET['accesscheck'])) {
  
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset(
$_POST['textfield'])) {
  
$loginUsername=$_POST['textfield'];
  
$password=$_POST['textfield2'];
  
$MM_fldUserAuthorization "";
  
$MM_redirectLoginSuccess "bien.php";
  
$MM_redirectLoginFailed "mail.php";
  
$MM_redirecttoReferrer false;
  
mysql_select_db($database$variablexx);
  
  
$LoginRS__query=sprintf("SELECT campousuario, campopass FROM tabla WHERE campousuario='%s' AND campopass='%s'",
    
get_magic_quotes_gpc() ? $loginUsername addslashes($loginUsername), get_magic_quotes_gpc() ? $password addslashes($password)); 
   
  
$LoginRS mysql_query($LoginRS__query$variablexx) or die(mysql_error());
  
$loginFoundUser mysql_num_rows($LoginRS);
  if (
$loginFoundUser) {
     
$loginStrGroup "";
    
    
//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 );
  }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
</head>

<body>
<form id="form1" name="form1" method="POST" action="<?php echo $loginFormAction?>">
  <p>Usuario</p>
  <p>
    <input type="text" name="textfield" />
  </p>
  <p>Pass</p>
  <p>
    <input type="text" name="textfield2" />
  </p>
  <p>&nbsp;</p>
  <p>
    <input type="submit" name="Submit" value="Enviar" />
  </p>
</form>
</body>
</html>
__________________
Tengo una duda...