-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmailvalidator.php
More file actions
38 lines (31 loc) · 1007 Bytes
/
Copy pathEmailvalidator.php
File metadata and controls
38 lines (31 loc) · 1007 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Codeigniter Library
*
* @package CODEIGNITER
* @author SUPARDYKE <supardyke@gmail.com>
*/
class Emailvalidator {
// bool value of the request status if it is valid or not
public $valid;
public function _construct(){
}
public function check($email){
// get the registrar
$registrar = explode("@", $email);
//list of allowed registrars
$allowed_reg = 'gmail.com,yahoo.com,yahoo.co.uk,rocketmail.com,outlook.com,aol.com,yandex.com,protonmail.com,protonmail.ch,zoho.com';
$ex_all_reg = explode(",", $allowed_reg);
$valid = false;
if (count($registrar) > 1) {
if (!empty($ex_all_reg)) {
foreach ($ex_all_reg as $value) {
if (strtolower($registrar[1]) == $value) {
$valid = true;
}
}
}
}
return $valid;
}
}