Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. <?php
  2. ini_set('display_errors', 1);
  3. ini_set('display_startup_errors', 1);
  4. error_reporting(E_ALL);
  5.  
  6.  
  7. /*ini_set('display_startup_errors', 1);
  8. ini_set('display_errors', 1);
  9. error_reporting(-1);*/
  10. global $wpdb;
  11.  
  12. //die('x');
  13.  
  14. $user = wp_get_current_user();
  15. //if( current_user_can('editor') || current_user_can('administrator') || ( $user->roles[0] == 'shop_manager' )) {
  16.  
  17. // 'SELECT * FROM `wp_orders_onepage_v2` WHERE `product_id` = 61581 order by order_id asc'
  18. $orders = 'SELECT * FROM `wp_orders_onepage_v2` WHERE `product_id` = 61624 order by order_id asc';// LIMIT 500;
  19. $orders_array = $wpdb->get_results($orders, ARRAY_A);
  20.  
  21. foreach ($orders_array as $arr) {
  22. $mess=$arr['order_event'];
  23. if (strcasecmp( $arr['distanciya'], "7,5 км ") != 0 && strcasecmp( $arr['distanciya'], "Казанский Велопарад Тинькофф") != 0) { #Проверка на валидность дистанции
  24.  
  25. $phone = preg_replace('/\D/', '', $arr['phone']); #Проверка корректности номера
  26. if (strlen($phone) == 10 && $phone[0] == 9) {
  27. $phone = '7' . $phone;
  28. }
  29. if (strlen($phone) < 11 || intval($arr['billing_start_number']) <= 0) {
  30. continue;
  31. }
  32.  
  33. $message ='Вы участвуете в Тур де Татарстан Казань 2019 - '.$arr['distanciya'].' под №'. $arr['billing_start_number']; #Заданаие текста сообщения
  34.  
  35. $sendstring = 'http://smspilot.ru/api.php?send=' . $message . '&to=' . $phone . '&apikey=ZCTT45UU9G03M3N4G7LT7L68G8LCP4BHX719FWUPH3C1Y8G4OTF86TJ9OHV1JM32';
  36. $response = wp_remote_get($sendstring); #Отправка сообщения
  37. echo $response['response']['message'] . '<br>';
  38. }
  39.  
  40. }
  41.  
  42. //} ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement