Additional changes for Session-based Auth.

Main changes in checklogin.php and db.php