Page 1 of 1

Help me !!!!!!!!

Posted: Sun Apr 05, 2015 9:31 pm
by iEvil
Well, I'm trying to change this code , the invez to be 30 days to breathe out the vip I wanted it to be two hours , can arumar this for me please ? :(

Code: Select all

<?php
$file = "./users.txt";
$fh = fopen($file,'r+');
$infouser = htmlspecialchars($_GET["user"]);
$infopass = htmlspecialchars($_GET["pass"]);
$infoHDI  = htmlspecialchars($_GET["hdi"]);
$users = '';
$libera = false;
while(!feof($fh)) {

    $user = explode(',',fgets($fh));

    $username = trim($user[0]);
    $password = trim($user[1]);
    $data     = trim($user[2]);
    $HDI      = trim($user[3]);
    $status   = trim($user[4]);
    if (!empty($username) AND !empty($password)) {
        if ($username == $infouser AND $password == $infopass    ) {
           
           if (empty($data) AND empty($HDI) AND empty($status)){
            $libera = true;
            $data   = date('d-m-Y');
            $data   = date('d-m-Y', strtotime("+1 month", strtotime($data))); 
            $HDI    = $infoHDI;
            $status = "OK";
            $data_inicial =  date('Y-m-d');
            $data_final = $data;
            $time_inicial = strtotime($data_inicial);
            $time_final = strtotime($data_final);
            $diferenca = $time_final - $time_inicial; 
            $dias = (int)floor( $diferenca / (60 * 60 * 24)); 
            echo $status . "|" . $HDI . "|" . $dias; 
           }else{
            $libera = true;
            $data_inicial =  date('Y-m-d');
            $data_final = $data;
            $time_inicial = strtotime($data_inicial);
            $time_final = strtotime($data_final);
            $diferenca = $time_final - $time_inicial; 
            $dias = (int)floor( $diferenca / (60 * 60 * 24)); 
            if ($dias < 0) {
              //Acabou
              $status = "Acabou";
              echo $status . "|" . $HDI . "|" . $dias;     
            }else{
            echo $status . "|" . $HDI . "|" . $dias;   
             
            }
            
        }
        }

        $users .= $username . ',' . $password .','. $data . ',' . $HDI . ',' . $status ;
        $users .= "\r\n";
     }
}

file_put_contents($file, $users);

fclose($fh); 

if ( $libera == false ){
echo "Nao Cadastrado";

}
?>

Re: Help me !!!!!!!!

Posted: Mon Apr 06, 2015 11:04 am
by Christopher
I do not understand what "the invez to be 30 days to breathe out the vip I wanted it to be two hours" means? Have you tried to change "+1 month" to "+2 hours" ?

Re: Help me !!!!!!!!

Posted: Thu Apr 09, 2015 9:27 pm
by iEvil
Excuse me I was implying that did not want it inspired the vip (which is the function of the code ) in 30 days more in 2 hours


The problem is that I do not know how to do this , he is the one that uses php in my program , I Faso vb.net programming and this code was a friend of mine who did
without asking a lot, you could arrange for me please ? :roll:

Re: Help me !!!!!!!!

Posted: Fri Apr 10, 2015 5:00 pm
by Christopher
Christopher wrote:Have you tried to change "+1 month" to "+2 hours" ?

Re: Help me !!!!!!!!

Posted: Fri Apr 10, 2015 11:34 pm
by iEvil
Thanks , sorry for my lack of kkk brain , just went now understand O.o