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