maar nu zijn er handige mensen bij die heel veel ip adressen gebruiken in dezelfde range nu wil ik alleen
de eerste 5 a 6 chars gebruiken van de ip om te blokken het script doet nu alleen het hele ip checken.
weet iemand hoe ik dit voorelkaar kan krijgen ?
zie onder dit is het probleem wil dus 005.101 blocken
2018-08-10 02:06:24 5.101.221.37
2018-08-10 02:07:28 5.101.221.91
2018-08-10 02:08:03 5.101.221.83
2018-08-10 02:08:51 5.101.221.52
2018-08-10 02:09:24 5.101.221.34
<?php
protected function check_payout_time($ip_address){
$this->ip_address = $this->DB->escape_string($ip_address);
$interval = "7 HOUR"; // hardcoded default interval if the custom interval is messed up
$interval_value = intval(substr($this->SETTINGS->config["payout_interval"],0,-1));
$interval_function = strtoupper(substr($this->SETTINGS->config["payout_interval"],-1));
if ($interval_value >= 0 && ($interval_function == "H" || $interval_function == "M" || $interval_function == "D")) {
$interval = $interval_value." ";
switch ($interval_function) {
case "M":
$interval .= "MINUTE";
break;
case "H":
$interval .= "HOUR";
break;
case "D":
$interval .= "DAY";
break;
}
}
$user_check = " AND (";
if ($this->SETTINGS->config["user_check"] == "ip_address" || $this->SETTINGS->config["user_check"] == "both") {
$user_check .= " `ip_address` = '". $this->ip_address ."'";
}
if ($this->SETTINGS->config["user_check"] == "wallet_address" || $this->SETTINGS->config["user_check"] == "both") {
$user_check .= ($this->SETTINGS->config["user_check"] == "both"?" OR":"")." `payout_address` = '". $this->payout_address ."'";
}
$user_check .= ")";
$query = sprintf("SELECT `id` FROM `%spayouts` WHERE `timestamp` > NOW() - INTERVAL %s",
$this->DB->TB_PRFX,
$interval.$user_check);
$result = $this->DB->query($query);
if ($row = @$result->fetch_assoc()) {
// user already received a payout within the payout interval
$this->status = SF_STATUS_PAYOUT_DENIED;
return false;
}
else {
// All is good, payment will be given
return true;
}
}
?>