Advertisement
smaction

Here is everything above the mail (which is end of code)

Jan 3rd, 2019
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.24 KB | None | 0 0
  1. /**
  2.  * Created by PhpStorm.
  3.  * User: scott
  4.  * Date: 12/17/18
  5.  * Time: 12:07 PM
  6.  */
  7.  
  8. // Import PHPMailer classes into the global namespace
  9. // These must be at the top of your script, not inside a function
  10. use PHPMailer\PHPMailer\PHPMailer;
  11. use PHPMailer\PHPMailer\Exception;
  12.  
  13. //Load Composer's autoloader
  14. require 'vendor/autoload.php';
  15. include('Rework.php');
  16. include('DateTimeStuff.php');
  17.  
  18. $reworks = new Rework;
  19.  
  20. $accounts = $reworks->get_list_of_accounts();
  21.  
  22. foreach($accounts as $account){
  23.  
  24.     if (is_null($account['account_no'])){
  25.         continue;
  26.     }
  27.     $zero = $reworks->fetch_zero_ranks($account['account_no']);
  28.     $keywords = $reworks->number_of_keywords($account['account_no']);
  29.     //var_dump($keywords[0][ 'COUNT(keyword)']);
  30.     //var_dump($zero);
  31.     $zeros = $zero[1]['zero'];
  32.     $numkeywords = $keywords[0]['COUNT(keyword)'];
  33. //    var_dump($zeros);
  34. //    var_dump($numkeywords);
  35.    
  36.    /* if ($keywords[0][ 'COUNT(keyword)']= 0){
  37.    continue;
  38.     }
  39.     if(($zero[1]['zero']/$keywords[0][ 'COUNT(keyword)']) > .5){
  40.         $reworks->send_rework_mail($account['account_no']);
  41.     }*/
  42.  
  43.     if(($zeros/$numkeywords) > .5){
  44.         $latest = $reworks->already_in_rework($account['account_no']);
  45. //        var_dump($latest);
  46.         if(!$latest || date() > $latest['end_date']){
  47.  
  48.        
  49.        
  50.            
  51.                echo "Account: ".$account['account_no'].": ".$zeros."/".$numkeywords."    Result: ".($zeros/$numkeywords)."\r\n";
  52.                file_put_contents('current/rework.txt', "Account: ".$account['account_no'].": ".$zeros."/".$numkeywords."    Result: ".($zeros/$numkeywords)."\r\n", FILE_APPEND | LOCK_EX);
  53.                
  54.          
  55.  
  56.          
  57.              
  58.                  $date = new DateTime();
  59.                       $start = $date->format('Y-m-d');
  60.                       $end = $date->add(new DateInterval('P28D'));
  61.                       $end = $end->format('Y-m-d');
  62.          
  63.                       $result = $reworks->put_for_rework($account['account_no'], $start, $end);
  64.              
  65.  
  66.         }
  67.  
  68.     }
  69.     else{
  70.         echo "Account: ".$account['account_no'].": ".$zeros."/".$numkeywords."  Good Result: ".($zeros/$numkeywords)."\r\n";
  71.     }
  72.     // add mail function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement