blob: 061ec12e3f040ff1e71acb76d38e56a8a780c828 (
plain)
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
39
40
41
42
43
44
45
|
<?php
include('db.php');
function checkEmail($email) {
$db = opendb();
$sql = "select email from email where email='".$email."';";
$res = mysql_fetch_array(mysql_query($sql));
if($res){
closedb($db);
return 0;
}
if(preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/" , $email)){
list($username,$domain) = split('@', $email);
if(!checkdnsrr($domain,'MX')){
closedb($db);
return false;
}
closedb($db);
return true;
}
closedb($db);
return false;
}
function addEmail($email, $ip) {
$db = opendb();
$sql = "insert into email (email, ip, date) values
('".$email."', '".$ip."', '".date('Y-m-d')."')";
mysql_query($sql);
closedb($db);
}
function checkIP($ip) {
$db = opendb();
$today = date('Y-m-d');
$sql = "select count(id) from email where ip='".$ip."' and date='".$today."';";
$res = mysql_fetch_array(mysql_query($sql));
if($res and $res[0] >= 100){
closedb($db);
return 0;
}
closedb($db);
return 1;
}
?>
|