<ul class="nav nav-justified"> <li class="active"><a href=".">Таблица 1</a></li> <li><a href="table2.php">Таблица 2</a></li> <li><a href="table3.php">Таблица 3</a></li> <li><a href="table4.php">Таблица 4</a></li> <li><a href="table5.php">Таблица 5</a></li> </ul> </div> </div> </div> <div class="container"> <?php require 'db.php'; $current_table = 'table1'; $table_content = get_table_content($current_table); if ($table_content == '' || count($table_content) == 0) { ?> <div class="alert alert-danger"><strong>Ошибка получения данных: </strong>Невозможно получить данные из БД. Проверьте существование таблицы <?php echo $current_table; ?> в БД.</div> <?php } else { // begin else if ?> <h3 class="sub-header">Таблица 1</h3> <div class="table-responsive"> <table class="table table-striped"> <thead> <tr>
print "# --------------------------------------------------------" . $ctrn . $ctrn; get_table_content($DB['name'], $Xtbl, "my_handler", urldecode($SQL)); $i++; } } else { print "#---------------------------------------------------------" . $ctrn; print "# 호스트: " . $DB['host'] . " 선택한 디비 : " . $DB['name'] . $ctrn; print "# 테이블 네임 : " . $Xtbl . $ctrn; print "# --------------------------------------------------------" . $ctrn . $ctrn; print get_table_def($DB['name'], $Xtbl, $ctrn) . ";" . $ctrn; if ($dump_type == 'dump_all') { print "{$ctrn}{$ctrn}"; print "#---------------------------------------------------------" . $ctrn; print "# " . $Xtbl . " INSERT DATA" . $ctrn; print "# --------------------------------------------------------" . $ctrn . $ctrn; get_table_content($DB['name'], $Xtbl, "my_handler", urldecode($SQL)); } } exit; } if ($_a == 'table_excel') { header("Content-type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename=" . $Xtbl . ".xls"); header("Content-Description: PHP4 Generated Data"); get_excel_content($DB['name'], $Xtbl, urldecode($SQL)); exit; } if ($_a == 'field_alter') { if ($field_default || $field_default == "0") { $field_default_str = "DEFAULT '" . $field_default . "'"; }
if (isset($tmp_select) && is_int(strpos($tmp_select, '|' . $table . '|')) == FALSE) { $i++; } else { $formatted_table_name = isset($use_backquotes) ? backquote($table) : '\'' . $table . '\''; // If only datas, no need to displays table name if ($what != 'dataonly') { $dump_buffer .= '# --------------------------------------------------------' . $crlf . $crlf . '#' . $crlf . '# ' . $strTableStructure . ' ' . $formatted_table_name . $crlf . '#' . $crlf . $crlf . get_table_def($db, $table, $crlf) . ';' . $crlf; } // At least data if ($what == 'data' || $what == 'dataonly') { $dump_buffer .= $crlf . '#' . $crlf . '# ' . $strDumpingData . ' ' . $formatted_table_name . $crlf . '#' . $crlf . $crlf; $tmp_buffer = ''; if (!isset($limit_from) || !isset($limit_to)) { $limit_from = $limit_to = 0; } get_table_content($db, $table, $limit_from, $limit_to, 'my_handler'); $dump_buffer .= $tmp_buffer; } // end if $i++; } // end if-else } // end while // Don't remove, it makes easier to select & copy frombrowser - staybyte $dump_buffer .= $crlf; } else { // Handles the EOL character if ($GLOBALS['what'] == 'excel') { $add_character = "\r\n"; } else {
} else { echo "{$sql_insert};{$crlf}"; } } if ($what != "csv") { print "{$crlf}/* -------------------------------------------------------- {$crlf}"; print " {$cfgProgName} {$cfgVersion} DB Dump{$crlf}"; print " http://www.greatbridge.org/project/phppgadmin/{$crlf}"; print " {$strHost}: " . $cfgServer['host']; if (!empty($cfgServer['port'])) { print ":" . $cfgServer['port']; } print "{$crlf} {$strDatabase}: {$db}{$crlf}"; print " {$strTableStructure} {$cfgQuotes}{$table}{$cfgQuotes} {$crlf}"; print " " . date("Y-d-m H:m:i") . $crlf; print "-------------------------------------------------------- */ {$crlf} {$crlf}"; print get_table_def($link, $table, $crlf) . "{$crlf}"; if ($what == "data") { print "{$crlf}/* -------------------------------------------------------- {$crlf}"; print " {$strDumpingData} {$cfgQuotes}{$table}{$cfgQuotes} {$crlf}"; print "-------------------------------------------------------- */ {$crlf}"; get_table_content($link, $table, "my_handler"); } } else { // $what != "csv" get_table_csv($link, $table, $separator, "my_csvhandler"); } if (empty($asfile)) { print "</pre></div>\n"; include "footer.inc.php"; }
print "# --------------------------------------------------------{$ctrn}{$ctrn}"; get_table_content($MYSQL_DB, $table, "my_handler", urldecode(stripslashes($SQL))); $i++; } } else { print "#---------------------------------------------------------{$ctrn}"; print "# 호스트: localhost 선택한 디비 : {$MYSQL_DB}{$ctrn}"; print "# 테이블 네임 : {$table}{$ctrn}"; print "# --------------------------------------------------------{$ctrn}{$ctrn}"; print get_table_def($MYSQL_DB, $table, $ctrn) . ";{$ctrn}"; if ($dump_type == 'dump_all') { print "{$ctrn}{$ctrn}"; print "#---------------------------------------------------------{$ctrn}"; print "# {$table} INSERT DATA{$ctrn}"; print "# --------------------------------------------------------{$ctrn}{$ctrn}"; get_table_content($MYSQL_DB, $table, "my_handler", urldecode(stripslashes($SQL))); } } exit; } if ($action == 'table_excel') { header("Content-type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename={$table}.xls"); header("Content-Description: PHP4 Generated Data"); ?> <HTML> <HEAD> <META http-equiv="Content-Type" content="text/html; charset=euc-kr"> <STYLE type="text/css"> body,table,tr,td { font-size: 9pt; font-family: gullim; line-height: 1.0;} </STYLE>
function download_pdf_file($assign, $sub, $auto_judge_scenarios, $auto_judge_scenarios_output) { // create new PDF document $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); // set document information $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor(PDF_AUTHOR); $pdf->SetTitle('Auto Judge Report'); $pdf->SetSubject('Auto Judge Report'); // set default header data $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); // set header and footer fonts $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); // set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // set margins $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); // set auto page breaks $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); // set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); // set some language-dependent strings (optional) if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) { require_once dirname(__FILE__) . '/lang/eng.php'; $pdf->setLanguageArray($l); } // add a page $pdf->AddPage(); $report_table = ' <style> table.first{ width: 100%; border-collapse: collapse; } td { font-size: 0.9em; border: 1px solid #95CAFF; padding: 3px 7px 2px 7px; } th { font-size: 0.9em; text-align: center; padding-top: 5px; padding-bottom: 4px; background-color: #3399FF; color: #ffffff; } </style> <table class="first"> <tr> <th>Είσοδος</th> <th>Έξοδος</th> <th>Τελεστής</th> <th>Αναμεν. Έξοδος</th> <th>Βαρύτητα</th> <th >Αποτέλεσμα</th> </tr> ' . get_table_content($auto_judge_scenarios, $auto_judge_scenarios_output, $assign->max_grade) . ' </table>'; $report_details = ' <style> table.first{ width: 100%; border-collapse: collapse; vertical-align: center; } td { font-size: 1em; border: 1px solid #000000; padding: 3px 7px 2px 7px; text-align: center; } th { font-size: 1.0em; text-align: left; padding-top: 5px; padding-bottom: 4px; background-color: #3399FF; color: #ffffff; width: 120px; border: 1px solid #000000; } </style> <table class="first"> <tr> <th> Μάθημα</th> <td>' . htmlspecialchars(get_course_title(), ENT_QUOTES) . ' </td> </tr> <tr> <th> Εργασία</th> <td> ' . htmlspecialchars($assign->title, ENT_QUOTES) . '</td> </tr> <tr> <th> Εκπαιδευόμενος</th><td> ' . htmlspecialchars(q(uid_to_name($sub->uid)), ENT_QUOTES) . '</td> </tr> <tr> <th> Βαθμός</th> <td>' . htmlspecialchars($sub->grade, ENT_QUOTES) . '/' . htmlspecialchars($assign->max_grade, ENT_QUOTES) . ' </td> </tr> <tr> <th> Κατάταξη</th> <td>' . htmlspecialchars(get_submission_rank($assign->id, $sub->grade, $sub->submission_date), ENT_QUOTES) . '</td> </tr> </table>'; $pdf->writeHTML($report_details, true, false, true, false, ''); $pdf->Ln(); $pdf->writeHTML($report_table, true, false, true, false, ''); $pdf->Output('auto_judge_report_' . q(uid_to_name($sub->uid)) . '.pdf', 'D'); }
$dump_buffer .= "# Database: {$dbname}{$crlf}"; $dump_buffer .= "# Backed up tables : {$dbname} {$crlf}"; $i = 0; while ($i < $num_tables) { $table = mysql_tablename($tables, $i); $dump_buffer .= "# --------------------------------------------------------{$crlf}"; $dump_buffer .= "{$crlf}#{$crlf}"; $dump_buffer .= "# Table structure for table '{$table}'{$crlf}"; $dump_buffer .= "#{$crlf}{$crlf}"; $db = $table; $dump_buffer .= get_table_def($table, $crlf, $dbname) . ";{$crlf}"; $dump_buffer .= "{$crlf}#{$crlf}"; $dump_buffer .= "# Dumping data for table '{$table}'{$crlf}"; $dump_buffer .= "#{$crlf}{$crlf}"; $tmp_buffer = ""; get_table_content($dbname, $table, 0, 0, 'my_handler', $dbname); $dump_buffer .= $tmp_buffer; $i++; $dump_buffer .= "{$crlf}"; } $f_name = "tmp/" . $dbname . ".sql"; //check if file exist $suffix = 1; while (file_exists($f_name)) { $f_name = $f_name = "tmp/" . $dbname . "-(" . $suffix . ").sql"; $suffix++; } if (!($handle = fopen($f_name, "w"))) { $keyMessage = 'ErrorCreateDump'; $error = 1; }
function download_pdf_file($assign, $submissions) { // create new PDF document $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); // set document information $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor(PDF_AUTHOR); $pdf->SetTitle('Rank Report'); $pdf->SetSubject('Rank Report'); // set default header data $pdfHeaderStr = htmlspecialchars('Αναφορά κατάταξης εκπαιδευόμενων για το μάθημα ' . get_course_title() . ' και την εργασία ' . $assign->title, ENT_QUOTES); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, $pdfHeaderStr); // set header and footer fonts $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); // set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // set margins $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(3); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); // set auto page breaks $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); // set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); // set some language-dependent strings (optional) if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) { require_once dirname(__FILE__) . '/lang/eng.php'; $pdf->setLanguageArray($l); } // add a page $pdf->AddPage(); $report_details = ' <style> table.first{ width: 100%; border-collapse: collapse; vertical-align: center; } td { font-size: 1em; border: 1px solid #000000; padding: 3px 7px 2px 7px; text-align: center; } th { font-size: 1.1em; text-align: left; padding-top: 5px; padding-bottom: 4px; background-color: #3399FF; color: #ffffff; border: 1px solid #000000; } </style> <table class="first"> <tr> <th>Κατάταξη</th> <th>Εκπαιδευόμενος</th> <th>Βαθμός</th> <th>Περασμένα Σενάρια</th> </tr> ' . get_table_content($assign, $submissions) . ' </table> '; $pdf->writeHTML($report_details, true, false, true, false, ''); $pdf->Ln(); $pdf->Output('Rank Report_' . greeklish(get_course_title() . '_' . $assign->title) . '.pdf', 'D'); }
echo "# " . get_opendb_lang_var('db_backup_generated', 'date', get_localised_timestamp(get_opendb_config_var('listings', 'print_listing_datetime_mask'))) . $CRLF; echo "# -------------------------------------------------------------" . $CRLF; // special all tables option reset $HTTP_VARS['tables'] array as a result if (strcasecmp($HTTP_VARS['all_tables'], 'y') === 0) { unset($HTTP_VARS['tables']); $opendb_tables_r = fetch_opendb_table_list_r(); while (list(, $value) = each($opendb_tables_r)) { $HTTP_VARS['tables'][] = $value; } } @reset($HTTP_VARS['tables']); while (list(, $table) = @each($HTTP_VARS['tables'])) { echo $CRLF . "#" . $CRLF; echo "# " . get_opendb_lang_var('dumping_data_for_table', 'table', $table) . $CRLF; echo "#" . $CRLF . $CRLF; get_table_content($table, $CRLF); } } else { //if($HTTP_VARS['op'] == 'export') echo "<h3>Which tables should be backed up?</h3>"; echo "<form method=\"POST\" action=\"{$PHP_SELF}\">" . "<input type=\"hidden\" name=\"type\" value=\"{$ADMIN_TYPE}\">" . "<input type=\"hidden\" name=\"op\" value=\"export\">" . "<input type=\"hidden\" name=\"mode\" value=\"job\">"; echo "<ul class=\"checkboxGridOptionsVertical\">"; $opendb_tables_r = fetch_opendb_table_list_r(); while (list(, $table) = each($opendb_tables_r)) { // the cache tables cannot be backed up as they might contain // binary data, which we don't yet support. if (!ends_with($table, '_cache') && $table != 'php_session') { $checked = FALSE; if (strcasecmp(substr($table, 0, 2), 's_') !== 0) { $checked = TRUE; }
function dbSave() { global $dbname, $name, $MSos, $crlf; @set_time_limit(600); $date_jour = date(adm_translate("dateforop")); $date_op = date("mdy"); $filename = $dbname . "-" . $date_op; $tables = sql_list_tables($dbname); $num_tables = sql_num_rows($tables); if ($num_tables == 0) { echo " " . adm_translate("Aucune table n'a été trouvée") . "\n"; } else { $heure_jour = date("H:i"); $data = "# ========================================================{$crlf}" . "# {$crlf}" . "# " . adm_translate("Sauvegarde de la base de données") . " : " . $dbname . " {$crlf}" . "# " . adm_translate("Effectuée le") . " " . $date_jour . " : " . $heure_jour . " " . adm_translate("par") . " " . $name . " {$crlf}" . "# {$crlf}" . "# ========================================================{$crlf}"; while ($row = sql_fetch_row($tables)) { $table = $row[0]; $data .= "{$crlf}" . "# --------------------------------------------------------{$crlf}" . "# {$crlf}" . "# " . adm_translate("Structure de la table") . " '" . $table . "' {$crlf}" . "# {$crlf}{$crlf}"; $data .= get_table_def($table) . "{$crlf}{$crlf}" . "# {$crlf}" . "# " . adm_translate("Contenu de la table") . " '" . $table . "' {$crlf}" . "# {$crlf}{$crlf}"; $data .= get_table_content($table) . "{$crlf}{$crlf}" . "# --------------------------------------------------------{$crlf}"; } } send_file($data, $filename, "sql", $MSos); }
$i = 0; $heure_jour = date("H:i"); print "# ========================================================{$crlf}"; print "#{$crlf}"; print "# {$strName} : {$dbname}{$crlf}"; print "# {$strDone} {$date_jour} {$strat} {$heure_jour} {$strby} {$name} !{$crlf}"; print "#{$crlf}"; print "# ========================================================{$crlf}"; print "{$crlf}"; while ($i < $num_tables) { $table = mysql_tablename($tables, $i); print $crlf; print "# --------------------------------------------------------{$crlf}"; print "#{$crlf}"; print "# {$strTableStructure} '{$table}'{$crlf}"; print "#{$crlf}"; print $crlf; echo get_table_def($dbname, $table, $crlf) . ";{$crlf}{$crlf}"; print "#{$crlf}"; print "# {$strDumpingData} '{$table}'{$crlf}"; print "#{$crlf}"; print $crlf; get_table_content($dbname, $table, "my_handler"); $i++; } } break; } } else { echo "Access Denied"; }
if ($form[deletetable]) { $db->query_str("DROP TABLE IF EXISTS {$tab[$a]}"); } $db->query_str("DELETE FROM {$tab['config']} WHERE name='tab_{$a}'"); } } $tab = gettabs(); $adminaction = "tables"; } ########################### if ($adminaction == "backuptable") { if ($form[type] == 1 || $form[type] == 3) { $dump .= get_table_def($tab[$tablename]) . "<br>"; } if ($form[type] == 2 || $form[type] == 3) { $dump .= get_table_content($tab[$tablename]); } $inc[action] = "<pre>{$dump}</pre>"; } ########################### if ($adminaction == "renametable") { if ($form[type] == 2) { $db->query_str("ALTER TABLE `{$tab[$tablename]}` RENAME `{$form['newname']}`"); } if ($form[type] == 1 || $form[type] == 2) { $db->query_str("DELETE FROM {$tab['config']} WHERE name='tab_{$tablename}'"); $db->query_str("INSERT INTO {$tab['config']} VALUES ('tab_{$tablename}','{$form['newname']}')"); } $tab = gettabs(); $adminaction = "edittable"; }
$target = backquote($target_db) . '.' . backquote($new_name); $sql_structure = get_table_def($db, $table, "\n"); $sql_structure = eregi_replace('^CREATE TABLE (`?)' . $table . '(`?)', 'CREATE TABLE ' . $target, $sql_structure); $result = mysql_query($sql_structure) or mysql_die('', $sql_structure); if (isset($sql_query)) { $sql_query .= "\n" . $sql_structure . ';'; } else { $sql_query = $sql_structure . ';'; } // Copy the data if ($result != FALSE && $what == 'data') { // speedup copy table - staybyte - 22. Juni 2001 if (MYSQL_INT_VERSION >= 32300) { $sql_insert_data = 'INSERT INTO ' . $target . ' SELECT * FROM ' . backquote($table); $result = mysql_query($sql_insert_data) or mysql_die('', $sql_insert_data); } else { $sql_insert_data = ''; get_table_content($db, $table, 0, 0, 'my_handler'); } // end MySQL < 3.23 $sql_query .= "\n\n" . $sql_insert_data; } $message = sprintf($strCopyTableOK, $source, $target); $reload = 'true'; } else { mysql_die($strTableEmpty); } /** * Back to the calling script */ require './tbl_properties.php';
function dump_sql($src_table, $dest_table = '', $params = array(), &$stream = null) { /*if(empty($dest_table)) $dest_table=$src_table; if(empty($params['primary'])) $params['primary']='id'; $dump=array(); if(!empty($params['flag_create_table'])) { $insert= str_replace('`'.$src_table.'`','`'.$dest_table.'`',mysql_fetch_array(mysql_query("SHOW CREATE TABLE $src_table"))); if($params['flag_create_table']=='drop') $dump[]="DROP TABLE IF EXISTS $dest_table;"; $dump[]=$insert[1].";"; } $req_table = mysql_query("SELECT * FROM $src_table"); $nbr_champs = mysql_num_fields($req_table); while ($ligne = mysql_fetch_array($req_table)) { $tab_id[]=$ligne[$params['primary']]; //var_dump($ligne); $insertion= "INSERT INTO $dest_table VALUES ("; for ($i=0; $i<$nbr_champs; $i++) { $insertion.= "'" . mysql_real_escape_string($ligne[$i]) . "', "; } $insertion= substr($insertion, 0, -2); $insertion.= ");"; $dump[]=$insertion; } return $dump;*/ $crlf = "\n"; $escape = '`'; if (empty($dest_table)) { $dest_table = $src_table; } $dump = ''; $strTableStructure = "Table structure for table"; $strDumpingData = "Dumping data for table"; $dump .= "# ---- Date de la sauvegarde : " . DH_NOW . " ----------------{$crlf}"; $dump .= '# ' . $strTableStructure . ' ' . $escape . $src_table . $escape . $crlf; $dump .= $crlf; $dump .= get_table_def($src_table, $dest_table, $crlf, $escape) . ";{$crlf}"; $dump .= "# {$strDumpingData} '{$src_table}'{$crlf}"; if (!empty($stream)) { fputs($stream, $dump); get_table_content($src_table, $dest_table, $crlf, $escape, $stream); } else { $dump .= get_table_content($src_table, $dest_table, $crlf, $escape); } return $dump; }