Rev Author Line No. Line
250 kaklik 1 <?php
2 /* $Id: decode_bug.php,v 2.3 2006/01/17 17:03:02 cybot_tm Exp $ */
3 // vim: expandtab sw=4 ts=4 sts=4 foldmarker={,} fdm=marker:
4  
5  
6 /**
7 * Parser BUG decoder
8 *
9 * This is the parser bug decoder system
10 * Throw the bug data in teh query box, and hit submit for output.
11 *
12 * Copyright 2002 Robin Johnson <robbat2@users.sourceforge.net>
13 */
14  
15  
16 /**
17 * Displays the form
18 */
19 ?>
20 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
21 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
22 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
23  
24 <head>
25 <link rel="icon" href="./favicon.ico" type="image/x-icon" />
26 <link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />
27 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
28 <title>phpMyAdmin - Parser BUG decoder</title>
29 <style type="text/css">
30 <!--
31 body, p {
32 font-family: Arial, Helvetica, sans-serif;
33 font-size: medium;
34 }
35 h1 {
36 font-family: Verdana, Arial, Helvetica, sans-serif;
37 font-size: large;
38 font-weight: bold;
39 color: #000066;
40 }
41 //-->
42 </style>
43 </head>
44  
45  
46 <body bgcolor="#FFFFFF">
47 <h1>Parser BUG decoder</h1>
48 <br />
49  
50 <form method="post" action="./decode_bug.php">
51 <input type="hidden" name="bar" value="<?php echo rand(); ?>" />
52 Encoded bug report:<br />
53 <textarea name="bug_encoded" cols="72" rows="10"></textarea>
54 <br /><br />
55 <input type="submit" />
56 </form>
57 <hr />
58  
59 <?php
60 /**
61 * If the form has been submitted -> decodes the bug report
62 */
63  
64 /**
65 * Display the decoded bug report in ASCII format
66 *
67 * @param string the text data
68 *
69 * @return string the text enclosed by "<pre>...</pre>" tags
70 *
71 * @access public
72 */
73 function PMA_printDecodedBug($textdata)
74 {
75 return '<pre>' . htmlspecialchars($textdata) . '</pre><br />';
76 } // end of the "PMA_printDecodedBug()" function
77  
78  
79 if (!empty($_POST) && isset($_POST['bug_encoded'])) {
80 $bug_encoded = $_POST['bug_encoded'];
81 }
82  
83 if (!empty($bug_encoded)) {
84 if (get_magic_quotes_gpc()) {
85 $bug_encoded = stripslashes($bug_encoded);
86 }
87  
88 $bug_encoded = ereg_replace('[[:space:]]', '', $bug_encoded);
89 $bug_decoded = base64_decode($bug_encoded);
90 if (substr($bug_encoded, 0, 2) == 'eN') {
91 if (function_exists('gzuncompress')) {
92 $result = PMA_printDecodedBug(gzuncompress($bug_decoded));
93 } else {
94 $result = 'Error: &quot;gzuncompress()&quot; is unavailable!' . "\n";
95 }
96 } else {
97 $result = PMA_printDecodedBug($bug_decoded);
98 } // end if... else...
99  
100 echo '<p>Decoded:</p>' . "\n"
101 . $result . "\n";
102 } // end if
103 ?>
104 </body>
105  
106 </html>