Results 1 to 13 of 13

Thread: Is it possible to use page_open() and close()?

  1. #1

    Thread Starter
    Hyperactive Member wordracr's Avatar
    Join Date
    Aug 2001
    Posts
    281

    Is it possible to use page_open() and close()?

    When I try to use these to create a session, I get a message saying that there was a called to an undefined function.

    All I know about my web host is that they use PHP 4.1

    Is there a way so I can use these functions? Or.. is there another way to have cookieless sessions?

    Thanks a lot!!

  2. #2
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    urrmm, probably because those functions don't exist

    shouldn't they be session_start() and session_destroy()?

  3. #3
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256

    Re: Is it possible to use page_open() and close()?

    Originally posted by wordracr
    When I try to use these to create a session, I get a message saying that there was a called to an undefined function.
    That's because they aren't functions. Look up Session Functions in the manual.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  4. #4

    Thread Starter
    Hyperactive Member wordracr's Avatar
    Join Date
    Aug 2001
    Posts
    281
    thanks for the responses. I assumed they were functions because it sounded like it. I got this text from another website: "As in PHP4, you need to call a predefined page_open() function each time you initiate a session. " The page doesn't mention anything about creating the function.
    Click to see the page..

    So, anyway, what way would I create a session that doesn't use cookies on the client side? That is one of my objectives.

    Thanks for all the help.

  5. #5
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Basic example:

    PHP Code:
    <?php
    session_start
    ();
    if (!isset(
    $_SESSION['count'])) {
        
    $_SESSION['count'] = 0;
    } else {
        
    $_SESSION['count']++;
    }

    echo 
    "You have visited this page " $_SESSION['count'] . " times!";

    ?>
    My evil laugh has a squeak in it.

    kristopherwilson.com

  6. #6
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    As in PHP4, you need to call a predefined page_open() function each time you initiate a session. PHPLIB comes with a default session class named Example_Session - you can modify this by changing the values in the "local.inc" file - which is what we've used in the following example:
    You probably need whatever PHPLIB is. That's probably where the function is.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  7. #7
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    phplib was an add-on for PHP < 4 for sessions

    Much of it's functionality was built into PHP 4+, so you don't really need it now. That page related to phplib so you shouldn't follow it

    See this http://www.php.net/manual/en/ref.session.php for the built in session handling functions

  8. #8
    Fanatic Member cpradio's Avatar
    Join Date
    Apr 2002
    Posts
    616
    If you read the following you will get all the information you need to know about sessions:

    http://www.vbforums.com/showthread.p...hreadid=173853
    http://www.vbforums.com/showthread.p...hreadid=175041

    -Matt
    http://cpradio.net/
    Administrator @ WDForums and a Moderator @ WebXpertz City Forums

  9. #9

    Thread Starter
    Hyperactive Member wordracr's Avatar
    Join Date
    Aug 2001
    Posts
    281
    Thanks for the information! I will read it all when I get time.

  10. #10
    scoutt
    Guest
    Originally posted by wordracr
    So, anyway, what way would I create a session that doesn't use cookies on the client side? That is one of my objectives.

    Thanks for all the help.
    you can't. you have to have cookies enabled on the client side to use sessions. although the session is saved on the server, the browser keeps the seesion_id in cache or a cookie.

  11. #11
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    it can go in the URL which is what it does if it can't (or you tell it not to in php.ini) use cookies

  12. #12
    scoutt
    Guest
    true, but on my server I don't control the ini file and I turned off cookies and it didn't go in the url. it just didn't keep any session variables. but which ever way he wanted I guess

  13. #13
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    I noticed a bug with the parser, in that if you split the <a href.... over two lines, it won't append the session id

    Also, you have to keep the paths relative otherwise it assumes it's an outside server which you wouldn't want to leak the session id to (even though it would be in the referrer anyway )

    Also you have to have compiled PHP with enable-trans-id or something like that.

    Maybe some of those are why it didn't work for you.

Posting Permissions

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



Click Here to Expand Forum to Full Width