removed unreferenced gloval variables.
check for php session properly started using php.net reccomended procedure, and avoiding globals.
return state from session start so that return value can be checked if needed