/*
* 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;
}
}
}
}
}
Anotherpower.com Forum - PageTitleHere
Recent Posts
[Weather]
|
Been about a year
by bj
|
February 11, 2024, 05:03:39 am
|
[Users Projects]
|
Off grid water heating project
by Wolvenar
|
January 29, 2024, 07:26:03 am
|
[Product Support]
|
The dreaded Rifa smoke maker
by OTG
|
December 03, 2023, 06:22:57 am
|
[General Electronics Discussion]
|
The Ultimate Lead Acid Batteries Sale
by RFburns
|
November 20, 2023, 03:10:17 am
|
[Watt's projects]
|
Got some cell monitors for two unmatched AH rated 24v forklift batteries for 48v
by Watt
|
October 15, 2023, 10:09:41 pm
|
[Users Projects]
|
Going off-grid in Idaho
by dochubert
|
October 03, 2023, 10:46:14 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
|
25 Guests, 0 Users