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