connection functions and hist.php