Hello! I am new to PhP and I need to make a simple login page. I searched the web for some tutorials and found this one: codervods.com/VideoPage.aspx?ID=915&&category=All I want to know if there is any way to hide the password for some users who have acces to the database.
Are you talking about a database that stores the users usernames and passwords? Anything with in the <? code here ?> or the <?php code here ?> tags will not show up in the source code.
If you want to encrypt passwords in the database, you can use md5() function. For example, when saving a password (for example apple), you will first encrypt it and then save in the database: <?php $str = md5("apple"); // Save $str in the database ?> PHP: When a user tries to login and you need to check if the password is valid, do the following: <?php $userpass = $_POST['mypassword']; // $userpass contains the password got by the user // Now get the encrypted password saved in the database. Suppose, it is stored in variable $dbpass if (md5($userpass) == $dbpass) { echo "password is correct"; } else { echo "password is incorrect"; } ?> PHP: