What are you trying to do on this page? The errors are because you have code to update the user table that is above the includes. Moving lines 1-41 down below the include files that currently end on line 47 will correct that.
But I'm a bit confused about what you are trying to do with that update in the first place. It looks like it is updating the database for logged in users and encrypting the password field. But then you have another update doing it again on lines 135-175.
Instead of moving the update on the top of the page it may be more appropriate to remove it, since it appears to be repetitive.