Advertisement
Guest User

processQuesry.php

a guest
Mar 28th, 2015
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1. <?php
  2.  
  3. global $wpdb, $wp_hasher;
  4.  
  5. define('WP_USE_THEMES', false);
  6.  
  7. require_once('./wp-load.php');
  8.  
  9. $siteUser = $_COOKIE['siteUser'];
  10.  
  11. $fname = $_COOKIE['fname'];
  12. $lname = $_COOKIE['lname'];
  13. $email = $_COOKIE['email'];
  14. $phoneNum = $_COOKIE['pno'];
  15. $address = $_COOKIE["address"];
  16. $unit = $_COOKIE['unit'];
  17. $bedrooms = $_COOKIE['bedrooms'];
  18. $bathrooms = $_COOKIE['bathrooms'];
  19. $condition = $_COOKIE['condition'];
  20.  
  21. $wpdb->insert('userQuery',
  22. //new data
  23. array(
  24. 'First Name' => $fname,
  25. 'Last Name' => $lname,
  26. 'Email Address' => $email,
  27. 'Phone Number' => $phoneNum,
  28. 'Property Address' => $address,
  29. 'UNIT #' => $unit,
  30. 'Bedrooms' => $bedrooms,
  31. 'Bathrooms' => $bathrooms,
  32. 'Condition' => $condition,
  33. 'user' => $siteUser
  34. ));
  35.  
  36. $to[] = 'info@sickwebmedia.com';
  37. $to[] = 'tousifosman@gamil.com';
  38. $to[] = 'shawn@sickwebmedia.com';
  39. $to[] = 'info@valuetargeting.com';
  40.  
  41.  
  42. $emailList = $wpdb->get_results(
  43. "
  44. SELECT user_email
  45. FROM wp_users
  46. "
  47. );
  48. foreach ( $emailList as $email )
  49. {
  50. $to[] = $email->user_email;
  51. }
  52.  
  53.  
  54. $message = 'First Name : ' . $fname
  55. .'<br />Last Name : ' . $lname
  56. .'<br />Email Address : ' . $address
  57. .'<br />Phone Number : ' . $phoneNum
  58. .'<br />Property Address : ' . $address
  59. .'<br />UNIT # : ' . $unit
  60. .'<br />Bedrooms : ' . $bedrooms
  61. .'<br />Bathrooms : ' . $bathrooms
  62. .'<br />Condition : ' . $condition;
  63.  
  64. $headers[] = 'Content-Type: text/html; charset=UTF-8';
  65. $headers[] = 'From: valuetargeting <info@valuetargeting.com>' . "\r\n";
  66.  
  67. if (!wp_mail( 'tousifosman@gmail.com', 'New Request', $message, $headers)) {
  68. echo 'Mail not Sent';
  69. exit(1);
  70. }
  71.  
  72. wp_redirect( home_url().'/thank-you/' ); exit;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement