authenticating users with php&mysql

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi All,

I am trying to create a page with 2 text boxes a name and a
password with a submit button.The user must enter his
username and password that is stored in mysql to access the
site.

With the following code i get a successfull connection with
a blank username and password but when i enter a wrong
username and password i get a error that is correct.

<html>
   <head><title>MySQL Connection</title></head>
      <body>
         <div align="centre">
            <form action="<?php echo $_SERVER[PHP_SELF];
?>" method="POST">
               Name: <input type="text"
name="txt_name">&nbsp;
               Password: <input type="text"
name="txt_password">&nbsp;
               <br /><input type="submit" value="Submit">
         </div>
            </form>
       </body>
</html>
<?php
   $db_host = "localhost";
   $db_user = $_POST["txt_name"];
   $db_password = $_POST["txt_password"];
   $db_name = "data";
   $connection = @mysql_connect ($db_host, $db_user,
$db_password) or die ("error connecting");
   echo "connection successful!";
?>

What is the best way to authenticate users against mysql
for login?

Regards
______________________________________________________________
http://www.webmail.co.za the South African FREE email service

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux