1 00:00:00,800 --> 00:00:07,070 So another thing that we need to fix here is that we need to say here, user underscore email, not 2 00:00:07,070 --> 00:00:07,740 just email. 3 00:00:07,760 --> 00:00:08,210 Why? 4 00:00:08,810 --> 00:00:15,710 The reason is because in the database, remember in the user stable, the the column for the email is 5 00:00:15,710 --> 00:00:16,940 user underscore email. 6 00:00:17,210 --> 00:00:24,050 And here we are using we are using it to connect to the database and I'm here checking I'm you're saying 7 00:00:24,050 --> 00:00:29,500 we're user email is equal to something so we need to use this SQL user underscore email. 8 00:00:30,170 --> 00:00:37,010 And also here are another thing that they wanted to fix here is they get error this get error. 9 00:00:37,010 --> 00:00:47,000 If if we if the error if the the get request is not set, we are going to this is going to display a 10 00:00:48,230 --> 00:00:48,940 an error. 11 00:00:48,950 --> 00:00:49,970 This is going to split an error. 12 00:00:49,970 --> 00:00:55,430 And instead of displaying the error message itself, so we need to say here we are if statements and 13 00:00:55,430 --> 00:00:56,270 we need to say if. 14 00:00:57,460 --> 00:01:01,780 Is sex only a set get. 15 00:01:02,920 --> 00:01:04,270 Is said, get air. 16 00:01:04,600 --> 00:01:10,530 If the air is set air, then I'm going to execute. 17 00:01:10,540 --> 00:01:12,670 I'm going to hear you say echo and then echo this. 18 00:01:12,670 --> 00:01:12,910 Good. 19 00:01:13,600 --> 00:01:14,140 That's it. 20 00:01:15,010 --> 00:01:18,460 So this good will never be executed unless there is an error message. 21 00:01:18,970 --> 00:01:20,380 This is very, very important. 22 00:01:21,370 --> 00:01:29,860 Finally, we need to continue working here after after the after we say here statement to bind by ram. 23 00:01:30,220 --> 00:01:32,110 We need to excuse this. 24 00:01:32,110 --> 00:01:35,200 I'm going to say is to empty and then execute. 25 00:01:37,040 --> 00:01:48,410 Excuse this and we need to bind the we need to store the information in the session. 26 00:01:48,410 --> 00:01:49,790 And I'm going to work on this later. 27 00:01:49,790 --> 00:01:55,670 But for now, what we want to do is that we need to fix the code because the code now is getting complicated. 28 00:01:56,210 --> 00:02:01,340 So here I'm going to say in order to fix this code, I'm going to say if password don't match, then 29 00:02:01,340 --> 00:02:05,240 we are going to display an error here instead of saying another statement. 30 00:02:05,240 --> 00:02:06,440 I'm going to say else if. 31 00:02:08,730 --> 00:02:09,620 Else If the. 32 00:02:10,350 --> 00:02:16,590 Else if the password is less than six characters, then I'm going to split another error here. 33 00:02:16,590 --> 00:02:17,100 I'm going to say. 34 00:02:17,130 --> 00:02:18,030 Else. 35 00:02:18,780 --> 00:02:19,290 Else. 36 00:02:20,520 --> 00:02:20,790 Else. 37 00:02:21,060 --> 00:02:22,980 If there are no errors, are there? 38 00:02:24,120 --> 00:02:26,460 If there are no errors, then I'm going to say ls. 39 00:02:27,820 --> 00:02:30,100 And then I'm going to push all of this good insight. 40 00:02:31,190 --> 00:02:33,350 All of this code will go inside the seals. 41 00:02:34,330 --> 00:02:35,630 Here, I'm going to close the seals. 42 00:02:37,070 --> 00:02:38,960 And here, inside the seals. 43 00:02:39,500 --> 00:02:41,140 Here, I'm going to add a comment. 44 00:02:41,150 --> 00:02:41,960 I'm going to say if. 45 00:02:43,820 --> 00:02:46,580 There is no error. 46 00:02:49,470 --> 00:02:55,830 Then we to display this at the closing racketeer and also the closing racketeer. 47 00:02:56,460 --> 00:03:00,210 And remove it from here because this is going to make the code more organized. 48 00:03:02,840 --> 00:03:04,730 So else else. 49 00:03:04,730 --> 00:03:10,970 If there is no air, then we need to check whether check whether the there is a user with this email 50 00:03:10,970 --> 00:03:12,970 or not here. 51 00:03:12,980 --> 00:03:22,640 If this statement is going to check if there is there is a user with. 52 00:03:24,610 --> 00:03:34,660 Already registered with registered with this email, then we cannot continue. 53 00:03:34,660 --> 00:03:35,980 We need to send the user to the. 54 00:03:36,190 --> 00:03:37,690 We need to display an error message. 55 00:03:38,220 --> 00:03:40,740 Else else. 56 00:03:41,320 --> 00:03:43,120 I'm going to add this code now. 57 00:03:43,150 --> 00:03:53,860 All of this code now will go inside here and then I'm going to add a curly bracket and you need to double 58 00:03:54,280 --> 00:03:59,830 check your code because there are so many curly braces. 59 00:04:00,490 --> 00:04:02,410 If you get this wrong, it's not going to work. 60 00:04:02,410 --> 00:04:06,910 So I want you to double check your code one more time. 61 00:04:07,390 --> 00:04:09,400 So let me show you the code one more time. 62 00:04:10,360 --> 00:04:17,820 If if user clicks on register, we get the data from the form and then check whether the email is whether 63 00:04:17,830 --> 00:04:20,770 the password and the password confirm a match. 64 00:04:21,190 --> 00:04:23,110 If they don't match, we display an error. 65 00:04:25,090 --> 00:04:30,610 If there is another error, if the password is less than six characters, we also we also display an 66 00:04:30,610 --> 00:04:30,910 error. 67 00:04:31,600 --> 00:04:36,370 LS If there are no errors, by the way, these are the errors that I have used. 68 00:04:36,640 --> 00:04:42,880 You can add more else ifs here if you want to check for more errors, but they think these are the most 69 00:04:42,880 --> 00:04:48,790 important two errors that they want to I want the user to avoid. 70 00:04:49,060 --> 00:04:52,120 The password don't match the password. 71 00:04:52,120 --> 00:04:54,550 Less than six characters else. 72 00:04:54,610 --> 00:05:00,070 If there are no errors, I'm going to first check whether there is an email, whether there is a user 73 00:05:00,070 --> 00:05:01,060 with this email or not. 74 00:05:01,840 --> 00:05:07,150 If there is a user with this email, then we need to take the user to the. 75 00:05:07,150 --> 00:05:16,390 We needed to display an error message if there is a if there is no user with this email, if no user, 76 00:05:17,260 --> 00:05:18,460 let me add your comment. 77 00:05:19,180 --> 00:05:23,590 If no user registered. 78 00:05:25,050 --> 00:05:25,500 With. 79 00:05:27,120 --> 00:05:35,610 This email before then we can create an account with this email and password. 80 00:05:36,240 --> 00:05:40,110 And finally here we need to say a statement excuse. 81 00:05:40,110 --> 00:05:48,840 And then we need to check this by saying if if this is correct, if, if the the account has been created 82 00:05:48,840 --> 00:05:57,100 successfully, what we want to do is that we need to get the data and display the date. 83 00:05:57,660 --> 00:06:05,250 We need to store the user information in decision because at this point, the account has been created 84 00:06:05,250 --> 00:06:05,880 successfully. 85 00:06:06,360 --> 00:06:13,170 So I'm going to say here, user email is equal. 86 00:06:14,950 --> 00:06:17,740 To the user email. 87 00:06:17,770 --> 00:06:25,840 So here I'm going to say that user email is equal to the user email is equal to the email that they 88 00:06:25,840 --> 00:06:26,800 use a registered with. 89 00:06:27,700 --> 00:06:30,250 And this session I'm going to get another session with. 90 00:06:32,490 --> 00:06:33,090 User 91 00:06:35,490 --> 00:06:36,210 username. 92 00:06:38,580 --> 00:06:41,460 Is equal to. 93 00:06:44,070 --> 00:06:45,090 User name or name. 94 00:06:48,180 --> 00:06:51,150 And we can also create a session. 95 00:06:52,080 --> 00:06:53,550 A session? 96 00:06:58,130 --> 00:07:00,770 Logged in. 97 00:07:02,940 --> 00:07:04,530 Is equal to two. 98 00:07:07,380 --> 00:07:08,460 And that's it. 99 00:07:08,460 --> 00:07:14,880 And then we take the user to the account, which you can see here, there, and then location. 100 00:07:17,020 --> 00:07:20,110 And then I count. 101 00:07:21,880 --> 00:07:25,780 And then that BHP and I'm going to say here. 102 00:07:29,430 --> 00:07:30,450 Register. 103 00:07:32,570 --> 00:07:40,910 And then is equal to you register successfully. 104 00:07:42,000 --> 00:07:42,510 That's it. 105 00:07:43,020 --> 00:07:54,270 Else if there is a fear here, if account was created successfully. 106 00:07:56,530 --> 00:07:57,220 Else. 107 00:08:00,790 --> 00:08:08,140 Ills account couldn't could not be created for some reason. 108 00:08:08,860 --> 00:08:11,540 So we need to display an error here. 109 00:08:11,560 --> 00:08:12,940 Again, we need to use the header. 110 00:08:15,270 --> 00:08:15,960 And then. 111 00:08:18,110 --> 00:08:24,290 Register and then a location and then register. 112 00:08:27,100 --> 00:08:28,300 And then that BHP. 113 00:08:30,880 --> 00:08:41,650 And then air is equal to crude and could not get an account. 114 00:08:43,510 --> 00:08:44,160 At the. 115 00:08:45,780 --> 00:08:47,160 More Mitt. 116 00:08:49,700 --> 00:08:50,780 And assets. 117 00:08:51,900 --> 00:08:55,650 LC Or you can display anywhere you can. 118 00:08:55,650 --> 00:08:58,890 You see, for example, here, there and then. 119 00:09:00,450 --> 00:09:01,170 Location. 120 00:09:05,660 --> 00:09:10,040 Register that BHP and then air. 121 00:09:12,130 --> 00:09:21,530 And then you can say here, please fill in the form of the air. 122 00:09:21,550 --> 00:09:26,890 The air is possibly at this point is that the past is not set. 123 00:09:28,960 --> 00:09:29,620 So that's it. 124 00:09:31,220 --> 00:09:35,630 And the last thing that we need to do is that we need to clear the account that BHP page. 125 00:09:36,230 --> 00:09:41,960 So if you go through the account that BHP hope you will find that we have a page, full account, that 126 00:09:42,000 --> 00:09:46,550 each email and we need to convert this to, we need to convert this to BHP. 127 00:09:46,550 --> 00:09:49,400 We need to say account that BHP. 128 00:09:50,240 --> 00:09:51,590 That's it for now. 129 00:09:51,590 --> 00:09:56,720 I'm going to convert it to two, account three and then later I'm going to display the information there. 130 00:09:56,990 --> 00:10:06,950 And finally here actually if I use the header in the LS it, it's not going to allow me to enter the 131 00:10:06,950 --> 00:10:10,580 page anyways because the is set here. 132 00:10:11,030 --> 00:10:14,870 Whenever I enter the page it's always going to be not set. 133 00:10:14,870 --> 00:10:16,220 The post is not going to be set. 134 00:10:16,220 --> 00:10:19,460 So here actually I shouldn't have this code at all. 135 00:10:20,120 --> 00:10:21,890 I should remove this completely. 136 00:10:22,700 --> 00:10:27,080 I should remove this code and I shouldn't add this code for now. 137 00:10:28,250 --> 00:10:35,810 Let me save and we can have another code that's going to to check whether the user is logged in or not 138 00:10:36,860 --> 00:10:37,820 in order to. 139 00:10:39,720 --> 00:10:40,680 To avoid. 140 00:10:40,680 --> 00:10:41,740 They used to go to the area. 141 00:10:41,760 --> 00:10:42,830 So if they are lucky. 142 00:10:42,840 --> 00:10:44,310 But there is no need for this now. 143 00:10:44,820 --> 00:10:47,850 Here we need to say session start. 144 00:10:48,510 --> 00:10:49,860 This is the last thing that we need. 145 00:10:50,250 --> 00:10:58,050 And the last thing that I'm going to do is that here we need to say statement and then store result. 146 00:10:58,110 --> 00:10:59,150 This is very important. 147 00:10:59,160 --> 00:11:00,570 You need to call a result. 148 00:11:01,320 --> 00:11:02,600 Otherwise it's not going to work. 149 00:11:02,620 --> 00:11:03,630 This is not going to work. 150 00:11:04,350 --> 00:11:12,000 And by the way, here after this if statement, we need to check whether the user is logged in or not. 151 00:11:12,000 --> 00:11:15,900 But I'm going to work on this later because I don't want to confuse you right now. 152 00:11:16,440 --> 00:11:18,630 So let me now head on over to the browser and test. 153 00:11:19,140 --> 00:11:24,810 So first we need to go to the Register page because as you can see, there is no link for the register. 154 00:11:24,810 --> 00:11:31,590 So I'm going to say register, you just turn that feed and then maybe it's an account. 155 00:11:34,580 --> 00:11:40,130 So leaving your with an account and I'm going to type everything correctly. 156 00:11:42,760 --> 00:11:45,010 And let me here create an account. 157 00:11:45,010 --> 00:11:49,540 So if you click on register and if everything is fine, as you can see, it's going to take me to the 158 00:11:49,540 --> 00:11:55,750 account page and now in the database I should find my account so my account has been created. 159 00:11:56,500 --> 00:11:57,720 Now, let me try. 160 00:11:57,730 --> 00:12:01,750 Let me go to the register page and try to. 161 00:12:03,430 --> 00:12:07,960 To test for other possible scenarios. 162 00:12:08,440 --> 00:12:13,360 Now, if you go to the Register page, the first problem that they have is that they will be able to 163 00:12:13,360 --> 00:12:17,260 go through to the register page even though I already have created an account. 164 00:12:17,650 --> 00:12:23,140 So this is a problem that I'm going to work on shortly, but first, let's test the problems. 165 00:12:23,440 --> 00:12:28,270 So the first problem is that if you click on register without feeling the form, it's not going to allow 166 00:12:28,270 --> 00:12:29,440 you which which is great. 167 00:12:29,890 --> 00:12:35,620 And if you try to use an account with the, with the same email, for example, if you're trying to 168 00:12:35,620 --> 00:12:38,770 create an account with this email, let me test. 169 00:12:40,760 --> 00:12:42,080 It's not going to allow you. 170 00:12:42,140 --> 00:12:43,070 Let me show you this. 171 00:12:50,510 --> 00:12:55,860 So if you click on register, it's going to say your user with this email already exists. 172 00:12:55,880 --> 00:13:02,420 So this is going to protect the form from getting to accounts with the same email. 173 00:13:02,720 --> 00:13:04,560 If you test with the let's say. 174 00:13:04,760 --> 00:13:11,750 Let's say that the user did not type did not out the let's say the emails. 175 00:13:11,900 --> 00:13:13,370 The passwords don't match. 176 00:13:13,790 --> 00:13:21,760 So if I type your password and in the second field, I'm going to type another password that don't match. 177 00:13:21,770 --> 00:13:25,070 If you click on register, it's going to say here, password don't match. 178 00:13:25,550 --> 00:13:31,370 So you can use this and commit this thing this multiple times in order to avoid any problems with the 179 00:13:31,370 --> 00:13:31,760 or for. 180 00:13:32,450 --> 00:13:36,740 The last problem is that that we need to fix is the registration. 181 00:13:37,310 --> 00:13:44,810 So here in the form we need to say we need to say ILS if and then we need to check this session. 182 00:13:44,810 --> 00:13:47,930 We need to say session is set. 183 00:13:49,680 --> 00:13:50,880 A set session. 184 00:13:53,070 --> 00:13:57,450 Session, locked in, logged in. 185 00:13:57,450 --> 00:14:00,870 Remember, we have here a key call logged in. 186 00:14:01,230 --> 00:14:10,620 So if user if the logged in is if user is logged in, then what we need to do is that we need to say 187 00:14:10,620 --> 00:14:25,140 here that location, location and then index or account actually account account dot BHP and we need 188 00:14:25,140 --> 00:14:30,300 to take the user to the account that we because at this point the user has already registered and we 189 00:14:30,300 --> 00:14:30,960 need to exit. 190 00:14:32,400 --> 00:14:33,600 So let me test this. 191 00:14:34,200 --> 00:14:37,070 So now I'm locked in research. 192 00:14:37,080 --> 00:14:42,510 So if I try to go to the registration page, I shouldn't be able to enter the. 193 00:14:42,780 --> 00:14:48,570 As you can see, I will not be able to enter the registration page leaving here, say register one more 194 00:14:48,570 --> 00:14:50,760 time registered at BHP. 195 00:14:51,460 --> 00:14:56,790 And if I try to go to the register, it's not going to allow me because this is going to protect the 196 00:14:57,630 --> 00:14:58,950 the registration page. 197 00:14:58,970 --> 00:15:06,780 I'm going to say here, if a user has already registered. 198 00:15:09,230 --> 00:15:09,740 Then. 199 00:15:12,570 --> 00:15:16,920 Take user to account which. 200 00:15:19,640 --> 00:15:23,120 And also in the registration page, we have a link here. 201 00:15:23,960 --> 00:15:25,510 We have a link for log in. 202 00:15:25,520 --> 00:15:27,290 So we need to to activate this link. 203 00:15:27,740 --> 00:15:34,790 I'm going to say here, Ashraf, and this is going to take the user to the log in that which is the 204 00:15:34,790 --> 00:15:36,110 page that I'm going to work on. 205 00:15:36,590 --> 00:15:39,830 So now our registration system is complete.