Advertisement
Guest User

Untitled

a guest
Feb 12th, 2018
420
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.06 KB | None | 0 0
  1. title>Recover password / Recuperare parola - <?php echo Config::$_SITE_NAME; ?></title>
  2. <?php
  3. if(!defined('panel'))
  4. die('Nope.');
  5. if(isset($_SESSION['user'])) echo '<meta http-equiv="refresh" content="0;URL=\''.Config::$_PAGE_URL.'\'/>';
  6. ?>
  7. </div>
  8. <div class="main-content">
  9. <div class="breadcrumbs" id="breadcrumbs">
  10. <script type="text/javascript">
  11. try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
  12. </script>
  13.  
  14. <ul class="breadcrumb">
  15. <li>
  16. <i class="ace-icon fa fa-home home-icon"></i>
  17. <a href="<?php echo Config::$_PAGE_URL; ?>">Home</a>
  18. </li>
  19. <li class="active">Password recovery</li>
  20. </ul><!-- /.breadcrumb -->
  21.  
  22. <div class="nav-search" id="nav-search">
  23. <form method="POST" action="<?php echo Config::$_PAGE_URL; ?>search">
  24. <span class="input-icon">
  25. <input type="text" placeholder="Search ..." name="sname" id="username" type="submit" class="nav-search-input" autocomplete="on">
  26. <i class="ace-icon fa fa-search nav-search-icon"></i>
  27. </span>
  28. </form>
  29. </div> <!-- /.nav-search -->
  30. </div>
  31. <div class="page-content">
  32. <?php
  33. $ipaddress = getenv("REMOTE_ADDR") ;
  34. $now = date("Y-m-d H:i:s");
  35.  
  36. if(isset($_POST['submit'])) {
  37. if(!$_POST['recover']) {
  38. echo '<div class="alert alert-block alert-danger">Complete the field.</div>';
  39. } else {
  40. $q = Config::$g_con->prepare('SELECT * FROM `users` WHERE `name` = ?');
  41. $q->execute(array($_POST['recover']));
  42. while($row = $q->fetch(PDO::FETCH_OBJ))
  43. if($q->rowCount()) {
  44. $d = Config::$g_con->prepare('SELECT * FROM `recover` WHERE `name` = ?');
  45. $d->execute(array($_POST['recover']));
  46. if($d->rowCount()) {
  47. echo '<div class="alert alert-block alert-danger">Ai mai f&#259;cut deja o cerere de recuperare a parolei.</div>';
  48. }
  49. elseif($row->Email == "") {
  50. echo '<div class="alert alert-block alert-danger">Acest cont nu are o adres&#259; de Email.</div>';
  51. }
  52. else {
  53.  
  54. $email = $row->Email;
  55. $user = $row->name;
  56.  
  57. $first = md5(uniqid());
  58. $final_key = $first . md5($first);
  59.  
  60. $s = Config::$g_con->prepare("INSERT INTO recover (RecoverKey, name, email) VALUES (?, ?, ?)");
  61. $s->execute(array($final_key, $user, $email));
  62.  
  63. require 'inc/PHPMailerAutoload.php';
  64. $mail = new PHPMailer;
  65. $mail->isSMTP();
  66. $mail->Host = 'mail.h-godly.ro';
  67. $mail->SMTPAuth = true;
  68. $mail->Username = 'panel@h-godly.ro';
  69. $mail->Password = 'nu tio spun';
  70. $mail->SMTPSecure = 'tls';
  71. $mail->Port = 25;
  72. $mail->setFrom('user mail webhost', 'site link');
  73. $mail->addAddress($email);
  74. $mail->Subject = 'H-Godly - password recovery / recuperare parola';
  75. $mail->Body = "$user,
  76. [RO] Ai primit acest email pentru ca ai solicitat resetarea parolei pe serverul H-godly
  77. Daca nu doresti sa iti schimbi parola, poti ignora/sterge acest email.
  78. Pentru a-ti schimba parola, da click pe link-ul de mai jos:
  79. ".Config::$_PAGE_URL."change/".$final_key."
  80.  
  81.  
  82. [EN] You have recived this email because you have requested a reset of your password on H-godly
  83. If you don't want to change your password, please ignore this email.
  84. To change your password, please click the link above this message.
  85.  
  86. Cu stima,
  87. Echipa H-godly
  88. Contact: bafu_toto@yahoo.it";
  89. if(!$mail->send()) {
  90. echo 'Email could not be sent.';
  91. } else {
  92. $email1 = explode('@', $email);
  93. $first_part = $email1[0];
  94. $domain = $email1[1];
  95. $newemail = substr($first_part, 0, 4) . "****@" . substr($domain, 0, 10);
  96. echo "<div class='alert alert-block alert-success'><center>Code sent!<br />The verification code was sent to ". $newemail ."!<br />Please check your email. Also check the Spam folder!</center></div>";
  97. }
  98.  
  99.  
  100. }
  101.  
  102. }
  103. else echo '<div class="alert alert-block alert-danger">Nume incorect.</div>';
  104. }
  105. }
  106.  
  107.  
  108. ?>
  109.  
  110. <div class="row-fluid">
  111. <div class="span12">
  112. <center>
  113. <form method="POST" action="" accept-charset="UTF-8">
  114. <label>Username:</label><br />
  115. <input type="text" name="recover"><br />
  116. <br>
  117. <input class="btn btn-inverse" name="submit" type="submit" value="Recover password">
  118. </form>
  119. </center>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement