]> git.mxchange.org Git - friendica-addons.git/blob - dav/SabreDAV/examples/basicauth.php
75552f3f9438974f0c13d315201206490f943ce3
[friendica-addons.git] / dav / SabreDAV / examples / basicauth.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_BasicAuth();
17
18 $result = $auth->getUserPass();
19
20 if (!$result || $result[0]!=$u || $result[1]!=$p) {
21
22     $auth->requireLogin();
23     echo "Authentication required\n";
24     die();
25
26 }