Home > Backend Development > PHP Problem > How to write php login

How to write php login

藏色散人
Release: 2023-02-26 14:22:01
Original
3545 people have browsed it

How to write php login

How to write php login?

1. First create a login form. (This is all HTML, no explanation).

<form action="" method="post">
<input type="text" name="username" /><br>
<input type="password" name="pwd" /><br />
<input type="submit" name="login" value="登录" />
</form>
Copy after login

2. Start writing the PHP processing program, and start writing on top of the code you just wrote:

$username = "admin"; //要登录的账号
$pwd = "123456"; //要使用的密码
if ($username==$_POST[username]&&$pwd==$_POST[pwd]){
echo "登陆成功!";
}else{
echo "账号或密码错误";
exit();
}
Copy after login

In fact, this is a very simple user system.

For more PHP related knowledge, please visit PHP Chinese website!

The above is the detailed content of How to write php login. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template