mail_getfile.php
1.02 KB
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
<?php
require_once(dirname(__FILE__)."/config.php");
CheckPurview('plus_Mail');
if(!isset($dopost)){
$dopost = '';
}
if($dopost=="save"){
$start = empty($start)? 1 : intval(preg_replace("/[\d]/",'', $start));
$end = empty($end)? 0 : intval(preg_replace("/[\d]/",'', $end));
if(!preg_match("/^[0-9a-z_]+$/i",$filename)){
ShowMsg("请填写正确的文件名!","-1");
exit();
}
if($end!="0") $wheresql="where mid between $start and $end";
else $wheresql="";
$sql="SELECT email FROM #@__member $wheresql";
$db->Execute('me',$sql);
while($row = $db->GetArray()){
$mails[]=$row;
}
$email="";
foreach($mails as $mail){
$email.=$mail['email'].",";
}
$m_file = DEDEDATA."/mail/".$filename.".txt";
if (file_exists($m_file)) {
ShowMsg("该文件已经存在,重新换个文件名!","-1");
exit();
} else {
$fp = fopen($m_file,'w');
flock($fp,3);
fwrite($fp,$email);
fclose($fp);
ShowMsg("获取邮件列表成功!","-1");
exit();
}
}
require_once(DEDEADMIN."/templets/mail_getfile.htm");
?>