1 00:00:00,390 --> 00:00:04,470 The next step is to make our blog dog pee pee page inaccessible. 2 00:00:04,500 --> 00:00:15,630 If the user is not logged in to do so open your blog that page page and add the following block of code 3 00:00:16,320 --> 00:00:18,540 right at the beginning of the document. 4 00:00:19,110 --> 00:00:26,290 Here we've initialized the session using the session start function and then we have an if statement. 5 00:00:26,610 --> 00:00:36,690 If the log in session variable is set then we've created two new variables f name and l name the FNM 6 00:00:36,700 --> 00:00:44,540 variable holds the value of the F name session variable l name all the value of the L name session variable 7 00:00:45,440 --> 00:00:52,040 and remember that we'd set these session variables both on the P check dot BHP page 8 00:00:55,450 --> 00:01:03,980 and on the add user dot BHP page so basically when a new account is created or when the user logs in 9 00:01:05,260 --> 00:01:09,190 is I'm back on to the blog wp page. 10 00:01:09,220 --> 00:01:12,680 Now if on the other hand this session is not set. 11 00:01:12,680 --> 00:01:16,280 So if the log in session is not set we need to create a redirect. 12 00:01:16,280 --> 00:01:20,710 Back to the log in page in order to scroll all the way down. 13 00:01:22,300 --> 00:01:24,610 And insert the following block of code 14 00:01:29,740 --> 00:01:36,180 so here that we have an L statement which will redirect the user back to the log in dock DHB page. 15 00:01:36,180 --> 00:01:42,170 The last thing we need to do here is add a welcome message above our blog. 16 00:01:43,470 --> 00:01:53,340 So it's called the blog and you can see that the redirect is working it's redirecting this back to the 17 00:01:53,340 --> 00:01:57,890 log in page because it's determined that a session is not set. 18 00:01:59,150 --> 00:02:21,400 So we will have to log in so I'll just quickly create a new new user. 19 00:02:21,470 --> 00:02:22,630 Now we can see the blog 20 00:02:29,260 --> 00:02:32,480 and we're going to add the welcome message right above this heading 21 00:02:50,720 --> 00:02:56,510 so here we have the text welcome and then we echo the F name and l name variable which is the user's 22 00:02:56,510 --> 00:02:58,730 first name and last name. 23 00:02:58,790 --> 00:03:04,430 We also have a link to a logout dot P HP page which will terminate the user session. 24 00:03:04,430 --> 00:03:06,200 It'll log them out. 25 00:03:06,200 --> 00:03:11,060 We haven't created the logo but page by page we'll be doing that a little bit later on. 26 00:03:11,060 --> 00:03:16,330 So for now I'll refresh the page and there we go.