1
0
mirror of https://github.com/newnius/YAO-portal.git synced 2025-12-15 09:36:43 +00:00

init & add agent & add job

This commit is contained in:
2019-01-15 10:02:28 +08:00
parent 71f1f10e2c
commit d0a4b891b5
321 changed files with 24657 additions and 1 deletions

36
util4p/Validator.class.php Executable file
View File

@@ -0,0 +1,36 @@
<?php
class Validator
{
/**/
public static function isIP($str)
{
$ip = explode('.', $str);
for ($i = 0; $i < count($ip); $i++) {
if ($ip[$i] < 0 || $ip[$i] > 255) {
return false;
}
}
return preg_match('/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/', $str);
}
/**/
public static function isEmail($str)
{
if ($str === null) {
return false;
}
return preg_match("/^([0-9A-Za-z\\-_\\.]+)@([0-9a-z]+\\.[a-z]{2,3}(\\.[a-z]{2})?)$/i", $str) === 1;
}
/*TODO*/
public static function isURL($url)
{
if (is_null($url) || empty($url)) {
return false;
}
return true;
}
}