Skip to content

Instantly share code, notes, and snippets.

@RdlP
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RdlP/84af1d872b84236ca045 to your computer and use it in GitHub Desktop.
Save RdlP/84af1d872b84236ca045 to your computer and use it in GitHub Desktop.
<?php
$rest_json = file_get_contents("php://input");
$_POST = json_decode($rest_json, true);
if (isset($_POST['pass'])){
$pass = $_POST['pass'];
$resource = $_POST['resource'];
if ($pass == 1234 && $resource==0){
echo json_encode(array('error' => false, 'url' => str_replace(' ', '%20', '/download/resource1' )));
}else if ($pass == 4321 && $resource==1){
echo json_encode(array('error' => false, 'url' => str_replace(' ', '%20', '/download/resource2' )));
}else{
echo json_encode(array('error' => true));
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment