基本信息
源码名称:thinkphp入门级项目示例下载
源码大小:1.78M
文件格式:.zip
开发语言:PHP
更新时间:2016-04-19
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 3 元×
微信扫码支付:3 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
<?php namespace Index\Controller; use Think\Controller; class IndexController extends CommonController { //Page public function index(){ $this->_display("首页","index"); } public function login(){ //检测是否允许登录 $system = M("SystemOptions"); $system = $system->where("name='site_login'")->find(); if($system['value']!="Y"){ $this->assign("_title","关闭登录"); $this->assign("_closeTitle","Loofir工作室暂时无法登录"); $this->assign("_closeBody","十分抱歉的通知您,Loofir工作室官方网站(以下简称本站)暂时无法进行登录!<br /> 原因如下:<font color='red'>{$system['value']}</font><br /> 我们再次为本次站点关闭登录系统为您带来的不便致歉,希望您能理解和包涵,感谢您对Loofir工作室的支持与厚爱!<br />"); $this->siteaccelerate(); $this->display("Common:close"); exit(); } $this->_display("登录","login"); } public function loofirpassport(){ //检测是否允许注册 $system = M("SystemOptions"); $system = $system->where("name='site_register'")->find(); if($system['value']!="Y"){ $this->assign("_title","关闭注册"); $this->assign("_closeTitle","Loofir工作室暂时无法注册"); $this->assign("_closeBody","十分抱歉的通知您,Loofir工作室官方网站(以下简称本站)暂时无法进行注册!<br /> 原因如下:<font color='red'>{$system['value']}</font><br /> 我们再次为本次站点关闭注册系统为您带来的不便致歉,希望您能理解和包涵,感谢您对Loofir工作室的支持与厚爱!<br />"); $this->siteaccelerate(); $this->display("Common:close"); exit(); } $this->_display("Loofir账号通注册",null); } public function accountverifyemail(){ //检测是否允许验证邮箱 $system = M("SystemOptions"); $system = $system->where("name='site_register'")->find(); if($system['value']!="Y"){ $this->assign("_title","关闭验证"); $this->assign("_closeTitle","Loofir工作室暂时无法验证邮箱"); $this->assign("_closeBody","十分抱歉的通知您,Loofir工作室官方网站(以下简称本站)暂时无法进行邮箱验证!<br /> 原因如下:<font color='red'>{$system['value']}</font><br /> 我们再次为本次站点关闭邮箱验证系统为您带来的不便致歉,希望您能理解和包涵,感谢您对Loofir工作室的支持与厚爱!<br />"); $this->siteaccelerate(); $this->display("Common:close"); exit(); } $user = M("UserAccount"); $user = $user->where("uid={$_COOKIE['uid']}")->find(); $this->assign("email",$user['email']); $this->_display("邮箱验证",null); } //Action public function login_verify(){ if(!IS_POST){ $this->siteaccelerate(); $this->error("非法访问!",U("Index/Index/index")); } $username = $_POST['username']; $password = md5($_POST['password']); $user = M("UserAccount"); $user = $user->where("username='{$username}'")->find(); //用户是否存在 if(empty($user)){ echo "EU"; //emptyUser exit(); } //是否禁止登陆 if($user['value']!="Y"){ cookie("uid",$user['uid']); cookie("username",$user['username']); $userDisable = M("UserDisable"); $userDisable = $userDisable->where("uid={$user['uid']}")->find(); if(empty($userDisable)){ echo "UE"; exit(); }else if($userDisable['type']=='email'){ echo "VE"; exit(); }else{ echo "UE"; exit(); } } if($username==$user['username']&&$password==$user['password']){ //登录 $login = M("UserLoginRecord"); date_default_timezone_set("PRC"); $last_login = $login->where("uid={$user['uid']}")->find(); $last_login = $last_login['last_login']; if($last_login!=date("Y-m-d")){ $login->last_login = date("Y-m-d"); $login->where("uid={$user['uid']}")->save(); $exp = M("UserExp"); $exps = $exp->where("uid={$user['uid']}")->find(); $exps = $exps['exp']; $exp->exp = $exps 2; $exp->where("uid={$user['uid']}")->save(); } cookie('uid',$user['uid']); cookie('username',$user['username']); cookie('shell',md5($user['uid'].$user['username'].$user['password']."loofirstudio")); echo "SL"; //successLogin exit(); }else{ echo "EI"; //errorInfo exit(); } } public function logout(){ cookie("uid",null); cookie("username",null); cookie("shell",null); $this->siteaccelerate(); $this->success("成功退出登录!"); } public function regsiter_verifyinfo(){ if(!IS_POST){ $this->siteaccelerate(); $this->error("非法访问!",U("Index/Index/index")); } //判断验证码是否正确 $verify = new \Think\Verify(); $verify = $verify->check($_POST['verify']); if(!$verify){ //不正确 echo "VE"; //verifyError exit(); }else{ //初始化信息 $username = $_POST['username']; $password = $_POST['password']; $repassword = $_POST['repassword']; $email = $_POST['email']; //判断用户名格式是否正确 $pattern = "/^[a-zA-Z][a-zA-Z0-9_]{5,15}$/"; //字母开头,允许6-16字节,允许字母数字下划线 $verify = preg_match($pattern,$username); if(!$verify){ echo "UFE"; //usernameFormateError exit(); } //判断密码格式是否正确 $pattern = "/^\w $/"; $verify = preg_match($pattern,$password); if(!$verify){ echo "PFE"; //passwordFormateError exit(); } //判断两次密码是否一致 if($password!=$repassword){ echo "PNS"; //passwordNotSame exit(); } //判断邮箱是否正确 $pattern = "/\w ([- .]\w )*@\w ([-.]\w )*\.\w ([-.]\w )*/"; $verify = preg_match($pattern,$email); if(!$verify){ echo "EFE"; //emailFormateError exit(); } //进行注册 $user = M("UserAccount"); //判断重复 $v_user = $user->where("username='{$username}'")->find(); if(!empty($v_user)){ echo "UNU"; //usernameNotUnique exit(); } //验证邮箱重复 $v_email = $user->where("email='{$email}'")->find(); if(!empty($v_email)){ echo "SEE"; //theSameEmailExist exit(); } $user->username = $username; $user->password = md5($password); $user->email = $email; $user->value = "Y"; $user = $user->add(); if(!$user){ echo "UKE"; //unKnowError exit(); } //设置基础权限 $jurisdiction = M("UserJurisdiction"); $jurisdiction->uid = $user; $jurisdiction->u_value = 1; $jurisdiction->a_value = 0; $jurisdiction->add(); //初始化账户 $exp = M("UserExp"); $exp->uid = $user; $exp->exp = 2; $exp->add(); $login = M("UserLoginRecord"); $login->uid = $user; $login->last_login = "0000-00-00"; $login->add(); //设置邮箱,关闭 /* $disable = M("UserDisable"); $disable->uid = $user; $disable->type = "email"; $disable->value = $email; $disable->add(); cookie("uid",$user); cookie("username",$username); */ echo "S"; //success } } public function send_verify_email(){ if(!IS_POST){ $this->siteaccelerate(); $this->error("非法访问!",U("Index/Index/index")); } //判断邮箱是否正确 $pattern = "/\w ([- .]\w )*@\w ([-.]\w )*\.\w ([-.]\w )*/"; $verify = preg_match($pattern,$_POST['email']); if(!$verify){ echo "EFE"; //emailFormateError exit(); } //验证邮箱重复 $user = M("UserAccount"); $v_email = $user->where("username!='{$_POST['username']}' AND email='{$_POST['email']}'")->find(); if(!empty($v_email)){ echo "SEE"; //theSameEmailExist exit(); } session("sve",rand(100000,999999)); vendor("PHPMailer.PHPMailerAutoload"); vendor("PHPMailer.class#phpmailer"); $mail = new \PHPMailer(); $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'smtp.ym.163.com'; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = 'service@loofir.tk'; // SMTP username $mail->Password = '19990521'; // SMTP password $mail->Port = 25; $mail->CharSet = "UTF-8"; $mail->From = 'service@loofir.tk'; $mail->FromName = 'Loofir服务中心'; $mail->addAddress("{$_POST['email']}", "{$_POST['username']}"); $mail->isHTML(true); $mail->Subject = 'Loofir账号邮箱验证'; $mail->Body = "<table cellpadding='0' cellspacing='0' style='text-align:left;border:1px solid #50a5e6;color:#fff;font-size:18px;' width='740'><tbody><tr height='39' style='background-color:#50a5e6;'><td style='padding-left:15px;font-family:".'微软雅黑'.",".'黑体'.",arial;'>Loofir工作室</td></tr></tbody></table> <table cellpadding='0' cellspacing='0' style='text-align:left;border:1px solid #f0f0f0;border-top:none;color:#585858;background-color:#fafafa;font-size:14px;' width='740'> <tbody> <tr height='25'><td></td></tr> <tr height='40'><td style='padding-left:25px;padding-right:25px;font-size:18px;font-family:".'微软雅黑'.",".'黑体'.",arial;'>您好,{$_POST['username']}:</td><iframe id='tmp_downloadhelper_iframe' style='display: none;'></iframe></tr> <tr height='15'><td></td></tr> <tr height='30'><td style='padding-left:55px;padding-right:55px;font-family:".'微软雅黑'.",".'黑体'.",arial;font-size:14px;'>感谢您使用Loofir服务。</td></tr> <tr height='30'><td style='padding-left:55px;padding-right:55px;font-family:".'微软雅黑'.",".'黑体'.",arial;font-size:14px;'>请输入以下庐码进行邮箱验证,以便开始使用您的Loofir账号:</td></tr> <tr height='60'><td style='padding-left:55px;padding-right:55px;font-family:".'微软雅黑'.",".'黑体'.",arial;font-size:14px;'><a style='color: rgb(255,255,255);text-decoration: none;display: block;min-height: 39px;width: 158px;line-height: 39px;background-color:rgb(80,165,230);font-size:20px;text-align:center;'>{$_SESSION['sve']}</a></td></tr> <tr height='10'><td></td></tr> <tr height='20'><td style='padding-left:55px;padding-right:55px;font-family:".'微软雅黑'.",".'黑体'.",arial;font-size:12px;'>如果您并未申请Loofir账号,可能是其他用户误输入了您的邮箱地址。请忽略此邮件,或与我们联系。</td></tr> <tr height='20'><td style='padding-left:55px;padding-right:55px;font-family:".'微软雅黑'.",".'黑体'.",arial;font-size:12px;'>请认准发件者邮箱,Loofir服务中心邮箱:service@loofir.tk。</td></tr> <tr height='20'><td></td></tr> </tbody> <table cellpadding='0' cellspacing='0' style='text-align:left;border:1px solid #f0f0f0;border-top:none;color:#585858;background-color:#fafafa;font-size:14px;' width='740'> <table cellpadding='0' cellspacing='0' style='color:#969696;font-size:12px;vertical-align:middle;text-align:center;' width='740'><tbody> <tr height='5'><td></td></tr> <tr height='20'><td width='680' style='text-align:left;font-family:".'微软雅黑'.",".'黑体'.",arial;'> 2015 <span>©</span><a href='http://loofir.tk/' target='_blank' style='text-decoration:none;color:#969696;padding-left:5px;' title='Loofir工作室'>Loofir工作室</a></td></tr> <tr height='20'><td style='text-align:left;font-family:".'微软雅黑'.",".'黑体'.",arial;' colspan='2'>客户支持: jokin@loofir.tk</td></tr> <tr height='45'><td></td></tr> </tbody></table>"; $mail->AltBody = '[Loofir服务中心]您的验证码为:'; if(!$mail->send()){ echo "Error"; }else{ echo "Success"; } } public function verify_loonumber(){ if(!IS_POST){ $this->siteaccelerate(); $this->error("非法访问!",U("Index/Index/index")); } $sve = $_SESSION['sve']; if($_POST['verify']==$sve){ //开通账户 $user = M("UserAccount"); $user->email = $_POST['email']; $user->value = "Y"; $user->where("username='{$_POST['username']}'")->save(); $uInfo = $user->where("username='{$_POST['username']}'")->find(); cookie('uid',$uInfo['uid']); cookie('username',$uInfo['username']); cookie('shell',md5($uInfo['uid'].$uInfo['username'].$uInfo['password']."loofirstudio")); //- $disable = M("UserDisable"); //查询禁用记录 $v_disable = $disable->where("uid={$uInfo['uid']}")->find(); if(empty($v_disable)){ echo "AR"; exit(); } //删除禁用记录 $disable->where("uid={$uInfo['uid']}")->delete(); echo "Success"; exit(); }else{ echo "Error"; exit(); } } //Function protected function _display($title,$nav){ $this->assign("_nav",$nav); $this->assign("_title",$title); $this->siteaccelerate(); $this->display(); } } ?>