简体   繁体   中英

Password Protect PHP File

In PHP, how can I password protect my php file so I have to go to:

http://www.example.com/upload.php/?pass=password

If you know how to do this I would greatly appreciate a snippet of code.

我将引导您使用读取 url 路径的 $_GET,但请注意,这只是不安全的。

Alright. I used this code. It's just for something small.

<?php
$pass = $_GET['pass'];
if(!isset($pass)) {
    exit(0);
} else {
    if($pass != 'examplepass') {
        exit(0);
    }
}
?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM