Logout problem using cookie

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • TechnoAtif
    New Member
    • Sep 2007
    • 63

    Logout problem using cookie

    Hi All,I'm using following two codes for logging in and logging out,respectivel y.
    At the localhost the codeis working fine however when uploaded on the internet,The login page works fine but the logout page has no effect.Clicking on logout tab does not logs out the user and the user account remains intact.
    Any help please.


    Login:

    [PHP]<?
    setcookie("appi d",$row->applicantid) ;
    setcookie("emai l",$row->email);

    ?>[/PHP]

    Logout:

    [PHP]<?
    setcookie("appi d","");
    setcookie("emai l","");
    ?>[/PHP]


    with regards
    Technoatif
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Heya, Techno.

    Consider storing those values in the session rather than cookies. It will make your code more reliable, and it will prevent hackers from tinkering with the values (to log on as somebody else, for example).

    Comment

    • TechnoAtif
      New Member
      • Sep 2007
      • 63

      #3
      thanx for the reply.
      Can you please give some example

      Comment

      • pbmods
        Recognized Expert Expert
        • Apr 2007
        • 5821

        #4
        On your login page:
        [code=php]
        session_start() ;
        $_SESSION['appid'] = $row->applicantid;
        $_SESSION['email'] = $row->email;
        [/code]

        On your logout page:
        [code=php]
        session_start() ;
        unset($_SESSION['appid']);
        unset($_SESSION['email']);
        [/code]

        Comment

        Working...