Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (isset($_POST['login'])
- && isset($_POST['old_pswd'])
- && isset($_POST['change_pswd'])
- && isset($_POST['change_pswd_sec']))
- {
- $login = $_POST['login'];
- $login = stripslashes($login);
- $login = trim($login);
- $login = htmlspecialchars($login);
- $password = $_POST['old_pswd'];
- $password = stripslashes($password);
- $password = trim($password);
- $password = htmlspecialchars($password);
- $password_new = $_POST['change_pswd'];
- $password_new = stripslashes($password_new);
- $password_new = trim($password_new);
- $password_new = htmlspecialchars($password_new);
- $password_new_sec = $_POST['change_pswd_sec'];
- $password_new_sec = stripslashes($password_new_sec);
- $password_new_sec = trim($password_new_sec);
- $password_new_sec = htmlspecialchars($password_new_sec);
- if(empty($password_new))
- {
- echo 'Error: Password not specified!';
- echo "<script>setTimeout('location=document.location.href', 8000 )</script>";
- }
- if ($password_new == $password_new_sec) {
- include 'a_api.php';
- $result = $proxy->checkPassword($login, $password);
- if (!$result->isOk()) {
- echo 'Error: Incorrect old account password!';
- echo "<script>setTimeout('location=document.location.href', 8000 )</script>";
- }else{
- $result = $proxy->changePassword($login, $password_new);
- if ($result->isOk()) {
- echo 'Password changed!';
- echo "<script>setTimeout('location=document.location.href', 8000 )</script>";
- }else{
- echo 'Error: ' . $result->toString();
- echo "<script>setTimeout('location=document.location.href', 8000 )</script>";
- }
- }
- } else {
- echo 'Error: Password mismatch!';
- echo "<script>setTimeout('location=document.location.href', 8000 )</script>";
- }
- } else { ?>
- <form method="post" style="max-width:500px;margin:auto">
- <h2>Change password</h2>
- <div class="input-container">
- <i class="fa fa-user icon"></i>
- <input placeholder="Username" class="input-field" type="text" name="name" pattern="[A-Za-z0-9]{4,16}" required />
- </div>
- <div class="input-container">
- <i class="fa fa-key icon"></i>
- <input placeholder="Old Password" class="input-field" autocomplete="new-password" type="password" name="old_pswd" pattern="[A-Za-z0-9]{4,16}" required />
- </div>
- <div class="input-container">
- <i class="fa fa-key icon"></i>
- <input placeholder="New Password" class="input-field" autocomplete="new-password" type="password" name="change_pswd" pattern="[A-Za-z0-9]{4,16}" required />
- </div>
- <div class="input-container">
- <i class="fa fa-key icon"></i>
- <input placeholder="Repeat Password" class="input-field" autocomplete="new-password" type="password" name="change_pswd_sec" pattern="[A-Za-z0-9]{4,16}" required />
- </div>
- <div class="input-container">
- <button type="submit" class="btn" name="pswd_submit" value="Chanege Password!"> Chanege Password!</button>
- </div>
- <p><a href="?">Back to Register Form!</a></p>
- </form>
- <?php }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement