PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I want to have a tick box on a log in system so when a user ticks it they are remembered on future visits. I've got it working through a cookie but I have run into one issue. When no cookie is set to start with the page displays an error stating the cookie doesn't exist. How can I get it to autofill the username and password fields only if the box has been ticked?
But I really wouldn't save the user's password in the cookie. This is very insecure! If $_COOKIE['user'] is set, then you should probably query the db for the user's pass when they hit the login page. Better yet, just save the user_id in the cookie and then query for the name and pass when needed. If this won't work for you then maybe save these values in session vars.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Thank you very much, AbraCadaver, I have have got it working from your code with a few adjustments. I'm fairly new to PHP so sometimes miss simple things like that.
I've set up a database so that when a user logs in it connects and checks the username and password are correct. I heard cookies can be used to autofill the fields but really just wanted to get it to work first before looking at security issues. I feel pleased just to see it work.