alvinchua Posted May 13, 2007 Share Posted May 13, 2007 this code is to match the username and the password in the database and if correct it will redirect... can some1 tell me which part in this code is masked the password ?? i cant figure it out... and i need the masking to mask the password when the user register themself ...(this code will masked the password when the user type) <?php // we must never forget to start the session session_start(); $errorMessage = ''; if (isset($_POST['username']) && isset($_POST['password'])) { include 'library/config.php'; include 'library/opendb.php'; $userId = $_POST['username']; $password = $_POST['password']; // check if the user id and password combination exist in database $sql = "SELECT username FROM register WHERE username = '$userId' AND password = '$password'"; $result = mysql_query($sql) or die('Query failed. ' . mysql_error()); if (mysql_num_rows($result) == 1) { // the user id and password match, // set the session $_SESSION['db_is_logged_in'] = true; // after login we move to the main page header('Location: main.php'); exit; } else { $errorMessage = 'Sorry, wrong user id / password'; } include 'library/closedb.php'; } ?> <html> <head> <title>Basic Login</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <?php if ($errorMessage != '') { ?> <p align="center"><strong><font color="#990000"><?php echo $errorMessage; ?></font></strong></p> <?php } ?> <form action="" method="post" name="frmLogin" id="frmLogin"> <table width="400" border="1" align="center" cellpadding="2" cellspacing="2"> <tr> <td width="150">Username</td> <td><input name="username" type="text" id="username"></td> </tr> <tr> <td width="150">Password</td> <td><input name="password" type="password" id="password"></td> </tr> <tr> <td width="150"> </td> <td><input name="btnLogin" type="submit" id="btnLogin" value="Login"></td> </tr> </table> </form> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/51220-solved-where-is-the-masked-password/ Share on other sites More sharing options...
marmite Posted May 13, 2007 Share Posted May 13, 2007 I'm not certain what you mean, apologies if i'm not answering the question. But I believe type="password" is what masks the password as the user enters it. Does this answer your question? Quote Link to comment https://forums.phpfreaks.com/topic/51220-solved-where-is-the-masked-password/#findComment-252263 Share on other sites More sharing options...
cmgmyr Posted May 13, 2007 Share Posted May 13, 2007 <input name="password" type="password" id="password"> setting the type as password will "mask" it Quote Link to comment https://forums.phpfreaks.com/topic/51220-solved-where-is-the-masked-password/#findComment-252265 Share on other sites More sharing options...
alvinchua Posted May 13, 2007 Author Share Posted May 13, 2007 omg... lol .. i din see da type..mayb i m a little bit sleepy now ..anywayz.. thanks bro~ Quote Link to comment https://forums.phpfreaks.com/topic/51220-solved-where-is-the-masked-password/#findComment-252270 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.