How to write PHP login function

墨辰丷
Release: 2023-03-29 21:36:01
Original
1364 people have browsed it

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 appcation storm image



Author:wangming

DateTime:2009-9-1

Version:1.0.0

Email:wangmingemail@163.com


姓名:wangming
电商06-2


用户名:
密 码:
验证码: image code

©Copyright 2015.

Copy after login

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); } }
Copy after login

3 dologin .php

Copy after login

4 conn.php

 5 
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!