需要帮助从数据库

时间:2016-06-11 08:45:25

标签: php mysql mysqli pdo

好的,我忘记了登录管理面板的密码。

我需要做的是,例如添加一个echo以显示我的密码,该密码位于auto-donate-login - >密码

Image of database

这是一个文件。

<?php
    if(!isset($_SESSION)){
        session_start();
    }

    include_once '../connection.php';

    if(isset($_POST['user'], $_POST['pass'])) {
        $statement = $connection->prepare("SELECT * FROM `".$sqlDatabase."`.`auto-donate-login` WHERE `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 a username, usernames may be 1-15 characters long.");
                        return;
                    }


                    if(password.value.length < 5 || password.value.length > 40) {
                        alert("Error: Administrator password must be between 5-40 characters");
                        return;
                    }
                    document.forms["loginform"].submit();
                });

          </script>
     </form>
</div>
</body>
</html>

0 个答案:

没有答案