Change directory to root of webtrees installation before loading session.php. Change is required after change in webtrees-base (commit ed285daa12bd7bf5fef583fe91b97c238dbf606f).
Add header content type to script.
Add csrf check to post action.