diff --git a/Amysql/Amysql.php b/Amysql/Amysql.php index 4e7a7d8..228baa1 100644 --- a/Amysql/Amysql.php +++ b/Amysql/Amysql.php @@ -344,12 +344,11 @@ class AmysqlModel { /** * 更新数据 * - * @param string $table - * @param Array $data - * @param string $where + * @param string $table 表名 + * @param Array $data 数据 + * @param string $where 更新数据依据 * @return int Affected 影响数 - * @param string $content - * 更新数据依据 + * */ public function _update($table, $data, $where = '') { $this->Affected = 0; diff --git a/Controller/mail_status.php b/Controller/mail_status.php index b08a5bd..02e814a 100644 --- a/Controller/mail_status.php +++ b/Controller/mail_status.php @@ -1,45 +1,39 @@ - _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); - } - if($this -> _model("mail_model") -> mail(@$_REQUEST['mail'], $verify, @$_SESSION['username'])) - JsonSuccess('验证成功'); - JsonError("验证失败"); - } - - /** - * 显示邮箱验证状态 - */ - function stat(){ - JsonSuccess($this -> _model('mail_model') -> status(@$_SESSION['username'])); - } -} +_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 ); + } + if ($this->_model ( "mail_model" )->mail ( @$_REQUEST ['mail'], $verify, @$_SESSION ['username'] )) + JsonSuccess ( '验证成功' ); + else + JsonError ( "验证失败" ); + } + + /** + * 显示邮箱验证状态 + */ + function stat() { + JsonSuccess ( $this->_model ( 'mail_model' )->status ( @$_SESSION ['username'] ) ); + } +} ?> \ No newline at end of file diff --git a/Controller/retrieve.php b/Controller/retrieve.php index 1b40fae..cb80760 100644 --- a/Controller/retrieve.php +++ b/Controller/retrieve.php @@ -1,34 +1,29 @@ - _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("验证成功"); - - } +_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 ( "验证成功" ); + } } \ No newline at end of file diff --git a/Model/authme.php b/Model/authme.php index b064ed5..5372624 100644 --- a/Model/authme.php +++ b/Model/authme.php @@ -40,7 +40,6 @@ class authme extends AmysqlModel { } public function login($username, $password) { if ($this->_sum ( "SELECT * FROM `authme` WHERE `username` = '$username' AND `password` = '$password'" ) == 0) - return false; else return true; @@ -49,7 +48,6 @@ class authme extends AmysqlModel { $key = array ( "password" => $newpass ); - $num = $this->_update ( 'authme', $key, "WHERE username='" . $username . "'" ); if ($num == 0) return false; diff --git a/Model/current_model.php b/Model/current_model.php index fee0ccd..974dcc1 100644 --- a/Model/current_model.php +++ b/Model/current_model.php @@ -1,10 +1,7 @@ _all ( $sql ); } } diff --git a/Model/mail.php b/Model/mail.php index ac02ef8..e6eb868 100644 --- a/Model/mail.php +++ b/Model/mail.php @@ -1,14 +1,16 @@ _sum ( "SELECT * FROM `authme` WHERE `email` = '$url'" ) == 0) + function check($email) { + if ($this->_sum ( "SELECT * FROM `authme` WHERE `email` = '$email'" ) == 0) { return false; - $sql = "SELECT * FROM `authme` WHERE `email` = '$url'"; + } + $sql = "SELECT * FROM `authme` WHERE `email` = '$email'"; return $this->_all ( $sql ); } - function mailcheck($url) { - if ($this->_sum ( "SELECT * FROM `authme` WHERE `email` = '$url'" ) == 0) + function mailcheck($email) { + if ($this->_sum ( "SELECT * FROM `authme` WHERE `email` = '$email'" ) == 0) return true; - return false; + else + return false; } } \ No newline at end of file diff --git a/Model/mail_model.php b/Model/mail_model.php index c021dd0..1afdcab 100644 --- a/Model/mail_model.php +++ b/Model/mail_model.php @@ -1,10 +1,7 @@ _all ( $sql ); } public function mail($mail, $verify, $user) { @@ -15,7 +12,7 @@ class mail_model extends AmysqlModel { "time" => date ( "Y-m-d" ) ); // var_dump($data); - $num = $this->_update ( 'mail', $data, "where user='" . $user . "'" ); + $num = $this->_update ( 'mail', $data, "WHERE user='" . $user . "'" ); // var_dump($num); if ($num == 0) { return false; @@ -24,10 +21,7 @@ class mail_model extends AmysqlModel { } } public function status($user) { - $sql = "SELECT * - FROM `mail` - WHERE `user` = '" . $user . "' - LIMIT 0 , 75"; + $sql = "SELECT * FROM `mail` WHERE `user` = '" . $user; return $this->_all ( $sql ); } } diff --git a/View/AmysqlNotice.php b/View/AmysqlNotice.php index 752010c..77f8e79 100644 --- a/View/AmysqlNotice.php +++ b/View/AmysqlNotice.php @@ -6,6 +6,6 @@ [Amysql-Notice] -# + \ No newline at end of file diff --git a/View/forge.php b/View/forge.php index 064dc24..080dd38 100644 --- a/View/forge.php +++ b/View/forge.php @@ -39,9 +39,7 @@
- - +
@@ -64,8 +62,7 @@ @@ -81,8 +78,7 @@ class="span12" type="text" placeholder="重复输入密码" id="pass2" /> @@ -96,8 +92,7 @@ 点击确定完成密码更换操作。 @@ -162,6 +157,7 @@ $("#statu").eq(0).addClass('yz'); $("#step").eq(0).removeClass("yz").clearQueue().fadeIn(2000); $("#key").attr("disabled","disabled"); + $("#sec").click(); break; case "error": alert(r.info); return; break; } @@ -175,18 +171,14 @@ } function updatepass(){ + $("#sub").attr("disabled","disabled"); $.ajax({ type:"POST", data:{user:$("#hidden_name").val(),mail:$("#email").val(),type:"forge",pass:$("#hidden_pass").val()}, dataType:"json", - url:'', - success:function(data){ - switch(data.status){ - case "success": alert(data.info); window.location.href = ""; break; - case "error": alert(data.info); return false; break; - } - } + url:'' }) + window.location.href = "" } $(function(){ $(".container").scrollable({ diff --git a/View/forge1.php b/View/forge1.php deleted file mode 100644 index 23bd8b5..0000000 --- a/View/forge1.php +++ /dev/null @@ -1,297 +0,0 @@ - - - -<?=$title?> - - - - - - - - - - - - - - - - - - -
- - -
-
-
-
-
找回密码
- -
-
-
-
- 第一步
- 填写验证码来确认这个是否你所绑定的邮箱 -
- -
-
- -
- -
-
-
-
-
-
-
- 第二步
- 请填写你所要设定的新密码 -
- -
- - -
-
-
-
- 第三步
- 点击确定完成密码更换操作。 -
-
-
-
-
- - -
-
-
-
- - -
-
- -
-

已经有了帐号?

- 点击这里登陆 -
-
- - - - - - - - - \ No newline at end of file diff --git a/View/header.php b/View/header.php index f56592a..27125c5 100644 --- a/View/header.php +++ b/View/header.php @@ -11,7 +11,7 @@ class="icon-bar"> - Minecraft用户中心 + Minecraft用户中心