diff --git a/ykval-sync.php b/ykval-sync.php index 0c28b34..8005c05 100644 --- a/ykval-sync.php +++ b/ykval-sync.php @@ -109,7 +109,13 @@ $sync->addField('otp', $syncParams['otp']); # Verify correctness of input parameters # -foreach (array('modified') as $param) { +foreach (array('modified','yk_counter', 'yk_use', 'yk_high', 'yk_low') as $param) +{ + // -1 is valid except for modified + if ($param !== 'modified' && $syncParams[$param] === '-1') + continue; + + // [0-9]+ if ($syncParams[$param] !== '' && ctype_digit($syncParams[$param])) continue; @@ -117,19 +123,6 @@ foreach (array('modified') as $param) { sendResp(S_MISSING_PARAMETER, $myLog, $apiKey); } -foreach (array('yk_counter', 'yk_use', 'yk_high', 'yk_low') as $param) { - if ($syncParams[$param] === '-1') - continue; - - if ($syncParams[$param] !== '' && ctype_digit($syncParams[$param])) - continue; - - $myLog->log(LOG_NOTICE, 'Input parameters ' . $param . ' not correct'); - sendResp(S_MISSING_PARAMETER, $myLog, $apiKey); -} - - - # # Get local counter data