خرید بک لینک

Vote count: 0

I have this file where the user needs to provide a password to enter the directory of logs. Now it was suggested to add a "Change Password" functionality.

Now the process that I want to do is to let the user type his current password first before showing the "type new password" input field. I already used the isset() function in the initial login(before seeing the logs). Now the problem is whenever I press the submit button in the collapsed "Change Password" textfield, it starts all over again. (the page goes back to the initial login)

Also, the password is saved in a .json file

P.S. Everything is in just 1 php file (login, showing of the logs, etc.). Here is my snippet for the "Change Password" functionality.

echo "<center>
                    <div style='display:inline-block;''>
                        <button type='button' class='btn btn-default btn-xs' data-toggle='collapse' data-target='#demo'>Change Password</button>
                    </div>

                    <div id='demo' class='collapse'>
                        <form method='POST' class='form-inline' role='form'>
                        <br>
                            <input type='password' name='curr_pw' placeholder='Enter Password' class='form-control input-sm'>
                            <input type='submit' class='btn btn-primary btn-xs' name='save' value='Submit' data-toggle='modal' data-target='#correct'>
                        </form>
                    </div>
                </center>";

                if (!empty($_POST['save'])){
                    if (($_POST['curr_pw'] == $json['password'])){
                        echo "<div id='correct' class='modal fade' role='dialog'>
                                        <div class='modal-dialog modal-lg'>

                                            <div class='modal-content'>
                                                <div class='modal-header'>
                                                    <button type='button' class='close' data-dismiss='modal'>&times;</button>
                                                    <h4 class='modal-title'>Change Password</h4>
                                                </div>
                                                <div class='modal-body' style='overflow-y: auto;word-wrap:break-word;'>
                                                </div>
                                                <div class='modal-footer'>
                                                    <button type='button' class='btn btn-danger' data-dismiss='modal'>Close</button>
                                                </div>
                                            </div>

                                        </div>
                                    </div>";
                            } else {
            echo "<br><div class='alert alert-danger'>
                    <center>
                        <span class='glyphicon glyphicon-remove-circle'></span><strong> Incorrect Password!</strong>
                    </center>
                 </div>";
                            }
                        }  

asked 3 mins ago

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 6 ارديبهشت 1395 ساعت: 12:33

صفحه بندی