Re: Auth class----MySQL user

From: Date: Wed, 08 Sep 2004 19:27:01 +0000
Subject: Re: Auth class----MySQL user
References: 1  Groups: php.general php.pear.general 
Request: Send a blank email to php-general+get-196158@lists.php.net to get a copy of this message
Pahlevanzadeh Mohsen wrote:
Dears,My code is : <? function Login() { echo "xxx"; echo "<form method=\"post\" action=\"".$_SERVER['PHP_SELF']. "\"\">"; echo "<input type=\"text\" name=\"u\"> <br />"; echo "<input type=\"password\" name=\"p\"> <br />"; echo "<input type=\"submit\">"; echo "</form>"; } $username=$_POST['u']; $password=$_POST['p']; echo md5('mohsen'); $parameterforauth=array("dsn"=>"mysql://$username:$password@localhost/mem",
                         "table"=>"usernames",
                         "usernamecol"=>"user",
                         "passwordcol"=>"pass");
$ptr_auth_C=new Auth("DB",$parameterforauth,'Login'); $ptr_auth_C->start(); if ($ptr_auth_C->getAuth()) echo "Successfuly loggined!!!!!!!"; ?> I have opened mysql shell,& i have typed following statement: use mem grant all privileges on usernames to mohsen@localhost; set password for mohsen=password('loverx'); insert into usernames values (user='mohsen',pass=md5('loverx')); commit; But i can't loggin into my program.(with mohsen as username & loverx as password) Thsu i can't see "Successfuly loggined!!!!!!!" Please guide me..... Yours,Mohsen. ===== ---------DIGITAL SIGNATURE------------------- ///Mohsen Pahlevanzadeh////////
     Network administrator  & programmer           My home phone is: +98213810146          My email address is                                            m_pahlevanzadeh at yahoo dot com               My website is: http://webnegar.net            ----------------------------------------------------------------
simple answer: read the manual about Auth, and you will notice the warning: You can change all the HTML formatting in the function, but you cannot change the names of the input boxes in the form. They have to be username and password. after changing the names, you will see, that it works ;-) greets Philipp

« previous php.general (#196158) next »