10/09/2008, 17:03
|
| | Fecha de Ingreso: agosto-2008 Ubicación: Encarnacion
Mensajes: 5
Antigüedad: 16 años, 3 meses Puntos: 0 | |
Respuesta: Problema con sesiones de Dreamweaver proba con esto..
<?php require_once('Connections/connection.php');
// *** Validate request to login to this site.
session_start();
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($accesscheck)) {
$GLOBALS['PrevUrl'] = $accesscheck;
session_register('PrevUrl');
}
if (isset($_POST['user'])) {
$loginUsername=$_POST['user'];
$password=$_POST['pass'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "add.php";
$MM_redirectLoginFailed = "login.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_connection, $connection);
$LoginRS__query=sprintf("SELECT usuario, contrasena FROM usuarios WHERE usuario='$loginUsername' AND contrasena='$password'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
$LoginRS = mysql_query($LoginRS__query, $connection) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";
//declare two session variables and assign them
$GLOBALS['MM_Username'] = $loginUsername;
$GLOBALS['MM_UserGroup'] = $loginStrGroup;
//register the session variables
session_register("MM_Username");
session_register("MM_UserGroup");
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Documento sin título</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form name="form1" method="POST" action="<?php echo $loginFormAction; ?>">
<table width="200" border="1">
<tr>
<td>Usuario:</td>
<td><input name="user" type="text" id="user"></td>
</tr>
<tr>
<td>Contraseña:</td>
<td><input name="pass" type="password" id="pass"></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="Enviar"></td>
</tr>
</table>
</form>
</body>
</html> |