-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqora.gzip.php
43 lines (42 loc) · 1.01 KB
/
qora.gzip.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
function htmlFilter($html)
{
$html1 = $html;
$html1 = str_replace("<", "<", $html1);
$html1 = str_replace(">", ">", $html1);
return $html1;
}
if(isset($_POST['txt']))
{
if($_POST['comp'] == "Compress")
{
$string = $_POST['txt'];
$compressed = gzencode($string,9);
echo "Uncompressed size: ". strlen($string)."\n";
$base64 = base64_encode($compressed);
$base64 = "?gz!".$base64;
echo "Compressed size: ". (strlen($base64))."\n";
}
else
{
$base64 = substr($_POST['zip'],4);
$compressed = gzcompress($string);
echo "Compressed size: ". (strlen($_POST['zip']))."\n";
$string = gzdecode(base64_decode($base64));
echo "Uncompressed size: ". strlen($string)."\n";
}
}
$string = htmlFilter($string);
echo "
<form method=post>
Uncompressed:<br>
<textarea name=txt rows=20 cols=60>$string</textarea>
<br>
Compressed:
<br>
<textarea name=zip rows=20 cols=60>$base64</textarea>
<br>
<input type=submit value=\"Compress\" name=comp>
<input type=submit value=\"Decompress\" name=comp>
</form>";
?>