SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: Session

  1. #1
    SitePoint Wizard rbutler's Avatar
    Join Date
    Jul 2003
    Location
    Springfield, MO
    Posts
    1,867
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Session

    Is there a way to put something like this:

    Code:
    <?php session_start(); 
    include 'connection/connection.php'; 
    if (!session_is_registered("counted")){ 
    mysql_query("UPDATE simplecount SET count=(count + 1) WHERE count_id=1"); 
    session_register("counted"); 
    } 
    ?>
    before my doctype without it affecting my links? For example, I have a horizontal menu where I have a link that says "Home", but using the above code, it extends my actual href parameters as http://domain.com?PHPsessionID12323124, then upon a refresh it doesn't.

    The reason is because this needs to be the first code that is sent to the browser, otherwise, it throws errors all over the place.

    Suggestions?

  2. #2
    SitePoint Enthusiast ModestITExpert's Avatar
    Join Date
    Jun 2004
    Location
    Planet Earth
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Lightbulb

    It is a server software specific problem. You need to set "session.use_only_cookies" to 1 in your php.ini

    Then it will no add PHPSESSIONID at the end of URLs.

    For more information read php manual.

    Hope this help.

  3. #3
    SitePoint Wizard rbutler's Avatar
    Join Date
    Jul 2003
    Location
    Springfield, MO
    Posts
    1,867
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the info, I'll look into it.
    Ryan Butler

    Midwest Web Design

  4. #4
    SitePoint Wizard rbutler's Avatar
    Join Date
    Jul 2003
    Location
    Springfield, MO
    Posts
    1,867
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    An added question, would enabling this take away the ability to use sessions in the future? Another words, can I have the best of both worlds?
    Ryan Butler

    Midwest Web Design


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
  •