Esempio n. 1
0
 function Show()
 {
     if (!$this->allow(ALLOW_SELECT)) {
         return $this->AD();
     }
     $sql = !empty($GLOBALS['_POST']['sql']) ? $GLOBALS['_POST']['sql'] : '';
     if (get_magic_quotes_gpc()) {
         $sql = stripslashes($sql);
     }
     $err = '';
     if ($sql) {
         $time = time64();
         set_time_limit(0);
         $res = $this->ExecSql($sql);
         $time = sprintf("%1.1f", (time64() - $time) * 1000);
     }
     # SQL FORM
     //$ret = PageHeader($this->str('head'), 'icons/mysqlcon.gif');
     $ret = "<h3>" . $this->str('head') . "</h3>";
     $ret .= "\n\t\t<form method=post name=sql_form id=sql_form action=''>\n\t\t<input type=hidden name=page value=" . $this->name . ">\n\t\t<input type=hidden name=do value=show>\n\t\t<textarea class=fForm name=sql cols=70 rows=10 wrap=off style='width: 100%'>" . stripslashes($sql) . "</textarea>\n\t\t<div align=right class=note>post_max_size=" . ini_get('post_max_size') . "</div>\n\t\t<a class='button' href='javascript:document.getElementById(\"sql_form\").submit();'>" . $this->str('exec') . "</a>\n\t\t</form>\n\t\t";
     if (isset($res)) {
         $count = is_resource($res) ? @mysql_num_rows($res) : 0;
         $ret .= $this->str('result') . " (Time = <b>" . $time . " ms</b>; Count = <b>" . $count . "</b>)<br>\n";
         if (false && $count) {
             $ret .= TTable::Show(array('sql' => $sql, 'noedit' => true));
         } else {
             $result_str = $this->GetSqlResult($res);
             if (!$result_str) {
                 $success = $this->str('success');
                 $result_str = str_repeat("-", strlen($success)) . "\n" . $success . "\n" . str_repeat("-", strlen($success));
                 $result_str .= "\nAffected rows: " . mysql_affected_rows();
             }
             $ret .= $result_str;
         }
     }
     //$ret.= PageFooter();
     return $ret;
 }
Esempio n. 2
0
 function settings()
 {
     cHeader($this->name, 'settings');
     TTable::Show(array('select' => "title", 'titles' => $this->str('', 'module_title'), 'from' => "{$this->table_settings}", 'proc_view' => array(), 'edit' => 0, 'edit_method' => 'editsettings'));
     cFooter();
 }