WEBVTT 00:00:07.140 --> 00:00:11.070 So once you create all the files and open them you're going to get something like this. 00:00:11.250 --> 00:00:13.800 So it starts with the index theaudience file. 00:00:13.830 --> 00:00:19.920 So this file is going to include all the AJAX calls which will use to process the user inputs inside 00:00:19.920 --> 00:00:21.590 the index those page befal. 00:00:21.630 --> 00:00:25.220 So the first AJAX call is going to be vollies sign a form. 00:00:25.560 --> 00:00:32.740 So once the user submits the form Wagener first prevents the default ph pre-processing and will collect 00:00:32.760 --> 00:00:39.630 the user inputs and then will send them to the sign up those page file using AJAX. 00:00:39.630 --> 00:00:44.040 So if the call is successful we can show an error or success message. 00:00:44.040 --> 00:00:47.730 Otherwise we're going to show an error message. 00:00:48.150 --> 00:00:51.630 The age of school for the logging form is going to be similar. 00:00:51.630 --> 00:00:57.230 The only difference is that if the age of school is successful we're going to check if the place we 00:00:57.240 --> 00:00:59.680 file returns success. 00:00:59.790 --> 00:01:00.640 OK. 00:01:01.260 --> 00:01:07.290 So if the log as I said for this file is going to return success and we will redirect the user to the 00:01:07.290 --> 00:01:08.130 Notes page. 00:01:08.220 --> 00:01:09.930 Otherwise we're going to show an error message. 00:01:10.050 --> 00:01:10.690 OK. 00:01:11.400 --> 00:01:16.170 And finally the AJAX call for the full cost password form is going to be very similar to the sign up 00:01:16.170 --> 00:01:18.690 front. 00:01:18.690 --> 00:01:20.820 Now let's move to the sign of busways profile. 00:01:20.820 --> 00:01:25.060 So this file is going to process the user inputs of the sign of form. 00:01:25.320 --> 00:01:29.190 So at the beginning we're going to start a session and connect to the database as we're going to be 00:01:29.190 --> 00:01:31.230 running some queries later on. 00:01:31.230 --> 00:01:35.050 So first we will check the user inputs will they find error messages. 00:01:35.190 --> 00:01:39.410 Gives the user inputs and will store the errors in error is variable. 00:01:39.420 --> 00:01:42.230 If there are any errors real prints an error message. 00:01:42.330 --> 00:01:46.410 Otherwise we'll prepare the variables for the queries. 00:01:46.410 --> 00:01:51.660 So first we are going to check using a query if the username exists in the user's table. 00:01:51.810 --> 00:01:54.410 Ok if that's the case we're going to print an error. 00:01:54.900 --> 00:02:01.320 Otherwise we are going to check if the email exists in the Users table and it's an error if that's the 00:02:01.320 --> 00:02:02.250 case. 00:02:02.250 --> 00:02:08.430 Otherwise we're going to create a unique activation code and inserts the user details including the 00:02:08.430 --> 00:02:10.550 activation code in the Users table. 00:02:10.810 --> 00:02:15.960 Are we going to send the user an email with a link to activate both BHP. 00:02:16.080 --> 00:02:16.390 OK. 00:02:16.440 --> 00:02:21.900 So the link is going to include their e-mail address and activation code. 00:02:21.930 --> 00:02:22.220 All right. 00:02:22.220 --> 00:02:24.750 Now let's move to the activate those PSP file. 00:02:24.870 --> 00:02:30.510 So the user is going to be redirected to this file after clicking the activation link they will receive 00:02:30.600 --> 00:02:32.020 after seeing them. 00:02:32.070 --> 00:02:37.650 So this link is going to contain a couple of promises the e-mail and activation key if one of these 00:02:37.680 --> 00:02:38.660 is missing. 00:02:38.670 --> 00:02:45.450 We're going to show an error message otherwise well first all these in a couple of variables and then 00:02:45.450 --> 00:02:48.030 we prepare these variables for the query. 00:02:48.030 --> 00:02:53.400 So the query we're going to be running is going to be setting the activation field to activated for 00:02:53.400 --> 00:02:54.200 that e-mail. 00:02:54.210 --> 00:03:01.650 So in the Users table our users stages is going to turn to activated if the query is successful we're 00:03:01.650 --> 00:03:05.730 going to show a success message and invite our user to log in. 00:03:05.730 --> 00:03:09.960 Otherwise we'll just show an error message. 00:03:09.960 --> 00:03:15.540 Now let's move to the log in those places file which will process the user inputs corresponding to the 00:03:15.720 --> 00:03:16.700 logging form. 00:03:16.830 --> 00:03:17.460 OK. 00:03:17.610 --> 00:03:22.040 So the structure of the file is very similar to the sign up those BHB file. 00:03:22.080 --> 00:03:24.740 So the main difference is going to be the query you're going to be running. 00:03:24.930 --> 00:03:29.910 So that's queries going to check the combination of email and password exits. 00:03:30.150 --> 00:03:32.080 If they don't much we're going to print an error. 00:03:32.310 --> 00:03:33.880 Otherwise we're going to log the user in. 00:03:34.110 --> 00:03:38.920 Which means that we're going to be setting their session variables at the end. 00:03:38.940 --> 00:03:44.120 If everything goes fine This file is going to return a success message. 00:03:44.310 --> 00:03:48.330 But first we're going to check if the remember the box is checked. 00:03:48.420 --> 00:03:48.750 OK. 00:03:48.780 --> 00:03:54.390 If it's not we're going to bring the success message straight away otherwise we're going to create a 00:03:54.390 --> 00:03:57.300 couple of variables and store them in a cookie. 00:03:57.330 --> 00:04:02.200 And also in the Remember table as we have covered in the logic. 00:04:02.910 --> 00:04:03.570 OK. 00:04:03.990 --> 00:04:08.250 So if the query is not successful we're going to bring an error. 00:04:08.490 --> 00:04:12.800 Otherwise we the prints are a success message. 00:04:12.870 --> 00:04:14.620 Now let's move to the Remember Me. 00:04:14.640 --> 00:04:15.740 Those BHP. 00:04:15.760 --> 00:04:20.180 So this file is going to be called at the beginning of the index those PSP Voll. 00:04:20.280 --> 00:04:23.120 So he's going to check if the user is remembered. 00:04:23.240 --> 00:04:23.650 OK. 00:04:23.660 --> 00:04:26.540 And if that's the case we're going to lock them in. 00:04:26.940 --> 00:04:29.540 So the structure of the file is going to be us following. 00:04:29.760 --> 00:04:36.610 We're going to check if the user is not locked in and we have a remember me cookie. 00:04:36.610 --> 00:04:41.910 So if that's the case we go into extracts the two other cases from the cookie and then we're going to 00:04:41.910 --> 00:04:47.920 go to the remainder of the table and we're going to look for a record with all those cases one. 00:04:48.720 --> 00:04:56.790 Once we find the record then we go into much the authors vacated to be extracted from the cookie with 00:04:56.790 --> 00:04:59.250 the authors we cater to. 00:04:59.400 --> 00:05:02.060 But we have in our table. 00:05:02.510 --> 00:05:02.980 OK. 00:05:03.180 --> 00:05:04.910 If they don't much we're going to show an error message. 00:05:04.920 --> 00:05:07.040 Otherwise we are ready to lock the user in. 00:05:07.100 --> 00:05:14.700 But before we do that we need to generate new authenticators and store them in a cookie and in the Remember 00:05:14.820 --> 00:05:21.350 table and then we'll lock the user in and redirect them to the Notes page. 00:05:21.360 --> 00:05:23.340 Now we're going to move to the forgoes password. 00:05:23.330 --> 00:05:28.870 Those PSAP file which will process the user inputs corresponding to the Fuegos password form. 00:05:29.280 --> 00:05:34.820 So these trucks of this file is going to be very similar to the logging and Sign-Up files. 00:05:34.830 --> 00:05:37.110 The main difference is going to be the query. 00:05:37.320 --> 00:05:43.910 So when we run the query it's going to check if the provided email exists in the Users table. 00:05:44.080 --> 00:05:47.640 OK so if it doesn't we can print an error message. 00:05:47.670 --> 00:05:55.650 Otherwise we're going to get the user id and we will create a unique observation code that we will insert 00:05:57.060 --> 00:06:01.560 in the foregoes password table along with other user details. 00:06:01.740 --> 00:06:02.250 OK. 00:06:02.430 --> 00:06:08.270 And then we'll send an e-mail to our user with a link to the reset password. 00:06:08.270 --> 00:06:09.520 Most BHB file. 00:06:09.600 --> 00:06:17.580 Ok so that link is going to contain their user ID and activation code if the email is sent successfully 00:06:17.670 --> 00:06:24.890 will show a success message.