Home > Backend Development > PHP Tutorial > 求圣人帮忙写几句简单的验证

求圣人帮忙写几句简单的验证

WBOY
Release: 2016-06-13 11:57:42
Original
1030 people have browsed it

求高人帮忙写几句简单的验证
我有一个站,有10来个html的文件,

现在想把加密授权使用。

应该怎么写来实现呢。

我百度里抄了个,单独命名了m.php

现在怎么让首页index.html能先加载m.php验证正确了,再继续执行显示正确的代码


------解决方案--------------------
把你的html改成php,然后在最顶,加上include('m.php'); 就可以了。
m.php

<br /><?php<br />$username = isset($_GET['username'])? $_GET['username'] : '';<br />$password = isset($_GET['password'])? $_GET['password'] : '';<br /><br />if($username!='fdipzone' <br><font color='#FF8000'>------解决方案--------------------</font><br> $password!='123456'){<br />	exit('no permission');<br />}<br />?><br />
Copy after login

index.php
<br /><?php<br />include('m.php');<br />?><br /><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><br /><html><br /> <head><br />  <title> index </title><br /> </head><br /><br /> <body><br />  index page<br /> </body><br /></html><br />
Copy after login


http://localhost/index.php 会显示no permission
http://localhost/index.php?username=fdipzone&password=123456 显示index.php的内容。

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