function run_cron() { if ($this->sql_options == NULL) { return; } $sql_queries = $this->create_query(); foreach ($sql_queries as $company_id => $date_ranges) { $this->final_report[$company_id]['rc_results'] = array(); foreach ($date_ranges as $date_range => $sql_query) { $result = sql_query_read($sql_query); if (!$result) { echo "<p><b>" . mysql_error() . "</b><br>{$sql_query}</p>"; } else { if ($row = mysql_fetch_assoc($result)) { $this->final_report[$company_id]['rc_results'] += $row; } else { $this->final_report[$company_id]['rc_results'][$date_range] = 0; } } } $risk_calc = get_merchant_quick_status($company_id); $this->final_report[$company_id]['rc_risk_value'] = $risk_calc['percent']; $this->final_report[$company_id]['rc_date_time'] = time(); $this->final_report[$company_id]['rc_results'] = serialize($this->final_report[$company_id]['rc_results']); $this->goto_sleep(); } $sql = array(); foreach ($this->final_report as $company_id => $fields) { $values = "rc_company_id = {$company_id}"; foreach ($fields as $field => $value) { $values .= ($values != "" ? ", " : "") . "{$field} = \"" . quote_smart($value) . "\""; } $sql = "INSERT cs_risk_cron SET {$values} ON DUPLICATE KEY UPDATE {$values}"; $res = sql_query_write($sql) or dieLog("error" . mysql_error() . "<pre>{$sql}</pre>"); $this->goto_sleep(); } }
<td class="infoHeader">Action</td> <td class="infoHeader">Score</td> </tr> <?php $companyInfo = NULL; $display_none = "1"; //if($no_display==true) $display_none = "0"; $qry_company = "select * from {$company_table_sql} as cd where {$display_none} {$userList_sql} {$bank_sql_limit} and cd_pay_status='payable' and cd_ignore=0 order by cd_next_pay_day ASC"; //etelPrint($qry_company); $gatewayid = -1; $company_details = sql_query_read($qry_company) or dieLog("Cannot execute query: {$qry_company}"); while ($companyInfo = mysql_fetch_assoc($company_details)) { $sql = 0; $error = 0; //sleep(1); $quick_status = get_merchant_quick_status($companyInfo['userId']); while (pastPayPeriod() && $error < 1000) { $pushedBack = pushBackOnePeriod(); $sql = "Update cs_companydetails set `cd_next_pay_day` = '{$pushedBack}' where userId = '" . $companyInfo['userId'] . "'"; $companyInfo['cd_next_pay_day'] = $pushedBack; $error++; if ($error == 1000) { print "Error " . $companyInfo['userId'] . "<BR>"; } } if ($sql) { sql_query_write($sql) or dieLog(mysql_error() . " ~ {$sql}"); } $date_hold = 0; $mi_pay_info = calcReal(strtotime($companyInfo['cd_next_pay_day'])); $pay_checked = '';