`

PHP HTTP Authentication

    博客分类:
  • PHP
 
阅读更多

<?php
 
$config['admin_username'] = "demo";
$config['admin_password'] = "demo";
 
if (!($_SERVER['PHP_AUTH_USER'] == $config['admin_username'] && $_SERVER['PHP_AUTH_PW'] == $config['admin_password'])) {
    header("WWW-Authenticate: Basic realm=\"Papermashup.com Demo Admin\"");
    header("HTTP/1.0 401 Unauthorized");
    echo 'This is what happens if you press cancel';
    ?>
<?php
    exit;
}
// if the username and password match show the rest of the content
 
?>
 
分享到:
评论

相关推荐

    SNS Windows Live ID Delegated Authentication SDK 1.2

    现在国内SNS网站众多,基本上都会有一个功能,即通过来邀请好友,大体实现方式是让最终用户提供MSN用户名以及密码,采用Windows Live ID Delegated Authentication来实现这个功能(可以使用C#、VB、Java、PHP、...

    php英文开发文档

    •Features•HTTP authentication with PHP •Cookies •Sessions •Dealing with XForms •Handling file uploads •Using remote files •Connection handling •Persistent Database Connections •Safe Mode •...

    PHP and MYSQL Bilbe [英文原版]

    Chapter 44: User Authentication 819 Chapter 45: A User-Rating System857 Chapter 46: A Trivia Game871 Chapter 47: Converting Static HTML Sites 913 Chapter 48: Data Visualization with Venn Diagrams 945...

    php发送邮件插件

    第一,需要下载PHPMailer文件包phpmailer. http://phpmailer.sourceforge.net/ 第二,确认你的服务器系统已经支持socket ,通过phpinfo();查看是否支持sockets(socket 是属于PHP扩展部分),如果显现为“enabled”,那...

    php.ini-development

    http://php.net/configuration.file ; The syntax of the file is extremely simple. Whitespace and lines ; beginning with a semicolon are silently ignored (as you probably guessed). ; Section headers (e...

    电子商务网店程序PHP

    # robots.txt # # This file is to prevent the crawling and indexing of certain parts # of your site by web crawlers and spiders run by sites like...Disallow: /authentication.php Disallow: /pdf-invoice.php

    PHPMailer邮件类

    第一步:需要下载PHPMailer文件包phpmailer-1.73.tar.gz 来自开源社区: http://phpmailer.sourceforge.net/ 第二步:确认你的服务器系统已经支持socket 如下图,通过phpinfo();查看是否支持sockets  如果...

    PHP cookbook

    arrays, and dates and times, Program building blocks: variables, functions, classes, and objects, Web programming: cookies, forms, sessions, and authentication, Database access using PDO, SQLite, and...

    google api php client

    * [PHP 5.4.0 or higher](http://www.php.net/) ## Developer Documentation ## http://developers.google.com/api-client-library/php ## Installation ## You can use **Composer** or simply **Download the ...

    PHP User Management and Authentication-开源

    UMA是一个PHP用户管理和身份验证应用程序。 支持PostgreSQL和MySQL数据库。 http://uma.halosrealm.com

    PHP连接MSSQL2005的扩展插件.

    先到微软网站下载 SQL Server Driver for PHP :http://www.microsoft.com/downloads/details.aspx?familyid=CCDF728B-1EA0-48A8-A84A-5052214CAAD9&displaylang=en , 这是一个自解压的EXE文件,解压缩后你会得到...

    authentication_app

    用户认证应用 该应用程序允许您对数据存储在名称为fileDB.txt的文本文件中的用户进行身份验证登录名和密码将根据此模式写入文本文件。... 要运行该应用程序,您... 启动服务器后,您将在地址栏中看到: http:// local

    Android-Token-Authentication:使用客户端服务器令牌身份验证对用户进行身份验证,以保护您的应用程序

    Android客户端服务器令牌认证第一步是在您的http服务器上设置php文件。 这可能类似于NGINX或Apache。 将token.php文件复制到您的主目录中在每个php文件的开头,您都希望包含 $data = json_decode(file_get_contents&...

    php基于表单密码验证与HTTP验证用法实例

    PHP 的 HTTP 认证机制仅在 PHP 以 Apache 模块方式运行时才有效,因此该功能不适用于 CGI 版本。在 Apache 模块的 PHP 脚本中,可以用 header() 函数来向客户端浏览器发送“Authentication Required”信息,使其弹出...

    PhpTelnet:php telnet 客户端

    远程登录 (惊人的)php telnet 客户端。 基本的 http 示例: $client = new \PhpTelnet\Client('...// authentication $resp = $client-&gt;getResponse(); $arrResp = explode("\n", $resp); $challenge =

    WiKID Strong Authentication System:二元认证系统-开源

    WiKID 强认证系统是一种基于公钥的双因素认证系统。...阅读我们的电子指南,了解如何使用双因素身份验证设置您的网络:http://www.wikidsystems.com/learn-more/two -factor-authentication-white-papers

    Consumir-API-Rest-PHP:在PHP中使用API​​ Rest的类

    $ rs = API :: Authentication ( $ URL . 'authentication' , 'usuario' , 'clave' ); $ array = API :: JSON_TO_ARRAY ( $ rs ); $ token = $ array [ 'data' ][ 'APIKEY' ]; JSON身份验证结构 { "success": ...

    http身份验证:PSR-15中间件,用于实现基本和摘要Http身份验证

    composer require middlewares/http-authentication基本认证是最简单的技术。 您必须为Array或ArrayAccess提供所有可用用户的用户名和密码。 键是用户名,值是密码。 Dispatcher :: run ([ new Middlewares \ Basic...

    game-addiction:根据中国网络游戏防沉迷实名认证系统互连对接技术规范开源项目

    游戏成瘾 根据中国网络游戏防沉迷实名认证系统互连对接技术规范开源项目 安装 composer require " jacklin/game-addiction " 例子 **测试用例如下**注:测试时更换app_id,biz_id键IP白名单...use GuzzleHttp \ Excepti

    IcecastAuth:PHP库用于通过网址系统(http)通过Icecast身份验证对侦听器进行身份验证

    IcecastAuth 用于通过Icecast身份验证(URL)( )对侦听器进行身份验证PHP库。... // REQUIRED : Set the function call for the authentication // Execute $ IceAuth -&gt; execute (); 安装程序回调

Global site tag (gtag.js) - Google Analytics