Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php require_once 'engine/init.php';
- protect_page();
- include 'layout/overall/header.php';
- require_once('phpmailer/PHPMailer.php');
- $price = 100;
- $player_points = (int)$user_znote_data['points'];
- $cid = (int)$user_data['id'];
- if (isset($_POST['t']) && $_POST['t'] == 'd') {
- if ($player_points >= $price) {
- $new_recovery_key = strtoupper(generate_recovery_key(8));
- $update_account = mysql_update("UPDATE `accounts` SET `rkey`='$new_recovery_key' WHERE `id`='$cid'");
- $new_points = $player_points - $price;
- $update_account = mysql_update("UPDATE `znote_accounts` SET `points`='$new_points' WHERE `account_id`='$cid'");
- $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>';
- echo $wiadomosc;
- // wyslij maila
- $mail = new PHPMailer;
- $mail->CharSet = "UTF-8";
- $mail->IsSMTP();
- $mail->Host = 'smtp.gmail.com'; # Gmail SMTP host
- $mail->Port = 465; # Gmail SMTP port
- $mail->SMTPAuth = true; # Enable SMTP authentication / Autoryzacja SMTP
- $mail->Username = "you@gmail.com"; # Gmail username (e-mail) / Nazwa użytkownika
- $mail->Password = "GMAIL PASSWORD"; # Gmail password / Hasło użytkownika
- $mail->SMTPSecure = 'ssl';
- #$mail->From = ''; # REM: Gmail put Your e-mail here
- $mail->FromName = 'Realesta'; # Sender name
- $mail->AddAddress('send_to@adress', 'Name'); # # Recipient (e-mail address + name) / Odbiorca (adres e-mail i nazwa)
- $mail->IsHTML(true); # Email @ HTML
- $mail->Subject = 'New recovery key generated';
- $mail->Body = $wiadomosc;
- $mail->AltBody = $wiadomosc;
- if(!$mail->Send()) {
- echo 'Some error... / Jakiś błąd...';
- echo 'Mailer Error: ' . $mail->ErrorInfo;
- exit;
- }
- } else {
- echo 'You dont have ' . $price . ' points.';
- }
- } else {
- echo '<font size="4">Do you really want to purchase new recovery key for <b>' . $price . '</b> premium points?</font>
- <form method="POST" action="">
- <input type="hidden" name="t" value="d">
- <input type="submit" value="Submit">
- </form>';
- }
- include 'layout/overall/footer.php'; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement