Skip to content

Commit

Permalink
Update ul.php
Browse files Browse the repository at this point in the history
  • Loading branch information
biscoe916 committed May 29, 2013
1 parent 593cbf5 commit cc5789f
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions ul.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,22 @@
$url = trim($_GET["img_url"]);
$sk = urldecode($_GET["secret_key"]);
$directory = urldecode($_GET["directory"]);
$resp_str = $_GET['resp_str'];
$new_image_name = rand(1,9999).basename($url);
$return = array();
$return['resp_str'] = $resp_str;
$return = array("resp_str" => $_GET["resp_str"]);

if(!$url || !$directory || !$sk || !$resp_str) { // Ensure we have all of the required data
$return['status'] = 'failed';
$return['fail_reason'] = 'Missing Data';
$return["status"] = "failed";
$return["fail_reason"] = "Missing Data";
} elseif($secret_key != $sk) { // Make sure we're authorized
$return['status'] = 'failed';
$return['fail_reason'] = 'Unauthorized: Keys must match.';
$return["status"] = "failed";
$return["fail_reason"] = "Unauthorized: Keys must match.";
} else {
if(file_put_contents($new_image_name, file_get_contents($url))) {
$return['status'] = 'success';
$return['url'] = $directory.$new_image_name;
$return["status"] = "success";
$return["url"] = $directory.$new_image_name;
} else {
$return['status'] = 'failed';
$return['fail_reason'] = 'Unknown Error';
$return["status"] = "failed";
$return["fail_reason"] = "Unknown Error";
}
}
?>

0 comments on commit cc5789f

Please sign in to comment.