It sounds as though you can't log in via the GUI, but can through the command line. If this is so, you probably have a corrupted file which is causing the GUI to hang. Drop into single user mode on startup, and run fsck. If that doesn't help, run DiskWarrior.