Completed

Alterar programação php de time 60 para mês

Published on the December 03, 2018 in IT & Programming

About this project

Open

Alterar uma programação php que no meu site tem uma função que contabiliza um valor $ no balance  por minuto quando o usuário é membro PRO e gostaria de alterar essa função para contabilizar o valor $ uma vez só no mês apenas quando o usuário for membro pro.

A programação essa ABAIXO que precisa ser alterada a função:

if ($wo['loggedin'] == true && !isset($_GET['f'])) {
    $session_id  = (!empty($_SESSION['user_id'])) ? $_SESSION['user_id'] : $_COOKIE['user_id'];
    $id          = Wo_GetUserFromSessionID($session_id);
   
    $amount  = array(
                    0 => 0, // Usuário sem plano
                    1 => 1.00, // Usuário Estrela
                    2 => 1.00, // Usuário Quente
                    3 => 1.00, // Usuário Última
                    4 => 1.00  // Usuário VIP
                );

    $select = "select balance, pro_type from Wo_Users where user_id=".$Id." Limit 1";
    $result = mysqli_query($sqlConnect, $select) or die ("Error: ". $Select ." - ".  Mysqli_error($sqlConnect));
    $result = mysqli_fetch_assoc($result);
   
    $balance  = $result['balance'];
    $wo['setting']['balance'] = $balance;


    if ( !isset( $_SESSION['last-click'] ) ) {
        $_SESSION['last-click'] = time();
    } else {
        $difference =  ( time() - $_SESSION['last-click'] ) / 60;
        $difference = floor ($difference);
        if ( $difference > 0 && $difference <= 5) {
           
            $user_pro = 0;

            $user_pro = $result['pro_type'];

            $add      = floor( $difference ) * $amount[$user_pro];

            $balance += $add;
            $wo['setting']['balance'] = $balance;           

            $query    = "update Wo_Users set balance='".number_format($balance, 2)."' Where user_id=".$Id." Limit 1";
            mysqli_query($sqlConnect, $query) or die ( "error: " .mysqli_error($sqlConnect));
            $_SESSION['last-click'] = time();
        } else if ( $difference > 5 ) {
            $_SESSION['last-click'] = time();
        }
    }
}

Category IT & Programming
Subcategory Web development
What is the scope of the project? Small change or bug
Is this a project or a position? Project
I currently have I have specifications
Required availability As needed
API Integrations Other (Other APIs)
Roles needed Developer

Delivery term: November 15, 2018

Skills needed

PHP

Other projects posted by D. A.