php - Need help retrieving forgotten password from database -
okay, forgot password login administration panel.
what needing done, example echo added display password, located auto-donate-login -> password
here file.
<?php if(!isset($_session)){ session_start(); } include_once '../connection.php'; if(isset($_post['user'], $_post['pass'])) { $statement = $connection->prepare("select * `".$sqldatabase."`.`auto-donate-login` `username`=:name"); $statement->bindparam(":name", $_post['user']); $statement->execute(); if($row = $statement->fetch()) { $hash = md5(md5($row['salt']).md5($_post['pass'])); if($hash == $row['password']) { $_session['user'] = $_post['user']; $_session['ip'] = $_server['remote_addr']; $_session['salt'] = md5(md5($row['salt']).md5($private_key)); header('location: index.php'); } else { echo "<script> alert('invalid username or password, please try again.');</script>"; die(); } } die(); } ?> <html> <head> <title>donation administrator login</title> <link href="css/formstyle.css" media="screen" rel="stylesheet" type="text/css"/> <link href="css/uniform.css" media="screen" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script> <script type="text/javascript" src="js/jquery.tools.js"></script> <script type="text/javascript" src="js/jquery.uniform.min.js"></script> <script type="text/javascript" src="js/main.js"></script> </head> <body> <div class="ttwform-container"> <div id="form-title" class="form-title field"> <h2> installment information </h2> </div> <form id="loginform" action="login.php?action=1" class="ttwform" method="post" novalidate=""> <div id="field1-container" class="field f_100"> <label for="field1"> administrator username </label> <input type="text" name="user" id="user" required="required"> </div> <div id="field9-container" class="field f_100"> <label for="field9"> administrator password </label> <input type="password" name="pass" id="pass" required="required"> </div> <div id="form-submit" class="field f_100 clearfix submit"> <input type="button" value="submit" id="button"> </div> <script> var button = document.getelementbyid("button"); button.addeventlistener("click", function() { var username = document.getelementbyid("user"); var password = document.getelementbyid("pass"); if(username.value.length < 1 || username.value.length > 15) { alert("error: please enter username, usernames may 1-15 characters long."); return; } if(password.value.length < 5 || password.value.length > 40) { alert("error: administrator password must between 5-40 characters"); return; } document.forms["loginform"].submit(); }); </script> </form> </div> </body> </html>
Comments
Post a Comment