1 00:00:00,520 --> 00:00:04,390 Now, the first thing that we need to check is that we need to compare the password. 2 00:00:04,390 --> 00:00:07,990 We compare the password with the confirmed password and make sure that they match. 3 00:00:08,500 --> 00:00:16,810 So I'm going to say here, if and then if password is not equal to the confirmed password, then we 4 00:00:16,810 --> 00:00:17,760 need to display an area. 5 00:00:17,770 --> 00:00:32,890 We need to say header and then header and then location and then register that BHP and then I'm going 6 00:00:32,890 --> 00:00:35,550 to pass a get parameter. 7 00:00:35,560 --> 00:00:36,820 I'm going to say error. 8 00:00:37,630 --> 00:00:41,110 So error is going to be equal to password. 9 00:00:41,980 --> 00:00:44,530 Passwords don't match. 10 00:00:45,040 --> 00:00:46,390 Don't match. 11 00:00:50,970 --> 00:00:51,890 Matt. 12 00:00:52,800 --> 00:00:57,870 And then I'm going to check another area, which is the length, the length of the passport. 13 00:00:57,870 --> 00:01:05,670 So if the passport is a t r length. 14 00:01:07,450 --> 00:01:08,740 Yes, they are linked. 15 00:01:10,970 --> 00:01:16,310 And then passport is smaller than, let's say, six characters. 16 00:01:16,850 --> 00:01:22,280 Then I'm going to tell you that you cannot use a password that's less than six characters. 17 00:01:22,970 --> 00:01:34,910 So I'm going to say here, Heather again and then location and then register that BHP and then I'm going 18 00:01:34,910 --> 00:01:36,440 to say error. 19 00:01:38,260 --> 00:01:40,690 Is equal to password. 20 00:01:41,260 --> 00:01:44,800 Must be at least. 21 00:01:46,910 --> 00:01:47,600 Six. 22 00:01:49,390 --> 00:01:50,140 Characters. 23 00:01:54,760 --> 00:01:56,420 So let's display the these errors. 24 00:01:56,440 --> 00:01:57,880 So how can you display these areas? 25 00:01:58,450 --> 00:02:05,140 You can use the get browser as the above the form just below below the opening track of the form. 26 00:02:05,140 --> 00:02:13,210 You can say here p paragraph and then you can use say B b2b and then you can see echo and then what? 27 00:02:13,300 --> 00:02:14,530 What do we want to echo? 28 00:02:14,530 --> 00:02:25,030 We want to actually get parameter, we get error, and then we need to give this paragraph a color. 29 00:02:25,030 --> 00:02:30,490 I'm going to say style color red, because this is an error. 30 00:02:32,310 --> 00:02:38,820 Let's this let's test this this part or let's continue first. 31 00:02:38,820 --> 00:02:41,430 I think we need to contain you first because it's going to take some time. 32 00:02:41,430 --> 00:02:43,950 So let me continue first and then we are going to test later. 33 00:02:44,670 --> 00:02:51,090 So this is going to check whether if pass or don't match. 34 00:02:52,350 --> 00:02:54,600 And here this is going to check. 35 00:02:55,260 --> 00:03:03,270 A password is less than less than six characters. 36 00:03:04,680 --> 00:03:05,420 Six characters. 37 00:03:05,430 --> 00:03:08,970 And then if there is no error, you can, by the way, add many errors. 38 00:03:08,970 --> 00:03:12,690 You can customize this depending on what you want to check. 39 00:03:12,690 --> 00:03:14,760 But I think these are the most important things. 40 00:03:16,650 --> 00:03:21,150 Then if there is no error, we can here start the registration process. 41 00:03:21,540 --> 00:03:26,010 So their attention process is that we need to get these and then insert them into the database. 42 00:03:26,580 --> 00:03:31,010 So to do this, we need to we need to start a connection, too. 43 00:03:31,080 --> 00:03:36,090 So to start a connection, we need to include remember, we need to say here include and then we need 44 00:03:36,090 --> 00:03:40,320 to include the server server for separate connection. 45 00:03:40,920 --> 00:03:43,860 And then we need to use the connection variable. 46 00:03:43,860 --> 00:03:52,560 We need to say here con and then we need to call a function called prepare, prepare. 47 00:03:52,560 --> 00:03:53,850 And then we need to insert. 48 00:03:53,850 --> 00:03:56,280 We need to insert. 49 00:03:57,830 --> 00:04:01,700 Seared into we into what table? 50 00:04:02,180 --> 00:04:03,680 Into the user's table. 51 00:04:04,010 --> 00:04:09,140 We need to insert into the user's table this user's table, user ID, name, email and password. 52 00:04:09,950 --> 00:04:13,310 So what I'm going to do is that I'm going to say insert into users. 53 00:04:13,310 --> 00:04:15,260 And then what do we want to insert? 54 00:04:15,710 --> 00:04:20,750 We want to insert the name, email and password, and the ID will be given by the database. 55 00:04:21,230 --> 00:04:28,310 So we need to say the first one is user underscore name, user underscore name. 56 00:04:28,970 --> 00:04:32,300 The second is user underscore email. 57 00:04:33,470 --> 00:04:35,900 User underscore email. 58 00:04:36,680 --> 00:04:44,750 The third is user underscore password and nearing to say values. 59 00:04:47,150 --> 00:04:48,590 Values. 60 00:04:53,880 --> 00:04:54,840 Values. 61 00:04:56,280 --> 00:04:57,300 What are the values? 62 00:04:58,350 --> 00:05:05,460 The values are question marks because I'm going to be using I'm going to be using the mind. 63 00:05:06,600 --> 00:05:12,150 So I'm going to say here going I'm going to say here is statement. 64 00:05:12,150 --> 00:05:17,310 I'm going to store this in a statement I'm going to say is the empty is equal to con and then I'm going 65 00:05:17,310 --> 00:05:22,080 to use the statement and then I'm going to say bind param. 66 00:05:22,890 --> 00:05:25,290 And the parameters are three parameters. 67 00:05:25,290 --> 00:05:37,860 The are the username email and the password is SS and then we need to basically email the facility name 68 00:05:38,610 --> 00:05:41,850 and then email and then password. 69 00:05:44,140 --> 00:05:48,730 However, there are two important things that we need to do before this. 70 00:05:49,510 --> 00:05:54,600 So these these two things are first, the password must be hacked. 71 00:05:55,150 --> 00:05:58,720 So in order to have the password, we need to say here. 72 00:05:59,660 --> 00:06:04,640 We need to say aim the fines and then pass the password. 73 00:06:05,300 --> 00:06:06,980 This is going to hash the password. 74 00:06:07,010 --> 00:06:12,710 This is very important and this is one of the best practices of BHP when it comes to security. 75 00:06:13,040 --> 00:06:19,250 And if you want to find out more about best practices in BHP when it comes to security, you can take 76 00:06:19,250 --> 00:06:27,080 my course about the best practices of BHP, the best of security practices at BHP. 77 00:06:27,590 --> 00:06:34,340 I recommend I'd highly recommend taking this course because it's going to teach you the important things 78 00:06:34,340 --> 00:06:39,080 that you need to take into account whenever you are working with P2P in order to avoid being hacked 79 00:06:40,790 --> 00:06:46,160 and in order to protect your systems and your websites and your web applications. 80 00:06:47,360 --> 00:06:54,010 Anyways, we need now to do a very important thing, which is check before doing this. 81 00:06:54,020 --> 00:06:55,070 This is going to insert. 82 00:06:55,730 --> 00:06:59,150 This is going to create a user, a new user. 83 00:06:59,750 --> 00:07:02,450 However, before creating a new user, we need to check. 84 00:07:03,800 --> 00:07:04,610 Check whether. 85 00:07:07,310 --> 00:07:08,010 Whether. 86 00:07:10,690 --> 00:07:22,570 There is a user with this email or not with this email or not because we cannot register the user with 87 00:07:22,870 --> 00:07:24,520 many users with the same email. 88 00:07:24,820 --> 00:07:27,790 So to do this, we need to create another statement. 89 00:07:27,790 --> 00:07:29,460 We need to say Here, gone. 90 00:07:30,220 --> 00:07:37,750 And then we need to say prepare, prepare and then select. 91 00:07:39,760 --> 00:07:40,900 Select. 92 00:07:43,420 --> 00:07:45,520 All from. 93 00:07:49,630 --> 00:07:50,410 Users. 94 00:07:50,410 --> 00:07:50,960 Where? 95 00:07:52,200 --> 00:07:52,720 Where. 96 00:07:53,650 --> 00:07:54,310 Email. 97 00:07:56,270 --> 00:07:57,680 Is equal to a question mark. 98 00:07:58,460 --> 00:08:00,530 And then I'm going to pass here the question mark. 99 00:08:00,710 --> 00:08:01,400 I'm going to say. 100 00:08:02,450 --> 00:08:07,430 Uh, is the empty one is equal to this. 101 00:08:08,090 --> 00:08:14,810 And then I'm going to say stmd1 bind Baram. 102 00:08:15,380 --> 00:08:18,410 And then s and then comma. 103 00:08:18,410 --> 00:08:19,430 And then email. 104 00:08:21,070 --> 00:08:27,910 And then I'm going to say here is the empty and then execute. 105 00:08:32,640 --> 00:08:41,720 And then I'm going to say statement and then bind the result and then I'm going to say num underscore. 106 00:08:41,720 --> 00:08:42,000 Right. 107 00:08:45,300 --> 00:08:46,740 And then statement. 108 00:08:47,520 --> 00:08:48,870 And then Fitch. 109 00:08:50,100 --> 00:08:53,460 And then finally I'm going to say I'm going to check. 110 00:08:53,460 --> 00:08:55,710 I'm going to say if numb. 111 00:08:57,700 --> 00:09:00,370 Bras is not. 112 00:09:01,570 --> 00:09:06,620 If it's not equal to zero, then we need to display an error. 113 00:09:06,640 --> 00:09:07,900 So I'm going to say here, Hitler. 114 00:09:09,540 --> 00:09:10,050 Hey there. 115 00:09:10,050 --> 00:09:15,740 And then location and then register. 116 00:09:17,780 --> 00:09:19,490 Got BHP and then air. 117 00:09:21,000 --> 00:09:21,690 And then. 118 00:09:24,780 --> 00:09:32,340 Use, I'm going to say user when this email already exists. 119 00:09:34,850 --> 00:09:41,540 And here, by the way, we need to say count, count and then start, count, start, because we aren't 120 00:09:41,540 --> 00:09:43,010 interested in getting information. 121 00:09:43,340 --> 00:09:48,500 We are interested only in getting the number of rows we need to find, whether there's an email with 122 00:09:48,830 --> 00:09:50,670 whether there's a user with this email or not. 123 00:09:50,690 --> 00:09:53,140 If there is, then we need to stop emails. 124 00:09:53,150 --> 00:09:54,020 We need to continue. 125 00:09:54,500 --> 00:10:02,660 So here we need to see in location, register that BGP and display this area in case the number of rows 126 00:10:02,660 --> 00:10:03,680 is not equal to zero.