Ignore:
Timestamp:
Aug 22, 2014, 11:09:17 AM (10 years ago)
Author:
plg
Message:

use filter_var for checking int/float values from user input instead of preg_match (PHP 5.2+)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/batch_manager.php

    r29244 r29245  
    132132    foreach (array('min_width','max_width','min_height','max_height') as $type)
    133133    {
    134       if ( preg_match('#^[0-9]+$#', $_POST['filter_dimension_'. $type ]) )
     134      if (filter_var($_POST['filter_dimension_'.$type], FILTER_VALIDATE_INT) !== false)
    135135      {
    136136        $_SESSION['bulk_manager_filter']['dimension'][$type] = $_POST['filter_dimension_'. $type ];
     
    139139    foreach (array('min_ratio','max_ratio') as $type)
    140140    {
    141       if ( preg_match('#^[0-9\.]+$#', $_POST['filter_dimension_'. $type ]) )
     141      if (filter_var($_POST['filter_dimension_'.$type], FILTER_VALIDATE_FLOAT) !== false)
    142142      {
    143143        $_SESSION['bulk_manager_filter']['dimension'][$type] = $_POST['filter_dimension_'. $type ];
     
    150150    foreach (array('min','max') as $type)
    151151    {
    152       if ( preg_match('#^[0-9\.]+$#', $_POST['filter_filesize_'. $type ]) )
     152      if (filter_var($_POST['filter_filesize_'.$type], FILTER_VALIDATE_FLOAT) !== false)
    153153      {
    154154        $_SESSION['bulk_manager_filter']['filesize'][$type] = $_POST['filter_filesize_'. $type ];
Note: See TracChangeset for help on using the changeset viewer.