| Current Path : /home2/wtmwscom/www/admin/ |
| Current File : /home2/wtmwscom/www/admin/cron_binary_type_update.php |
<?php
include '../connection.php';
include '../function_lib.php';
$datetime = date('Y-m-d H:i:s');
$result = mysqli_query($connection, "SELECT uid, type FROM user WHERE reg_date <= '$datetime' AND type=0 ORDER BY recid ASC ");
while($row = mysqli_fetch_object($result)) {
$uid = $row->uid;
$type = $row->type;
$childs_left = get_child_levels(get_child_ids_by_reg_date($uid, 'L', $datetime));
$childs_right = get_child_levels(get_child_ids_by_reg_date($uid, 'R', $datetime));
$n_of_i_left = count($childs_left);
$n_of_i_right = count($childs_right);
if($type == 0) {
if ( ($n_of_i_left >=2 && $n_of_i_right >=1) || ($n_of_i_left >=1 && $n_of_i_right >=2) ) {
mysqli_query($connection, "UPDATE user SET type = '1', type_update_datetime='" . $datetime . "' WHERE uid = '$uid' ");
//echo " uid: $uid , ";
}
}
}
?>