[Job Management system development combat three] user login module backend code (THINKPHP5)

Source: Internet
Author: User

The previous two articles have implemented the user login interface and verification, and now look at what the backend is going to do (based on ThinkPHP5). For example, when a student's landing is successful, the student interface is entered, and in this interface, students can submit assignments to see how their homework is being corrected. When the user entered the user name and password in the above interface, after selecting the student user, point login, will enter the Dologin method (located in Controller\index\account\dologin), the code is as follows:

 Public functionDologin () {$kind=$_post[' Kind ']; if($kind= = ' Tea ')        {            $user=usermodel::get ([' username ' =$_post[' username '], ' password ' =MD5($_post[' pwd '])]); if($user)            {                if($user->power== ' Common ')                    Echo"Successful teacher Landing"; Else                     Echo' Administrator login successful '; }                    }Else         {            $stu=stumodel::get ([' Stu_no ' =$_post[' username '], ' password ' =MD5($_post[' pwd '])]); if($stu)            {                $_session[' Stuno ']=$stu-Stu_no; $this->success (' Landing success ', ' student/'.$stu-stu_no); }            Else             {                $this->error (' User name or password error ')); }        }    }

This is only a simple implementation of the student logic. When the student landed successfully will enter the student controller's index method, of course, you need to configure the following route in rote.php:

' Index/student/:stuno ' = ' index/student/index '

The following can be handled in the student controller:

 <? phpnamespace App\index\controller;  use   Think\controller;  use  app\index\model\student as   Stumodel;  class  Student extends   controller{ public  function  index ( $stuno  Span style= "color: #000000;" ) {  $stu  =stumodel::get ([' Stu_no ' =>

Here is just a simple elaboration of the processing and jump logic, of course, the actual development of the more abundant functions and logic, to point the face bar, I hope you have some help.

Here is the page after successful landing:

The first top of this article to seek the net, by the author original, if need to reprint please indicate the source.

[Job Management system development combat three] user login module backend code (THINKPHP5)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.