The next step is to make our blog dog pee pee page inaccessible.
If the user is not logged in to do so open your blog that page page and add the following block of code
right at the beginning of the document.
Here we've initialized the session using the session start function and then we have an if statement.
If the log in session variable is set then we've created two new variables f name and l name the FNM
variable holds the value of the F name session variable l name all the value of the L name session variable
and remember that we'd set these session variables both on the P check dot BHP page
and on the add user dot BHP page so basically when a new account is created or when the user logs in
is I'm back on to the blog wp page.
Now if on the other hand this session is not set.
So if the log in session is not set we need to create a redirect.
Back to the log in page in order to scroll all the way down.
And insert the following block of code
so here that we have an L statement which will redirect the user back to the log in dock DHB page.
The last thing we need to do here is add a welcome message above our blog.
So it's called the blog and you can see that the redirect is working it's redirecting this back to the
log in page because it's determined that a session is not set.
So we will have to log in so I'll just quickly create a new new user.
Now we can see the blog
and we're going to add the welcome message right above this heading
so here we have the text welcome and then we echo the F name and l name variable which is the user's
first name and last name.
We also have a link to a logout dot P HP page which will terminate the user session.
It'll log them out.
We haven't created the logo but page by page we'll be doing that a little bit later on.
So for now I'll refresh the page and there we go.