I'm building a UI to configure the settings of a theme (non WP, custom framework) I'm working on. Part of the requirements of that theme is database access.
I would, ideally, like to give the user the option to save his/her database credentials (host, user, pass, name) to be picked up next time the UI is loaded. Is is it safe to save that data in a session on that user's computer?
Or should I look into using fwrite()
to create a seperate file, and write that data to it?
The first idea just seems开发者_JS百科 quicker, but I just want to make sure that it's actually safe.
There is no such thing as a "session on the user's computer". What you're referring to are Cookies. There's functions built into PHP for handling those, like setcookie()
. Storing credentials in the cookie is never really safe - however, it is a method that's frequently used. When a website offers to 'remember you', they're actually storing a cookie with your username + password, so you can be logged automatically on the next visit.
精彩评论