How to safely store a password inside PHP code?

前端 未结 11 1898
轮回少年
轮回少年 2020-12-11 04:12

How can I have a password inside PHP code and guarantee that no one viewing the page in the browser can retrieve it?

Is:

11条回答
  •  攒了一身酷
    2020-12-11 04:46

    Store the password encrypted. For example, take the output of:

    sha1("secretpassword");
    

    ...and put it in your code. Even better, put it in your database or in a file outside of the web server's directory tree.

提交回复
热议问题