I want to create a website where people can register an account and log in with there username and password but im not sure how that actually works, do i have to put some html javacode or something?
You best bet is to start learning PHP(http://www.php.net) there is a large resource of PHP tutorials and stuff at the top of this forum. Once you have the basics of PHP. You need to learn how to use a database most likly MySQL since it's the most popular free one out there.
Make sure you have a host that supports PHP, and MySQL before you start something like this.