diff --git a/beam.php b/beam.php old mode 100755 new mode 100644 index 84af6f8..e952a76 --- a/beam.php +++ b/beam.php @@ -1,153 +1,75 @@ \n"); - -function celebrate($dest_file) -{ - -?> -
Thank you for feeding me
-Your coin is in safe hands
-It will not be de-atomized for at least a year
- -Your coin's over here
- -It's meta-stuff (or lack thereof) is - here
- -...
-That was weird, something went wrong.
-Give it another go-- if it happens again, tell me.
-
Also tell this: "File: , - Method: ."
- - 36) - { - ?> -just a friendly note:
-it looks like your filename is total gibberish or really long.
-it could probably be a bit prettier--
-
remember, you can use the filename box when uploading to set a custom filename.
- \n"); - -if (!empty($_POST["upload_url"])) -{ - $upload_url = $_POST["upload_url"]; - $file_name = url_to_filename($upload_url); - $upload_method = 2; -} -else if (!empty($_POST["desired_filename"])) +if (!empty($_POST["desired_filename"])) { $file_name = $_POST["desired_filename"]; - $upload_method = 1; + $file_name = sanitize_filename($file_name); + $dest_file = $file_beam_dir . $file_name; + + $beaming_permitted = 0; } else if (!empty($_FILES["fileToUpload"]["name"])) { $file_name = $_FILES["fileToUpload"]["name"]; - $upload_method = 1; + $file_name = sanitize_filename($file_name); + $dest_file = $file_beam_dir . $file_name; + + $beaming_permitted = 0; } else { - $upload_method = 0; + $beaming_permitted = 1; } - -// check if file-name has any... undesirable characteristics -$file_name = sanitize_filename($file_name); - - -// and now we pretend that never happened - - -$dest_dir = "p/"; -$dest_file = $dest_dir . $file_name; - - -$beaming_permitted = 1; - if (file_exists($dest_file)) { - echo("\tWe're getting some interference
\n"); - echo("\tPlease use a different coin-name
\n\n"); - $beaming_permitted = 0; + $beaming_permitted = 2; } -if ($beaming_permitted == 0) + + +switch ($beaming_permitted) { - echo("\tsorry <\\3
\n"); -} -else -{ - if ($upload_method == 1) - { + case 1: + celebrate_death($dest_file, $file_beam_item, + $file_beam_die_img, $file_beam_die_alt, + "… you didn't upload anything, dope. +
Try again.
"); + break; + case 2: + celebrate_death($dest_file, $url_aliasize_item, + $file_beam_die_img, $file_beam_die_alt, + "Er, that coin already exists— try a different file-name.
"); + break; + case 0: if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"],$dest_file)) { - write_metadata($dest_file, $_POST["file_desc"], $_POST["file_source"]); - celebrate($dest_file); - check_name_length($file_name); + write_metadata($dest_file, $_POST["file_source"]); + celebrate($dest_file, $file_beam_item, + $file_beam_win_img, $file_beam_win_alt, true); } else { - celebrate_death($dest_file, $upload_method); + celebrate_death($dest_file, $url_aliasize_item, + $file_beam_die_img, $file_beam_die_alt, + "What the hell just happened? :o
+I dunno, but maybe you should give it another go?
"); } - } - else if ($upload_method == 2) - { - $download = file_get_contents($upload_url); - if (file_put_contents($dest_file, $download)) - { - write_metadata($dest_file, $_POST["file_desc"], $upload_url . "\n\t" . $_POST["file_source"]); - celebrate($dest_file); - check_name_length($file_name); - } - else - { - celebrate_death($dest_file, $upload_method); - } - } - else if ($upload_method == 0) - { - echo("\t(upload something next time, my dumb, sweet honey-pie <3)
"); - celebrate_death("n/a", "smartassery"); - } - else - { - celebrate_death($dest_file, $upload_method); - } + break; } - - ?> diff --git a/conjure.php b/conjure.php old mode 100755 new mode 100644 index d070056..b90aae2 --- a/conjure.php +++ b/conjure.php @@ -1,90 +1,63 @@ \n"); - -function celebrate($dest_file) -{ - -?> -
Thank you for feeding me
-Your coin is in safe hands
-It will not be de-atomized for at least a year
- -Your coin's over here
- -It's meta-stuff (or lack thereof) is - here
- -...
-That was weird, something went wrong.
-Give it another go-- if it happens again, tell me.
-
Also tell this: "File: , - Method: ."
- -\n"); if (!empty($_POST["url_target"]) && !empty($_POST["url_alias"])) { $url_target = $_POST["url_target"]; $url_alias = $_POST["url_alias"]; - $beaming_permitted = 1; + $url_alias = sanitize_filename($url_alias); + + $dest_file = $url_aliasize_dir . $url_alias . $url_aliasize_suffix; + + $beaming_permitted = 0; } else { - $beaming_permitted = 0; + $beaming_permitted = 1; +} + +if (!filter_var($url_target, FILTER_VALIDATE_URL)) +{ + $beaming_permitted = 3; +} +else if (file_exists($dest_file)) +{ + $beaming_permitted = 2; } -// check if file-name has any... undesirable characteristics -$url_alias = sanitize_filename($url_alias); - - -// and now we pretend that never happened - -$dest_dir = "u/"; -$dest_file = $dest_dir . $url_alias; - - - -if (file_exists($dest_file)) +switch ($beaming_permitted) { - echo("\tWe're getting some interference
\n"); - echo("\tPlease use a different coin-name
\n\n"); - $beaming_permitted = 0; -} - -if ($beaming_permitted == 0) -{ - echo("\tsorry <\\3
\n"); -} -else -{ - $redirectfile = fopen($dest_file, 'w'); - - fwrite($redirectfile, ""); - fclose($redirectfile); - - celebrate($dest_file); + case 1: + celebrate_death($dest_file, $url_aliasize_item, + $url_aliasize_die_img, $url_aliasize_die_alt, + "... you didn't pick a URL/target.
+Do it next time >;c
"); + break; + case 2: + celebrate_death($dest_file, $url_aliasize_item, + $url_aliasize_die_img, $url_aliasize_die_alt, + "Oh, sorry. Some-one just took that mask before you got here!
+Try a different target name, doggo
"); + break; + case 3: + celebrate_death($dest_file, $url_aliasize_item, + $url_aliasize_die_img, $url_aliasize_die_alt, + "Are you screwing with me? That's not a URL
+Nice try, buck-o
"); + break; + case 0: + write_alias($dest_file, $url_target); + celebrate($dest_file, $url_aliasize_item, + $url_aliasize_win_img, $url_aliasize_win_alt); + break; } ?> @@ -92,5 +65,5 @@ else diff --git a/index.html b/index.html deleted file mode 100644 index 96d3b78..0000000 --- a/index.html +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - ---> rocket scientist edition <--
- -Thanks for feeding me
+Your 's in safe hands
+ + + +Your 's + over here
+ +It's meta-stuff (or lack thereof) is + here
+ +Oh God, I've never seen so much blood—
+err, I mean, there're just some minor problems under the hood!
+ + + + + + -