forked from soxft/TimeMail
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
75 changed files
with
9,537 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
require_once "header.php"; | ||
?> | ||
<div class="mdui-container"> | ||
<div class="mdui-typo"> | ||
<h2 class="doc-chapter-title doc-chapter-title-first">关于</h2> | ||
 1.该网站由个人运营,不能保证您在未来一定收到信件,但我一定会尽力让您收到您发送的信件,因为那是您最宝贵的财富.<br /> | ||
 2.本站运行在香港腾讯云上,使用cloudflare CDN进行加速,前端采用MDUI框架后端使用PHP发信采用腾讯企业邮箱.对于定时发信采用screen+php的方式,未来将会增加其稳定性.<br /> | ||
 3.寄出的信是不可撤回的,也不可查找,希望你也忘掉这件事,直到你收到信的那一天.<br /> | ||
 4.同时在投递的那一刻我们将向你的邮箱发送一封确认邮件,只有点击确认邮件中的链接,您才能在未来收到邮件.<br /> | ||
 5.请记得将service#xcsoft.top加入邮箱白名单,以防收不到信.<br /> | ||
 6.发送邮件请遵守当地法律法规!<br /> | ||
</div> | ||
</div> | ||
<br /> | ||
<br /> | ||
<?php | ||
require_once "footer.php"; | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
require_once "config.php"; | ||
$code = $_GET['c']; | ||
$arr = mysqli_fetch_assoc(mysqli_query($conn,"SELECT * FROM `check` WHERE `code`='$code';")); | ||
@$uid = $arr['uid']; | ||
@$timefrom = $arr['time']; | ||
//获取输入请求时间,用于验证是否失效 | ||
|
||
if(empty($timefrom)) | ||
{ | ||
$info = "该链接已失效!"; | ||
}elseif((time()- $timefrom) > 3600){ | ||
mysqli_query($conn,"DELETE FROM `check` WHERE `uid`='$uid';"); | ||
mysqli_query($conn,"DELETE FROM `checking` WHERE `uid`='$uid';"); | ||
$info = "该链接已失效!"; | ||
}else{ | ||
$result = mysqli_fetch_assoc(mysqli_query($conn,"SELECT * FROM `checking` WHERE `uid`='$uid'")); | ||
$topic = $result['topic']; | ||
$content = $result['content']; | ||
$email = $result['email']; | ||
$timenow = $result['from']; | ||
$time = $result['to']; | ||
$ip = $result['ip']; | ||
//获取基本信息 | ||
|
||
mysqli_query($conn,"DELETE FROM `check` WHERE `uid`='$uid';"); | ||
mysqli_query($conn,"DELETE FROM `checking` WHERE `uid`='$uid';"); | ||
mysqli_query($conn,"INSERT INTO `waiting` VALUES('$uid','$topic','$content','$email','$timenow','$time','$ip')"); | ||
|
||
$info = "恭喜你,验证成功!"; | ||
header("Refresh:10;url=\"./index.php\""); | ||
} | ||
?> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no"> | ||
<meta http-equiv="Cache-Control" content="no-siteapp" /> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/soxft/cdn@master/mdui/css/mdui.min.css"> | ||
<script src="https://cdn.jsdelivr.net/gh/soxft/cdn@master/mdui/js/mdui.min.js"></script> | ||
<title> | ||
<?php echo TITLE;?> | ||
</title> | ||
</head> | ||
<body background="https://cdn.jsdelivr.net/gh/soxft/cdn@latest/time/img/background.png"> | ||
<div style="Height:40px"></div> | ||
<div class="mdui-container" style="max-width: 500px;"> | ||
<div class="mdui-card"> | ||
<div class="mdui-card-menu"> | ||
<button onclick="window.location.href='/'" class="mdui-btn mdui-btn-icon mdui-text-color-grey"><i class="mdui-icon material-icons">home</i> | ||
</button> | ||
</div> | ||
<div class="mdui-card-primary"> | ||
<div class="mdui-card-primary-title">邮件确认</div> | ||
<div class="mdui-card-primary-subtitle">Corfirm State</div> | ||
</div> | ||
<div class="mdui-card-content"> | ||
<center> | ||
<h2><?php echo $info ?></h2> | ||
</center> | ||
<br> | ||
</div> | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
<?php | ||
define('DATABASE',array("localhost","db_user","db_passwd","db_name")); | ||
//数据库配置 服务器/数据库用户名/数据库密码/数据库名称 | ||
|
||
define("URL","http://example.com/"); | ||
//网址 记住必须以/结尾 | ||
|
||
define("TITLE","TimeMail - 给未来写封信"); | ||
//网站名称 | ||
|
||
define('EMAIL_SET',array( | ||
'key' => 'rand', //随机值 | ||
'smtp' => 'smtp.exmail.qq.com', //SMTP 用户名 即邮箱的用户名 | ||
'email' => '[email protected]', //邮箱账户 | ||
'passwd' => 'PASSWD', //SMTP 密码 部分邮箱是授权码(例如163邮箱) | ||
'Secure' => 'ssl', | ||
'setFrom' => '[email protected]', //发件人 | ||
'port' => '465', //服务器端口 25 或者465 具体要看邮箱服务器支持 | ||
'name' => 'TimeMail - 时光邮局' //发信名称 | ||
)); | ||
//邮箱配置 | ||
|
||
define('IF_SET',false); | ||
//用于判断是否手动修改配置,请再修改过后将此处的false改为true 如 替换为define('IF_SET',true); | ||
|
||
/*********************************** | ||
* * | ||
* 以下配置不需要修改 * | ||
* * | ||
***********************************/ | ||
$conn = mysqli_connect(DATABASE[0],DATABASE[1],DATABASE[2],DATABASE[3]); | ||
$conns = mysqli_connect(DATABASE[0],DATABASE[1],DATABASE[2],"information_schema"); | ||
|
||
|
||
define("EMAILAPI",URL . "email/emailsend.php"); | ||
|
||
/* | ||
function | ||
*/ | ||
if ($HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"]) | ||
{ | ||
$ip = $HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"]; | ||
} | ||
elseif ($HTTP_SERVER_VARS["HTTP_CLIENT_IP"]) | ||
{ | ||
$ip = $HTTP_SERVER_VARS["HTTP_CLIENT_IP"]; | ||
} | ||
elseif ($HTTP_SERVER_VARS["REMOTE_ADDR"]) | ||
{ | ||
$ip = $HTTP_SERVER_VARS["REMOTE_ADDR"]; | ||
} | ||
elseif (getenv("HTTP_X_FORWARDED_FOR")) | ||
{ | ||
$ip = getenv("HTTP_X_FORWARDED_FOR"); | ||
} | ||
elseif (getenv("HTTP_CLIENT_IP")) | ||
{ | ||
$ip = getenv("HTTP_CLIENT_IP"); | ||
} | ||
elseif (getenv("REMOTE_ADDR")) | ||
{ | ||
$ip = getenv("REMOTE_ADDR"); | ||
} | ||
else | ||
{ | ||
$ip = "Unknown"; | ||
} | ||
//获取用户ip | ||
|
||
function is_email($user_email) | ||
{ | ||
$chars = "/^([a-z0-9+_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,6}\$/i"; | ||
if (strpos($user_email, '@') !== false && strpos($user_email, '.') !== false) | ||
{ | ||
if (preg_match($chars, $user_email)){ | ||
return true; | ||
} | ||
else{ | ||
return false; | ||
} | ||
} | ||
else{ | ||
return false; | ||
} | ||
} | ||
//邮箱合法性 | ||
|
||
$ban = array( | ||
"1.1.1.2" => "ban" | ||
); | ||
//ban用户数据库 | ||
|
||
function emailsend($sendto,$topic,$content) { | ||
$data = array ( | ||
'key' => EMAIL_SET['key'], | ||
'sendto' => $sendto, | ||
'topic' => $topic, | ||
'content' => $content, | ||
'name' => EMAIL_SET['name'] | ||
); | ||
$ch = curl_init (); | ||
curl_setopt ($ch, CURLOPT_URL, EMAILAPI); | ||
curl_setopt ($ch, CURLOPT_POST, 1); | ||
curl_setopt ($ch, CURLOPT_HEADER, 0); | ||
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); | ||
curl_setopt ($ch, CURLOPT_POSTFIELDS, $data); | ||
$return = curl_exec ($ch); | ||
curl_close ($ch); | ||
$arr = json_decode($return, true); | ||
//获取返回值 | ||
return $arr; | ||
} | ||
//邮件发送 | ||
|
||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
require_once ("smtp.php"); | ||
/* | ||
if(empty($_POST['sendto'])){ | ||
$sendto = $_GET['sendto']; | ||
}else{ | ||
$sendto = $_POST['sendto']; | ||
} | ||
if(empty($_POST['topic'])){ | ||
$topic = $_GET['topic']; | ||
}else{ | ||
$topic = $_POST['topic']; | ||
} | ||
if(empty($_POST['content'])){ | ||
$content = $_GET['content']; | ||
}else{ | ||
$content = $_POST['content']; | ||
} | ||
if(empty($_POST['key'])){ | ||
$key = $_GET['key']; | ||
}else{ | ||
$key = $_POST['key']; | ||
} | ||
*/ | ||
if ($_POST['key'] !== 'emailapikeyxcsoft') { | ||
$data = array(//向服务器返回token | ||
'code' => '401' | ||
); | ||
$data_json = json_encode($data); | ||
header('Content-type:text/json'); | ||
echo $data_json; | ||
exit(); | ||
} | ||
//******************** 配置信息 ******************************** | ||
$smtpserver = "smtp.exmail.qq.com"; | ||
//SMTP服务器 | ||
$smtpserverport = 25; | ||
//SMTP服务器端口 | ||
$smtpusermail = "[email protected]"; | ||
//SMTP服务器的用户邮箱 | ||
$smtpuser = "[email protected]"; | ||
//SMTP服务器的用户帐号,注:部分邮箱只需@前面的用户名 | ||
$smtppass = "Wabadmin.9824"; | ||
//SMTP服务器的授权码 | ||
$smtpemailto = $_POST['sendto']; | ||
//发送给谁 | ||
$mailtitle = $_POST['topic']; | ||
//邮件主题 | ||
$mailcontent = $_POST['content']; | ||
//邮件内容 | ||
$mailtype = "TXT"; | ||
//邮件格式(HTML/TXT),TXT为文本邮件 | ||
//************************ 配置信息 **************************** | ||
$smtp = new Smtp($smtpserver,$smtpserverport,true,$smtpuser,$smtppass); | ||
//这里面的一个true是表示使用身份验证,否则不使用身份验证. | ||
$smtp->debug = false; | ||
//是否显示发送的调试信息 | ||
$state = $smtp->sendmail($smtpemailto, $smtpusermail, $mailtitle, $mailcontent, $mailtype); | ||
if ($state == "") { | ||
$data = array(//向服务器返回token | ||
'code' => 'error' | ||
); | ||
$data_json = json_encode($data); | ||
header('Content-type:text/json'); | ||
echo $data_json; | ||
} else { | ||
$data = array(//向服务器返回token | ||
'code' => '200' | ||
); | ||
$data_json = json_encode($data); | ||
header('Content-type:text/json'); | ||
echo $data_json; | ||
} | ||
?> |
Oops, something went wrong.