/* * Patch for filter_var() */ if(!function_exists('filter_var')){ define('FILTER_VALIDATE_IP', 'ip'); define('FILTER_FLAG_IPV4', 'ipv4'); define('FILTER_FLAG_IPV6', 'ipv6'); define('FILTER_VALIDATE_EMAIL', 'email'); define('FILTER_FLAG_EMAIL_UNICODE', 'unicode'); function filter_var($variable, $filter, $option = false){ if($filter == 'ip'){ if($option == 'ipv4'){ if(preg_match("/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/", $variable, $matches)){ $variable = $matches[1]; return $variable; } } if($option == 'ipv6'){ if(preg_match("/\s*(([:.]{0,7}[0-9a-fA-F]{0,4}){1,8})\s*/", $variable, $matches)){ $variable = $matches[1]; return $variable; } } } if($filter == 'email'){ if($option == 'unicode' || $option == false){ if(preg_match("/\s*(\S*@\S*\.\S*)\s*/", $variable, $matches)){ $variable = $matches[1]; return $variable; } } } } }
[Users Projects] | Going off-grid in Idaho by bj | September 27, 2023, 03:03:01 am |
[Automation, Controls, Inverters, MPPT, etc] | long distance pwm control of GTI's with arduino by noneyabussiness | November 22, 2022, 02:38:28 am |
[Renewable Energy Q&A] | Max winding temp by lighthunter | August 10, 2022, 08:19:05 am |
[Product Reviews] | Mini Split by dang | July 03, 2022, 10:49:39 pm |
[Users Projects] | y Philippines Retirement Solar Off Grid System by solarnewbee | June 04, 2022, 02:28:40 am |
[Solar (heating or electric)] | PV hot water and space heat at a small cabin by eidolon | March 31, 2022, 10:03:49 am |
[Electric Vehicles] | E-Bike by noneyabussiness | February 07, 2022, 03:14:53 am |
[Users Projects] | Off grid water heating project by lighthunter | January 11, 2022, 06:02:12 pm |
[Automation, Controls, Inverters, MPPT, etc] | 8010 based 5kw chinese sinewave mosfet inverter board by sunnypower46 | November 28, 2021, 07:46:01 pm |
10 Guests, 0 Users