1 00:00:00,810 --> 00:00:01,440 Welcome back. 2 00:00:01,800 --> 00:00:07,110 Now, what we need to do is that we need to organize the template further so that I will be able to 3 00:00:07,170 --> 00:00:09,930 create other pages and work on other pages. 4 00:00:10,290 --> 00:00:16,320 So in this template I have the side menu and this is the side menu and we need also to create a header. 5 00:00:16,650 --> 00:00:21,630 So I'm going to create a new file in the admin here called header that BHP. 6 00:00:22,920 --> 00:00:27,600 And now what I'm going to do is that I'm going to move from the, from the log in. 7 00:00:28,230 --> 00:00:34,680 What I'm going to do is that I'm going to move the header, which is this which starts from here all 8 00:00:34,680 --> 00:00:35,520 the way to. 9 00:00:37,140 --> 00:00:42,470 All the way to this body and this sign out. 10 00:00:42,490 --> 00:00:43,500 So this is the header. 11 00:00:44,220 --> 00:00:45,060 This is the header. 12 00:00:45,840 --> 00:00:46,680 Let me copy it. 13 00:00:47,130 --> 00:00:48,430 Elaine You remove it from here. 14 00:00:48,460 --> 00:00:50,460 Elaine added to the header here in the header. 15 00:00:51,990 --> 00:00:53,730 And again, this here is inside the admin. 16 00:00:53,740 --> 00:00:56,400 This is not the header that's inside the layout. 17 00:00:56,400 --> 00:00:57,270 So this is different. 18 00:00:58,230 --> 00:00:59,820 Now we need to import a header here. 19 00:01:00,150 --> 00:01:04,860 So here what I'm going to do is that I'm going to say BHP and then include. 20 00:01:05,460 --> 00:01:11,760 And then what we want to include is that we want to include the header header that BHP either that BHP 21 00:01:12,270 --> 00:01:19,410 and similarly for the for the side menu, remember we have here inside menu, I'm going to add the side 22 00:01:19,410 --> 00:01:22,020 menu on a in a different page. 23 00:01:22,020 --> 00:01:23,370 I have already done that here. 24 00:01:23,370 --> 00:01:28,920 The side menu let me work on I now let's work on the header itself. 25 00:01:30,000 --> 00:01:36,440 So for the header we need to add a log out, a log out code. 26 00:01:37,080 --> 00:01:38,850 So for the look out for this log out. 27 00:01:38,850 --> 00:01:45,390 What we need to do is that we need to say here we need to say a trip and the entry of will log the user 28 00:01:45,390 --> 00:01:45,570 out. 29 00:01:45,570 --> 00:01:52,650 So this trip is going to be equal to log out dot BHP and then I'm going to create a new file called 30 00:01:52,650 --> 00:01:53,960 logout here. 31 00:01:54,000 --> 00:02:00,090 I'm going to create a new file admin new file log out dot BHP. 32 00:02:00,660 --> 00:02:02,970 I remember the log out is pretty simple. 33 00:02:03,930 --> 00:02:08,790 The log out if you go to the account, if you go to the account you'll find that we have here. 34 00:02:08,790 --> 00:02:09,480 They log out. 35 00:02:10,470 --> 00:02:11,310 This has been log out. 36 00:02:11,310 --> 00:02:19,110 Good, this is a log output so we can copy this good and then we can paste it in the log output. 37 00:02:19,110 --> 00:02:22,740 BHP, we can use a BHP and then we can paste this code. 38 00:02:23,490 --> 00:02:25,350 However, we need to edit a few things. 39 00:02:25,800 --> 00:02:29,520 First, the log out get is in the header. 40 00:02:33,180 --> 00:02:36,630 Log out that PDB and then question mark. 41 00:02:36,990 --> 00:02:43,430 Log out is equal, let's say, to one and a year. 42 00:02:43,660 --> 00:02:54,060 If if a set session add the main admin underscore logged in and then here unset add the main underscore 43 00:02:54,060 --> 00:03:00,380 logged in and then unset admin email, admin, email. 44 00:03:01,080 --> 00:03:04,290 And here on set also admin admin. 45 00:03:05,170 --> 00:03:09,000 Our name and then header location log in. 46 00:03:09,020 --> 00:03:14,800 We take the user to the log page and it's similar by the way, again, if resizing this because it's 47 00:03:14,800 --> 00:03:18,610 similar to the account, there's basically there is no difference. 48 00:03:18,610 --> 00:03:20,770 The only difference is the keys that we stored. 49 00:03:21,840 --> 00:03:23,190 That we saw it in this session. 50 00:03:23,670 --> 00:03:29,190 So here, remember in the lockout we have here, this lockout button is lockout button and this lockout 51 00:03:29,190 --> 00:03:33,210 button says account that BHP question mark lockout is equal to one. 52 00:03:33,330 --> 00:03:34,080 Pretty simple. 53 00:03:35,260 --> 00:03:37,510 So let me now save Sable. 54 00:03:38,260 --> 00:03:45,910 And by the way, here you can say a set ad is set, log out is set, get log out. 55 00:03:45,910 --> 00:03:46,910 And you can also check. 56 00:03:46,910 --> 00:03:47,710 You can see and. 57 00:03:49,030 --> 00:03:53,740 And log out or get get. 58 00:03:55,140 --> 00:03:56,010 Log out. 59 00:03:57,300 --> 00:03:58,650 Log book is equal to one. 60 00:03:59,160 --> 00:04:00,120 But this is not. 61 00:04:01,250 --> 00:04:04,400 This is not this is not mandatory because it doesn't matter. 62 00:04:04,880 --> 00:04:05,900 As soon as they use it. 63 00:04:06,200 --> 00:04:11,960 Well, our goal is that as soon as the user clicks on this button, we just log them out for there is 64 00:04:11,960 --> 00:04:16,040 no need to check this, but this is just for the sake of explanation. 65 00:04:16,580 --> 00:04:20,780 So let me now save everything and show you how this is going to work. 66 00:04:21,200 --> 00:04:22,740 Now, let me go to the log in page. 67 00:04:22,760 --> 00:04:29,600 I'm going to go to the actually, I cannot go to the log in page because I am logged in. 68 00:04:29,600 --> 00:04:32,420 So let me continue working and then I'm going to show you the log out. 69 00:04:33,080 --> 00:04:35,030 So let me work on the index. 70 00:04:35,690 --> 00:04:36,560 In the index. 71 00:04:38,050 --> 00:04:39,010 In the index here. 72 00:04:39,040 --> 00:04:43,670 What we want to do is that we need to repeat the same the design design pattern. 73 00:04:44,110 --> 00:04:45,670 So we need to remove this header. 74 00:04:46,830 --> 00:04:48,420 All of this code must be removed. 75 00:04:49,080 --> 00:04:50,250 And instead of this good. 76 00:04:53,120 --> 00:04:54,080 Until they hit her. 77 00:04:54,110 --> 00:04:54,980 Remove the skirt. 78 00:04:55,400 --> 00:05:02,680 And then what you need to do is that you need to adhere BHP, BHP and then include. 79 00:05:03,600 --> 00:05:04,260 Include. 80 00:05:05,240 --> 00:05:07,940 And then what we want to include is that we want to include the header. 81 00:05:07,940 --> 00:05:10,460 We need to say header that BHP. 82 00:05:12,160 --> 00:05:13,300 And then that's it. 83 00:05:14,380 --> 00:05:20,740 And by the way, in the header, something very important to add in the header is the. 84 00:05:22,520 --> 00:05:24,010 Is the session start? 85 00:05:24,020 --> 00:05:26,360 We need to say here BHP. 86 00:05:27,860 --> 00:05:28,850 BHP and then. 87 00:05:29,840 --> 00:05:30,590 Session. 88 00:05:32,640 --> 00:05:33,120 Start. 89 00:05:36,960 --> 00:05:39,960 Because we want to use the session on all pages. 90 00:05:40,830 --> 00:05:45,240 Also in the log out we I forgot to say session because here I'm using this session. 91 00:05:45,690 --> 00:05:48,360 So I also need to say here session start. 92 00:05:49,640 --> 00:05:50,660 Session start. 93 00:05:53,150 --> 00:05:56,000 Now back to the to the index. 94 00:05:56,450 --> 00:06:02,420 In the index, we need to remove the side menu here. 95 00:06:02,990 --> 00:06:09,230 And instead of using this static side menu, we need to use the side menu file. 96 00:06:09,230 --> 00:06:12,950 So this side menu file will contain the side menu. 97 00:06:13,820 --> 00:06:15,410 So I'm going to remove it from here. 98 00:06:15,410 --> 00:06:22,010 What we need to remove is that we need to remove this now because the side menu record is in the side 99 00:06:22,010 --> 00:06:23,170 menu starts from there now. 100 00:06:24,590 --> 00:06:27,860 Therefore in the index, we just need to remove this now. 101 00:06:28,580 --> 00:06:30,380 From here, all the way to the end of the nav. 102 00:06:34,540 --> 00:06:35,380 Which is this? 103 00:06:36,610 --> 00:06:37,240 Which. 104 00:06:43,130 --> 00:06:45,260 Which let me show you which is this. 105 00:06:46,850 --> 00:06:57,770 And then after you remove it, we just need to say here we just need to say BHP and then include. 106 00:06:58,640 --> 00:06:59,660 Include. 107 00:07:02,110 --> 00:07:03,070 Side menu. 108 00:07:09,000 --> 00:07:10,530 Include and then side. 109 00:07:12,450 --> 00:07:12,990 Many. 110 00:07:14,260 --> 00:07:17,470 That BHP, I mean you're limited. 111 00:07:17,470 --> 00:07:21,760 I was able let's say been over to the browser and now let me refresh. 112 00:07:23,320 --> 00:07:29,830 And as you can see now in the dashboard, if I click on logout, I will be taken to the login page. 113 00:07:30,280 --> 00:07:35,140 However, I having a problem in say the session had already been started. 114 00:07:35,140 --> 00:07:37,930 So in line one in the header. 115 00:07:38,530 --> 00:07:41,350 So in the header we have a problem here. 116 00:07:41,350 --> 00:07:45,760 It says the the session has already been started. 117 00:07:46,540 --> 00:07:51,520 I think the reason is because in the log in we or we have also a session start. 118 00:07:52,090 --> 00:07:59,020 So we need to remove it from here because we shouldn't be using the we shouldn't be using the position 119 00:07:59,020 --> 00:07:59,350 twice. 120 00:07:59,740 --> 00:08:04,960 So it's better to add the session, start in the header page and not in every single page. 121 00:08:06,070 --> 00:08:06,970 So it worked. 122 00:08:06,970 --> 00:08:07,930 Let me refresh now. 123 00:08:08,000 --> 00:08:09,280 The air should be gone. 124 00:08:09,730 --> 00:08:10,780 Now let me log in. 125 00:08:11,410 --> 00:08:19,600 If I log in and then if I say admin at email that HP and log in. 126 00:08:21,650 --> 00:08:28,640 Now I will be able to go to the dashboard and if I click on log out I will be taken to here. 127 00:08:28,640 --> 00:08:35,570 It did not take me actually to the to the, to the login page. 128 00:08:35,600 --> 00:08:38,720 I have a problem again in the in the logout. 129 00:08:39,440 --> 00:08:41,720 So if you get nothing here then we have a problem. 130 00:08:42,050 --> 00:08:47,930 And the problem is that here I should say instead of saying admin id if say saying admin, it is equal 131 00:08:47,930 --> 00:08:55,190 to user ID, we need to say admin, it is equal to admin 80 because here we are using the admin I.D. 132 00:08:55,190 --> 00:09:01,130 not to use a and here we need also to say admin name and admin email. 133 00:09:02,480 --> 00:09:04,340 And another problem that we have. 134 00:09:05,990 --> 00:09:06,740 Is that. 135 00:09:07,610 --> 00:09:11,570 And we should also move the header from here to the top. 136 00:09:11,660 --> 00:09:17,740 We need to add that at the top because the header contains the session start and we need this recession 137 00:09:17,750 --> 00:09:18,560 start at the top. 138 00:09:19,220 --> 00:09:21,890 Let me now say about let's say a bit over to the browser and replace. 139 00:09:22,460 --> 00:09:24,320 Now as you can see, there is no problem. 140 00:09:24,800 --> 00:09:25,790 Leonie here log in. 141 00:09:26,000 --> 00:09:27,260 Click on admin at. 142 00:09:27,590 --> 00:09:30,440 Let me talk to you my email on my password. 143 00:09:31,310 --> 00:09:32,720 Let me log in. 144 00:09:32,750 --> 00:09:35,600 So if I log in, I will be taken to the dashboard. 145 00:09:35,960 --> 00:09:39,620 Now, if you click a log out, I will be taken to the log in. 146 00:09:40,190 --> 00:09:45,770 However, there's still a very small problem, which is a year the log out button. 147 00:09:46,220 --> 00:09:50,960 This log out button is being displayed if you need to remove it from the log in page and to remove it 148 00:09:50,960 --> 00:09:53,960 from the log in page, we can add the header. 149 00:09:54,500 --> 00:09:57,680 We can add a code that is going to hide it. 150 00:09:58,190 --> 00:10:04,130 So we can here say BHP and then we can see if. 151 00:10:05,150 --> 00:10:05,690 Is. 152 00:10:06,940 --> 00:10:07,390 Sir. 153 00:10:10,840 --> 00:10:11,440 Session. 154 00:10:13,720 --> 00:10:14,350 Session. 155 00:10:16,410 --> 00:10:19,140 Ad man logged. 156 00:10:20,650 --> 00:10:21,160 In. 157 00:10:21,580 --> 00:10:24,310 If admin is locked in, then I'm going to display this code. 158 00:10:25,510 --> 00:10:27,000 Then I'm not going to display this. 159 00:10:27,010 --> 00:10:35,830 But if I mean is if admin is is logged in, then we need to display this equipment is not logged in 160 00:10:35,830 --> 00:10:37,390 then we shouldn't be displaying this. 161 00:10:37,990 --> 00:10:43,350 So here I'm also I'm only going to display this code if admin is logging. 162 00:10:44,200 --> 00:10:45,310 So now let me save. 163 00:10:45,310 --> 00:10:49,720 I'm showing you that this button will be hidden from the login page. 164 00:10:50,290 --> 00:10:56,290 So as you can see, the logging of the log out button does doesn't exist because now we are in the log 165 00:10:56,290 --> 00:11:03,760 a page and finally we need to protect the index and to protect the index, we, we should add a code 166 00:11:03,760 --> 00:11:06,450 at the top that's going to protect the page. 167 00:11:06,460 --> 00:11:07,330 And to do this. 168 00:11:08,550 --> 00:11:15,360 We can't create a file that's going to do this or we can adequately let's advocate here for now I'm 169 00:11:15,360 --> 00:11:18,180 going to say B2B and then I'm going to say if. 170 00:11:23,540 --> 00:11:30,230 Session is the same code that we we added before we just added we to the session. 171 00:11:31,440 --> 00:11:41,150 Admin logged in, admin log in and then instead of saying admin logged in, I'm going to say if admin 172 00:11:41,150 --> 00:11:48,560 is not, I'm going to say here exclamation, which means that which means that the admin is not logged. 173 00:11:48,650 --> 00:11:54,350 So if the admin is not logged in then we need to say header location. 174 00:11:57,600 --> 00:11:58,520 Log in. 175 00:12:00,210 --> 00:12:00,540 But. 176 00:12:00,540 --> 00:12:03,990 HP And we also need to say exit. 177 00:12:07,540 --> 00:12:10,240 And he logged logged in. 178 00:12:10,240 --> 00:12:11,710 Be careful with the key here. 179 00:12:12,220 --> 00:12:14,620 The key is admin underscore logged in. 180 00:12:15,910 --> 00:12:18,070 Let me click on table and let me test. 181 00:12:18,790 --> 00:12:24,940 So I'm going to go back to the index and let me go now to the log in. 182 00:12:27,220 --> 00:12:28,690 Laney log out because I'm logged in. 183 00:12:28,720 --> 00:12:30,340 Actually leave me log in one more time. 184 00:12:31,030 --> 00:12:32,290 So I'm going to log in again. 185 00:12:32,290 --> 00:12:32,890 And then. 186 00:12:34,760 --> 00:12:36,800 I'm going to guess here. 187 00:12:37,520 --> 00:12:39,710 First, I'm going to click on Look Out. 188 00:12:39,980 --> 00:12:42,470 Let me see what's going to happen if I click a log out. 189 00:12:42,860 --> 00:12:43,850 I will be logged out. 190 00:12:44,180 --> 00:12:47,510 Now let me try to go through the index without logging in. 191 00:12:47,540 --> 00:12:49,700 Now I've looked at let me try to go to the index. 192 00:12:50,120 --> 00:12:51,710 If I try to go to the index. 193 00:12:52,070 --> 00:12:54,830 I will not be able to index again. 194 00:12:54,830 --> 00:13:00,920 I will not be able to, because now the index page has been protected, which is very, very important.