Advertisement
Guest User

Untitled

a guest
Nov 2nd, 2016
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4.  
  5. //include 'helper/fnc.php';
  6.  
  7. if(isset($_GET['call']) == null)
  8. die();
  9.  
  10. $fnc = $_GET['call'];
  11. $arg = $_POST;
  12.  
  13. $fnc($arg);
  14.  
  15.  
  16.  
  17. header('Content-type: application/json');
  18.  
  19.  
  20. /**
  21. *
  22. * Returns object to sender request
  23. *
  24. * @param string Function
  25. * @param array Argument
  26. * @return object return to sender
  27. *
  28. */
  29. function returnToSender($fnc,$argArray){
  30.  
  31. $return = array();
  32.  
  33. array_push($return,$fnc);
  34. array_push($return,$argArray);
  35.  
  36. echo json_encode($return); // RETURN OBJECT NEVER FORGET !!!!
  37.  
  38. }
  39.  
  40.  
  41. /**
  42. *
  43. * Returns object to sender request
  44. *
  45. * @param array
  46. * @return nothing
  47. *
  48. */
  49. function demo($arg){
  50.  
  51. print_r($arg);
  52.  
  53.  
  54. returnToSender('demo',$arg);
  55.  
  56. };
  57.  
  58. function sendMail($arg){
  59.  
  60. $name = $arg["nickname"];
  61. $text = $arg["text"];
  62. $steamid = $arg["steamid"];
  63. $form = $arg["form"];
  64.  
  65.  
  66. $email = "zskullfox@gmail.com";
  67.  
  68.  
  69. $message = "Bewerbung von: " . $name . "\r\n\r\n" . $text . "\r\n\r\nSteam ID: ". $steamid;
  70.  
  71. require 'PHPMailer/PHPMailerAutoload.php';
  72.  
  73. $mail = new PHPMailer;
  74.  
  75.  
  76. //Send mail using gmail
  77.  
  78. $mail->IsSMTP(); // telling the class to use SMTP
  79. $mail->SMTPAuth = true; // enable SMTP authentication
  80. $mail->SMTPSecure = "ssl"; // sets the prefix to the servier
  81. $mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
  82. $mail->Port = 465; // set the SMTP port for the GMAIL server
  83. $mail->Username = $email; // GMAIL username
  84. $mail->Password = "philipp5693"; // GMAIL password
  85.  
  86. //Typical mail data
  87. $mail->AddAddress($email, $name);
  88. $mail->SetFrom("admin@xof.at", "Admin");
  89. $mail->Subject = $form;
  90. $mail->Body = $message;
  91.  
  92. try{
  93. $mail->Send();
  94. returnToSender('mailComplete',array('status' => true,"message"=> "Success!","formid" => "#" . $form ));
  95. } catch(Exception $e){
  96. returnToSender('mailComplete',array('status' => false,"message"=> $mail->ErrorInfo ,"formid" => "#" . $form ));
  97. }
  98.  
  99. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement