Difference between revisions of "PHP-and-MySQL/C4/User-Registration-Part-3/English-timed"

From Script | Spoken-Tutorial
Jump to: navigation, search
(Created page with '{| border=1 !Time !Narration |- |0.00 |Welcome to the 3rd part of the User Registration tutorial. In this part we are going to check for existence of all that was discussed in t…')
 
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{| border=1
 
{| border=1
!Time
+
|'''Time'''
!Narration
+
|'''Narration'''
 +
 
 
|-
 
|-
|0.00
+
|00:00
|Welcome to the 3rd part of the User Registration tutorial. In this part we are going to check for existence of all that was discussed in the last part.
+
|Welcome to the 3rd part of the '''User Registration''' tutorial.  
 +
 
 
|-
 
|-
|0.07
+
|00:04
 +
| In this part, we are going to check for existence of all that was discussed in the last part.  
 +
 
 +
|-
 +
|00:10
 
|Let us have a quick recap of what was done in the last part.  
 
|Let us have a quick recap of what was done in the last part.  
 +
 
|-
 
|-
|0:09
+
|00:14
|We have striped the tags off our  "fullname" and "username".   
+
|We have striped the '''tags''' off our  "fullname" and "username".   
 +
 
 
|-
 
|-
|0:12
+
|00:19
 
|We have stripped and encrypted our "password".  
 
|We have stripped and encrypted our "password".  
 +
 
|-
 
|-
|0:17
+
|00:23
|Remember this sequence for the  functions, so that we are not striping off our encrypted value.
+
|Remember this sequence for the  functions so that we are not striping off our encrypted value.
 +
 
 
|-
 
|-
|0:23
+
|00:30
|Here we are going to start our registration process. I'll be checking the existence of all these.
+
|Here, we are going to start our registration process.
 +
 
 
|-
 
|-
|0:33
+
|00:34
|Just before I do that I am going to set the "date". Now,  this is using the date function.  
+
| I'll be checking the existence of all these.
 +
 
 
|-
 
|-
|0:38
+
|00:38
|Inside we have "Y" for the year "m" for the month and "d" for the date.
+
|Just before I do that, I am going to set the "$date".  
 +
 
 
|-
 
|-
|0:45
+
|00:43
|It's the capital "Y" for a 4-digit year. If we use a small "y", we would have a 2-digit year.
+
|Now,  this is using the '''date()''' function.  
 +
 
 
|-
 
|-
|0:59
+
|00:47
|So, in my database, at the moment. I have my year first, then my month and my day and these are separated by hyphens.  
+
|Inside, we have "Y" for the year, "m" for the month and "d" for the date.
 +
 
 
|-
 
|-
|1:08
+
|00:55
|You can see this when we enter our database here and say insert a value into "users".  
+
|It's the capital "Y" for  4-digit year. If we use a small "y", it  would be a 2-digit year.
 +
 
 
|-
 
|-
|1:13
+
|01:02
 +
|So, in my database, at the moment,  I have my year first, then my month and my day and these are separated by hyphens. 
 +
 
 +
|-
 +
|01:15
 +
|You can see this when we enter our database here and insert a value into "users".
 +
 
 +
|-
 +
|01:22
 
|We can see that the "date" is in a specific format, if we use this kind of function here.
 
|We can see that the "date" is in a specific format, if we use this kind of function here.
 +
 
|-
 
|-
|1:19
+
|01:29
 
|When I click today, you can see here that we have got the year in a 4-digit format and our month here and our day here, separated by hyphens.
 
|When I click today, you can see here that we have got the year in a 4-digit format and our month here and our day here, separated by hyphens.
 +
 
|-
 
|-
|1:29
+
|01:40
|Its adjusted into that structure inside my database.  
+
|It's adjusted into that structure in my database.  
 +
 
 
|-
 
|-
|1:33
+
|01:45
|Okay, so "if submit", then we need to check for existence. I will add a comment here "check for existence".
+
|Okay, so '''if''' '$submit' then we need to check for existence.  
 +
 
 
|-
 
|-
|1:46
+
|01:51
|Now, this is really easy. All we want to do is we have to say is "if" statement and a block a code after that.
+
|I will add a comment here "check for existence".
 +
 
 
|-
 
|-
|1:55
+
|01:55
|The condition will be "if fullname, username, password and repeat password exist".... we have the evidence here.... we will say "if username" followed by "and", so double ampersand symbol.  
+
|Now, this is really easy.  
 +
 
 
|-
 
|-
|2:10
+
|01:58
|Then we will say "password" and then we'll say....  
+
|All we want to do is, we have to say "if" '''statement''' and a block of code after that.
 +
 
 
|-
 
|-
|2:14
+
|02:05
|Oh! I forgot the "fullname" here, so I'll add it here.
+
|The condition will be 'if $fullname, $username, $password and $repeat password exist', we have the evidence here.... we will say '''if''' $username followed by '''AND''', so double ampersand symbol.
 +
 
 
|-
 
|-
|2:18
+
|02:24
|Separated these with a double ampersand sign.
+
|Then we will say "$password" and then we'll say....
 +
 
 
|-
 
|-
|2:21
+
|02:28
|The last one is "repeat password" so type that.  
+
|Oh! I forgot the "$fullname" here, so I'll add it there.
 +
 
 
|-
 
|-
|2:26
+
|02:33
 +
|Separate these with a double ampersand sign.
 +
 
 +
|-
 +
|02:38
 +
|The last one is "$repeat password"; so type that.
 +
 
 +
|-
 +
|02:42
 
|We are going to require all of these.
 
|We are going to require all of these.
 +
 
|-
 
|-
|2.31
+
|02:46
|Else, we will say - echo "Please fill in" and in bold, "all fields".  
+
|Else, we will say - '''echo''' "Please fill in" and in bold, "all", "fields!".  
 +
 
 
|-
 
|-
|2:42
+
|02:57
 
|We will put a paragraph break after that.
 
|We will put a paragraph break after that.
 +
 
|-
 
|-
|2:45
+
|03:01
|Also let me put a paragraph break before the form so that we don't need to add it to every error message we give.  
+
|Also, let me put a paragraph break before the '''form''' so that we don't need to add it to every '''error''' message we give.  
 +
 
 
|-
 
|-
|2:57
+
|03:10
|So that's it. Let's just try it.
+
|So, that's it. Let's just try it.
 +
 
 
|-
 
|-
|3:00
+
|03:13
|I will go back to my "register" page. We got it here.  Lets click in register.
+
|I will go back to my "Register" page.  
 +
 
 
|-
 
|-
|3:05
+
|03:17
|"Please fill in all fields".
+
|We got it here.  Let's click in register.  
 +
 
 
|-
 
|-
|3:07
+
|03:20
|Lets type a couple of fields here.  
+
|"Please fill in all fields!".
 +
 
 
|-
 
|-
|3:10
+
|03:22
|Lets choose one of our passwords. We will not repeat our password.  
+
|Let's type a couple of '''fields''' here.  
 +
 
 
|-
 
|-
|3:15
+
|03:25
|Register. Oh!  repeat password..... repeat password.
+
|Let's choose one of our passwords.  
 +
 
 
|-
 
|-
|3.32
+
|03:27
|The reason  this is not working at the moment is, an "md5" value of nothing is equal to an "md5" string of text. An encrypted string of text.
+
|We will not repeat our password.  
 +
 
 
|-
 
|-
|3:44
+
|03:30
|So, I realise what we need to do is, take out the "md5" function here.
+
|Register. Oh! repeat password....
 +
 
 
|-
 
|-
|3.51
+
|03:42
|Make sure you remove the end brackets. I will come down here and check for all of our data.  
+
|'$repeat password'.
 +
 
 
|-
 
|-
|3:59
+
|03:45
 +
|The reason  this is not working at the moment is, an "md5" value of nothing is equal to an "md5" '''string''' of text.
 +
 
 +
|-
 +
|03:56
 +
|An encrypted string of text.
 +
 
 +
|-
 +
|04:00
 +
|So, I realize what we need to do is, take out the "md5" function here.
 +
 
 +
|-
 +
|04:06
 +
|Make sure you remove the end brackets. I will come down here and check for all of our data.
 +
 +
|-
 +
|04:14
 
|So, let me go back and try this again.
 
|So, let me go back and try this again.
 +
 
|-
 
|-
|4:01
+
|04:17
|Remember it didn't work before when we didn't chose a "repeat password".  
+
|Remember it didn't work before when we didn't chose a "Repeat password".  
 +
 
 
|-
 
|-
|4:05
+
|04:23
|So if I didn't chose a password or a repeat password we get our error.  
+
|So, if I didn't chose a repeat or a password we get our error.  
 +
 
 
|-
 
|-
|4:10
+
|04:30
|If I again choose a value except the repeat password, we still get this error.
+
|If I again choose a value except the "Repeat password", we still get this error.
 +
 
 
|-
 
|-
|4:16
+
|04:37
 
|That's the problem.  What we should say is - if everything exists then we can convert our password and repeat password.  
 
|That's the problem.  What we should say is - if everything exists then we can convert our password and repeat password.  
 +
 
|-
 
|-
|4:25
+
|04:46
|So I will just say "password" is equal to "md5" of password".
+
|So I will just say "$password" is equal to "md5" of "$password".
 +
 
 
|-
 
|-
|4:30
+
|04:53
 
|This will encrypt our original variable value and store a new password code in the same variable.
 
|This will encrypt our original variable value and store a new password code in the same variable.
 +
 
|-
 
|-
|4:40
+
|05:00
|We also need to say "repeat password" equals "md5" and "repeat password".  
+
|We also need to say "$repeat password" equals "md5" and "$repeat password".  
 +
 
 
|-
 
|-
|4:52
+
|05:08
|Here comment this as "encrypt password". We have encrypted our password.
+
|Here, comment this as "encrypt password". We have encrypted our password.
 +
 
 
|-
 
|-
|4:58
+
|05:15
|Now we will go ahead and add all our data into our data base.
+
|Now we will go ahead and add all our data into our database.
 +
 
 
|-
 
|-
|5:07
+
|05:21
| I am going to do this. Because we have got our data going to our registration, we are going to set a maximum limit for each data that is input.
+
| I am going to do this. Because we have got our data going to our registration, we are going to set a maximum limit for each data that is input.
 +
 
 
|-
 
|-
|5:19
+
|05:39
 
|Now we say 25 characters for our fullname, username, password and repeat password. So the maximum value is 25.
 
|Now we say 25 characters for our fullname, username, password and repeat password. So the maximum value is 25.
 +
 
|-
 
|-
|5.32
+
|05:50
|So I will say- if the string length of username is bigger or greater than 25.... or.... string length of the fullname is greater that 25
+
|So, I will say- if the string length of '$username' is bigger or greater than 25.... '''OR'''
 +
 
 
|-
 
|-
|6:00
+
|06:05
|Let us look at these individually and say if the length of your username or fullname is too long.
+
|string length of the '$fullname' is greater than 25.
 +
 
 
|-
 
|-
|6:09
+
|06:15
|Let me put this correctly.
+
|Let us look at these individually and say - if the length of your username or fullname is too long.
 +
 
 
|-
 
|-
|6:12
+
|06:24
|If each of these values is greater than 25 or bigger than 25.
+
|Let me put this correctly.  
 +
 
|-
 
|-
|6:15
+
|06:27
| We are going to echo out these values saying "username" or...... no....
+
|If each of these values is greater than 25 or bigger than 25,
 +
 
 
|-
 
|-
|6:25
+
|06:34
 +
| we are going to '''echo''' out these values
 +
 
 +
|-
 +
|06:40
 +
|  saying "username" or... no...
 +
 
 +
|-
 +
|06:48
 
|Let me say "Max limit for username or fullname are 25 characters".
 
|Let me say "Max limit for username or fullname are 25 characters".
 +
 
|-
 
|-
|6:36
+
|06:55
 
|Otherwise I will proceed to check my password length.  
 
|Otherwise I will proceed to check my password length.  
 +
 
|-
 
|-
|6:40
+
|07:01
 
|Now I have decided to do this - "check password length" because I want a specific check for this.
 
|Now I have decided to do this - "check password length" because I want a specific check for this.
 +
 
|-
 
|-
|6:48
+
|07:12
|Let me say "if string length of my password is greater than 25.... or.... string length.....
+
|"If string length of my password is greater than 25.. or.. string length...
 +
 
 
|-
 
|-
|7:08
+
|07:30
|No... um... lets get rid of this, get rid of "else".
+
|No... um... let's get rid of this, get rid of '''else'''.
 +
 
 
|-
 
|-
|7:15
+
|07:36
 
|The first check I want to do is to see if my passwords match.  
 
|The first check I want to do is to see if my passwords match.  
 +
 
|-
 
|-
|7:21
+
|07:41
|Let me say "if password equals equals to repeat password"  then continue the big block of code.
+
|Let me say "if password equals equals (==)to repeat password"  then continue the big '''block''' of code.
 +
 
 
|-
 
|-
|7:31
+
|07:53
|Otherwise echo out to the user "Your passwords do not match". Okay?
+
|Otherwise '''echo''' out to the user "Your passwords do not match".  
 +
 
 
|-
 
|-
|7:41
+
|08:00
|So, you can type here and we can keep checking our character length.
+
|Okay?
 +
 
 
|-
 
|-
|7:44
+
|08:03
|Now to check the character length of "username" and "fullname".  So, "check char length of username and fullname".
+
|So, you can type here and we can keep checking your character length.  
 +
 
 
|-
 
|-
|7:56
+
|08:09
|And that is going to be what we said before, "if username is greater than 25"  
+
|Now, to check the character length of "username" and "fullname". 
 +
 
 
|-
 
|-
|8:02
+
|08:14
|Rather if the string length used in this function is greater than 25...  
+
|So, "check character  length of username and fullname".
 +
 
 
|-
 
|-
|8.08
+
|08:18
|Or the string length of fullname is greater that 25, then we echo "Length of username or fullname is too long!".
+
|And that is going to be what we said before, '''if''' "username is greater than 25",
 +
 
 
|-
 
|-
|8:24
+
|08:25
|So, just to keep it simple and then otherwise we will say "check password length".
+
|rather if the '''string''' length used in this function is greater than 25...
 +
 
 
|-
 
|-
|8:36
+
|08:31
|Here I am going to specify or say "if"... now remember our passwords match...
+
|'''OR''' the string length of fullname is greater than 25, then we '''echo''' "Length of username or fullname is too long!".
 +
 
 
|-
 
|-
|8:42
+
|08:43
 +
|So, just to keep it simple and then otherwise we will say
 +
 
 +
|-
 +
|08:51
 +
|"check password length".
 +
 
 +
|-
 +
|08:57
 +
|Here, I am going to specify or say '''if'''... now remember our passwords match...
 +
 
 +
|-
 +
|09:04
 
|So we only need to check this on one of the password variables.
 
|So we only need to check this on one of the password variables.
 +
 
|-
 
|-
|8:46
+
|09:09
|Here I will say - if the string length of the password is greater than 25 or string length of our password is lesser than 6 characters....
+
|Here, I will say - if the string length of the password is greater than 25 or string length of our password is lesser than 6 characters....
 +
 
 
|-
 
|-
|9.00
+
|09:23
|...then we will echo out an error saying "Password must be between 6 and 25 characters". This will work for sure.
+
|...then we will '''echo''' out an '''error''' saying "Password must be between 6 and 25 characters".  
 +
 
 
|-
 
|-
|9:16
+
|09:35
 +
|This will work for sure.
 +
 
 +
|-
 +
|09:37
 
|We will continue this discussion in the next tutorial.
 
|We will continue this discussion in the next tutorial.
 +
 +
|-
 +
|09:41
 +
|Before that, let me just conclude this with an '''else''' statement.
 +
 
|-
 
|-
|9:19
+
|09:46
|Before that let me just conclude this with an "else" statement.
+
|So, otherwise we will say "register the user".  
 +
 
 
|-
 
|-
|9:25
+
|09:51
|So, otherwise we will say "register the user".  Our code to register the user will go here.
+
| Our code to register the user will go here.
 +
 
 
|-
 
|-
|9:35
+
|09:56
|In the next tutorial we'll test this out and will learn how to register the user and we will put our code here in that tutorial.
+
|In the next tutorial, we'll test this out and will learn how to register the user and we will put our code here in that tutorial.
 +
 
 
|-
 
|-
|9:42
+
|10:06
|This is basically for checking a minimum or maximum limit on our password and this block of code here is will be our magical "register the user" piece of code.
+
|This is basically for checking a minimum or maximum limit on our password and this block of code here will be our magical "register the user" piece of code.
 +
 
 
|-
 
|-
|9:52
+
|10:17
|So join me in the next part. Bye-bye.  This is ____________ dubbing for the Spoken Tutorial project.
+
|So join me in the next part. Bye-bye.  This is Mad Madhur, dubbing for the Spoken Tutorial project.
 +
|}

Latest revision as of 11:25, 28 April 2017

Time Narration
00:00 Welcome to the 3rd part of the User Registration tutorial.
00:04 In this part, we are going to check for existence of all that was discussed in the last part.
00:10 Let us have a quick recap of what was done in the last part.
00:14 We have striped the tags off our "fullname" and "username".
00:19 We have stripped and encrypted our "password".
00:23 Remember this sequence for the functions so that we are not striping off our encrypted value.
00:30 Here, we are going to start our registration process.
00:34 I'll be checking the existence of all these.
00:38 Just before I do that, I am going to set the "$date".
00:43 Now, this is using the date() function.
00:47 Inside, we have "Y" for the year, "m" for the month and "d" for the date.
00:55 It's the capital "Y" for 4-digit year. If we use a small "y", it would be a 2-digit year.
01:02 So, in my database, at the moment, I have my year first, then my month and my day and these are separated by hyphens.
01:15 You can see this when we enter our database here and insert a value into "users".
01:22 We can see that the "date" is in a specific format, if we use this kind of function here.
01:29 When I click today, you can see here that we have got the year in a 4-digit format and our month here and our day here, separated by hyphens.
01:40 It's adjusted into that structure in my database.
01:45 Okay, so if '$submit' then we need to check for existence.
01:51 I will add a comment here "check for existence".
01:55 Now, this is really easy.
01:58 All we want to do is, we have to say "if" statement and a block of code after that.
02:05 The condition will be 'if $fullname, $username, $password and $repeat password exist', we have the evidence here.... we will say if $username followed by AND, so double ampersand symbol.
02:24 Then we will say "$password" and then we'll say....
02:28 Oh! I forgot the "$fullname" here, so I'll add it there.
02:33 Separate these with a double ampersand sign.
02:38 The last one is "$repeat password"; so type that.
02:42 We are going to require all of these.
02:46 Else, we will say - echo "Please fill in" and in bold, "all", "fields!".
02:57 We will put a paragraph break after that.
03:01 Also, let me put a paragraph break before the form so that we don't need to add it to every error message we give.
03:10 So, that's it. Let's just try it.
03:13 I will go back to my "Register" page.
03:17 We got it here. Let's click in register.
03:20 "Please fill in all fields!".
03:22 Let's type a couple of fields here.
03:25 Let's choose one of our passwords.
03:27 We will not repeat our password.
03:30 Register. Oh! repeat password....
03:42 '$repeat password'.
03:45 The reason this is not working at the moment is, an "md5" value of nothing is equal to an "md5" string of text.
03:56 An encrypted string of text.
04:00 So, I realize what we need to do is, take out the "md5" function here.
04:06 Make sure you remove the end brackets. I will come down here and check for all of our data.
04:14 So, let me go back and try this again.
04:17 Remember it didn't work before when we didn't chose a "Repeat password".
04:23 So, if I didn't chose a repeat or a password we get our error.
04:30 If I again choose a value except the "Repeat password", we still get this error.
04:37 That's the problem. What we should say is - if everything exists then we can convert our password and repeat password.
04:46 So I will just say "$password" is equal to "md5" of "$password".
04:53 This will encrypt our original variable value and store a new password code in the same variable.
05:00 We also need to say "$repeat password" equals "md5" and "$repeat password".
05:08 Here, comment this as "encrypt password". We have encrypted our password.
05:15 Now we will go ahead and add all our data into our database.
05:21 I am going to do this. Because we have got our data going to our registration, we are going to set a maximum limit for each data that is input.
05:39 Now we say 25 characters for our fullname, username, password and repeat password. So the maximum value is 25.
05:50 So, I will say- if the string length of '$username' is bigger or greater than 25.... OR
06:05 string length of the '$fullname' is greater than 25.
06:15 Let us look at these individually and say - if the length of your username or fullname is too long.
06:24 Let me put this correctly.
06:27 If each of these values is greater than 25 or bigger than 25,
06:34 we are going to echo out these values
06:40 saying "username" or... no...
06:48 Let me say "Max limit for username or fullname are 25 characters".
06:55 Otherwise I will proceed to check my password length.
07:01 Now I have decided to do this - "check password length" because I want a specific check for this.
07:12 "If string length of my password is greater than 25.. or.. string length...
07:30 No... um... let's get rid of this, get rid of else.
07:36 The first check I want to do is to see if my passwords match.
07:41 Let me say "if password equals equals (==)to repeat password" then continue the big block of code.
07:53 Otherwise echo out to the user "Your passwords do not match".
08:00 Okay?
08:03 So, you can type here and we can keep checking your character length.
08:09 Now, to check the character length of "username" and "fullname".
08:14 So, "check character length of username and fullname".
08:18 And that is going to be what we said before, if "username is greater than 25",
08:25 rather if the string length used in this function is greater than 25...
08:31 OR the string length of fullname is greater than 25, then we echo "Length of username or fullname is too long!".
08:43 So, just to keep it simple and then otherwise we will say
08:51 "check password length".
08:57 Here, I am going to specify or say if... now remember our passwords match...
09:04 So we only need to check this on one of the password variables.
09:09 Here, I will say - if the string length of the password is greater than 25 or string length of our password is lesser than 6 characters....
09:23 ...then we will echo out an error saying "Password must be between 6 and 25 characters".
09:35 This will work for sure.
09:37 We will continue this discussion in the next tutorial.
09:41 Before that, let me just conclude this with an else statement.
09:46 So, otherwise we will say "register the user".
09:51 Our code to register the user will go here.
09:56 In the next tutorial, we'll test this out and will learn how to register the user and we will put our code here in that tutorial.
10:06 This is basically for checking a minimum or maximum limit on our password and this block of code here will be our magical "register the user" piece of code.
10:17 So join me in the next part. Bye-bye. This is Mad Madhur, dubbing for the Spoken Tutorial project.

Contributors and Content Editors

Gaurav, Gyan, PoojaMoolya, Sandhya.np14