Skip to content
Permalink
Browse files Browse the repository at this point in the history
Ensure provided period is a valid integer and a known value
  - if provided period is not an integer or a known value, we
    raise an exception
  • Loading branch information
dfranco committed Sep 25, 2017
1 parent 2349d14 commit 90d4c44
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions client-report.php
Expand Up @@ -64,6 +64,15 @@

$period = CHttpRequest::get_Value('period');

// Check if period is an integer and listed in known periods
if(!array_key_exists( $period, $periods_list)) {
throw new Exception('Critical: provided value for (period) is unknown or not valid');
}

if(!filter_var($period, FILTER_VALIDATE_INT)) {
throw new Exception('Critical: provided value for (period) is unknown or not valid');
}

$view->assign( 'no_report_options', 'false');

// Client informations
Expand Down

0 comments on commit 90d4c44

Please sign in to comment.