<%
include( "../modules/utils.inc.php" );
$pass = $PHP_AUTH_PW ? $PHP_AUTH_PW : urldecode( $password );
$u = $PHP_AUTH_USER ? $PHP_AUTH_USER : ( $user ? $user : $_COOKIE["c_uid"] );
$tok = $authenticated = $_COOKIE["c_pass_token"];
Header( "Content-type: text/xml");
if( $u && ($pass && $pass == getPasswdForUser( $u ) || ($tok && $tok == md5( getPasswdForUser( $u ))))) {
echo "<response>";
if( $id && $comments && $user )
$errors = addCommentToLink( $id, $comments, $user, $debug );
else
$errors = true;
if( $errors )
echo "<b>FAILED</b> : $errors";
else
echo "SUCCESS";
echo "</response>";
} else {
header('WWW-Authenticate: Basic realm="Feed Me Links XML API"');
header('HTTP/1.0 401 Unauthorized');
echo "<response>login first, please.
saw
[ 'id' => $id, 'comments' => $comments, 'user' => $user, 'password' => $password ]
</response>";
}
%>