Changeset 68


Ignore:
Timestamp:
Jan 3, 2016, 11:54:51 PM (9 years ago)
Author:
chronos
Message:
  • Fixed: Check also IP address of allowed host name in add script. This solve problem if IP address have multiple host names (DNS A records).
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/add.php

    r67 r68  
    1212  $Measure = new Measure($Application->Database);
    1313  $Measure->Load($MeasureId);
    14   if(gethostbyaddr($_SERVER['REMOTE_ADDR']) == $Measure->Data['PermissionAdd'])
     14  $HostName = gethostbyaddr($_SERVER['REMOTE_ADDR']);
     15  if(($HostName == $Measure->Data['PermissionAdd']) or ($_SERVER['REMOTE_ADDR'] == gethostbyname($Measure->Data['PermissionAdd'])))
    1516  {
    1617    $Measure->AddValue($Value);
    1718    echo('Hodnota '.$Value.' uložena');
    18   } else echo('Nemáte oprávnění k aktualizaci zadané veličiny!<br>Vaše adresa: '.gethostbyaddr($_SERVER['REMOTE_ADDR']).'('.$_SERVER['REMOTE_ADDR'].')');
     19  } else echo('Nemáte oprávnění k aktualizaci zadané veličiny!<br>Vaše adresa: '.$HostName.'('.$_SERVER['REMOTE_ADDR'].')');
    1920} else echo('Nebyly zadány potřebné parametry');
Note: See TracChangeset for help on using the changeset viewer.