Set Secure Session Cookie if HTTPS

This checks if connection is through SSL. If it is, the session cookie is set to secure only. Also includes workaround to php bug #49184 regarding filter_input(). More details in code comments.