database script. template with authentication