#!/usr/bin/python3
########################################################
# Start a web session, and save session variables
########################################################
import os
import datetime
import sessionFunc

sessionId = sessionFunc.startSession()              #must be called before any html output

print('Content-Type: text/html')
print('\n')

name  = "_session_start_time"
time  = str(datetime.datetime.now())                #Python date and time
value = time[0:19]                                  #get rid of milliseconds
sessionFunc.setSessionVar(name,value)
sessionFunc.setSessionVar('fname','Sam')
sessionFunc.setSessionVar('gender','male')

allvars = sessionFunc.getSessionVars()
print("<b>Session Id:</b>", sessionId, "<br><br>")
print("<b>Session created 3 variables: </b><br>")
print("_session_start_time <br>fname<br>gender<br><br>")
print(allvars)




#=== link to see the python code =================================================
import os, sys
sys.path.insert(0,'/home/s/sultans/web/python/demo')
import zCode                          #import func to display the Python code
filename = os.path.abspath(__file__)  #get absolute file name 
zCode.display(filename)               #call it
#=================================================================================