Php Cookie-session Examples Using Multiple Values for a Cookie Creating a Test Cookie Use cookie to create page counter Setting and Printing a Cookie Value Encoding Data Starting or Resuming a Session The syntax of the session_start () function Initiate session and create a few session variables Create session variable Delete session variable Deleting Existing Session Variables Modifying Session Variables Registering an Array Variable with a Session Register session variables Unregistering Variables A session variable can be destroyed with a call to session_unregister(). Accessing Session Variables Adding Session Data Checking Session Data Reading Session Data Registering Variables with a Session Storing Complex Data Types in Sessions Storing Complex Data Types to session Storing Simple Data Types in Sessions Session variable encoding Destroying a session Ending a Session function session_destroy() ends all persistent data corresponding to the current user session. function session_encode() formats session variables for storage. function session_id() returns the user's SID originally created by session_start(). session_id() function session_is_registered() checks whether or not a variable has been registered. Using the session_register() Function session_set_save_handler( )?php session_start(); ? Encode all session data into a single string and return the result Session running Session starter Sessions with register_globals on or off in session_test.php session_start() checks to see if a session has started, and if not, it starts one. PHP 5 setcookie() Parameters Assigning cookie names according to array index value Cookie created Deleting Cookies Setting a cookie with a domain restriction Setting a cookie with a path restriction Setting an expiring cookie Setting cookie expiration Setting the cookie domain Setting the cookie path Setting the cookie path to a specific directory Deleting a Cookie Using setcookie() Starting a page with setcookie() Reading Cookies Checking for Cookie Support from PHP Get Cookie Data Reading a cookie value Printing a cookie value Still Logged In with cookie Reading all cookie values Count Visits with session Counting page accesses with a session Implementing Sessions Printing session data Registering a variable by including it in $_SESSION Session based counter Session preferences Session using the proper $_SESSION super global Verifying session info check for a valid login in sessions create_session_variable.php delete_session_variable.php Doing something special for a logged in user Setting Up Cookie Authentication

Php Code : Register Session Variables

Register session variables in php

  $sessionold = session_name ( 'A' ) ;
  $sessionnew = session_name ( 'B' ) ;
  $sessionlatest = session_name ( 'C') ;

  session_register ( 'D' ) ;

  echo "The old session name was $sessionold.", "\n" ;
  echo "The new session name is $sessionnew! ", "\n" ;
  echo "The latest session name is $sessionlatest!! " ;