MySQL Forums
Forum List  »  Newbie

Help me with this PHP authentication code
Posted by: victor gabriel
Date: June 14, 2005 08:42AM

Who could help me with this PHP code about authentication - I found not way :

I charge my login form and write the user that i created in my table 'usuarios', which let me access to the menu page, but when i select an option it says i have not access or that i had not made the login

The only difference i can see is that the administrator password i write it in my program as it is and in the user table of mysql database it is written coded.

HERE IS THE CODE WHERE I VERIFY THE ACCESS :

<?

session_start();

if ($id_usuario && $clave_acceso)
{
$db_conn = mysql_connect("mysql", "mi_usuario", "mi_password");


$basededatos=mysql_select_db ("censo_sector_5", $db_conn);
$consulta_tabla = "select * from usuarios where id_usuario='$id_usuario' and clave_acceso='$clave_acceso'";

$arreglo_tabla = mysql_query($consulta_tabla, $db_conn);

if (mysql_num_rows($arreglo_tabla) > 0 )

{ $usuario_valido = $id_usuario;
session_register("usuario_valido");
}
}

?>



HERE IS THE CODE TO GET INTO ANY OPCION I WANT , BUT IT SHOWS THE MESSAGE "You are not working with access or not login" :

<?
global $usuario_valido;
session_start();

if (session_is_registered("usuario_valido"))
{
require_once("despliega_formularios.php");
despliega_formulario_manzanas();
}

else
{
echo "You are not working with access or not login";
echo "<p> Only members with access can login to this page. </p>";
}


?>

Options: ReplyQuote


Subject
Written By
Posted
Help me with this PHP authentication code
June 14, 2005 08:42AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.