I have to agree with here that javascript is a bad thing. Javascript can easily be manipulated on the client-side. Never trust the client as the old addage says. The ONLY way to securely transfer data from client to server is via ssl (which is basically a digital signature that is encrypted went the packets are sent over the network [internet]).
What I do is this - username and password are sent back to the sever (using ssl of course). The script then adds a 'secret' password to the password sent by the client. These are combined (using a function that integrates the two in a way that can be reversed using a reverseing fuction) and then encrpted and sent to the database. This will effectively stop a database attack from being effective. If they get the password from the database and reverse engineer the hash, the hash is useless to them - because they do not know the 'secret' password that was added to the password that was sent as well as the fact that they don't have the function that will reverse the combination algorithm.
As for cookies and like - Sessions are as secure as you can get. Cookies can be corrupted, hacked and spoofed (as well as being turned off). Sessions are stored on the server side. There are lots of discussions stating that sessions are insecure - but those problems were mainly in PHP3, with PHP4 and subsequent versions and builds, security holes have been closed, and more security added.
NOTE - If you are using a database, use PHP's function to clean the data - such as mysql_real_escape_string() to avoid sql injection attacks.
One more thing - people will try to tell you that MD5 and SHA1 are "crackable". This is absolutely true.......if the person lives to be very old, or is a mathematical genius. These algorithms use a highly sophisticated means of generating a hash. Crackers will not try to crack the algorithm, what they will try to do is use the MD5() or SHA1() to hash out the dictionary (yes they will use the entire dictionary). To prevent this, ALWAYS insist that your users use a password that cannot be guessed - such as by using at least 1 number in it (preferably not at the beginning or end). You can also go one step further and issue the password to them by using a pronouncable password generator that you can easily build yourself. Also require them to change their password every 6 months.
I really did not mean to go into this long boring dissertation on security, but I have learned the hard way. I had a site that was hacked, and it was my fault. After that - I wised-up and read up on security. I encourage you to read everything you can on the subject- it will save you time, money and grief.