简体   繁体   English

如何使用PHP PDO跨平台进行用户名/密码管理

[英]How to use PHP PDO Cross-platform for UserName/Password Management

I am working on a project which may be running on a server using mySQL or MS SQL as the Database. 我正在研究一个项目,该项目可能正在使用mySQL或MS SQL作为数据库的服务器上运行。 Therefore I am using PHP PDO to connect with my database. 因此,我使用PHP PDO连接数据库。 How can I most effectively handle password storage and verification as I do not want to store them in plain text. 我不想以纯文本形式存储密码,因此如何最有效地处理它。

I have attempted using Google for PDO Login and all the articles are mySQL specific, including using mySQL functions. 我尝试使用Google进行PDO登录,所有文章都是mySQL特有的,包括使用mySQL函数。 I have so far been unable to find anything regarding cross database support. 到目前为止,我无法找到有关跨数据库支持的任何信息。


   $qry = $db_conn->query("Select UserADID, EMPLID, UserActive, UserRole from tbl_Users Where UserADID= :USR_NAME and UserPass= :USR_PASS Limit 1");


I would expect to be able to pull from the DB the users's credentials (role and status) if their account is verified. 如果他们的帐户经过验证,我希望能够从数据库中提取用户的凭据(角色和状态)。

I used @aynber's suggestion of password_hash and password_verify . 我使用@aynber建议的password_hash和password_verify。

If the connection is all done with PHP, then use password_hash and password_verify – aynber Jul 25 如果连接全部通过PHP完成,则使用password_hash和password_verify – aynber 7月25日

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM