<?php
/************************************************************************/
/* Maximus CMS: Web Portal System                                       */
/* ==============================                                       */
/*                                                                      */
/* Copyright (c) 2002 - 2006                                            */
/* http://www.php-maximus.fr                                            */
/* dev@php-maximus.org                                                  */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
/* Based on PHP-NUKE: Web Portal System                                 */
/************************************************************************/
if (!defined('ADMIN_ALLOW') && !defined('ADMIN_MAX')) {
	die ("Access Denied");
}
if ($acces == 1) {
if($admintest && $adminsecu)  {
        $type = strtoupper(substr($op,0,-2));
        incoh();
        menu();
        br('1');
        Max_OpenTable();
        global $dbhost, $dbuname, $dbpass, $dbname, $tablelist;
        mysql_pconnect($dbhost, $dbuname, $dbpass);
        @mysql_select_db("$dbname") or die ("Base de données non déterminée");

        if (is_array($tablelist) && count($tablelist) > 0) {
            $tables = $tablelist;
            $num_tables = count($tablelist);
        } else {
            $tablelist = mysql_list_tables($dbname);
            $num_tables = @mysql_numrows($tablelist);
            if($num_tables > 0) for ($i = 0; $i < $num_tables; $i++) {
                $tables[] = mysql_tablename($tablelist, $i);
            }
    }

        if ($num_tables > 0) {
            if ($type == "STATUS") {
                $query = 'SHOW TABLE STATUS FROM '.$dbname;
            } else {
            $query = "$type TABLE ";
            foreach($tables AS $table) {
                if ($query != "$type TABLE ") $query .= ", ";
                $query .= $table;
            }
            }

            $result = mysql_query($query);

            $numfields = mysql_num_fields($result);
            echo "<table border=\"1\" width=\"100%\"><tr>";
            for($j=0; $j<$numfields;$j++) {
                echo '<td align="center"><b>'.mysql_field_name($result,$j).'</b></td>';
            }
            echo '</tr>';
            while($row = mysql_fetch_row($result)) {
                echo '<tr>';
                for($j=0; $j<$numfields;$j++) {
                    echo '<td>'.$row[$j].'</td>';
                }
                echo '</tr>';
            }
            echo '</table>';
        }}
        Max_CloseTable();
        incof();
}else {
	echo "Access Denied";
}