2015-10-13 11:29:11 +00:00
|
|
|
<?php
|
|
|
|
class mail_status extends AmysqlController {
|
|
|
|
function select() {
|
|
|
|
JsonSuccess ( $this->_model ( "mail_model" )->select ( @$_SESSION ['username'] ) );
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* 邮件发送
|
|
|
|
*/
|
|
|
|
function sendmail() {
|
|
|
|
$verify = md5 ( hash ( "sha256", @$_REQUEST ['mail'] . $_REQUEST ['user'] ) );
|
|
|
|
$send = mailsender ( $_REQUEST ['mail'], $verify, $_REQUEST ['type'] );
|
|
|
|
if ($send) {
|
|
|
|
$_SESSION ['verify'] = $verify;
|
|
|
|
JsonSuccess ( "邮件发送成功 收到后请填入验证码进行邮箱验证" );
|
|
|
|
} else {
|
|
|
|
JsonError ( "邮件发送失败" );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function mail() {
|
|
|
|
$verify = $_SESSION ['verify'];
|
|
|
|
|
|
|
|
if (@$_REQUEST ['verify'] != $verify) {
|
|
|
|
JsonError ( '验证码不对!请重试' );
|
|
|
|
exit ( 0 );
|
|
|
|
}
|
2015-11-01 14:29:21 +00:00
|
|
|
if ($this->_model ( "mail_model" )->mail ( @$_REQUEST ['mail'], @$_SESSION ['username'] ))
|
2015-10-13 11:29:11 +00:00
|
|
|
JsonSuccess ( '验证成功' );
|
|
|
|
else
|
|
|
|
JsonError ( "验证失败" );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 显示邮箱验证状态
|
|
|
|
*/
|
|
|
|
function stat() {
|
2015-11-05 12:22:48 +00:00
|
|
|
if ($this->_model ( 'mail_model' )->status ( @$_SESSION ['username'] )) {
|
|
|
|
JsonSuccess ( '邮箱已验证!' );
|
|
|
|
} else {
|
|
|
|
JsonError ( "邮箱未验证!" );
|
|
|
|
}
|
2015-10-13 11:29:11 +00:00
|
|
|
}
|
|
|
|
}
|
2015-10-13 06:26:47 +00:00
|
|
|
?>
|