forked from phpmyadmin/phpmyadmin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdecode_bug.php
103 lines (90 loc) · 2.55 KB
/
decode_bug.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Parser bug report decoder
*
* This is the parser bug decoder system
* Throw the bug data in the query box, and hit submit for output.
*
* Copyright 2002 Robin Johnson <[email protected]>
*
* @package PhpMyAdmin-debug
*/
/**
* Displays the form
*/
?>
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" dir="ltr">
<head>
<link rel="icon" href="favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<meta charset="iso-8859-1" />
<title>phpMyAdmin - Parser bug report decoder</title>
<style type="text/css">
<!--
body, p {
font-family: Arial, Helvetica, sans-serif;
font-size: medium;
}
h1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: large;
font-weight: bold;
color: #000066;
}
//-->
</style>
</head>
<body bgcolor="#FFFFFF">
<h1>Parser bug report decoder</h1>
<br />
<form method="post" action="./decode_bug.php">
<input type="hidden" name="bar" value="<?php echo rand(); ?>" />
Encoded bug report:<br />
<textarea name="bug_encoded" cols="72" rows="10"></textarea>
<br /><br />
<input type="submit" />
</form>
<hr />
<?php
/**
* If the form has been submitted -> decodes the bug report
*/
/**
* Display the decoded bug report in ASCII format
*
* @param string $textdata the text data
*
* @return string the text enclosed by "<pre>...</pre>" tags
*
* @access public
*/
function PMA_printDecodedBug($textdata)
{
return '<pre>' . htmlspecialchars($textdata) . '</pre><br />';
} // end of the "PMA_printDecodedBug()" function
if (!empty($_POST) && isset($_POST['bug_encoded'])) {
$bug_encoded = $_POST['bug_encoded'];
}
if (!empty($bug_encoded) && is_string($bug_encoded)) {
if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
$bug_encoded = stripslashes($bug_encoded);
}
$bug_encoded = preg_replace('/[[:space:]]/', '', $bug_encoded);
$bug_decoded = base64_decode($bug_encoded);
if (substr($bug_encoded, 0, 2) == 'eN') {
if (function_exists('gzuncompress')) {
$result = PMA_printDecodedBug(gzuncompress($bug_decoded));
} else {
$result = 'Error: "gzuncompress()" is unavailable!' . "\n";
}
} else {
$result = PMA_printDecodedBug($bug_decoded);
} // end if... else...
echo '<p>Decoded:</p>' . "\n"
. $result . "\n";
} // end if
?>
</body>
</html>