corrected a few variable types and labels in python script, abstracted db functions into page-based functions page_utils.php