Thursday, October 11, 2012

Create Session


            Creating session function which will check whether the existing session id or not the function is as follows:

session_start();

   Next is to create a global register that functions allow the server to remember the identity of the user, the user must be registered to use the function:

session_register();

In making the registers can also use $_session or $HTTP_session_vars

example :

            $username=”membername”;
      $session_register (“$username”)
      $_session[$username]=”membername”;
      $HTTP_session_vars[“username”]=”membername”;

If you wish to register more than one session variables:

            $session_register (“var1”, “var2”, “var..n”);
     
To remove or end the session function :

            session_unregister();
      session_destroy();
      session_unset();  

but if we use the $_session or $HTTP_session_vars then the function is used :

            unset($HTTP_session_vars[“sess_var”]);
     

No comments:

Post a Comment