I need a script which enable a person to create an account in the website ( and to be added it in the website database ) and that account with
logging in will enable the person to have some specific permisions in the website like posting or comenting. (not that the person cann't
view anything without the password )
That script will include

* "making an account" button and "signing in" as well as "singing out" buttons.
*The box that the details will be written in both creating an account and logging in .
* It must include the ability to sign up through facebook account.
* It should verify the email of the account.
* It should have Captcha for security purpose

Q1) How to connect that script with the specific permisions (Not just that the script will block everything in the page) ?
Q2) How to connect the buttons that i will design with the script ?
Q3) How to connect it with the mysql database ?