This article mainly introduces how to write the PHP login function. Interested friends can refer to it. I hope it will be helpful to everyone.
The specific code is as follows:
1 login.php
In the login interface, the javascript script uses ajax to asynchronously request dologin.php, which is responsible for user information. Verification (including verification code, PHP generates verification code and can search by yourself). The code of the login interface is as follows:
login
Ajax PHP Demo System
Author:wangming
DateTime:2009-9-1
Version:1.0.0
Email:wangmingemail@163.com
©Copyright 2015.
2 ajaxhelper.js
function createRequest() { try { request = new XMLHttpRequest(); } catch (tryMS) { try { request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (otherMS) { try { request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (failed) { request = null; } } } return request; } function getActivatedObject(e) { var obj; if (!e) { // early version of IE obj = window.event.srcElement; } else if (e.srcElement) { // IE 7 or later obj = e.srcElement; } else { // DOM Level 2 browser obj = e.target; } return obj; } function addEventHandler(obj, eventName, handler) { if (document.attachEvent) { obj.attachEvent("on" + eventName, handler); } else if (document.addEventListener) { obj.addEventListener(eventName, handler, false); } }
3 dologin .php
4 conn.php
5
Summary: The above is the entire content of this article, I hope it will be helpful to everyone's study.
Related recommendations:
php Detailed explanation of infinite classification tree data formatting code example
PHP obtains N-level classification from a two-dimensional array Tree implementation method
php fseek implementation function two ways to read large files
The above is the detailed content of How to write PHP login function. For more information, please follow other related articles on the PHP Chinese website!