PHP - crear usuario y contraseña

 
Vista:

crear usuario y contraseña

Publicado por switch (55 intervenciones) el 23/05/2007 00:26:16
hol@, estoy creando una aplicacion en la cual tengo usuario y contaseña, basicamente es que si el usuario existe ingrese a entra.php y si no existe el usuario que se vaya a no_entra.php, la conexion la realizo por el "asistente" para mysql que tiene DW, esto me genera un codigo automatico, pero al ejecutar la aplicacion me reclama en el session_start(); y en el header("Location: ". $MM_redirectLoginFailed );

ESTO ME MUSTRA LOS SIGUENTES ERRORES:

Warning: open(/tmp\sess_c39e642644fefc27ba19a5784d6e7a72, O_RDWR) failed: No such file or directory (2) in c:\foxserv\www\ja\index.php on line 4
(en esta linea esta el "session_start();" )

Warning: Cannot add header information - headers already sent by (output started at c:\foxserv\www\ja\index.php:4) in c:\foxserv\www\ja\index.php on line 41
(en esta linea esta el "header("Location: ". $MM_redirectLoginFailed" );

Warning: open(/tmp\sess_c39e642644fefc27ba19a5784d6e7a72, O_RDWR) failed: No such file or directory (2) in Unknown on line 0

Warning: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0

si alguen me puede ayudar

de ante mano gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

Codigo de la pagina principal

Publicado por switch (55 intervenciones) el 23/05/2007 00:28:21
<?php require_once('../Connections/prueba.php'); ?>
<?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['rut'])) {
$loginUsername=$_POST['rut'];
$password=$_POST['contraseña'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "entra.php";
$MM_redirectLoginFailed = "no_entra.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_prueba, $prueba);

$LoginRS__query=sprintf("SELECT Rut, Contraseña FROM usuarios WHERE Rut='%s' AND Contraseña='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));

$LoginRS = mysql_query($LoginRS__query, $prueba) 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 );
}
}

?>

ESTO ES LO QUE ME CREA DW
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Codigo de la pagina principal

Publicado por switch (55 intervenciones) el 23/05/2007 00:30:03
<!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>rut</td>
<td><input name="rut" type="text" id="rut"></td>
</tr>
<tr>
<td>contraseña</td>
<td><input name="contraseña" type="text" id="contraseña"></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="Enviar"></td>
</tr>
</table>
</form>
</body>
</html>

ESTO LO ESCRIBO YO
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

si el usuario existe

Publicado por switch (55 intervenciones) el 23/05/2007 00:34:24
<?php

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 = "no_entra.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;
}
?>
<!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>
jajaja
</body>
</html>

EN ESTA PAGINA VALIDO QUE SI EXISTE EL USUARIO EN LA BASE DE DATO MUESTRE JAJAJAJA SI EL USUARIO NO EXISE QUE SE VAYA A no_entra.php
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:crear usuario y contraseña

Publicado por Gonzalo (84 intervenciones) el 23/05/2007 08:00:15
Lo que te está diciendo es que no existe el directorio /tmp y entonces no consigue escribir los ficheros de sesión.

Puedes:
a. Crear un directorio C:\tmp
o
b. Editar el php.ini y cambiar la opción session.save_path para que apunte a un directorio que exista.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:crear usuario y contraseña

Publicado por switch (55 intervenciones) el 23/05/2007 14:45:05
pero crear un directorio C:\tmp es ¿hacer una carpeta en c con ese nombre? .
la segunda alternativa, eso de edita el php.ini, eso si que no lo comprendo, me podrias explicar un poco mas por favor


muchas gracias por tu ayuda
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:crear usuario y contraseña

Publicado por switch (55 intervenciones) el 23/05/2007 14:51:41
genere el directorio C:\tmp, pero al compilar mi aplicacion me muestra esto como error

Fatal error: Failed opening required '../Connections/prueba.php' (include_path='.;c:\php4\pear') in c:\foxserv\www\ja\index.php on line 1

de ante mano muchas gracias
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:crear usuario y contraseña

Publicado por Gonzalo (84 intervenciones) el 23/05/2007 18:54:06
Este es otro error. El otro ha quedado solucionado.

Lo que die este es que no encuentra el fichero prueba.php que estás intentando incluir en la línea uno de tu archivo index.php. Seguramente porque has puesto mal esa ruta ../Connections/prueba.php
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:crear usuario y contraseña

Publicado por switch (55 intervenciones) el 23/05/2007 21:30:08
con tanto hacer y desacer se cambio la ruta de Connections/prueba.php ............ ahora esta todo en su lugar y no me muestra ningun error

MUCHAS GRACIAS POR TU AYUDA!!!!!!!!!!!!!!!!!!!!!
muchas gracias
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar