You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.1 KiB
47 lines
1.1 KiB
<?php
|
|
|
|
class Validation
|
|
{
|
|
public function ValidateSet($var) :bool{
|
|
if (isset($var)) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public function ValidateNotEmpty($var) :bool{
|
|
if (empty($var)) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public function ValidateURL(string $url) :bool{
|
|
if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i",$url)) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public function ValidateEmail(string $email) :bool{
|
|
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
public function ValidateUsername(string $username) : bool{
|
|
if(!filter_var($username,FILTER_VALIDATE_REGEXP,array("options" => array( "regexp" => "^[^&=_'\-+;<>.]{1,18}$" ))))
|
|
{
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
public function ValidatePassword(string $password) : bool{
|
|
if(strlen($password)>100)
|
|
{
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
}
|