app/controller/register.php
(开头部分) 7KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace WY\app\controller;
use WY\app\libs\Controller;
if (!defined('WY_ROOT')) {
exit;
}
class register extends Controller
{
public function index()
{
$data = array('title' => '用户注册', 'superid' => $this->req->get('id'));
$this->put('register.php', $data);
}
public function save()
{
$email = $this->req->post('email');
$chkcode = $this->req->post('chkcode');
$id = $this->req->post('id');
if ($email == '' || $chkcode == '') {
echo json_encode(array('status' => 0, 'msg' => '选项填写不完整'));
exit;
}
if (strtolower($chkcode) != $this->session->get('chkcode')) {
echo json_encode(array('status' => 0, 'msg' => '验证码错误'));
exit;
}
if (!$this->res->isMail($email)) {
echo json_encode(array('status' => 0, 'msg' => '邮箱格式错误'));
exit;
}
$userinfo = $this->model()->select('email')->from('userinfo')->where(array('fields' => 'email=?', 'values' => array($email)))->fetchRow();
if ($userinfo) {
echo json_encode(array('status' => 0, 'msg' => '邮箱' . $email . '已被注册'));
exit;
}
$superid = 0;
if ($id && preg_match('/\\d/', $id)) {
if ($this->model()->select()->from('users')->where(array('fields' => 'id=? and is_agent=?', 'values' => array($id, 1)))->count()) {
$superid = $id;
}
}
$data = array('email' => $email, 'token' => sha1($this->res->getRandomString(40)), 'superid' => $superid);
if ($this->model()->from('register')->insertData($data)->insert()) {
if ($mailtpl = $this->model()->select()->from('mailtpl')->where(array('fields' => 'is_state=? and cname=?', 'values' => array(0, '注册确认')))->fetchRow()) {
$orginData = array('sitename' => $this->config['sitename'], 'url' => 'http://' . $this->config['siteurl'] . '/register/complete?email=' . $email . '&token=' . $data['token']);
$newData = $this->res->replaceMailTpl($mailtpl, $orginData);
$subject = array('title' => $newData['title'], 'email' => $email, 'content' => $newData['content']);
$this->res->sendMail($subject, $this->config);
echo json_encode(array('status' => 1, 'msg' => '注册邮件已发送,请登录您的邮箱查看', 'url' => '/register'));
exit;
}
}
echo json_encode(array('status' => 0, 'msg' => '注册失败'));
exit;
}
public function complete()
{
$email = $this->req->get('email');
$token = $this->req->get('token');
后面还有 88 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
