SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Evangelist ckchin's Avatar
    Join Date
    Mar 2002
    Location
    msia
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    cookies setting at brinkster

    PHP Code:
    <%
    If (
    not (session("MM_UserAuthorization") = "")) Then
        Response
    .cookies ("UserAuthorization")=Session("MM_UserAuthorization")
        
    Response.Cookies("MM_Username")=Session("MM_Username")
        
    Response.cookies ("UserAuthorization").ExpiresNow
        Response
    .cookies ("MM_Username").ExpiresNow
        strAuthorization 
    Session("MM_UserAuthorization")
    End if
    If (
    Request.Cookies("UserAuthorization")=""Then
    Response
    .redirect ("login.asp")
    Response.End
    Else
    strAuthorization request.cookies("UserAuthorization")
    End If
    %> 
    1st Question:
    Why I cannot use the [asp][/asp] for my asp code posting? I need to use the [php][/php/] which lead to display PHP: header?

    2nd Question:
    My codes displayed above created using the Ultradev, and since I use free member services from brinkster, which does not allow the session authentication, I "convert" the session into cookies. My question is that:

    Response.cookies ("UserAuthorization").Expires= Now
    Response.cookies ("MM_Username").Expires= Now

    What mean ... Expires= Now, and if i want to set the cookies expire based on session (per browser), what are the codes?

  2. #2
    SitePoint Wizard wdmny's Avatar
    Join Date
    Jul 2000
    Location
    Here
    Posts
    1,010
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The answer to your 2nd question is simple. To make cookies expired when the browser is closed, don't set an expiration date. Setting it to Now() forces the cookie to expire as soon as its set.

  3. #3
    SitePoint Wizard
    Join Date
    Jan 2001
    Location
    Milton Keynes, UK
    Posts
    1,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    1. You can use the &#091vbs&#093&#091/vbs&#093 tags.

    2. If you don't want the Cookie to be saved on the client then just simply don't set the Expires property.

    Edit: I've really got to learn to type faster.

  4. #4
    SitePoint Evangelist ckchin's Avatar
    Join Date
    Mar 2002
    Location
    msia
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you very much. Since I am new to this forum, I would like to know whether there is any thread in this forum talking about useful functions, for example as follows:

    function connectdb (parameter db, connectionstring, etc)

    so, when we use we just can type in

    call connectdb (xxx, xxx, etc)

    Thanks and regards,

    ckchin

  5. #5
    Just Blow It bronze trophy
    DaveMaxwell's Avatar
    Join Date
    Nov 1999
    Location
    Mechanicsburg, PA
    Posts
    7,294
    Mentioned
    123 Post(s)
    Tagged
    1 Thread(s)
    Originally posted by shane
    2. If you don't want the Cookie to be saved on the client then just simply don't set the Expires property.
    If you don't set the expires property, doesn't that cause the cookie to be deleted once the browser is closed?

    I always use this line to save the cookie good for 30 days from the current login:
    [vbs]
    Response.Cookies(CookieName).Expires = dateAdd("d", 30, Now())
    [/vbs]
    Dave Maxwell - Manage Your Site Team Leader
    My favorite YouTube Video! | Star Wars, Dr Suess Style
    Learn how to be ready for The Forums' Move to Discourse

  6. #6
    SitePoint Wizard
    Join Date
    Jan 2001
    Location
    Milton Keynes, UK
    Posts
    1,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by DaveMaxwell
    If you don't set the expires property, doesn't that cause the cookie to be deleted once the browser is closed?
    Yeah, but I think that is what ckchin wanted.

  7. #7
    SitePoint Evangelist ckchin's Avatar
    Join Date
    Mar 2002
    Location
    msia
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, I want browser pased (session) cookies setting. Is this correct?

    [vbs]
    Response.Cookies(CookieName)
    [/vbs]
    If you don't want the Cookie to be saved on the client then just simply don't set the Expires property.
    by: shane


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •