]> git.mxchange.org Git - friendica-addons.git/blob - dav/SabreDAV/examples/digestauth.php
Merge branch 'master' of git://github.com/friendica/friendica-addons
[friendica-addons.git] / dav / SabreDAV / examples / digestauth.php
1 <?php
2
3 // !!!! Make sure the Sabre directory is in the include_path !!!
4 // example:
5 // set_include_path('lib/' . PATH_SEPARATOR . get_include_path());
6
7 // settings
8 date_default_timezone_set('Canada/Eastern');
9
10 // Files we need
11 require_once 'Sabre/autoload.php';
12
13 $u = 'admin';
14 $p = '1234';
15
16 $auth = new Sabre_HTTP_DigestAuth();
17 $auth->init();
18
19 if ($auth->getUsername() != $u || !$auth->validatePassword($p)) {
20
21     $auth->requireLogin();
22     echo "Authentication required\n";
23     die();
24
25 }