Advertisement
Guest User

Untitled

a guest
Oct 11th, 2016
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 14.95 KB | None | 0 0
  1. <?php
  2. require('../../../includes/config.php');
  3. require('../../../structure/database.php');
  4. require('../../../structure/base.php');
  5. require('../../../structure/user.php');
  6.  
  7. $database = new database($db_host, $db_name, $db_user, $db_password);
  8. $base = new base($database);
  9. $user = new user($database);
  10.  
  11. //set some basic vars
  12. $username = $user->getUsername($_COOKIE['user'], 2);
  13. $rank = $user->getRank($username);
  14. ?>
  15. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  16. <html xmlns:IE>
  17.  
  18. <head>
  19.     <meta http-equiv="Expires" content="0">
  20.     <meta http-equiv="Pragma" content="no-cache">
  21.     <meta http-equiv="Cache-Control" content="no-cache">
  22.     <meta name="MSSmartTagsPreventParsing" content="TRUE">
  23.     <meta http-equiv="Content-Type" content="text/html; charset=EUC-JP">
  24.     <title><?php echo $data['wb_title']; ?></title>
  25.     <link href="../../../css/basic-3.css" rel="stylesheet" type="text/css" media="all">
  26.     <link href="../../../css/main/title-5.css" rel="stylesheet" type="text/css" media="all">
  27.     <link rel="shortcut icon" href="../../../img/favicon.ico"/>
  28.     <?php include('../../../includes/google_analytics.html'); ?>
  29.     <style>
  30.         fieldset {
  31.             text-align: left;
  32.             border: 2px solid #625437;
  33.             width: 95%;
  34.             position: relative;
  35.             margin: 10px;
  36.             padding-left: 10px;
  37.             background-color: transparent;
  38.         }
  39.  
  40.         legend {
  41.             color: #625437;
  42.             font-weight: bold;
  43.             font-size: 15px;
  44.         }
  45.  
  46.         label {
  47.             display: block;
  48.             height: 20px;
  49.             text-align: center;
  50.         }
  51.  
  52.         textarea {
  53.             display: block;
  54.             width: 200px;
  55.             height: 100px;
  56.         }
  57.  
  58.     </style>
  59.     <script type="text/javascript">
  60.         function goBack() {
  61.             window.history.back();
  62.         }
  63.     </script>
  64. </head>
  65.  
  66. <div id="body">
  67.     <?php //$base->getNavBar($username, $path, $rank); ?>
  68.  
  69.     <div style="text-align: center; background: none;">
  70.         <div class="titleframe e">
  71.             <b>Password Support</b><br/>
  72.             <a href="../../../index">ScapeRune Home</a>
  73.         </div>
  74.     </div>
  75. </div>
  76.  
  77. <div class="frame e" style="overflow:auto;">
  78.     <?php
  79.    //make sure user doesn't already have a recovery request submitted
  80.    $database->processQuery("SELECT * FROM `tracking` WHERE " . time() . " - `time` < 7200 AND `ip` = ? LIMIT 1", array($_SERVER['REMOTE_ADDR']), false);
  81.    if ($database->getRowCount() >= 1) {
  82.         echo '<center>Oops! You have already submitted a recovery request.<br /><br /> <a href="../../../index"Main Menu</a></center>';
  83.  
  84.     } elseif (!isset($_POST['username'])) {
  85.         ?>
  86.  
  87.         <form action="recover_password" method="POST">
  88.             <input type="text" name="username" maxlength="12"><input type="submit" value="Continue">
  89.         </form>
  90.  
  91.         <?php
  92.    } elseif (!$user->doesExist($_POST['username'])) {
  93.         echo 'No user exists with that username!<br /> <input type="button" value="Back" onclick="goBack()" />';
  94.     } else {
  95.  
  96.         $questions[] = array();
  97.         $questions[0] = 'Where was your first vacation?:';
  98.         $questions[1] = 'Who was your first best friend?:';
  99.         $questions[2] = 'What was your first pets name?:';
  100.         $questions[3] = 'Who was your first boyfriend/girlfriend?:';
  101.         $questions[4] = 'What color was your first bedroom?:';
  102.         $questions[5] = 'Who is your favorite musical artist?';
  103.  
  104.         //extract data
  105.         $data = $database->processQuery("SELECT * FROM `recoveries` WHERE `id` = ? LIMIT 1", array($user->getIdByName($_POST['username'])), false);
  106.  
  107.         if ($database->getRowCount() == 0 || $user->getUsername($_COOKIE['user'], 2) == $_POST['username']) {
  108.             echo 'Temporarily disabled! <input type="button" value="Back" onclick="goBack()" />';
  109.         } elseif (!isset($_POST['answer'])) {
  110.             ?>
  111.             <fieldset class="question">
  112.                 <legend>Important Information</legend>
  113.                 This form will allow you to request that a new password is set for your account.<br/><br/>
  114.                 <img style="float: left" src="/img/title2/lock.gif">
  115.                 <span style="font-weight: bold; color: rgb(255, 187, 34);">Want to be back in game sooner? If you want to get back in game quickly, here are a few tips:</span><br/><br/>
  116.  
  117.                 Please answer all the questions below to confirm that you are the real owner of the account.<br/><br/>
  118.                 Enter the earliest and most specific information about the account that you can.<br/><br/>
  119.                 Take the time to remember as much detail as possible. The more detail you give us, <b>the quicker you
  120.                     can be
  121.                     back in game</b>
  122.                 <br/><br/>
  123.                 If you really don't know the answer to a question, leave the answer box blank.<br/><br/>
  124.                 <b>Remember:</b> The more questions you answer correctly, the sooner you can be back in game!
  125.             </fieldset>
  126.             <br/>
  127.  
  128.             <fieldset class="question">
  129.                 <legend>Answer Recovery Questions</legend>
  130.                 <p style="text-align: center">If you have set these, you must try to answer at least three. Recovery
  131.                     answers
  132.                     have a minimum length of 3 characters.
  133.                     Recovery answers can only contain the characters A-Z, 0-9 and accented characters such as &#233; or
  134.                     &#252;.
  135.                     Other characters will not count towards the length.</p>
  136.  
  137.                 <label><b>I have not set any recovery questions</b>
  138.                     <input type="checkbox" class="input_control" value="subject"/></label>
  139.  
  140.                 <form action="recover_password" method="POST">
  141.                     <table cellpadding="6" style="margin-left:auto;margin-right:auto;">
  142.                         <?php
  143.                        $i = 0;
  144.                        foreach ($questions as $question) {
  145.                            $i++;
  146.                            ?>
  147.                             <tr>
  148.                             </tr>
  149.                             <tr>
  150.                                 <td><?php echo $question; ?>&ensp;
  151.                                     <input type="text" class="textbox" name="answer[]" maxlength="40"
  152.                                           style="display: block;"></td>
  153.                             </tr>
  154.                             <?php
  155.                        }
  156.                        ?>
  157.                     </table>
  158.                     <input type="hidden" id="fuck" value="Submit Recovery">
  159.                 </form>
  160.             </fieldset>
  161.  
  162.             <fieldset class="question">
  163.                 <legend>Your New Password</legend>
  164.                 <p style="text-align: center">These must match exactly for the appeal to proceed.<br/>
  165.                     For advice on setting a good password, please click <a style="color: rgb(255, 187, 34);"
  166.                                                                           target="_blank"
  167.                                                                           href="/kbase/viewarticle7564.html?article_id=2087">here</a>
  168.                     (Opens in a new window).</p>
  169.                 <table>
  170.                     <tr>
  171.                         <td style="vertical-align: middle"><b>Enter a new password for your account: <input type="text"
  172.                                                                                                            name="username"></b>
  173.                         </td>
  174.                     </tr>
  175.                     <tr>
  176.                         <td style="vertical-align: middle"><b>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&ensp;&ensp;Please
  177.                                 enter it again: <input type="text" name="username"></b></td>
  178.                     </tr>
  179.                 </table>
  180.             </fieldset>
  181.             <fieldset class="question">
  182.                
  183.                 <legend>Other Details</legend>
  184.                 When did you create this account?
  185.                 <form action="recover_password.php" method="POST">
  186.                     <table>
  187.                         <tr>
  188.                             <td style="vertical-align: middle">
  189.                                 If you have any other details which would help you prove your ownership of this
  190.                                 account, please enter them here.<br/>
  191.                                 Please <b>do not</b> provide us with any of this following personal information, your
  192.                                 full
  193.                                 name, home
  194.                                 address, email address or telephone number.<br/><br/>
  195.                                 <span class='textcounter' id="counter1">You have 300 characters remaining</span>
  196.                             </td>
  197.                             <td>
  198.                             <textarea style="height: 120px; width: 450px;" class="textlimited"
  199.                                      data-textcounterid="counter1" maxlength="300" rows="4" cols="50"></textarea><br/>
  200.                             </td>
  201.                         </tr>
  202.                     </table>
  203.                     <input type="submit" value="Submit Recovery">
  204.                 </form>
  205.             </fieldset>
  206.             <?php
  207.        } else {
  208.            //validate answers
  209.            $errors = array();
  210.            $answers = $_POST['answer'];
  211.            $i = 0;
  212.  
  213.            foreach ($answers as $answer) {
  214.                $i++;
  215.  
  216.                if (strlen($answer) < 3 || strlen($answer) > 35) {
  217.                     $errors[] = 'Question #' . $i . ' must be at least three characters and no more than 26 characters.';
  218.                 }
  219.  
  220.                 if (preg_match('#[^a-zA-Z0-9$/^[\p{L}-]*$/u ]#', $answer)) {
  221.                     $errors[] = 'Question #' . $i . ' contains illegal characters.';
  222.                 }
  223.             }
  224.  
  225.             if (count($errors) >= 1) {
  226.                 //back button
  227.                 ?>
  228.                 <center><input type="button" value="Back" onclick="goBack()"/></center> <?php
  229.  
  230.                //display errors
  231.                foreach ($errors as $error) {
  232.                    echo $error . '<br/>';
  233.                 }
  234.             } else {
  235.                 //generate a tracking ID
  236.                 $rand_hash = $base->randomString(11);
  237.                 $tracking_id = substr($rand_hash, 0, 3) . '-' . substr($rand_hash, 4, 3) . '-' . substr($rand_hash, 7, 3);
  238.  
  239.                 //create the recovery request
  240.                 $database->processQuery("INSERT INTO `tracking` VALUES (null, ?, ?, NOW(), ?, ?, 0, ?, ?, ?, ?, ?, ?)", array($user->getIdByName($_POST['username']), $_SERVER['REMOTE_ADDR'], time(), $tracking_id, $answers[0], $answers[1], $answers[2], $answers[3], $answers[4], $answers[5]), false);
  241.  
  242.                 ?>
  243.                 <fieldset class="question">
  244.                     <legend>Success!</legend>
  245.                     You have successfully submitted an account recovery request. Your request will be
  246.                     reviewed and processed within the next 48 hours. To track your account recovery
  247.                     progress you can use the <b>recovery tracking ID</b>.<br><br> <b>Please make
  248.                         note</b> of the the tracking ID provided to you and store it in a <b>safe</b>,
  249.                     <b>secure</b> location so you don't lose or forget it.</b>
  250.                 </fieldset>
  251.                 <br/>
  252.                 <br/>
  253.                 <b>Tracking ID: <?php echo $tracking_id; ?></b>
  254.  
  255.                 <?php
  256.            }
  257.        }
  258.    }
  259.    ?>
  260.     <br/>
  261.     <br/>
  262.  
  263.     <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
  264.     <script src="http://code.jquery.com/jquery-latest.min.js"></script>
  265.     <script type="text/javascript">
  266.         //checks how many characters are remaining
  267.         // the selector below will catch the keyup events of elements decorated with class textlimited and have a maxlength
  268.         $('.textlimited[maxlength]').keyup(function () {
  269.             //get the fields limit
  270.             var maxLength = $(this).attr("maxlength");
  271.  
  272.             // check if the limit is passed
  273.             if (this.value.length > maxLength) {
  274.                 return false;
  275.             }
  276.  
  277.             // find the counter element by the id specified in the source input element
  278.             var counterElement = $(".textcounter#" + $(this).data("textcounterid"));
  279.             // update counter 's text
  280.             counterElement.html("You have " + (maxLength - this.value.length) + " chararacters remaining");
  281.         });
  282.  
  283.         //checks if the user has selected no recoveries and disables the textareas
  284.         $(document).ready(function () {
  285.             $('.input_control').change(function () {
  286.                 $(".textbox").prop('disabled', this.checked);
  287.                 $(".textarea").prop('disabled', this.checked);
  288.             });
  289.             $('.input_control').prop('checked', false);
  290.             $('.input_control').trigger('change');
  291.         });
  292.  
  293.         // for future development
  294.         var months = [
  295.             {DaysInMonth: 31, Name: "January"},
  296.             {DaysInMonth: 31, Name: "February"},
  297.             {DaysInMonth: 31, Name: "March"},
  298.             {DaysInMonth: 31, Name: "April"},
  299.             {DaysInMonth: 31, Name: "May"},
  300.             {DaysInMonth: 31, Name: "June"},
  301.             {DaysInMonth: 31, Name: "July"},
  302.             {DaysInMonth: 31, Name: "August"},
  303.             {DaysInMonth: 31, Name: "September"},
  304.             {DaysInMonth: 31, Name: "October"},
  305.             {DaysInMonth: 31, Name: "November"},
  306.             {DaysInMonth: 31, Name: "December"}
  307.         ];
  308.         $(function () {
  309.             var monthSelector = $('select[name=month]');
  310.             $.each(months, function (index, month) {
  311.                 $('<option></option>')
  312.                     .attr('label', month.Name)
  313.                     .attr('value', index)
  314.                     .html(month.DaysInMonth)
  315.                     .appendTo(monthSelector);
  316.             });
  317.  
  318.             var yearSelector = $('select[name=ano]');
  319.             for (var year = 2015; year <= 2016; year++)
  320.                $('<option></option>')
  321.                     .attr('label', year)
  322.                     .attr('value', year)
  323.                     .html(year)
  324.                     .appendTo(yearSelector);
  325.         });
  326.  
  327.         //limits the characters input in the 'other details' text area
  328.         function charLimit(limitField, limitNum) {
  329.             if (limitField.value.length > limitNum) {
  330.                 limitField.value = limitField.value.substring(0, limitNum);
  331.             }
  332.         }
  333.     </script>
  334.     <div style="clear: both;"></div>
  335. </div>
  336. </div>
  337. </div>
  338. </div>
  339.  
  340. <div class="tandc"><?php echo $data['wb_foot']; ?></div>
  341. </div>
  342. </body>
  343. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement