From e2a2a9eb9bfa3b7ed3464e6628297a53714f8874 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20=C3=81lvarez?= Date: Thu, 18 Jul 2019 08:53:55 +0200 Subject: [PATCH] Initial commit --- README.md | 1 + index.php | 119 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 120 insertions(+) create mode 100644 README.md create mode 100644 index.php diff --git a/README.md b/README.md new file mode 100644 index 0000000..0390e71 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +Simpler than the mechanism of a spoon. \ No newline at end of file diff --git a/index.php b/index.php new file mode 100644 index 0000000..2831b9c --- /dev/null +++ b/index.php @@ -0,0 +1,119 @@ + label +$buttons = [ + 'reset' => 'Reset', + 'urlencode' => 'URL Encode', + 'urldecode' => 'URL Decode', + 'b64encode' => 'Base64 Encode', + 'b64decode' => 'Base64 Decode', + 'htmlencode' => 'HTML Encode', + 'htmldecode' => 'HTML Decode', + // 'uuencode' => 'UU Encode', + // 'uudecode' => 'UU Decode', + 'qprintencode' => 'Qprint Encode', + 'qprintdecode' => 'Qprint Decode', + 'hash' => 'Hash', + 'hex' => 'Hex', +]; + +$str = $result = $_GET['str'] ?? ''; +$action = $_GET['action'] ?? ''; + +if ($action == 'reset') { + http_response_code(302); + header("Location: /"); + die(); + +} elseif ($action == 'urlencode') { + $result = urlencode($str)?: $str; + +} elseif ($action == 'urldecode') { + $result = urldecode($str)?: $str; + +} elseif ($action == 'b64encode') { + $result = base64_encode($str)?: $str; + +} elseif ($action == 'b64decode') { + $result = base64_decode($str)?: $str; + +} elseif ($action == 'htmlencode') { + $result = htmlentities($str, ENT_QUOTES | ENT_HTML5)?: $str; + +} elseif ($action == 'htmldecode') { + $result = html_entity_decode($str, ENT_QUOTES | ENT_HTML5)?: $str; + +} elseif ($action == 'uuencode') { + $result = convert_uuencode($str)?: $str; + +} elseif ($action == 'uudecode') { + $result = convert_uudecode($str)?: $str; + +} elseif ($action == 'hash') { + $result = "Algorithm Time Len Hash\n"; + foreach (hash_algos() as $algo) { + $t1 = microtime(true); + $r = hash($algo, $str, false); + $t2 = (microtime(true) - $t1) * 1000; + $result .= sprintf("%-15s %.3f %3d %s\n", $algo, $t2, strlen($r), $r); + } + $result = trim($result); + +} elseif ($action == 'hex') { + $result = chunk_split(bin2hex($str), 2, " "); + +} elseif ($action == 'qprintencode') { + $result = quoted_printable_encode($str)?: $str; + +} elseif ($action == 'qprintdecode') { + $result = quoted_printable_decode($str)?: $str; +} + +?> + + + + + + + + Encode/Decode everything + + + + + + + + + +
+
+ $label) { ?> + + +
+ +
+ +
+
+ +
+ Contact me via email or twitter. +
+ +