thelee Posted November 15, 2012 Share Posted November 15, 2012 hellow.im using md5 password for register.but when at the login session,i dont know how i can read the md5 password to login back ? can someone help me.here is the login form <?php require_once('Connections/deli.php'); ?> <?php // *** Validate request to login to this site. session_start(); $loginFormAction = $_SERVER['PHP_SELF']; if (isset($accesscheck)) { $GLOBALS['PrevUrl'] = $accesscheck; session_register('PrevUrl'); } if (isset($_POST['username'])) { $loginUsername=$_POST['username']; $password=$_POST['password']; $MM_fldUserAuthorization = ""; $MM_redirectLoginSuccess = "home.php"; $MM_redirectLoginFailed = "index.php"; $MM_redirecttoReferrer = false; mysql_select_db($database_deli, $deli); $LoginRS__query=sprintf("SELECT username, password FROM users WHERE username='%s' AND password='%s'", get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password)); $LoginRS = mysql_query($LoginRS__query, $deli) or die(mysql_error()); $loginFoundUser = mysql_num_rows($LoginRS); if ($loginFoundUser) { $loginStrGroup = ""; //declare two session variables and assign them $GLOBALS['MM_Username'] = $loginUsername; $GLOBALS['MM_UserGroup'] = $loginStrGroup; //register the session variables session_register("MM_Username"); session_register("MM_UserGroup"); if (isset($_SESSION['PrevUrl']) && false) { $MM_redirectLoginSuccess = $_SESSION['PrevUrl']; } header("Location: " . $MM_redirectLoginSuccess ); } else { header("Location: ". $MM_redirectLoginFailed ); } } ?> </table> <style type="text/css"> <!-- .style9 {color: #FFFFFF} body { background-color: #FFFFFF; background-image: url(); } .style11 {font-size: 16px} .style14 {font-family: "Microsoft PhagsPa"} .style16 {color: #FFFFFF; font-weight: bold; } body,td,th { color: #FFFFFF; } --> </style> <table width="1139" border="1" align="center"> <tr> <td width="1129" height="164" bordercolor="#000000" background="wallpaper system.jpg" bgcolor="#FFFFFF"><div align="center"><img src="Deuter_Logo.jpg" width="243" height="214"></div></td> </tr> </table> <style type="text/css"> <!-- .style1 {color: #FFFFFF} body,td,th { color: #FFFFFF; } .style2 { font-size: xx-large; color: #000000; font-family: "Microsoft PhagsPa"; } .style8 {font-family: "Microsoft PhagsPa"; color: #FFFFFF; } a:link { color: #FFFFFF; text-decoration: none; } .style9 { font-family: "Microsoft PhagsPa"; color: #00FF00; } a:visited { color: #FFFFFF; text-decoration: none; } a:active { color: #FFFFFF; text-decoration: none; } a:hover { text-decoration: none; color: #FFFFFF; } body { background-color: #000000; } --> </style> <p align="center" class="style16 style22"><table width="357" border="0" align="center" bgcolor="#FFFFFF"> <tr> <td width="351" height="218" bordercolor="#000000" bgcolor="#000000"><form action='<?php echo $loginFormAction; ?>' method='POST'> <p align="center" class="style16 style22 style34 style9 style11 style14"><strong>deuter E-Shop</strong></p> <p align="center" class="style16 style22"><span class="style16 style23 style2 style9 style11 style14">We Provide High Quality Hiking Bag</span></p> <p> <p><span class="style8 style9 style14">Username: </span> <input type='username' name='username'> <p><br> <span class="style8 style9 style14">Password: </span> <input type='password' name='password'> <p> <br> <input type='submit' value='Log in'> <input type="reset" name="Submit2" value="Reset"> </form> <p class="style1"> <a href="register.php" class="style9 style14">click here to register</a></td> </tr> </table> <div align="center"> <p> </p> <table width="212" border="1" bgcolor="#000000"> <tr> <td width="230"><span class="style16"><a href="index_admin.php">ADMINISTRATION LOGIN</a> </span></td> </tr> </table> </div> <p align="center" class="style16 style23 style2"> <table width="1139" border="1" align="center"> <tr> <td width="1129" height="164" bordercolor="#000000" background="wallpaper system.jpg" bgcolor="#FFFFFF"> </td> </tr> </table> Quote Link to comment https://forums.phpfreaks.com/topic/270716-how-to-login-with-md5-password/ Share on other sites More sharing options...
requinix Posted November 15, 2012 Share Posted November 15, 2012 You don't get the password back. What you do is hash the login password and compare that hash against what you stored in the database. Quote Link to comment https://forums.phpfreaks.com/topic/270716-how-to-login-with-md5-password/#findComment-1392547 Share on other sites More sharing options...
thelee Posted November 15, 2012 Author Share Posted November 15, 2012 how i can hash the password Quote Link to comment https://forums.phpfreaks.com/topic/270716-how-to-login-with-md5-password/#findComment-1392549 Share on other sites More sharing options...
White_Lily Posted November 15, 2012 Share Posted November 15, 2012 http://php.net/manual/en/faq.passwords.php http://crackstation.net/hashing-security.htm Those should help you. Quote Link to comment https://forums.phpfreaks.com/topic/270716-how-to-login-with-md5-password/#findComment-1392552 Share on other sites More sharing options...
Muddy_Funster Posted November 15, 2012 Share Posted November 15, 2012 by running md5() on it.... Quote Link to comment https://forums.phpfreaks.com/topic/270716-how-to-login-with-md5-password/#findComment-1392553 Share on other sites More sharing options...
thelee Posted November 15, 2012 Author Share Posted November 15, 2012 thanks a lot Quote Link to comment https://forums.phpfreaks.com/topic/270716-how-to-login-with-md5-password/#findComment-1392554 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.