uawdijnntqw1x1x1
IP : 216.73.216.26
Hostname : server.wtmmart.in
Kernel : Linux server.wtmmart.in 4.18.0-553.45.1.el8_10.x86_64 #1 SMP Wed Mar 19 09:44:46 EDT 2025 x86_64
Disable Function : exec,passthru,shell_exec,system
OS : Linux
PATH:
/
home2
/
wtmwscom
/
public_html
/
admin
/
cronjob
/
cron_binary_income.php
/
/
<?php include '../../connection.php'; include '../../function_lib.php'; //$date = "2018-09-19"; //$datetime = $date." 23:59:59"; $datetime = date('Y-m-d H:i:s'); //$datetime = "2016-01-07 23:00:00"; /* $hour_now = date("H", strtotime($datetime)); //if($hour_now == 6 || $hour_now == 14 || $hour_now == 22){} if($hour_now >= 00 && $hour_now <= 06){ $closing_type = 1 ; } elseif($hour_now > 06 && $hour_now <= 12){ $closing_type = 2; } elseif($hour_now > 12 && $hour_now <= 18){ $closing_type = 3; } elseif($hour_now > 18 && $hour_now <= 23){ $closing_type = 4; } else{ $closing_type = 0; } */ $closing_type = 0; $result = mysqli_query($connection, "SELECT uid, refer_id, type, binary_type, is_paid FROM user WHERE reg_date <= '$datetime' AND is_paid=1 ORDER BY recid ASC "); while ($row = mysqli_fetch_object($result)) { $uid = $row->uid; $type = $row->type; $refer_id = $row->refer_id; $is_paid = $row->is_paid; $binary_type = $row->binary_type; //calculation($uid, $type, $closing_type, $datetime, $refer_id, $is_paid); $childs_left = get_paid_child_ids_by_reg_date_1d_array($uid, 'L', $datetime); $childs_right = get_paid_child_ids_by_reg_date_1d_array($uid, 'R', $datetime); //$childs_left = get_child_levels(get_paid_child_ids_by_reg_date($uid, 'L', $datetime)); //$childs_right = get_child_levels(get_paid_child_ids_by_reg_date($uid, 'R', $datetime)); $commission_ids_left = get_commission_ids($childs_left, $uid); $commission_ids_right = get_commission_ids($childs_right, $uid); //print_r($commission_ids_left); //echo "<br>"; //print_r($commission_ids_right); $n_of_i_left = count($commission_ids_left); $n_of_i_right = count($commission_ids_right); echo "<br/> | type: $type | uid: $uid | "; // if($type == 0) { // if ($n_of_i_left != 0 && $n_of_i_right != 0 && ($n_of_i_left>1 || $n_of_i_right>1)) { // calculate_binary_2_1($commission_ids_left, $commission_ids_right, $uid, $closing_type, $datetime, $refer_id, $is_paid); // //$type = 1; // $commission_ids_left = get_commission_ids($childs_left, $uid); // $commission_ids_right = get_commission_ids($childs_right, $uid); // if (count($commission_ids_left) != 0 && count($commission_ids_right) != 0) { // calculate_binary_1_1($commission_ids_left, $commission_ids_right, $uid, $closing_type, $datetime, $refer_id, $is_paid, $binary_type); // } // } // } // else{ if ($n_of_i_left != 0 && $n_of_i_right != 0) { calculate_binary_1_1($commission_ids_left, $commission_ids_right, $uid, $closing_type, $datetime, $refer_id, $is_paid, $binary_type); //calculation($uid, $type); } // } } /* For 1:1 pair this function is used */ function calculate_binary_1_1($commission_ids_left, $commission_ids_right, $uid, $closing_type, $datetime, $refer_id, $is_paid, $binary_type) { /* for applying capping at daily, weekly and monthly basis */ $date = date("Y-m-d", strtotime($datetime)); $daily_pair = mysqli_num_rows(mysqli_query($GLOBALS['connection'], "SELECT uid FROM binary_income WHERE uid = '$uid' AND date(datetime) = '" . $date . "' AND closing_type = '$closing_type' ")); // daily pair $total_binary_pair = mysqli_num_rows(mysqli_query($GLOBALS['connection'], "SELECT uid FROM binary_income WHERE uid = '$uid' ")); //$week_date = date("Y-m-d", strtotime('-1 week', strtotime(date('Y-m-d H:i:s')))); //$weekly_pair = mysqli_num_rows(mysqli_query($GLOBALS['connection'], "SELECT uid FROM binary_income WHERE uid = '$uid' AND datetime BETWEEN '$week_date' AND '$date'")); // weekly pair //$month_date = date("Y-m-d", strtotime('-1 month', strtotime(date('Y-m-d H:i:s')))); //$monthly_pair = mysqli_num_rows(mysqli_query($GLOBALS['connection'], "SELECT uid FROM binary_income WHERE uid = '$uid' AND datetime BETWEEN '$month_date' AND '$date'")); // monthly pair $n_of_i_left = count($commission_ids_left); $n_of_i_right = count($commission_ids_right); if ($n_of_i_left <= $n_of_i_right) { $j = $n_of_i_left; } elseif ($n_of_i_left > $n_of_i_right) { $j = $n_of_i_right; } $i = 0; //$current_pair_counter = 0; while ($i <= $j) { if (isset($commission_ids_left[$i])) { $uid1 = $commission_ids_left[$i]; if (isset($commission_ids_right[$i])) { $uid2 = $commission_ids_right[$i]; if ($daily_pair < 8) { //$current_pair_counter++; //if( (($total_binary_pair + $current_pair_counter) == 3) && (($total_binary_pair + $current_pair_counter) == 5) && (($total_binary_pair + $current_pair_counter) == 8) && (($total_binary_pair + $current_pair_counter) == 10) && (($total_binary_pair + $current_pair_counter) == 12) ){ //$amount = 0; //} else { // if ($total_binary_pair <= 15) { // $amount = 300; // } else if ($total_binary_pair > 15 && $total_binary_pair <= 30) { // $amount = 600; // } else if ($total_binary_pair > 30 ) { // $amount = 700; // } $amount = 500; //$income_on_income_amount = $amount * 0.10; if ($is_paid == 1) { $sql_income = "INSERT INTO `income` (uid, amount, income_type, datetime, status) VALUES ('$uid', '$amount', '2', '" . $datetime . "', 0)"; echo "type 1 $sql_income"; mysqli_query($GLOBALS['connection'], $sql_income); // income on income to sponser //mysqli_query($GLOBALS['connection'], "INSERT INTO `income` (uid, amount, income_type, datetime) VALUES ('$refer_id', '$amount', '5', '" . $datetime . "')"); } //} mysqli_query($GLOBALS['connection'], "INSERT INTO binary_income (uid, amount, datetime, closing_type) VALUES ('$uid', $amount, '" . $datetime . "', '$closing_type' )"); mysqli_query($GLOBALS['connection'], "INSERT INTO binary_done (uid, from_uid, datetime) VALUES ('$uid', '" . $uid1 . "', '" . $datetime . "')"); mysqli_query($GLOBALS['connection'], "INSERT INTO binary_done (uid, from_uid, datetime) VALUES ('$uid', '" . $uid2 . "', '" . $datetime . "')"); //mysqli_query($GLOBALS['connection'], "UPDATE user SET wallet = wallet + 250 WHERE uid = '$uid' "); $daily_pair++; } else { mysqli_query($GLOBALS['connection'], "INSERT INTO binary_done (uid, from_uid, datetime) VALUES ('$uid', '" . $uid1 . "', '" . $datetime . "')"); mysqli_query($GLOBALS['connection'], "INSERT INTO binary_done (uid, from_uid, datetime) VALUES ('$uid', '" . $uid2 . "', '" . $datetime . "')"); // break; } } } echo " | while counter = $i | "; $i++; } $daily_pair = 0; } /* For 2:1 or 1:2 pair this function is used, means first time calculation */ function calculate_binary_2_1($commission_ids_left, $commission_ids_right, $uid, $closing_type, $datetime, $refer_id, $is_paid, $binary_type) { $n_of_i_left = count($commission_ids_left); $n_of_i_right = count($commission_ids_right); if ($n_of_i_left > 1 || $n_of_i_right > 1) { $uid1 = $commission_ids_left[0]; $uid2 = $commission_ids_right[0]; if ($n_of_i_left > 1) { $uid3 = $commission_ids_left[1]; } else { $uid3 = $commission_ids_right[1]; } $amount = 100; //$income_on_income_amount = $amount * 0.10; mysqli_query($GLOBALS['connection'], "INSERT INTO binary_income (uid, amount, datetime, closing_type) VALUES ('$uid', '$amount', '" . $datetime . "', '$closing_type' )"); mysqli_query($GLOBALS['connection'], "INSERT INTO binary_done (uid, from_uid, datetime) VALUES ('$uid', '" . $uid1 . "', '" . $datetime . "')"); mysqli_query($GLOBALS['connection'], "INSERT INTO binary_done (uid, from_uid, datetime) VALUES ('$uid', '" . $uid2 . "', '" . $datetime . "')"); mysqli_query($GLOBALS['connection'], "INSERT INTO binary_done (uid, from_uid, datetime) VALUES ('$uid', '" . $uid3 . "', '" . $datetime . "')"); mysqli_query($GLOBALS['connection'], "UPDATE user SET type = '1', type_update_datetime='" . $datetime . "', board_type = '1' WHERE uid = '$uid' "); //add_user_to_board($uid, 1, $datetime); if ($is_paid == 1 && $binary_type == 1) { $sql_income = "INSERT INTO `income` (uid, amount, income_type, datetime) VALUES ('$uid', '$amount', '2', '" . $datetime . "')"; echo "type 0 $sql_income "; mysqli_query($GLOBALS['connection'], $sql_income); // income on income //mysqli_query($GLOBALS['connection'], "INSERT INTO `income` (uid, amount, income_type, datetime) VALUES ('$refer_id', '$amount', '5', '" . $datetime . "')"); } } } echo "<br/> Closing complete. Please close this browser."; ?>
/home2/wtmwscom/public_html/admin/cronjob/cron_binary_income.php