Advertisement
Guest User

Untitled

a guest
Jun 3rd, 2017
521
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.27 KB | None | 0 0
  1. <?php
  2.  
  3. session_start();
  4. require_once (__DIR__.'/../config.php');
  5. require_once (__DIR__.'/jsonRPCClient.php');
  6. require (__DIR__.'/../dbconnect.php');
  7. require '../../phpmail/PHPMailerAutoload.php';
  8.  
  9. function send($address, $subject, $body) {
  10. $mail = new PHPMailer;
  11. $mail->isSMTP(); // Set mailer to use SMTP
  12. $mail->Host = 'mail.privateemail.com'; // Specify main and backup SMTP servers
  13. $mail->SMTPAuth = true; // Enable SMTP authentication
  14. $mail->Username = 'info@1337casino.com'; // SMTP username
  15. $mail->Password = 'YOURPASSWORDHERE'; // SMTP password
  16. $mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
  17. $mail->Port = 465; // TCP port to connect to
  18.  
  19. $mail->setFrom('info@1337casino.com', '1337 Casino Admin');
  20. $mail->addAddress($address, $address); // Add a recipient
  21.  
  22. $mail->addReplyTo('info@1337casino.com', 'info@1337casino.com');
  23.  
  24.  
  25.  
  26. $mail->isHTML(true); // Set email format to HTML
  27.  
  28. $mail->Subject = $subject;
  29. $mail->Body = $body;
  30. $mail->AltBody = $body;
  31.  
  32. if(!$mail->send()) {
  33. echo 'Message could not be sent.';
  34. echo 'Mailer Error: ' . $mail->ErrorInfo;
  35. }
  36.  
  37. }
  38.  
  39. $mysql_hostname = $DB_host;
  40. $mysql_user = $DB_user;
  41. $mysql_password = $DB_pass;
  42. $mysql_database = $DB_name;
  43. $prefix = "";
  44. $bd = mysql_connect($mysql_hostname, $mysql_user, $mysql_password) or die("Could not connect database");
  45. mysql_select_db($mysql_database, $bd) or die("Could not select database");
  46.  
  47.  
  48.  
  49. $user = $_SESSION['userID'];
  50. #$balance = filter_input(INPUT_POST, 'b', FILTER_SANITIZE_STRING);
  51. $add = filter_input(INPUT_POST, 'to', FILTER_SANITIZE_STRING);
  52. $amount = filter_input(INPUT_POST, 'a', FILTER_VALIDATE_FLOAT);
  53. $ip = filter_input(INPUT_POST, 'i', FILTER_VALIDATE_IP);
  54. $secret = filter_input(INPUT_POST, 'csrf', FILTER_SANITIZE_STRING);
  55.  
  56. $us = mysql_query("SELECT * FROM blackjack_users WHERE id = '" . $user . "'");
  57. $fetch = mysql_fetch_assoc($us);
  58.  
  59. if ($secret != $_SESSION['secret'] || empty($_SESSION['secret'])) {
  60. echo 'csrf protection triggered';
  61. exit;
  62. }
  63.  
  64.  
  65. if ($add){
  66. if ($fetch['balance'] > 0 && $fetch['balance'] >= $amount && $fetch['balance'] >= 1.0) {
  67. $now = strtotime('now');
  68. $t = mysql_real_escape_string(hash('sha1', rand()));
  69. $t2 = mysql_real_escape_string(hash('sha1', rand()));
  70. mysql_query("UPDATE blackjack_users SET balance = (balance-$amount) WHERE id = '" . $user . "'");
  71. mysql_query(
  72. "INSERT INTO withdraw(userID,btcadd,amount,timest,token,token2,ip,activated) "
  73. . "VALUES ('$user','$add','$amount','$now','$t','$t2','$ip','0')"
  74. );
  75. $mail = trim($fetch['email']);
  76. $ipadd = explode(".", $ip);
  77. $ipnew = $ipadd[0] . $ipadd[1] . $ipadd[2] . "*";
  78.  
  79. $headers = "From: $adminEmail\r\n"
  80. ."Reply-To: $adminEmail\r\n"
  81. ."Return-Path: $adminEmail\r\n"
  82. ."MIME-Version: 1.0\r\n"
  83. ."Content-Type: text/html; charset=UTF-8\r\n";
  84.  
  85. $message = "<html><head>
  86. <title>$shortTitle Withdraw</title>
  87. </head><body><br><p></p>Please Confirm your withdraw of <b>"
  88. .($amount * 100)."</b> " . $coinSymbol . " to <b>" . $add . "</b>, by clicking here:
  89. <br>
  90. <a href='" . $domain . "accounts/confirm.php?t=" . $t
  91. . "'>" . $domain . "accounts/confirm.php?t=" . $t . "</a>
  92. <br>
  93. <br>
  94. <p>Withdraw requested by ip: " . $ipnew . "</p>
  95. </body>
  96. </html>";
  97.  
  98. $adminMessage = "<html><body>User $user wants to withdraw ".number_format($amount,7)."<br>"
  99. ."<a href='" . $domain . "accounts/confirm.php?t=$t2&a=1'>Approve</a></body></html>";
  100.  
  101. $subject = 'Withdrawal Request';
  102. $sent1 = send($mail, $subject, $message);
  103. $subject2 = '1337Casino.com Withdraw Approval';
  104. $sent2 = send($adminEmail, $subject2, $adminMessage);
  105.  
  106.  
  107. if ($sent1 && $sent2) echo "Please check your email ($mail)";
  108. else echo 'Could not send mail to '.$mail.' !';
  109. } else {
  110. echo "Insufficient fund";
  111. }
  112. } else echo 'Need to specify receiving address';
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement