9 <a href='showtable.php?table=macaddrs'>macaddrs</a>
10 <a href='showtable.php?table=nicvendors'>nicvendors</a> <br>
11 (Show max 1000 rows of selected table).
15 /************************************************************/
16 // show last 1000 rows of selected database on the web page.
17 // the database connection parameters might be modified.
18 // As this script should be used only by the administrators,
19 // it should be protected by some access control method.
20 /************************************************************/
22 // no table is indicated
23 if(!isset($_GET['table']))return;
25 // connect and access to MySql DB
26 $link = mysqli_connect('localhost', 'root', '');
27 if (!$link) die('Cannot connect DB'.mysqli_error());
29 $db_selected = mysqli_select_db($link, 'opengatem');
30 if (!$db_selected) die('Cannot select DB'.mysqli_error());
32 mysqli_set_charset($link, 'utf8');
34 $result = mysqli_query($link, 'SELECT * FROM '.$_GET['table'].' limit 1000');
35 if (!$result) die('Fail query'.mysqli_error());
38 print("<table border=1>");
41 while ($field = mysqli_fetch_field($result)) {
42 print('<td>'.$field->name.'</td>');
48 while ($row = mysqli_fetch_row($result)) {
50 for($i=0; $i<$count; $i++){
51 print('<td>'.$row[$i].'</td>');
56 $close_flag = mysqli_close($link);