X-Git-Url: http://git.onelab.eu/?p=plewww.git;a=blobdiff_plain;f=planetlab%2Fincludes%2Fplc_functions.php;h=9ebf7c9ab083d32c2fe9634c5dfc78ed96fdcac5;hp=658cc86a5a35270473d5d79e881cda7163571784;hb=59830fc795440fd636865f30cb7ed1e2d29f4a55;hpb=bed7b2e2c634c90f37fe2c934079bb2b0e034ac9 diff --git a/planetlab/includes/plc_functions.php b/planetlab/includes/plc_functions.php index 658cc86..9ebf7c9 100644 --- a/planetlab/includes/plc_functions.php +++ b/planetlab/includes/plc_functions.php @@ -223,16 +223,19 @@ function topdomain ($hostname) { return $exploded[0]; } +// with php-5.3 on f12, ereg is marked deprecated, using PCRE instead +// looks unused function is_valid_email_addr ($email) { - if (ereg("^.+@.+\\..+$", $email) ) { + if (preg_match("/^.+@.+\\..+$/", $email) ) { return true; } else { return false; } } +// looks unused function is_valid_url ($url) { - if (ereg("^(http|https)://.+\..+$", strtolower($url) ) ) { + if (preg_match("/^(http|https):\/\/.+\..+$/", strtolower($url) ) ) { return true; } else { return false; @@ -240,7 +243,7 @@ function is_valid_url ($url) { } function is_valid_ip ($ip) { - if (ereg("^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$", $ip ) ) { + if (preg_match("/^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/", $ip ) ) { // it's at least in the right format, now check to see if // each part is equal to less than 255 $parts= explode( '.', $ip );