I think it would be best to move away from cookies and keep all of this server side. The best replacement for the cookies is using session variables to hold the details of the user. When the user logs in you should store their userID in a session variable then use this variable wherever you need the id of the user.
If clicking on the back button is clearing the session then there is a problem with session management. A session variable should remain intact throughout the life of the session, either until it expires or the user closes their browser. If you are having the session cleared when going from page to page then this is a major problem.
To check on the settings for your session you can create a phpinfo page. To make this page just create a new php page with this line of code in it:
<?php phpinfo(); ?>
When you view this page look for these settings:
session.save_handler should be set to: files
session.save_path should be set to a folder on the server that you have access to
session.use_only_cookies this should be set to Off
As a test of this try using the following two page test attached to this post. You should go to the session_test.php page first and see the session information there. Then click on the link to the other test page, it should display the same session information for you there. If it does not then there is problem with the session that needs to be addressed. Post back and let us know what you discover.