<?php /* GENERATIONAL BONUS */ include "../connect.php"; include "../function.php"; $dateny = dateny(); $query = "SELECT *,(SELECT SUM(points) FROM tbl_buyproduct_history WHERE referdata.child=accounts_id and gendate_end='{$dateny}') as totalpoints,(SELECT SUM(points) FROM tbl_buyproduct_history WHERE referdata.parent=accounts_id and gendate_end='{$dateny}') as totalpoints_parent FROM tbl_referdata as referdata WHERE id NOT IN (SELECT id FROM tbl_referdata_payout WHERE gendate='{$dateny}') HAVING totalpoints>=400 AND totalpoints_parent>=400 LIMIT 10"; $q = mysql_query($query); while ($row = mysql_fetch_array($q)) { $level = getlevelgen($row['child'], $row['level']); echo "Total Rebates:" . reward_gen($level) * $row['totalpoints']; echo "<br>"; echo "Rebates:" . reward_gen($level); echo "<br>"; echo "Monthly P:" . $row['totalpoints']; echo "<br>"; echo "Level:" . $level . ">>" . $row['level']; echo "<hr>"; addmoneybonus($row['parent'], reward_gen($level) * $row['totalpoints']); mysql_query("INSERT INTO tbl_referdata_payout SET id='" . $row['id'] . "',gendate='{$dateny}'"); }
<?php /* CRON FOR PERSONAL BONUS */ include "../connect.php"; include "../function.php"; $dateny = dateny(); $query = "SELECT * ,(SELECT SUM(points) FROM tbl_buyproduct_history WHERE buyprod.accounts_id=accounts_id and buyprod.gendate_end=gendate_end) as totalpoints FROM tbl_buyproduct_history as buyprod WHERE gendate_end='" . $dateny . "' AND is_paid='' GROUP by accounts_id,gendate_end HAVING totalpoints >= 400"; //echo $query; $q = mysql_query($query); while ($row = mysql_fetch_array($q)) { addmoneybonus($row['accounts_id'], personalbonus($row['totalpoints'])); mysql_query("UPDATE tbl_buyproduct_history SET is_paid='1' WHERE gendate_end='{$dateny}' AND accounts_id='" . $row['accounts_id'] . "'"); //echo $row['id']."<Br>"; } ?>
<?php /* CRON FOR DIRECT/INDIRECT BONUS PAYOUT */ include "../connect.php"; include "../function.php"; $dateny = dateny(); $q = mysql_query("SELECT * FROM tbl_referdata WHERE level<=10 AND paid='' LIMIT 10"); while ($row = mysql_fetch_array($q)) { addmoneybonus($row['parent'], reward($row['level'])); mysql_query("UPDATE tbl_referdata SET paid='1' WHERE id='" . $row['id'] . "'"); }