Test.php
5.8 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<?php
namespace Controller;
use Lib\Mail\MailFun;
use Model\emailSql;
use Model\listsSql;
/**
* @author:dc
* @time 2023/2/13 11:28
* Class Home
* @package Controller
*/
class Test {
public function home(){
return 404;
}
public function a(){
// return 404;
// $urlGetSign = function ($mobile){
// $time = time();
// $s = 'MindrHbWGJaEfhw85oQW3LYTnUMebm4H';
// $data = [
// 'app_id' => 10002415,
// 'timestamp' => $time
// ];
// $data = http_build_query($data);
//
// $sign = md5(md5($data).$s);
//
// return 'http://local.admin.hagro.cn/'.app()->request('route').'?iframe_sign='.
// base64_encode($mobile.'.'.$sign.'.'.$time);
// };
//
//
// $url = $urlGetSign('18868868868');
// return '<html>
//<head><title>403 您没有权限访问</title></head>
//<body>
//<div style="display: flex">
//<div style="width: 200px;">
//<p><a href="/?route=ai_search">ai搜索</a></p>
//<p><a href="/?route=ai_company_search">企业洞察</a></p>
//<p><a href="/?route=ai_keyperson">ai决策人</a></p>
//<p><a href="/?route=customer_guide">海关数据</a></p>
//<p><a href="/?route=tools/tool_mobile_verify">验证手机号</a></p>
//<p><a href="/?route=tools/tool_translate">智能翻译</a></p>
//<p><a href="/?route=tools/tool_exchange_rate">实时汇率</a></p>
//<p><a href="/?route=tools/tool_mailbox_verify">邮箱验证</a></p>
//<p><a href="/?route=tools/tool_vat">VAT查询</a></p>
//<p><a href="/?route=pro/article/31">海外社媒(AI)</a></p>
//<p><a href="/?route=pro/article/29">网站文案(AI)</a></p>
//<p><a href="/?route=pro/article/73">邮件助手(AI)</a></p>
//<p><a href="/?route=pro/article/74">企业应用(AI)</a></p>
//<p><a href="/?route=pro/e/commerce">跨境电商(AI)</a></p>
//</div>
//<iframe src="'.$url.'" frameborder="0" style="width: 100%;height: 100vh;"></iframe>
//</div>
//
//</body>
//</html>';
// if(app()->request('sign')!='s1'){
// http_response_code(404);
// app()->e(404,404);
// }
//
$email = db()->first(emailSql::first(app()->request('mid')));
//
$config = (new \Lib\Imap\ImapConfig())
->setEmail($email['email'])
->setPassword(base64_decode($email['password']))
->setHost($email['imap']);
$imap = \Lib\Imap\ImapPool::get($config);
//$imap->debug();
$login = $imap->login();
if($login->isOk()) {
$uid = (int) app()->request('uid');
$page = (int) app()->request('page',1);
$f = app()->request('f','INBOX');
// foreach ($imap->getFolders()->all() as $a){
// echo $a->folder;
// echo '=>';
// echo $a->getParseFolder();
// echo '|';
// };
$folder = $imap->folder($f=='INBOX'?$f:base64_decode($f));
if($uid){
$msg = $folder->msg()->uid([$uid])->get()->first();
if(app()->request('show')=='origin'){
return "<pre>".$msg->header->getRaw()."\n\n".$msg->body->getRaw()."</pre>";
}
return $msg->body->getHtml();
}
echo "<div style='display: flex'><div style='width: 200px;'>";
foreach ($imap->getFolders()->all() as $fl){
echo "<p><a href=\"?mid={$email['id']}&f=".base64_encode($fl->folder)."\">".($fl->getParseFolder())."</a></p>";
}
echo "</div><div style='min-width: 1000px;'>";
echo "<br>";
echo '<a href="?mid='.$email['id'].'&page=1&f='.$f.'">第一页</a>';
echo ' ';
echo '<a href="?mid='.$email['id'].'&page='.($page-1).'&f='.$f.'">上一页</a>';
echo ' ';
echo '<a href="?mid='.$email['id'].'&page='.($page+1).'&f='.$f.'">下一页</a>';
echo ' ';
echo '<a href="?mid='.$email['id'].'&page='.(ceil($folder->getTotal()/20)).'&f='.$f.'">最后一页</a>';
echo ' ';
echo '当前显示第'.$page.'页 总'.$folder->getTotal().'条';
echo "<br>";
echo "<hr>";
$msgs = $folder->msg()->forPage($page)->get();
if ($msgs) {
echo "<style>td{padding: 5px 10px;}tr:hover{background-color: #f2f2f2;}</style>";
echo "<table style='width: 100%;' cellpadding='0' cellspacing='0'>";
$msgs->each(function ($msg) use($email,$f){
echo '<tr><td>'.$msg->uid.'</td><td><a href="?mid='.$email['id'].'&uid='.$msg->uid.'&f='.$f.'">'.$msg->header->getSubject().'</a></td><td>'.date('Y-m-d H:i:s',strtotime($msg->date)).'</td><td><a href="?mid='.$email['id'].'&uid='.$msg->uid.'&f='.$f.'&show=origin">查看原文</a></td></tr>';
});
// echo $msg->header->getSubject();
// echo '<br>-------------------------------------------------<br>';
// if($msg->body->getHtml()){
// echo $msg->body->getHtml();
// }else{
// echo $msg->body->getText();
// }
// $msg->header->getRaw()
// echo $msg->body->getAttachment();
// foreach ($msg->body->getAttachment() as $attachment){
// header("Content-Type:".$attachment->getFileType());
// echo $attachment->getContent();
// break;
// }
}
echo "</table>";
}else{
echo $login->getMessage();
}
echo "</div></div>";
}
}