when you start a session be careful because it my not be closed in it is still open.
you have two session at the start of each code so you have to kill the actions of both.
use this in a new php tag
$_session(die);
so you are directly omitting the affect of each action