Advertisement
Guest User

Untitled

a guest
Dec 25th, 2018
306
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.35 KB | None | 0 0
  1. <?php require_once 'engine/init.php';
  2. protect_page();
  3. include 'layout/overall/header.php';
  4.  
  5. require_once('phpmailer/PHPMailer.php');
  6.  
  7. $price = 100;
  8. $player_points = (int)$user_znote_data['points'];
  9. $cid = (int)$user_data['id'];
  10.  
  11. if (isset($_POST['t']) && $_POST['t'] == 'd') {
  12. if ($player_points >= $price) {
  13. $new_recovery_key = strtoupper(generate_recovery_key(8));
  14. $update_account = mysql_update("UPDATE `accounts` SET `rkey`='$new_recovery_key' WHERE `id`='$cid'");
  15.  
  16. $new_points = $player_points - $price;
  17. $update_account = mysql_update("UPDATE `znote_accounts` SET `points`='$new_points' WHERE `account_id`='$cid'");
  18.  
  19. $wiadomosc = 'Success! You have generated a new recovery key for <b>' . $points . '</b> points!<br />Your recovery key: <b style="color:red;">' . $new_recovery_key . '</b>';
  20. echo $wiadomosc;
  21.  
  22. // wyslij maila
  23. $mail = new PHPMailer;
  24. $mail->CharSet = "UTF-8";
  25.  
  26. $mail->IsSMTP();
  27. $mail->Host = 'smtp.gmail.com'; # Gmail SMTP host
  28. $mail->Port = 465; # Gmail SMTP port
  29. $mail->SMTPAuth = true; # Enable SMTP authentication / Autoryzacja SMTP
  30. $mail->Username = "you@gmail.com"; # Gmail username (e-mail) / Nazwa użytkownika
  31. $mail->Password = "GMAIL PASSWORD"; # Gmail password / Hasło użytkownika
  32. $mail->SMTPSecure = 'ssl';
  33.  
  34. #$mail->From = ''; # REM: Gmail put Your e-mail here
  35. $mail->FromName = 'Realesta'; # Sender name
  36. $mail->AddAddress('send_to@adress', 'Name'); # # Recipient (e-mail address + name) / Odbiorca (adres e-mail i nazwa)
  37.  
  38. $mail->IsHTML(true); # Email @ HTML
  39.  
  40. $mail->Subject = 'New recovery key generated';
  41. $mail->Body = $wiadomosc;
  42. $mail->AltBody = $wiadomosc;
  43.  
  44. if(!$mail->Send()) {
  45. echo 'Some error... / Jakiś błąd...';
  46. echo 'Mailer Error: ' . $mail->ErrorInfo;
  47. exit;
  48. }
  49. } else {
  50. echo 'You dont have ' . $price . ' points.';
  51. }
  52. } else {
  53. echo '<font size="4">Do you really want to purchase new recovery key for <b>' . $price . '</b> premium points?</font>
  54. <form method="POST" action="">
  55. <input type="hidden" name="t" value="d">
  56. <input type="submit" value="Submit">
  57. </form>';
  58. }
  59.  
  60. include 'layout/overall/footer.php'; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement