Difference between revisions of "PHP-and-MySQL/C4/Cookies-Part-2/English-timed"

From Script | Spoken-Tutorial
Jump to: navigation, search
(Created page with '{|Border=1 !Time !Narration |- |0:00 |Welcome back. Just to summarise - in the first part of the cookie tutorial, we learnt how to create cookies, how to give an expiry date to…')
 
Line 1: Line 1:
 
{|Border=1
 
{|Border=1
!Time
+
|'''Time'''
!Narration
+
|'''Narration'''
 
|-
 
|-
|0:00
+
|00:00
 
|Welcome back.  Just to summarise - in the first part of the cookie tutorial, we learnt how to create cookies, how to  give an expiry date to the cookie and how to print out specific cookies.
 
|Welcome back.  Just to summarise - in the first part of the cookie tutorial, we learnt how to create cookies, how to  give an expiry date to the cookie and how to print out specific cookies.
 
|-
 
|-
|0:13
+
|00:13
 
|Using this command here, we also learnt how to print out  every cookie that we had stored.
 
|Using this command here, we also learnt how to print out  every cookie that we had stored.
 
|-
 
|-
|0:18
+
|00:18
 
|So assuming that we have created these cookies, the next thing I'll do is use this specific cookie here that I have created, to check whether it does exist or not.
 
|So assuming that we have created these cookies, the next thing I'll do is use this specific cookie here that I have created, to check whether it does exist or not.
 
|-
 
|-
|0:28
+
|00:28
 
|To do so, we will use a function called “isset”.  
 
|To do so, we will use a function called “isset”.  
 
|-
 
|-
|0:32
+
|00:32
 
|This basically returns a true or false value depending on whether something is set or not.
 
|This basically returns a true or false value depending on whether something is set or not.
 
|-
 
|-
|0:37
+
|00:37
 
|For example-  a cookie ,I'll put a dollar sign then underscore cookie.  
 
|For example-  a cookie ,I'll put a dollar sign then underscore cookie.  
 
|-
 
|-
|0:42
+
|00:42
 
|And I'll put 'name' in here.   
 
|And I'll put 'name' in here.   
 
|-
 
|-
|0:46
+
|00:46
 
|So if I read this out in English language then I'll say -
 
|So if I read this out in English language then I'll say -
 
|-
 
|-
|0:49
+
|00:49
 
|If the cookie name is set then we say echo “Cookie is set”.  
 
|If the cookie name is set then we say echo “Cookie is set”.  
 
|-
 
|-
|0:57
+
|00:57
 
|Otherwise we will echo out to the user that "Cookie is not set".
 
|Otherwise we will echo out to the user that "Cookie is not set".
 
|-
 
|-
|1:01
+
|01:01
 
|Assuming that I have set my cookie and everything is working, when I refresh this I'll get the message that the "Cookie is set".  
 
|Assuming that I have set my cookie and everything is working, when I refresh this I'll get the message that the "Cookie is set".  
 
|-
 
|-
|1:11
+
|01:11
 
|Now I'll teach you how to 'unset' a cookie.  
 
|Now I'll teach you how to 'unset' a cookie.  
 
|-
 
|-
|1:14
+
|01:14
 
|So lets say over here - just before our 'if' statement, I wish to unset my cookie.  
 
|So lets say over here - just before our 'if' statement, I wish to unset my cookie.  
 
|-
 
|-
|1:20
+
|01:20
 
|So unset a cookie.
 
|So unset a cookie.
 
|-
 
|-
|1:21
+
|01:21
 
|So just to name one, I'll unset this cookie,
 
|So just to name one, I'll unset this cookie,
 
|-
 
|-
|1:25
+
|01:25
 
|presuming that if you learn to unset this one you can unset this one too.
 
|presuming that if you learn to unset this one you can unset this one too.
 
|-
 
|-
|1:31
+
|01:31
 
|So I'll unset this name cookie.  
 
|So I'll unset this name cookie.  
 
|-
 
|-
|1:34
+
|01:34
 
|So to unset we use the same command and that’s  'setcookie'.
 
|So to unset we use the same command and that’s  'setcookie'.
 
|-
 
|-
|1:39
+
|01:39
 
|So we are resetting a cookie.  
 
|So we are resetting a cookie.  
 
|-
 
|-
|1:41
+
|01:41
 
|This doesn’t seem to make any sense but it will soon.  
 
|This doesn’t seem to make any sense but it will soon.  
 
|-
 
|-
|1:45
+
|01:45
 
|Now we will set the cookie name to nothing.
 
|Now we will set the cookie name to nothing.
 
|-
 
|-
|1:49
+
|01:49
 
|And our expiry date here...
 
|And our expiry date here...
 
|-
 
|-
|1:51
+
|01:51
 
|I'll create a new one with "exp unset"
 
|I'll create a new one with "exp unset"
 
|-
 
|-
|1:55
+
|01:55
 
|And that is gonna equal to the time minus 86400.
 
|And that is gonna equal to the time minus 86400.
 
|-
 
|-
|2:01
+
|02:01
 
|Here we said plus which meant that the time is in the future.
 
|Here we said plus which meant that the time is in the future.
 
|-
 
|-
|2:05
+
|02:05
 
|Now by setting the cookie to this variable which represents a time in the future, we are actually unsetting the cookie.
 
|Now by setting the cookie to this variable which represents a time in the future, we are actually unsetting the cookie.
 
|-
 
|-
|2:13
+
|02:13
 
|So if I were to say - set a cookie that already exists called name, to 'no value' at all.  
 
|So if I were to say - set a cookie that already exists called name, to 'no value' at all.  
 
|-
 
|-
|2:20
+
|02:20
 
|And use “exp unset” variable to set it to a time in the future, thereby 'unsetting' our cookie.  
 
|And use “exp unset” variable to set it to a time in the future, thereby 'unsetting' our cookie.  
 
|-
 
|-
|2:28
+
|02:28
 
|So I'll get rid of this code for now and run this page, okay?
 
|So I'll get rid of this code for now and run this page, okay?
 
|-
 
|-
|2:34
+
|02:34
 
|Nothing has happened presuming my cookie is unset.   
 
|Nothing has happened presuming my cookie is unset.   
 
|-
 
|-
|2:40
+
|02:40
 
|Now I want to get rid of this code - so I'll comment this out.  
 
|Now I want to get rid of this code - so I'll comment this out.  
 
|-
 
|-
|2:45
+
|02:45
 
|And I'll put my 'if' statement back into my page.
 
|And I'll put my 'if' statement back into my page.
 
|-
 
|-
|2:48
+
|02:48
 
|Now presuming this says - is the cookie set name? I'm going to unset the cookie which should get the result "Cookie is not set".
 
|Now presuming this says - is the cookie set name? I'm going to unset the cookie which should get the result "Cookie is not set".
 
|-
 
|-
|2:56
+
|02:56
 
|Lets refresh and we got "Cookie is not set".
 
|Lets refresh and we got "Cookie is not set".
 
|-
 
|-
|3:02
+
|03:02
 
|And then from here you can set it again if you like and you can change the values of the cookie.
 
|And then from here you can set it again if you like and you can change the values of the cookie.
 
|-
 
|-
|3:08
+
|03:08
 
|To change the value of a cookie, you'll have to use 'setcookie' command again.
 
|To change the value of a cookie, you'll have to use 'setcookie' command again.
 
|-
 
|-
|3:13
+
|03:13
 
|You’ll say -  set cookie name and here just type a new value  
 
|You’ll say -  set cookie name and here just type a new value  
 
|-
 
|-
|3:17
+
|03:17
 
|So its not hard to work with cookies.
 
|So its not hard to work with cookies.
 
|-
 
|-
|3:19
+
|03:19
 
|Its quiet an easy process.
 
|Its quiet an easy process.
 
|-
 
|-
|3:21
+
|03:21
 
|And it’s a very very useful thing in php   
 
|And it’s a very very useful thing in php   
 
|-
 
|-
|3:23
+
|03:23
 
|So use it to your heart’s content.  Okay. Thanks for watching.
 
|So use it to your heart’s content.  Okay. Thanks for watching.
 
|-
 
|-
|3:27
+
|03:27
 
|If you have any questions, please let me know.  
 
|If you have any questions, please let me know.  
 
|-
 
|-
|3:30
+
|03:30
 
|This is Evan Varkey dubbing for the Spoken Tutorial Project.  Bye.
 
|This is Evan Varkey dubbing for the Spoken Tutorial Project.  Bye.

Revision as of 12:45, 10 July 2014

Time Narration
00:00 Welcome back. Just to summarise - in the first part of the cookie tutorial, we learnt how to create cookies, how to give an expiry date to the cookie and how to print out specific cookies.
00:13 Using this command here, we also learnt how to print out every cookie that we had stored.
00:18 So assuming that we have created these cookies, the next thing I'll do is use this specific cookie here that I have created, to check whether it does exist or not.
00:28 To do so, we will use a function called “isset”.
00:32 This basically returns a true or false value depending on whether something is set or not.
00:37 For example- a cookie ,I'll put a dollar sign then underscore cookie.
00:42 And I'll put 'name' in here.
00:46 So if I read this out in English language then I'll say -
00:49 If the cookie name is set then we say echo “Cookie is set”.
00:57 Otherwise we will echo out to the user that "Cookie is not set".
01:01 Assuming that I have set my cookie and everything is working, when I refresh this I'll get the message that the "Cookie is set".
01:11 Now I'll teach you how to 'unset' a cookie.
01:14 So lets say over here - just before our 'if' statement, I wish to unset my cookie.
01:20 So unset a cookie.
01:21 So just to name one, I'll unset this cookie,
01:25 presuming that if you learn to unset this one you can unset this one too.
01:31 So I'll unset this name cookie.
01:34 So to unset we use the same command and that’s 'setcookie'.
01:39 So we are resetting a cookie.
01:41 This doesn’t seem to make any sense but it will soon.
01:45 Now we will set the cookie name to nothing.
01:49 And our expiry date here...
01:51 I'll create a new one with "exp unset"
01:55 And that is gonna equal to the time minus 86400.
02:01 Here we said plus which meant that the time is in the future.
02:05 Now by setting the cookie to this variable which represents a time in the future, we are actually unsetting the cookie.
02:13 So if I were to say - set a cookie that already exists called name, to 'no value' at all.
02:20 And use “exp unset” variable to set it to a time in the future, thereby 'unsetting' our cookie.
02:28 So I'll get rid of this code for now and run this page, okay?
02:34 Nothing has happened presuming my cookie is unset.
02:40 Now I want to get rid of this code - so I'll comment this out.
02:45 And I'll put my 'if' statement back into my page.
02:48 Now presuming this says - is the cookie set name? I'm going to unset the cookie which should get the result "Cookie is not set".
02:56 Lets refresh and we got "Cookie is not set".
03:02 And then from here you can set it again if you like and you can change the values of the cookie.
03:08 To change the value of a cookie, you'll have to use 'setcookie' command again.
03:13 You’ll say - set cookie name and here just type a new value
03:17 So its not hard to work with cookies.
03:19 Its quiet an easy process.
03:21 And it’s a very very useful thing in php
03:23 So use it to your heart’s content. Okay. Thanks for watching.
03:27 If you have any questions, please let me know.
03:30 This is Evan Varkey dubbing for the Spoken Tutorial Project. Bye.

Contributors and Content Editors

Gyan, PoojaMoolya, Pratik kamble, Sandhya.np14