html Code

<if condition="!isset($_SESSION['account'])">
<div class="load lf">
<p> Register login </p>
<div class="userId">
Account number :<input type="text" placeholder=" Please enter your account number " value="" name="username" id="username" required>
<div class="userPwd">
password :<input type="password" placeholder=" Please input a password " value="" name="pwd" id="pwd" required>
<div class="user-choose">
<input type="checkbox" name="userId">
<div class="remember"> Remember the user name </div>
<a href="#" class="forget"> Forget the password </a>
<div class="bottom-choose">
<button class="submit" id="submit" type="submit"></button>
<a href="{{:U('register/index')}}" class="register"></a>
<else />
<div class="load lf">
{{$Think.session.account}} <a href="{{:U('index/loginout')}}">【 sign out 】</a>

js Code

var username = $("#username").val();
var pwd = $("#pwd").val();
if($data.status == 1){
location.href = $data.url;

php Code

 public function login(){
if($username=='' || $pwd==''){
$this->ajaxReturn(array('status'=>0,'info'=>' Account password cannot be empty ','url'=>''));
$User = D("User");
$result=$User->getFields("account='".$username."' and password='".md5($pwd)."'");
$this->ajaxReturn(array('status'=>0,'info'=>' Login failed ','url'=>''));
$this->ajaxReturn(array('status'=>1,'info'=>' Login successful ','url'=>$url));
} public function loginout(){

model Code

public function getFields($where){
return $this->where($where)->find();

thinkphp3.2 The user login ajax Submit more articles about validation

  1. Start from scratch MVC4 Framework website user login and authority verification module Detailed tutorial

    Start from scratch MVC4 Framework website user login and authority verification module Detailed tutorial   User login and authority verification is an indispensable part of the website , MVC4 The framework has built-in class libraries to implement this function , It's just a simple ride ...

  2. The user login ajax Local refresh captcha

    When the user logs in , Login page with captcha image , Users need to enter the correct verification code to log in , Verification code to achieve local refresh operation . The effect is as shown in the picture : The code is as follows : # Functions that generate captcha and picture import rando ...

  3. Vue Project to achieve user login and token verification

    Learning blog :

  4. django Starting from scratch 8 User login authentication To be tested

    Look at the document djang Comes with a user login authentication method , But some of them look confused , I went to the Internet for a tour , I found that many of them were copied from the documents , Almost nothing about the principle especially from django.contrib.auth import a ...

  5. frame ----Django And Form Submit validation ( One )

    One .Form Submit verification and Ajax Application examples of submission verification Form The page refreshes when the form is submitted , When input fails , The contents in the input box will be refreshed and cannot be retained : and Ajax Submission is a secret submission in the background , Will not refresh the page , So you can keep it in the input box of the page ...

  6. ajax Submit and upload files in sync

    We often worry about file uploads , The most annoying , It can be inferred , The size of the file we uploaded , Case style and so on . therefore , We can only ajax Submit validation .ajax Asynchronous commit is too cumbersome , I think too much change code , in fact , We use JQuery When plug-in , ...

  7. Use jQuery Ajax Asynchronous login , And verify user input (maven)

    Use jQuery Ajax Asynchronous login , And verify user input (maven) Content of this article : (1) The last one is using synchronous requests to log in , And by the Servlet Decide what to do next after landing , Use of this article jQuery A ...

  8. Python Django cache , The signal , serialize , Upload files ,Ajax Login and csrf_token verification

    Content of this section models operation Django The cache of Request mode serialize Form coordination Ajax Realize login authentication Upload files Ajax  csrf_token Verification mode 1 models operation Single table query : curd( increase ...

  9. PHP Verify user login example - Learning notes

    1. The basic flow : 2.UML Class diagram : 3.PHP Code : 3.1 index.php <?php /** * Created by PhpStorm. * User: andy * Date: 16- ...

Random recommendation

  1. Chapter five SQL Server Security architecture and security

    This article is SQL Server Chapter five of the security series , Please refer to the original for details . Architecture is essentially a database object , A container for other objects , It can easily manage groups of objects in a complex database . Architecture has important security functions . In this article you will learn ...

  2. ios compile openssl Support arm64( turn )

    Alipay is being compiled recently. Quick payment ( wireless ) ios I found out when I was at the end demo I won't support it arm64. I found it on the Internet , See customer service said yes openssl The library file for is not supported arm64, So I compiled the support arm64 Library file , I can't find it , ...

  3. POJ 3107-Godfather( Tree form dp)

    The question : Yes n Tree of nodes , Delete a point , The maximum connected branch is the smallest , Find the set of such points analysis : dp[i] Said to delete i The largest branch of the link , Just go through the nodes , This question uses vector Will timeout #include <map& ...

  4. super 1000 JQuery plug-in unit

    Reprint : super 1000 individual jquery plug-in unit !

  5. AR Introductory series -05-Vuforia Identify target video playback

    To play the video after identifying the target, we need a plug-in Easy Movie Texture 2.36.unitypackage Baidu online disk download address : take Ea ...

  6. Centos 6.9 install xtrabackup-2.4.8 General package ,yum install , Full volume backup , Incremental backup

    xtrabackup-2.4.8 Installation and use of Xtrabackup By percona Provided mysql Database backup tools , According to the official introduction , This is also the only open source product in the world that can innodb and xtradb Database hot standby ...

  7. WebP What's the effect on reducing image volume and traffic ?MIP Technology practice sharing

    author | Jackson edit | Caudate Whether it's PC Mobile or mobile , Pictures have always been a big part of page traffic , How to balance the size and quality of the picture , It's been a problem for developers for a long time . and WebP The emergence of Technology , In order to solve this problem ...

  8. Html5 Video player -VideoJS+Audio Tags enable video , Audio and subtitles play simultaneously

    One ,VideoJS Introduce Reference script ,videojs I'm very considerate of you , direct cdn 了 , You don't need to download the code and put it on your website <link href=” ...

  9. Python The verification thread is data shared

    import os import time from threading import Thread # from multiprocessing import Process # By modifying global variables ...

  10. Linux Input subsystem driver example

    < Key driver > #include <stdio.h> #include <fcntl.h> #include <linux/input.h> #inc ...