In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article will explain in detail how to use php to achieve user login, the content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
Php to achieve user login methods: 1, create get.php file, used to obtain user login information; 2, create login.php file, used to achieve login function; 3, create logout.php file, used to achieve user logout function.
This article operating environment: windows7 system, PHP7.1 version, DELL G3 computer
How to use php to achieve user login?
PHP study daily, put it on it and record it.
I used the bootstrap framework, so the interface looks better.
Login page:
The user name, password and verification code must be entered correctly in order to log in successfully, otherwise the following prompt appears
After the login is successful, the login and registration options switch to the user nickname and logout options:
After successful login:
Select logout:
HTML Code:
Li.toggle {display: block;} li.toggle1 {display: none;} login registration logout / / modal box × Close Please log in
User name:
Password:
CAPTCHA:
Login off
JS Code:
Function toggle () {$.getJSON ("php/get.php", function (res) {if (res ['flag']) {$(' li.toggle') .hide (); $('li.toggle1') .show ()) $('# nicheng') .html (res ['nc'])} else {$(' li.toggle'). Show (); $('li.toggle1'). Hide ();}});} toggle (); $(' # form_login') .submit (function (e) {e.preventDefault () Var data=$ ('# form_login'). Serialize (); $.getJSON ('php/login.php',data,function (res) {if (res==3) {toggle (); $(' # loginer'). Modal ('hide')) } else if (res==2) {$('# info') .html ('incorrect username or password')} else {$('# info') .html ('incorrect verification code')})}); $('# logout') .click (function () {confirm ('are you sure you want to log out?') ; $.getJSON ('php/logout.php',function (res) {if (res) toggle ();})})
Connect.php (connect to the database):
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.