help and links
This commit is contained in:
parent
c573a63552
commit
39ca9d90cc
|
@ -1 +1,3 @@
|
||||||
Simpler than the mechanism of a spoon.
|
Simpler than the mechanism of a spoon.
|
||||||
|
|
||||||
|
Local testing: `php -S localhost:8000`
|
26
index.php
26
index.php
|
@ -2,15 +2,14 @@
|
||||||
|
|
||||||
// action => label
|
// action => label
|
||||||
$buttons = [
|
$buttons = [
|
||||||
'reset' => 'Reset',
|
|
||||||
'urlencode' => 'URL Encode',
|
'urlencode' => 'URL Encode',
|
||||||
'urldecode' => 'URL Decode',
|
'urldecode' => 'URL Decode',
|
||||||
'b64encode' => 'Base64 Encode',
|
'b64encode' => 'Base64 Encode',
|
||||||
'b64decode' => 'Base64 Decode',
|
'b64decode' => 'Base64 Decode',
|
||||||
'htmlencode' => 'HTML Encode',
|
'htmlencode' => 'HTML Encode',
|
||||||
'htmldecode' => 'HTML Decode',
|
'htmldecode' => 'HTML Decode',
|
||||||
// 'uuencode' => 'UU Encode',
|
'uuencode' => 'UU Encode',
|
||||||
// 'uudecode' => 'UU Decode',
|
'uudecode' => 'UU Decode',
|
||||||
'qprintencode' => 'Qprint Encode',
|
'qprintencode' => 'Qprint Encode',
|
||||||
'qprintdecode' => 'Qprint Decode',
|
'qprintdecode' => 'Qprint Decode',
|
||||||
'hash' => 'Hash',
|
'hash' => 'Hash',
|
||||||
|
@ -19,6 +18,7 @@ $buttons = [
|
||||||
|
|
||||||
$str = $result = $_GET['str'] ?? '';
|
$str = $result = $_GET['str'] ?? '';
|
||||||
$action = $_GET['action'] ?? '';
|
$action = $_GET['action'] ?? '';
|
||||||
|
$help = 'manual/en/index.php';
|
||||||
|
|
||||||
if ($action == 'reset') {
|
if ($action == 'reset') {
|
||||||
http_response_code(302);
|
http_response_code(302);
|
||||||
|
@ -27,27 +27,35 @@ if ($action == 'reset') {
|
||||||
|
|
||||||
} elseif ($action == 'urlencode') {
|
} elseif ($action == 'urlencode') {
|
||||||
$result = urlencode($str)?: $str;
|
$result = urlencode($str)?: $str;
|
||||||
|
$help = 'urlencode';
|
||||||
|
|
||||||
} elseif ($action == 'urldecode') {
|
} elseif ($action == 'urldecode') {
|
||||||
$result = urldecode($str)?: $str;
|
$result = urldecode($str)?: $str;
|
||||||
|
$help = 'urldecode';
|
||||||
|
|
||||||
} elseif ($action == 'b64encode') {
|
} elseif ($action == 'b64encode') {
|
||||||
$result = base64_encode($str)?: $str;
|
$result = base64_encode($str)?: $str;
|
||||||
|
$help = 'base64_encode';
|
||||||
|
|
||||||
} elseif ($action == 'b64decode') {
|
} elseif ($action == 'b64decode') {
|
||||||
$result = base64_decode($str)?: $str;
|
$result = base64_decode($str)?: $str;
|
||||||
|
$help = 'base64_decode';
|
||||||
|
|
||||||
} elseif ($action == 'htmlencode') {
|
} elseif ($action == 'htmlencode') {
|
||||||
$result = htmlentities($str, ENT_QUOTES | ENT_HTML5)?: $str;
|
$result = htmlentities($str, ENT_QUOTES | ENT_HTML5)?: $str;
|
||||||
|
$help = 'htmlentities';
|
||||||
|
|
||||||
} elseif ($action == 'htmldecode') {
|
} elseif ($action == 'htmldecode') {
|
||||||
$result = html_entity_decode($str, ENT_QUOTES | ENT_HTML5)?: $str;
|
$result = html_entity_decode($str, ENT_QUOTES | ENT_HTML5)?: $str;
|
||||||
|
$help = 'html_entity_decode';
|
||||||
|
|
||||||
} elseif ($action == 'uuencode') {
|
} elseif ($action == 'uuencode') {
|
||||||
$result = convert_uuencode($str)?: $str;
|
$result = convert_uuencode($str)?: $str;
|
||||||
|
$help = 'convert_uuencode';
|
||||||
|
|
||||||
} elseif ($action == 'uudecode') {
|
} elseif ($action == 'uudecode') {
|
||||||
$result = convert_uudecode($str)?: $str;
|
$result = convert_uudecode($str)?: $str;
|
||||||
|
$help = 'convert_uudecode';
|
||||||
|
|
||||||
} elseif ($action == 'hash') {
|
} elseif ($action == 'hash') {
|
||||||
$result = "Algorithm Time Len Hash\n";
|
$result = "Algorithm Time Len Hash\n";
|
||||||
|
@ -58,15 +66,19 @@ if ($action == 'reset') {
|
||||||
$result .= sprintf("%-15s %.3f %3d %s\n", $algo, $t2, strlen($r), $r);
|
$result .= sprintf("%-15s %.3f %3d %s\n", $algo, $t2, strlen($r), $r);
|
||||||
}
|
}
|
||||||
$result = trim($result);
|
$result = trim($result);
|
||||||
|
$help = 'hash';
|
||||||
|
|
||||||
} elseif ($action == 'hex') {
|
} elseif ($action == 'hex') {
|
||||||
$result = chunk_split(bin2hex($str), 2, " ");
|
$result = chunk_split(bin2hex($str), 2, " ");
|
||||||
|
$help = 'bin2hex';
|
||||||
|
|
||||||
} elseif ($action == 'qprintencode') {
|
} elseif ($action == 'qprintencode') {
|
||||||
$result = quoted_printable_encode($str)?: $str;
|
$result = quoted_printable_encode($str)?: $str;
|
||||||
|
$help = 'quoted_printable_encode';
|
||||||
|
|
||||||
} elseif ($action == 'qprintdecode') {
|
} elseif ($action == 'qprintdecode') {
|
||||||
$result = quoted_printable_decode($str)?: $str;
|
$result = quoted_printable_decode($str)?: $str;
|
||||||
|
$help = 'quoted_printable_decode';
|
||||||
}
|
}
|
||||||
|
|
||||||
?><!doctype html>
|
?><!doctype html>
|
||||||
|
@ -81,6 +93,7 @@ if ($action == 'reset') {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
|
<meta name="description" content="Encode and Decode strings from/to URL, Base64, HTML entities, UU, Quprint, hash, hex and more." />
|
||||||
|
|
||||||
<title>Encode/Decode everything</title>
|
<title>Encode/Decode everything</title>
|
||||||
<meta name="description" content="Encode/Decode everything, base64, url, html, charset">
|
<meta name="description" content="Encode/Decode everything, base64, url, html, charset">
|
||||||
|
@ -91,10 +104,7 @@ if ($action == 'reset') {
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
html, body { height: 100%; }
|
html, body { height: 100%; }
|
||||||
body { margin: 0; }
|
body { margin: 0; }
|
||||||
/*form { padding: 10px; } */
|
|
||||||
/*textarea { width: 99%; height: 90vh; } */
|
|
||||||
textarea.form-input { width: 100%; height: 80vh; font-family: monospace; }
|
textarea.form-input { width: 100%; height: 80vh; font-family: monospace; }
|
||||||
/*.active { font-weight: bold; }*/
|
|
||||||
.container { padding-top: .4rem; padding-bottom: .4rem; }
|
.container { padding-top: .4rem; padding-bottom: .4rem; }
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
@ -105,6 +115,8 @@ if ($action == 'reset') {
|
||||||
<?php foreach ($buttons as $act => $label) { ?>
|
<?php foreach ($buttons as $act => $label) { ?>
|
||||||
<button type="submit" name="action" value="<?=$act?>" class="btn<?=($action == $act? ' btn-primary': '')?>"><?=$label?></button>
|
<button type="submit" name="action" value="<?=$act?>" class="btn<?=($action == $act? ' btn-primary': '')?>"><?=$label?></button>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
<a href="/" class="btn btn-link btn-error">Reset</button>
|
||||||
|
<a href="https://php.net/<?=$help?>" class="btn btn-link">Help</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
@ -113,7 +125,7 @@ if ($action == 'reset') {
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div class="container text-right">
|
<div class="container text-right">
|
||||||
<small>Contact me via <a href="mailto:xergio@gmail.com">email</a> or <a href="https://twitter.com/xergio">twitter</a>.</small>
|
<small>Contact me via <a href="mailto:xergio@gmail.com">email</a> or <a href="https://twitter.com/xergio">twitter</a>. Made with pure <a href="https://php.net/">PHP</a> and <a href="https://picturepan2.github.io/spectre/">Spectre</a>. <a href="https://gitlab.com/xergio/dencode">Code</a>.</small>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue