conjure.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. $page_title = "The Conjuring";
  3. include("res/config.php");
  4. include("lib.php");
  5. include("res/header.php");
  6. echo("\n<main>\n");
  7. if (!empty($_POST["url_target"]) && !empty($_POST["url_alias"]))
  8. {
  9. $url_target = $_POST["url_target"];
  10. $url_alias = $_POST["url_alias"];
  11. $url_alias = sanitize_filename($url_alias);
  12. $dest_file = $url_aliasize_dir . $url_alias . $url_aliasize_suffix;
  13. $beaming_permitted = 0;
  14. }
  15. else
  16. {
  17. $beaming_permitted = 1;
  18. }
  19. if (!filter_var($url_target, FILTER_VALIDATE_URL))
  20. {
  21. $beaming_permitted = 3;
  22. }
  23. else if (file_exists($dest_file))
  24. {
  25. $beaming_permitted = 2;
  26. }
  27. switch ($beaming_permitted)
  28. {
  29. case 1:
  30. celebrate_death($dest_file, $url_aliasize_item,
  31. $url_aliasize_die_img, $url_aliasize_die_alt,
  32. "<p>... you didn't pick a URL/target.</p>
  33. <p>Do it next time >;c</p>");
  34. break;
  35. case 2:
  36. celebrate_death($dest_file, $url_aliasize_item,
  37. $url_aliasize_die_img, $url_aliasize_die_alt,
  38. "<p>Oh, sorry. Some-one just took that mask before you got here!</p>
  39. <p>Try a different target name, doggo</p>");
  40. break;
  41. case 3:
  42. celebrate_death($dest_file, $url_aliasize_item,
  43. $url_aliasize_die_img, $url_aliasize_die_alt,
  44. "<p>Are you screwing with me? That's not a URL</p>
  45. <p>Nice try, buck-o</p>");
  46. break;
  47. case 0:
  48. write_alias($dest_file, $url_target);
  49. celebrate($dest_file, $url_aliasize_item,
  50. $url_aliasize_win_img, $url_aliasize_win_alt);
  51. break;
  52. }
  53. ?>
  54. </main>
  55. <?php
  56. include("res/footer.html");
  57. ?>