The crypt doesn't change the value of the database.



  • The MariaDB database is up on the server. When authorizing the user, the online value should change from 0 to 1. If you put a team in the console, it changes the meaning, but it's not in the crypt. What's the problem?

    #!/usr/bin/php
    <?php
    $bd = mysqli_connect("localhost","****","******");
    mysqli_select_db($bd,"*****");
    $user = getenv("username");
    $password = getenv("password");
    $nowtime=time();
    $qr="SELECT * FROM users where username='".$user."' AND password='".$password."' AND date>".$nowtime;
    $query=mysqli_query($bd,$qr) or die(mysqli_error());
    $strok=mysqli_num_rows($query);
    $status = "SELECT * FROM users where online and username = '".$user."'; 
    if (if $status == 0)
    "UPDATE users SET online = 1 where username = '".$user."';
    if ($strok==1)
    exit(0);
    else
    exit(1);
    ?>
    

    The whole code works except UPDATE.



  • #!/usr/bin/php
    <?php
    $bd = mysqli_connect("localhost","****","******");
    mysqli_select_db($bd,"*****");
    $user = getenv("username");
    $password = getenv("password");
    $nowtime=time();
    $qr="SELECT * FROM users where username='$user' AND password='$password' AND date>'$nowtime'";
    $query=mysqli_query($bd,$qr) or die(mysqli_error());
    $strok=mysqli_num_rows($query);
    $qr = "SELECT * FROM users where username = '$user'"; 
    $query=mysqli_query($bd,$qr) or die(mysqli_error());
    $row=mysqli_fetch_row($query);
    if ($row['online'] == 0){
        $qr="UPDATE users SET online = 1 where username = '$user'";
        $query=mysqli_query($bd,$qr) or die(mysqli_error());
    }
    if ($strok==1)
    exit(0);
    else
    exit(1);
    ?>
    


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2