基于时间的IP块与MySQL PHP

I am using ajax to store votes and currently trying to give every IP Adresse that has already voted a Block for 18 hours.

First I'm storing the IP and Time in the database but I can't seem to figure out how I check if the IP is found in my array and then if the time associated to the Ip is the matching with 18hours plus.

I am using a multidimensional array for each row in my database. This is what I have so far, but I am always getting either a 500 or unexpected end of JSON error.

 $currentip = $_SERVER['REMOTE_ADDR'];
    $time  = date('Y-m-d H:i:s');
    $exptime = date('Y-m-d H:i:s', strtotime('+18 Hours'));

    // Check IP
    $sqlip = "SELECT ip,exptime FROM `user_ip` ;";
    $storedip = array();
     if ($result = $this->databaseConnection->query($sqlip)){
         while($row = $result->fetch_assoc()) {
             $storedip = array($row['ip'], $row['exptime']);
            }       

      if(in_array($currentip, array_column($storedip, '0'))){
      $key = array_search($currentip, array_column($storedip, 0));

        if($time <= $storedip[$key][1]){
            echo json_encode("IP Block active", JSON_PRETTY_PRINT);
         }
      } 
      else{

         $setip = "INSERT INTO `user_ip` VALUES ('$currentip','$exptime');";
          if($this->executeDatabaseQuery($setip)){
        // Count Vote and do my stuff
          }
         }
     }

Your problem is here:

$storedip = array($row['ip'], $row['exptime']);

It should be:

$storedip[] = array($row['ip'], $row['exptime']);