Advertisement
Guest User

Untitled

a guest
Apr 10th, 2017
565
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.64 KB | None | 0 0
  1. <?php
  2.  
  3. if ($_SERVER['REQUEST_METHOD'] == 'POST') {
  4. $status = $_POST['status'];
  5. $uname = $_POST['uname'];
  6. $dept = $_POST['dept'];
  7. $ename = $_POST['ename'];
  8.  
  9. require_once('dbConnect.php');
  10.  
  11. $sql = "SELECT name,email FROM user WHERE mobile='" . $uname . "'";
  12. $check = mysqli_fetch_row(mysqli_query($con, $sql));
  13. $username = $check[0];
  14. $email = $check[1];
  15.  
  16. require_once 'smsapi/way2sms-api.php';
  17. sendWay2SMS('username', 'password', $uname,' Message');
  18.  
  19. require_once 'mailapi/PHPMailerAutoload.php';
  20. $mail = new PHPMailer;
  21.  
  22. $mail->isSMTP(); // Set mailer to use SMTP
  23. $mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
  24. $mail->SMTPAuth = true; // Enable SMTP authentication
  25. $mail->Username = 'username@gmail.com'; // SMTP username
  26. $mail->Password = 'password'; // SMTP password
  27. $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
  28. $mail->Port = 587; // TCP port to connect to
  29. $mail->setFrom('username@gmail.com', 'Name');
  30. $mail->addAddress($email, $username);
  31. $mail->isHTML(true);
  32. $mail->Subject = 'Subject';
  33. $mail->Body = 'Message';
  34. !$mail->send();
  35. }
  36. ?>
  37.  
  38. <?php
  39. require_once 'smsapi/way2sms-api.php';
  40. sendWay2SMS('username', 'password', $uname,' Message');
  41. ?>
  42.  
  43. <?php
  44. require_once 'mailapi/PHPMailerAutoload.php';
  45. $mail = new PHPMailer;
  46.  
  47. $mail->isSMTP(); // Set mailer to use SMTP
  48. $mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
  49. $mail->SMTPAuth = true; // Enable SMTP authentication
  50. $mail->Username = 'username@gmail.com'; // SMTP username
  51. $mail->Password = 'password'; // SMTP password
  52. $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
  53. $mail->Port = 587; // TCP port to connect to
  54. $mail->setFrom('username@gmail.com', 'Name');
  55. $mail->addAddress($email, $username);
  56. $mail->isHTML(true);
  57. $mail->Subject = 'Subject';
  58. $mail->Body = 'Message';
  59. !$mail->send();
  60. ?>
  61.  
  62. public void sendMessage(View view){
  63. StringRequest stringRequest = new StringRequest(Request.Method.POST, UPLOAD_URL1,
  64. new Response.Listener<String>() {
  65. @Override
  66. public void onResponse(String s) {
  67.  
  68. }
  69. },
  70. new Response.ErrorListener() {
  71. @Override
  72. public void onErrorResponse(VolleyError volleyError) {
  73. try {
  74. Toast.makeText(EventDetailActivity.this, volleyError.getMessage().toString(), Toast.LENGTH_LONG).show();
  75. }catch (Exception e){
  76.  
  77. }
  78. }
  79. }){
  80. @Override
  81. protected Map<String, String> getParams() throws AuthFailureError {
  82.  
  83. String Status = ebtn.getText().toString().trim().toLowerCase();
  84. SharedPreferences sharedPreferences = getSharedPreferences(SharedPrefConfig.SHARED_PREF_NAME,Context.MODE_PRIVATE);
  85. String uname = sharedPreferences.getString(SharedPrefConfig.USERNAME_SHARED_PREF, null);
  86. Map<String,String> params = new Hashtable<String, String>();
  87. params.put("status", Status);
  88. params.put("uname", uname);
  89. params.put("dept", dept);
  90. params.put("ename", name);
  91. return params;
  92. }
  93. };
  94. RequestQueue requestQueue = Volley.newRequestQueue(this);
  95. requestQueue.add(stringRequest);
  96. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement