mirror of
https://e.coding.net/circlecloud/McAccount.git
synced 2025-09-06 07:37:40 +00:00
@ -1,34 +1,29 @@
|
||||
<?php
|
||||
class retrieve extends AmysqlController
|
||||
{
|
||||
function checkmail()
|
||||
{
|
||||
if($this -> _model('mail') -> check($_REQUEST['mail']))
|
||||
JsonSuccess($this -> _model('mail') -> check($_REQUEST['mail']));
|
||||
JsonError("查询失败");
|
||||
}
|
||||
|
||||
function send()
|
||||
{
|
||||
$time = date("Y-m-d");
|
||||
$code = base64_encode($_REQUEST['mail'].":".$time);
|
||||
if(mailsender(@$_REQUEST['mail'],$code,"forget"))
|
||||
$_SESSION['code'] = $code;
|
||||
JsonSuccess("验证邮件已经发送");
|
||||
JsonError("验证邮件发送失败");
|
||||
}
|
||||
|
||||
function status()
|
||||
{
|
||||
$code = base64_decode($_SESSION['code']);
|
||||
$str = explode(":", $code);
|
||||
if($_REQUEST['mail'] !== $str[0])
|
||||
JsonError("邮箱不相同 验证失败");
|
||||
iF($str[1] !== date("Y-m-d"))
|
||||
JsonError('验证日期已过期');
|
||||
if($_REQUEST['key'] !== $_SESSION['code'])
|
||||
JsonError("验证失败");
|
||||
JsonSuccess("验证成功");
|
||||
|
||||
}
|
||||
<?php
|
||||
class retrieve extends AmysqlController {
|
||||
function checkmail() {
|
||||
if ($this->_model ( 'mail' )->check ( $_REQUEST ['mail'] ))
|
||||
JsonSuccess ( $this->_model ( 'mail' )->check ( $_REQUEST ['mail'] ) );
|
||||
else
|
||||
JsonError ( "查询失败" );
|
||||
}
|
||||
function send() {
|
||||
$time = date ( "Y-m-d" );
|
||||
$code = base64_encode ( $_REQUEST ['mail'] . ":" . $time );
|
||||
if (mailsender ( @$_REQUEST ['mail'], $code, "forget" )) {
|
||||
$_SESSION ['code'] = $code;
|
||||
JsonSuccess ( "验证邮件已经发送" );
|
||||
} else
|
||||
JsonError ( "验证邮件发送失败" );
|
||||
}
|
||||
function status() {
|
||||
$code = base64_decode ( $_SESSION ['code'] );
|
||||
$str = explode ( ":", $code );
|
||||
if ($_REQUEST ['mail'] !== $str [0])
|
||||
JsonError ( "邮箱不相同 验证失败!" );
|
||||
iF ($str [1] !== date ( "Y-m-d" ))
|
||||
JsonError ( '验证日期已过期!' );
|
||||
if ($_REQUEST ['key'] !== $_SESSION ['code'])
|
||||
JsonError ( "验证失败!" );
|
||||
JsonSuccess ( "验证成功" );
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user