Servers |
Functions
|
//////////////////////////////////PHP////////////////////////////////////////
echo "";
include 'include/dbauth.php';
$TABLE_NAME="SUP_machines";
$FN_TABLE_NAME="SUP_functions";
$html_block1="\n\n";
$html_block2=" | ";
$html_block3="
| \n\n";
/* OPEN DATABASE */
$link = mysql_connect("$DBHOST", "$DBUSER", "$DBPASSWD") or die("Could not connect");
mysql_select_db("$DBNAME") or die("Could not select database");
/* DISPLAY FROM DATABSE */
/* get the list of functions from the function table. only the functions
that have visibility on will be displayed */
$query = "Select function_name,visible from $FN_TABLE_NAME where visible='1'";
$qresult = mysql_query($query) or die("Select Query failed-qresult");
$query = "SELECT * FROM $TABLE_NAME";
$result = mysql_query($query) or die("Select Query failed");
$func_list = array();
while ($myrow = mysql_fetch_array($qresult, MYSQL_ASSOC)) {
$func_list[$myrow[function_name]] = $myrow[visible];
}
if ($myrow = mysql_fetch_array($result)) {
do {
// Print the first cell HTML code...then populate it with the
// Machine name from the database
// Then close the cell and start another one
printf("%s %s %s", $html_block1, $myrow["machine_name"], $html_block2);
// Explode functions into an array
$function_array = explode( ',',$myrow["function_list"] );
// Loop through the array elements and
// generate the links to each function
foreach ( $function_array as $element ) {
// Echo each function into the cell
if($func_list[$element]) {
echo "".$element." \n";
}
}
// Finish up the cell HTML printout
printf("%s", $html_block3);
} while ($myrow = mysql_fetch_array($result));
}
// Close the DB
include 'include/dbclose.php';
//////////////////////////////////PHP////////////////////////////////////////
echo "";
?>
|