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
/
.
/
cron_matching_income.php
/
/
<?php session_start(); include '../connection.php'; include '../function_lib.php'; //if(isset($_SESSION['adminid']) && !empty($_SESSION['adminid'])) { $result = mysqli_query($connection, "select uid from user ORDER BY uid"); while($row = mysqli_fetch_object($result)){ $uid = $row->uid; //$row_uid = mysqli_fetch_object(mysqli_query($connection, "select `left`, `rigth` from user where uid = '".$uid."'")); // $uid_left = $row_uid->left; // $uid_right = $row_uid->rigth; //echo $uid."<br/>"; $amount_left = 0; $amount_right = 0; $childs_left = get_child_levels(get_child_ids_2($uid, 'L')); $childs_right = get_child_levels(get_child_ids_2($uid, 'R')); $amount_left = get_pv_amount($childs_left); $amount_right = get_pv_amount($childs_right); // if($uid_left != 0){ // $uid_array_left = array(); // $tree = new Tree(); // $tree->root = $uid_left; // $uid_array_left = $tree->get_tree_node($uid_left, 0); // $amount_left = get_pv_amount($uid_array_left); // // } // if($uid_right != 0){ // $uid_array_right = array(); // $tree = new Tree(); // $tree->root = $uid_right; // $uid_array_right = $tree->get_tree_node($uid_right, 0); // $amount_right = get_pv_amount($uid_array_right); // } if($amount_left !=0 || $amount_right != 0) { $amount_left = $amount_left + get_carry_amount($uid, 'left_carry_amount'); $amount_right = $amount_right + get_carry_amount($uid, 'right_carry_amount'); } //echo $uid.' '.$amount_left.' - '.$amount_right."<br/>"; $date = date('Y-m-d'); $count = 0; if($amount_left != 0 && $amount_right == 0){ $is_insert = mysqli_query($connection, "insert into my_earning(uid, date, amount_left, amount_right, matching_amount, left_carry_amount, right_carry_amount) values( $uid, '".$date."', $amount_left, $amount_right, 0, $amount_left, $amount_right)"); if($is_insert) $count++; } elseif($amount_left == 0 && $amount_right != 0){ $is_insert = mysqli_query($connection, "insert into my_earning(uid, date, amount_left, amount_right, matching_amount, left_carry_amount, right_carry_amount) values( $uid, '".$date."', $amount_left, $amount_right, 0 , $amount_left, $amount_right)"); if($is_insert) $count++; } elseif($amount_left != 0 && $amount_right != 0){ $capping_matching_amount=250000; if($amount_left > $amount_right){ $matching_amount = $amount_right >= $capping_matching_amount ? $capping_matching_amount : $amount_right; $left_carry = $amount_left - $amount_right; $right_carry = 0; } elseif($amount_right > $amount_left){ $matching_amount = $amount_left >= $capping_matching_amount ? $capping_matching_amount : $amount_left; $right_carry = $amount_right - $amount_left; $left_carry = 0; } elseif($amount_left == $amount_right){ $matching_amount = $amount_left >= $capping_matching_amount ? $capping_matching_amount : $amount_left; $right_carry = 0; $left_carry = 0; } else{ $matching_amount = 0; $left_carry = 0; $right_carry = 0; } $is_insert = mysqli_query($connection, "insert into my_earning(uid, date, amount_left, amount_right, matching_amount, left_carry_amount, right_carry_amount) values( $uid, '".$date."', $amount_left, $amount_right, $matching_amount, $left_carry, $right_carry)"); $balance = $matching_amount * 0.10; //mysqli_query($connection, "update user set wallet = wallet + $balance where uid = '$uid'"); mysqli_query($connection, "INSERT INTO binary_income (uid, amount, datetime, closing_type, matching_amount) VALUES " . "('$uid', $balance, '".date('Y-m-d H:i:s')."', '0', $matching_amount )"); save_referral_income($uid, $balance *0.10, date('Y-m-d H:i:s')); if($is_insert) $count++; //if($uid == 100){ echo $amount_left.' - '.$amount_right; die;} } } mysqli_query($connection, "update product_sale set status = 1 where status = 0"); //echo "Record generated = $count"; echo "<br/> Closing complete. Please close this browser."; //}else{ // redirect('./index.php'); //} function get_pv_amount($id_array){ //foreach($id_array as $value){ $amount = 0; if(!empty ($id_array)) { $uid_in = implode(" , ", $id_array); $result = mysqli_query($connection, "select pv_amount from product_sale where uid in ( $uid_in ) and status = 0"); $rec_id_array = array(); while($row = mysqli_fetch_object($result)){ $amount = $amount + $row->pv_amount; // $rec_id_array[] = $row->rec_id; } // } /* if(!empty($rec_id_array)){ $rec_id = implode(" , ", $rec_id_array); mysqli_query($connection, "update product_sale set status = 1 where rec_id in ( $rec_id) "); }*/ } return $amount; } function get_carry_amount($uid, $position){ $amount = 0; //die("select max(rec_id), $position as amount from my_earning where uid = $uid and $position != 0"); $rs = mysqli_query($connection, "select $position as amount from my_earning where rec_id = ( select max(rec_id) from my_earning where uid = $uid )"); if(mysqli_num_rows($rs)){ $amount = $amount + mysqli_fetch_object($rs)->amount; } return $amount; } function save_referral_income($uid, $amount, $datetime){ $refer_id = mysqli_fetch_object(mysqli_query($connection, "SELECT refer_id FROM user WHERE uid='$uid' "))->refer_id; //$amount = 100; mysqli_query($connection, "INSERT INTO `referral_income` (uid, from_uid, amount, datetime) VALUES ('$refer_id', '" . $uid . "', '$amount', '" . $datetime . "')"); //mysqli_query($connection, "UPDATE user SET wallet = wallet + $amount WHERE uid = '$refer_id' "); } ?>
/home2/wtmwscom/public_html/admin/./cron_matching_income.php