1 00:00:00,520 --> 00:00:09,450 The next step in our project is to create the logo dot P HP page create a new document and save the 2 00:00:09,450 --> 00:00:14,240 file as logout dot P. HP in your perfect cup directory. 3 00:00:17,490 --> 00:00:19,350 Now insert the following block of code 4 00:00:23,210 --> 00:00:23,590 here. 5 00:00:23,600 --> 00:00:31,330 We've cleared each session that we'd initially created and this is done using the UNset function so 6 00:00:31,330 --> 00:00:38,050 that the log in session variable f name and l name are all cleared once they're cleared we redirect 7 00:00:38,050 --> 00:00:42,110 the user back to the index dot p p page. 8 00:00:42,180 --> 00:00:48,450 We also pass along a variable called logout with the value set to true and you'll see why we do this 9 00:00:48,450 --> 00:00:50,990 in just a moment. 10 00:00:51,250 --> 00:01:03,520 Make sure you save any changes you made to this file and open your index DRP HP page. 11 00:01:03,550 --> 00:01:09,160 We want to create an alert notifying the user that they've been successfully logged out of the system 12 00:01:09,260 --> 00:01:13,720 and I'll show you an example on the completed Web site. 13 00:01:13,730 --> 00:01:21,090 This is the message we want to display and you'll see that it's position directly underneath the address. 14 00:01:21,120 --> 00:01:28,650 Here is the variable logout with the value set to true. 15 00:01:28,830 --> 00:01:47,100 So in order to do this you're going to insert the following block of code directly under the address. 16 00:01:47,140 --> 00:01:53,470 Here we first check to see if the variable logout is contained within our U.R.L. using the get method 17 00:01:55,560 --> 00:01:59,050 if the variable is found. 18 00:01:59,420 --> 00:02:06,450 We check to see if the value of the logout variable is equal to true and if the value is equal to true 19 00:02:06,690 --> 00:02:14,200 we display our alert message stating that the user has been logged out of the system. 20 00:02:14,320 --> 00:02:19,650 So I'm just gonna test this out now and when to refresh the blog that BHP page. 21 00:02:19,730 --> 00:02:23,780 So now it's asking me to log in and I'll just log in using one of the test accounts 22 00:02:34,250 --> 00:02:38,690 so we've been authenticated and it says Welcome Joel. 23 00:02:39,000 --> 00:02:41,820 And here's the logout link. 24 00:02:42,060 --> 00:02:50,210 So when you click logout and you can see that we have been logged out and here's the success message 25 00:02:51,350 --> 00:02:55,920 I'll try to go back to the blog just to verify that we had been logged out. 26 00:02:56,030 --> 00:03:03,060 So it did work because now it's asking me to log back in and so at this point you can go ahead and test 27 00:03:03,120 --> 00:03:05,220 out the log in function.