I have purchased my desktop one year before. It worked properly for a period of 4 months.
Did you make any changes to the computer at 4 months? New hardware, new programs, update device drivers, etc?
The problem is, it keep on hanging either at the time of booting or after logging in.
Does the system get past the 'hang' and operate normally?
What are your system temperatures? Get Speedfan, if necessary:
http://www.almico.com/speedfan.php and post back with temps.
Try to remove and re-seat the RAM. Shutdown the computer normally, unplug from the electric supply, ground yourself and re-seat the RAM. If there
are is more than one module, try to boot with just one module at a time. Check your motherboard manual to determine which motherboard memory slot must be populated.
Remove and re-seat the CPU.
Try a different power supply.
Best of luck!