1 00:00:00,790 --> 00:00:04,900 So make sure that you say your dad, dad and then for lunch and then server and then connection. 2 00:00:05,650 --> 00:00:13,240 Now the next step is that we need, as usual, we need to say if user is not logged in, then we need 3 00:00:13,240 --> 00:00:20,440 to take them to the admin, to the if they are logged in, we need to take them to the account. 4 00:00:20,920 --> 00:00:26,470 But here in this case, if they are logged in, if the admin is logged in, we take them to the, let's 5 00:00:26,470 --> 00:00:29,080 say, the main dashboard. 6 00:00:29,080 --> 00:00:31,810 So let me see Dash. 7 00:00:33,590 --> 00:00:36,800 Board, not BHP dashboard at BHP. 8 00:00:39,250 --> 00:00:48,730 And this is in case the user is logged in and here if is set, log in button. 9 00:00:49,330 --> 00:00:57,130 If the user clicks on the log in button, we need to take the email and the password and then we insert 10 00:00:57,490 --> 00:01:07,330 a user select user ID here instead of user ID, we need to say admin ID, admin ID and then admin name 11 00:01:08,710 --> 00:01:09,310 and then. 12 00:01:11,360 --> 00:01:27,770 Admin email and then admin password and then from from admins where admin email is equal to question 13 00:01:27,770 --> 00:01:28,700 mark and admin. 14 00:01:30,700 --> 00:01:32,730 Admin password is equal to. 15 00:01:32,770 --> 00:01:34,120 Question mark, limit one. 16 00:01:34,810 --> 00:01:38,440 And then we say email a password and we continue here. 17 00:01:38,440 --> 00:01:42,550 We need to say admin ID and then. 18 00:01:43,870 --> 00:01:48,100 Admin Main and admin email admin password. 19 00:01:52,550 --> 00:01:59,360 And then we execute and then we get the user ID, the user name user. 20 00:02:00,900 --> 00:02:01,440 User. 21 00:02:02,730 --> 00:02:04,950 Email user ID instead of user ID. 22 00:02:05,040 --> 00:02:09,690 I'm going to say admin ID and admin name. 23 00:02:12,040 --> 00:02:17,140 An admin email and then logged in here. 24 00:02:17,140 --> 00:02:18,230 We shouldn't say a word. 25 00:02:18,320 --> 00:02:22,420 We shouldn't say logged in instead because we are using another session. 26 00:02:22,420 --> 00:02:26,670 Remember, we are using another session and therefore we need to say admin logged in. 27 00:02:26,680 --> 00:02:30,470 I'm going to say admin admin underscore logged in. 28 00:02:30,580 --> 00:02:31,600 This is very important. 29 00:02:32,950 --> 00:02:33,850 So I'm going to say here. 30 00:02:35,080 --> 00:02:37,330 Admin logged in. 31 00:02:38,350 --> 00:02:43,450 And then if if admin logged in, I'm going to take them to the dashboard dash. 32 00:02:44,900 --> 00:02:55,820 More that BHP then log in access and then logged in successfully and then in case of failure we just 33 00:02:57,020 --> 00:03:04,700 redirect to the same page and the case here in case of error, we also redirect to the same page and 34 00:03:04,970 --> 00:03:05,420 that's it. 35 00:03:05,670 --> 00:03:09,260 Now we need to clear the dashboard. 36 00:03:09,260 --> 00:03:14,880 So let me here you this this index is going to be the dashboard. 37 00:03:14,960 --> 00:03:21,830 And instead of saying index, we can rename this to Dashboard or alternatively we can say index, we 38 00:03:21,830 --> 00:03:22,940 can use say index. 39 00:03:23,150 --> 00:03:24,780 This could be index as well. 40 00:03:25,190 --> 00:03:28,490 So you can here say index that BHP. 41 00:03:30,110 --> 00:03:31,640 And then here you could say. 42 00:03:34,320 --> 00:03:38,160 Index index, that sort of dashboard. 43 00:03:39,060 --> 00:03:40,530 So make sure that this is correct. 44 00:03:41,290 --> 00:03:43,200 Your index. 45 00:03:44,130 --> 00:03:46,410 And here also index. 46 00:03:46,680 --> 00:03:47,080 That's it. 47 00:03:47,100 --> 00:03:47,610 Let me see. 48 00:03:48,210 --> 00:03:50,520 Alamy rename this file to. 49 00:03:51,650 --> 00:03:52,940 Let me rename this to. 50 00:03:55,510 --> 00:03:57,090 Let me rename this to BHP. 51 00:03:57,100 --> 00:03:58,120 It must be BHP. 52 00:03:59,260 --> 00:04:01,540 Lastly, let me create a new account. 53 00:04:02,020 --> 00:04:06,730 As I told you, you should never create a registration page. 54 00:04:06,760 --> 00:04:07,750 You should never. 55 00:04:07,990 --> 00:04:14,920 When it comes to admins, you should never create areas through a page unless you're planning on the 56 00:04:14,920 --> 00:04:15,310 are. 57 00:04:15,790 --> 00:04:20,380 Unless you are planning on hosting it on another server. 58 00:04:20,380 --> 00:04:24,970 But still it's it's dangerous because any user could create an account. 59 00:04:25,480 --> 00:04:27,580 I recommend only creating a log, a page. 60 00:04:27,580 --> 00:04:32,440 And then if somebody if you want somebody to work with you, then you need to create an account for 61 00:04:32,440 --> 00:04:35,290 them and then you need to give them email and password. 62 00:04:36,100 --> 00:04:42,430 So for example, here in the admins, what I'm going to do is that I'm going to click insert and then 63 00:04:42,430 --> 00:04:44,680 I'm going to get a new admin email and password. 64 00:04:45,100 --> 00:04:48,310 So the admin ID is going to be given by the database event here. 65 00:04:48,310 --> 00:04:53,920 I'm going to say admin admin name are going to say amen, amen and admin email. 66 00:04:53,920 --> 00:05:02,110 I'm going to say admin at email dot com and the password and then the password. 67 00:05:02,470 --> 00:05:04,540 The password must be hashed. 68 00:05:04,900 --> 00:05:06,670 You cannot type the password like this. 69 00:05:06,670 --> 00:05:09,880 You cannot say, for example, the password is one, two, three, four, five. 70 00:05:10,390 --> 00:05:14,710 You need to select here from this menu, you need to select MD5. 71 00:05:14,710 --> 00:05:19,500 So you need to look for MD5, which is this five MD5. 72 00:05:19,540 --> 00:05:22,810 By the way, if you don't use this, it's not going to work here. 73 00:05:22,810 --> 00:05:24,250 It's a unique four or five. 74 00:05:24,700 --> 00:05:27,070 So this one, two, three, four or five will be hashed. 75 00:05:27,380 --> 00:05:28,330 This is very important. 76 00:05:28,660 --> 00:05:31,630 Again, if you don't say MD5, it's not going to work. 77 00:05:32,380 --> 00:05:35,830 Lastly, you just need to click on Go and this is going to create a new admin. 78 00:05:36,850 --> 00:05:38,080 So let me show you that. 79 00:05:39,120 --> 00:05:44,580 As you can see now and your advent has been created and it says here admin ID is one name, admin and 80 00:05:44,580 --> 00:05:45,660 email and the password. 81 00:05:46,050 --> 00:05:48,060 The password, as you can see, has been hashed. 82 00:05:48,510 --> 00:05:50,910 So the password is hashed. 83 00:05:50,910 --> 00:05:54,960 But you know, you should know, of course, the password the actual password is one, two, three, 84 00:05:54,960 --> 00:05:55,560 four, five. 85 00:05:55,950 --> 00:05:58,140 But this password is the hashed password. 86 00:05:59,130 --> 00:06:07,260 Now, the last thing that we need to do is that if we do make sure that the input should say log in 87 00:06:07,650 --> 00:06:15,900 end and the method must be passed and the action must be a log in that BHP and the name for the email 88 00:06:15,900 --> 00:06:19,950 is is is email and the name for the password is password. 89 00:06:20,820 --> 00:06:23,060 Let me now turn over to the browser address. 90 00:06:23,520 --> 00:06:24,390 So I'm going to go back. 91 00:06:25,820 --> 00:06:30,260 And then I'm going to go to the log in that now the log in that BHP. 92 00:06:31,580 --> 00:06:33,890 Log in that BHP. 93 00:06:35,300 --> 00:06:44,360 So now in the log in that BHP let me say admin and then at email dot com and then let me see want to 94 00:06:44,360 --> 00:06:46,910 see four or five if I click on log in. 95 00:06:47,330 --> 00:06:52,190 As you can see, it will take me to the dashboard and it says here logged in successfully. 96 00:06:52,610 --> 00:06:59,630 So now I'm in the dashboard and I will be I will be able to use the dashboard if I log it.