Welcome to this site! First, Google is your friend, Google is your buddy.. LOL You can get samples for almost ANY PHP code if you search correctly. We can help you here once you start getting your site together. First, to create a nice login form for logging into your new site, you would need to create the UserID/Password info in your database and then create three pages.
The first page would be a simple HTML page with a FORM on it. The form can be very simple. It just has the form name, two input fields for your userid and password and one submit button to login with.
The second page is the actual PHP page that the form posts to. That page would read the posted variables for the userid and password. It would read the database and verify if the userid and password are valid. If so, it would redirect to a third page which would be your real site's home-page.
Of course, this simple explanation does not cover security using session variables. Session variables are easy to use in PHP. Basically, you use a session_start(); line at the top of EVERY page except the login page. When the login.php page validates that the userID and password is valid, it also sets a session variable, such as $_SESSION['User']=$userID; (pulled and validated as legal user). Then, on every page the session variable would be checked to make sure they are allowed to view the site. Something like this:
session_start(); //start the session, at top of every page.
echo "You are not allowed to view this page, please login!"; //Not valid user, say so...
Soooo, to handle security, the above would do a check on EVERY page of your site. So, if someone bookmarks a page on your site and goes there in the future, they will not be logged in, so the session variable would be blank and not allow access. You can add a timestamp to each user's log in if you want further security. Whenever they click on a button, update the timestamp. If they do not click a button for 20 minutes, or whatever time is good for you, they will have to re-log in to continue. 20 minutes may be too short of a time-out if you have a lot to do or read on your site.
Of course, this just a quick first step to get you moving in the correct direction. There are tons of samples for login code in google. Just search for "PHP login page sample". Or, "PHP login page tutorial" and you will find tons of sample code to start with. Or just ask here, we will help. Good luck