In Synchronize Token method the client and the server both should generate the same token value. The server has to do what client does. So it will be a heavy load to the server,Therefore we are using double submitted cookies method. If we need to use double submitted cookies, the javascript should run in in the cookie. So HTTP Flag should be off. In here we are sending the same cookie (that means our session cookie) through HTTP body and the HTTP header. So the server will validate if the cookie coming from the body and the header are same or not and accept the request or deny.
In the client side (index.php) we create the session and store it in the cookie.After that create a token and store it in a new cookie.

Figure 1
After that we should set the estimation of hidden token as "<?echo $token ?>". This will send the hidden token to server side when client clicks on login button. The hidden token is shown in Figure 02.

After that create a function to validate login in the server side
Comments
Post a Comment