Searching...
Thursday, 11 October 2012

Session Tracking Using Cookies

10:16 pm

Session Tracking Using Cookies

Session Tracking Using Cookies :

A web translation is a combination of request and response and in a session number of transactions will take place. in the above page 4 transactions are taking place but form4.php is able to retrieve only the value of t6.this is happening because to the protocol that we use-http.
      http is a stateless protocol ,that means when ever a new transaction is started http will forget about the previous transaction data and it will send only the current form data. In order to overcome this we can use the concept of “session tracking” . by using session tracking what ever data is submitted by the client in one transaction should be made available to any other transaction even to the last transaction.
Session tracking can be done by using the following techniques.
1.      Using hidden form fields.
2.      Using url retrieving .
3.      Using cookies.
4.      Using php sessions.


Session tracking using cookies :
                                                     A cookie is a server created object/file coming to the client side, so that whenever a client is sending a request to the server all the associated cookies also will gets submitted to that server.
    Cookies are a mechanism for storing data in the remote / client browser or client system and thus tracking are identifying return users and data.

Setcookies(name,value[,expirationtime])

function of php is used for setting or creating a cookie. cookies are part of the http header , so setcookie must be called before any response/output is sent to the client.
Any cookie sent to the server from the client will automatically be included into a $_COOKIE auto – global array.
<html>
<body>
<?php
If(isset($_COOKIE[“user”]))
Echo “welcome to guest”;
?>
</body>
</html>

0 comments:

Post a Comment