Advertisement
Guest User

Untitled

a guest
Jun 3rd, 2017
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.02 KB | None | 0 0
  1. //############## GENERATE NEW RECOVERY KEY ###########
  2. if($action == "newreckey")
  3. {
  4. $reg_password = password_ency(trim($_POST['reg_password']));
  5. $reckey = $account_logged->getRecoveryKey();
  6. if((!$config['site']['generate_new_reckey'] || !$config['site']['send_emails']) || empty($reckey))
  7. $main_content .= 'You cant get new rec key';
  8. else
  9. {
  10. $points = $account_logged->getPremiumPoints();
  11. if($_POST['registeraccountsave'] == "1")
  12. {
  13. if($reg_password == $account_logged->getPassword())
  14. {
  15. if($points >= $config['site']['generate_new_reckey_price'])
  16. {
  17. $dontshowtableagain = 1;
  18. $acceptedChars = 'ABCDEFGHIJKLMNPQRSTUVWXYZ123456789';
  19. $max = strlen($acceptedChars)-1;
  20. $new_rec_key = NULL;
  21. // 10 = number of chars in generated key
  22. for($i=0; $i < 10; $i++) {
  23. $cnum[$i] = $acceptedChars{mt_rand(0, $max)};
  24. $new_rec_key .= $cnum[$i];
  25. }
  26. $main_content .= '<div class="TableContainer" > <table class="Table1" cellpadding="0" cellspacing="0" > <div class="CaptionContainer" > <div class="CaptionInnerContainer" > <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span> <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span> <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span> <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span> <div class="Text" >Account Registered</div> <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span> <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span> <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span> <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span> </div> </div> <tr> <td> <div class="InnerTableContainer" > <table style="width:100%;" ><ul>';
  27. $mailBody = '<html>
  28. <body>
  29. <h3>New recovery key!</h3>
  30. <p>You or someone else generated recovery key to your account on server <a href="'.$config['server']['url'].'"><b>'.$config['server']['serverName'].'</b></a>.</p>
  31. <p>Recovery key: <b>'.$new_rec_key.'</b></p>
  32. </body>
  33. </html>';
  34. require("phpmailer/class.phpmailer.php");
  35. $mail = new PHPMailer();
  36. if ($config['site']['smtp_enabled'] == "yes")
  37. {
  38. $mail->IsSMTP();
  39. $mail->Host = $config['site']['smtp_host'];
  40. $mail->Port = (int)$config['site']['smtp_port'];
  41. $mail->SMTPAuth = ($config['site']['smtp_auth'] ? true : false);
  42. $mail->Username = $config['site']['smtp_user'];
  43. $mail->Password = $config['site']['smtp_pass'];
  44. }
  45. else
  46. $mail->IsMail();
  47. $mail->IsHTML(true);
  48. $mail->From = $config['site']['mail_address'];
  49. $mail->AddAddress($account_logged->getEMail());
  50. $mail->Subject = $config['server']['serverName']." - new recovery key";
  51. $mail->Body = $mailBody;
  52. if($mail->Send())
  53. {
  54. $account_logged->setRecoveryKey(new_rec_key);
  55. $account_logged->setPremiumPoints($account_logged->getPremiumPoints()-$config['site']['generate_new_reckey_price']);
  56. $account_logged->save();
  57. $main_content .= '<br />Your recovery key were send on email address <b>'.$account_logged->getEMail().'</b> for '.$config['site']['generate_new_reckey_price'].' premium points.';
  58. }
  59. else
  60. $main_content .= '<br />An error occorred while sending email ( <b>'.$account_logged->getEMail().'</b> ) with recovery key! Recovery key not changed. Try again.';
  61. $main_content .= '</ul> </table> </div> </table></div></td></tr><br/><center><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=accountmanagement" method="post" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></td></tr></form></table></center>';
  62. }
  63. else
  64. $reg_errors[] = 'You need '.$config['site']['generate_new_reckey_price'].' premium points to generate new recovery key. You have <b>'.$points.'<b> premium points.';
  65. }
  66. else
  67. $reg_errors[] = 'Wrong password to account.';
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement