denyIpAddress - PHP Online

Form of PHP Sandbox

Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php in the places where the PHP script should be executed.



Your result can be seen below.

Result of php executing





Full code of denyIpAddress.php

  1. <?php
  2. $thisIp ='36.55.84.121';
  3. $denyIpAddress = [
  4.     '36.55.84.121',
  5.     '192.168.56.1',
  6.     '10.0.20.22'
  7. ];
  8.  
  9. if ( !empty($thisIp) ) {
  10.     if ( in_array($thisIp, $denyIpAddress, TRUE) ) {
  11.         printf("Cannot use this IP Address: %s", $thisIp);
  12.     }
  13.     else {
  14.         printf("we're good to proceed!");
  15.     }
  16. }
  17.  
  18.  
File Description
  • denyIpAddress
  • PHP Code
  • 06 Feb-2020
  • 316 Bytes
You can Share it: