The idea is like this:
1. In the table where user data is stored, add a field say role, to indicate a registered user's role as teacher or student, this should be done by an administrator of the website.
2. When a user logs in successfully, direct him to the appropriate home page based on his role.
3. Not to forget, on each page, you have to check that it is only accessible by a user with the correct role.
I will not go into the nitty gritty of database design and coding, try it yourself, if you encounter problems, you may seek further advice here.
Having said that, this
tutorial[
^] should help you to kick start.