Htaccess

Can anbody plz help me… how to protect a directory or folder with “htaccess” in PHP?

How to create a password protection page with sessions(start/expire) in Php to a SQL server or a particular page?

Thanks in Advance