summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFbenas <philbeansburton@gmail.com>2015-12-05 19:32:39 +0000
committerFbenas <philbeansburton@gmail.com>2015-12-05 19:32:39 +0000
commit56380864115d6df864edf80e43492bf890a75521 (patch)
tree912eea56df8e4b1232171c109054a8fc6fa8d407
parent01494a7fb63fd99544ca39158dd1b48c7c6cd9b7 (diff)
Allow use on other urls making password optional
-rw-r--r--config.ini.example4
-rw-r--r--search.php8
2 files changed, 8 insertions, 4 deletions
diff --git a/config.ini.example b/config.ini.example
index df9bcf4..3b2bfd3 100644
--- a/config.ini.example
+++ b/config.ini.example
@@ -1,2 +1,2 @@
-url = http://www.blaupload.co.uk/
-password = password \ No newline at end of file
+url = http://www.blaupload.co.uk
+password = password (not required) \ No newline at end of file
diff --git a/search.php b/search.php
index bcfb2e9..370c25e 100644
--- a/search.php
+++ b/search.php
@@ -10,9 +10,13 @@ try {
}
// hash the password
- $hash = hash("sha256", $config['password']);
+ if (isset($config['password'])) {
+ $hash = hash("sha256", $config['password']);
+ }
$curl = curl_init($config["url"]. "?format=json");
- curl_setopt($curl, CURLOPT_HTTPHEADER, array("Cookie: password=$hash"));
+ if (isset($hash)) {
+ curl_setopt($curl, CURLOPT_HTTPHEADER, array("Cookie: password=$hash"));
+ }
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$output = json_decode(curl_exec($curl));
curl_close($curl);