it's not tooo difficult to build signup and login pages, but it's more of a challenge with error catching and feedback.
all pages must start with session_start();
/register.php -> create your form and post it to itself. this page should include code to add the user details to a mysql database.
/login.php -> again, create the form and post login fields to itself. must include code to query the database to check if user exists and password is correct. if successful, create set the session variable (eg. $_SESSION['loggedin']=1; )
if you want to secure your pages from unautheticated users, include this on your pages to redirect them to login page.
session_start();
if(!$_SESSION['loggedin']){
header("location: login.php");
}
also check out w3schools for php tutorials.