Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include 'system/config.php';
- if(!isset($_GET['key']) && !isset($_GET['username'])){
- die('Invalid Key');
- }
- $key = $_GET['key'];
- $user = $_GET['user'];
- $check = $db->prepare("SELECT * FROM password_keys WHERE `key_id` = :k");
- $check->bindParam(':k', $key, PDO::PARAM_STR);
- $check->execute();
- $check = $check->fetchAll();
- foreach($check as $row){
- if($user == $row['user']){
- if(isset($_POST['submit'])){
- $new_pass = $_POST['password'];
- $new_pass_r = $_POST['password_r'];
- if($new_pass == $new_pass_r){
- $hashed_new = password_hash($new_pass, PASSWORD_DEFAULT);
- $update = $db->prepare("UPDATE users SET password = :p WHERE username = :u");
- $update->bindParam(':p', $hashed_new, PDO::PARAM_STR);
- $update->bindParam(':u', $user, PDO::PARAM_STR);
- $update->execute();
- $setUsed = $db->prepare("UPDATE password_keys SET used = 1 WHERE key_id = :k");
- $setUsed->bindParam(':k', $key, PDO::PARAM_STR);
- $setUsed->execute();
- echo "<script>alert('Password changed successfully'); window.location.href= 'http://habboarchive.dev'; </script>";
- }
- }
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
- <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
- <link rel="stylesheet" type="text/css" href="assets/css/animate.css">
- <link rel="stylesheet" type="text/css" href="assets/css/pnotify.custom.min.css">
- <title>Habbo Archive || Reset Password</title>
- </head><body>
- <div class="container">
- <div id="loginbox" style="margin-top:50px;" class="mainbox col-md-6 col-md-offset-3 col-sm-8 col-sm-offset-2">
- <div class="panel panel-info" >
- <div class="panel-heading">
- <div class="panel-title">Reset password</div>
- </div>
- <div style="padding-top:30px" class="panel-body" >
- <div style="display:none" id="login-alert" class="alert alert-danger col-sm-12"></div>
- <form id="loginform" method="post" class="form-horizontal" role="form">
- <div style="margin-bottom: 25px" class="input-group">
- <label>New Password</label>
- <input type="password" name="password" class="form-control">
- </div>
- <div style="margin-bottom: 25px" class="input-group">
- <label>Retype password</label>
- <input type="password" name="password_r" class="form-control">
- </div>
- <div style="margin-top:10px" class="form-group">
- <!-- Button -->
- <div class="col-sm-12 controls">
- <input id="reset" type="submit" name="submit" href="#" class="btn btn-success">Login </a>
- </div></div></form></div></div></div></div></body></html>
- <?php
- }
- } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement