Last active
July 8, 2016 08:20
-
-
Save ken-muturi/063860f7912e3c5c4c0c8dea0e04e2a3 to your computer and use it in GitHub Desktop.
ODK formList.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require("../config.php"); | |
require("../util.php"); | |
if( ! isset( $_SERVER['PHP_AUTH_DIGEST'] ) || empty($_SERVER['PHP_AUTH_DIGEST']) ) | |
{ | |
http_response_code(401); | |
header("HTTP/1.1 401 Unauthorized"); | |
header('WWW-Authenticate: Digest realm="'. $realm .'",qop="auth",nonce="'.uniqid().'",opaque="'. md5($realm) .'"'); | |
die('Canceled !'); | |
} | |
$data = Util::http_digest_parse( $_SERVER['PHP_AUTH_DIGEST'] ); | |
if (! $data || ! isset($users[ $data['username'] ])) | |
die('Credentials not set!'); | |
if ( ! Util::check_user_pass() ) | |
{ | |
http_response_code( 401 ); | |
die('Wrong Credentials!'); | |
} | |
header('Content-Type: text/xml'); | |
header('HTTP/1.1 200 OK'); | |
header('X-OpenRosa-Version: 1.0'); | |
header('Date: '. date("r")); | |
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 | |
// header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past | |
header("X-OpenRosa-Accept-Content-Length: 1048576000"); | |
// generate the valid response | |
echo join(' ', Util::formList()); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment