// die('MySQL error: ' . mysql_error()); //} //$phones = array(); //while($row = mysql_fetch_row($result)) { // $phones[] = $row[0]; //} //mysql_free_result($result); // //$new_status = WAITING_CODE; //if (count($phones) >= ANTIFRAUD_MAX_PHONES_PER_WM_PER_HOUR) // if (!in_array($user_phone, $phones)) { // $new_status = REJECTED_FRAUD; // } // //if ($ran <= 3 and $new_status == WAITING_CODE) { // $new_status = MANUAL_TRANSFER; //} /************************************************************************************ Сохранение информации об СМСке ************************************************************************************/ $partner = $session->partner; if ($parner) { $sms->partner_earning = $partner->earning_percent / 100.0 * $sms->service_earning; } $sms->status = SMS_STATUS_OK; $sms->put(); stat_sms_received($session->id, $session->test_id, $session->partner_id, $session->day, $session->paid, $sms->service_earning, $sms->partner_earning); /************************************************************************************ Готово ************************************************************************************/ reply(sprintf(SMS_REPLY_OK, $session->sms_resp));
$start_time = time() - $day_ordinal * 60 * 60 * 24 + $timeofday; $day = strftime('%Y-%m-%d', $start_time); $session_id = stat_test_started($test->id, $partner_id, $day, $test->all_questions[0]->id, $test->sms_enabled); $r = rand(0, 100); $count_questions = $r <= $percent_sessions[0] ? rand(0, count($test->all_questions) - 1) : count($test->all_questions) - 1; for ($q = 0; $q < $count_questions; $q++) { $question = $test->all_questions[$i]; $answer = $question->all_answers[rand(0, count($question->all_answers) - 1)]; stat_question_answered($session_id, $test->id, $partner_id, $day, $question->id, $answer->id, $test->all_questions[$i + 1]->id, $test->sms_enabled); } if ($r > $percent_sessions[0]) { $question = $test->all_questions[count($test->all_questions) - 1]; $answer = $question->all_answers[rand(0, count($question->all_answers) - 1)]; stat_test_finished($session_id, $test->id, $partner_id, $day, $question->id, $answer->id, $test->sms_enabled, random_string(REATESTER_SMS_CHAL_LENGTH), random_string(REATESTER_SMS_RESP_LENGTH)); if ($r > $percent_sessions[1]) { stat_sms_received($session_id, $test->id, $partner_id, $day, $test->sms_enabled, 300, 200); } } } $daily_statistics_by_partner = group_by(DailyStatistics::query("ORDER BY day"), "partner_id"); $payment_dates = array(); for ($i = 0; $i < $payment_count; $i++) { $payment_dates[] = time() - rand(0, 60 * 60 * 24 * $time_range); } sort($payment_dates); $partner_last_payment = array(); $partner_last_stat_index = array(); for ($i = 0; $i < count($all_partners); $i++) { $partner_last_payment[] = null; $partner_last_stat_index[$i] = 0; }