Thread: Couch Sessions

Page 4 of 4 First ... 234
  • Jump to page:
    #46
  1. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)
  2. #47
  3. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: Sessions with mulitple pages


    That's the beauty of sessions. The customers browser keeps track of the session for you.(sort-of)
    All you have to do is put session_start on each page and then use your variables. Each customer(browser) will have their own session and variables.

    To see this in action, just create some sample session pages. Use session_id() to print out the id #'s.
    Now, open the page up in two different browsers on your machine. Both have different session id's, but the id stays the same until you close the browser(or it times out)
    Brian
  4. #48
  5. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Problem with the time elapse example


    Well, not sure if it's a problem, or I just don't understand.

    My question/problem: When refreshing the browser, it resets the session. I get a new session id and the script doesn't ever tell the time.
    I put a link on the page to itself, click on that, and it works as intended(doesn't reset the session)
    Is this how it's supposed to work? Or is there some setting in the configuration that changes how this works?
    thx
    Brian
  6. #49
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2002
    Location
    Aberdeen, UK
    Posts
    1
    Rep Power
    0

    Re: Cannot send session cache limiter


    Adam - this http://www.faqts.com/knowledge_base/view.phtml/aid/13713/fid/51

    worked for me - I went to the enf of the file, hit backspace until I reached the > and the problem ... ermmm ..went away.
  8. #50
  9. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: cookie


    Which might be said plainer, too.

    If you have initialized a session using 'session_start()' you also can use 'session_id()'.::

    <?php
    // start the session
    session_start();
    echo "<a href=\"nextpage.php?PHPSESSID=" . session_id() . "\">Click for next page</a>";
    ?>


    There is an important security breach to consider: even if you carefully do not add the session id to external links, the session id will be visible in the referer.
  10. #51
  11. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: cookie


    Okay, sorry, that sucked. The "structured text" is obviously *not* implemented completely here...

    The example from above which was gorked was (replace [] with &lt; or >):

    [?php

    // open session

    session_start();

    // create GET session id variable

    $mysessionid = "PHPSESSID=" . session_id();

    // give an example of use

    echo "[a href=\"nextpage.php?" . $mysessionid . "\"]Click for next page[/a]"

    ?]
  12. #52
  13. No Profile Picture
    php n00b
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Posts
    10
    Rep Power
    0

    problem with first code


    the first cde on the tutorials doesnt work.

    <?php

    // initialize a session

    session_start();

    // register a session variable

    session_register('counter');

    // increment and display the value of the counter

    $counter++;

    echo("You have visited this page $counter times! Don't you have anything else to do, you bum?!");

    ?>

    i get this error :

    Notice: Undefined variable: counter in c:\program files\apache group\apache\htdocs\counter.php on line 10
    You have visited this page 1 times! Don't you have anything else to do, you bum?!

    and the counter doesnt go beyond 1.
  14. #53
  15. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: Cannot send session cache limiter


    Give U two Exmaple!One is right,other is error!

    This is an error
    ****************************
    <html>
    <head><title>this is a error exm!</title>
    </head>
    <body>
    <?php
    session_start();
    session_register("test")
    ........................
    ?>
    </body></html>
    *************************************

    this right
    ======================================
    <?php
    session_start();
    session_register("test")
    ........................
    ?>
    <html>
    <head><title>this is a error exm!</title>
    </head>
    <body>
    <?php
    .................
    ?>
    </body></html>
    ========================================

    understand?Please email to me,if U want!
  16. #54
  17. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: Cannot send session cache limiter


    Give U two Exmaple!One is right,other is error!

    This is an error
    ****************************
    <pre>
    <html>
    <head><title>this is a error exm!</title>
    </head>
    <body>
    <?php
    session_start();
    session_register("test")
    ........................
    ?>
    </body></html></pre>
    *************************************

    this right
    ======================================
    <pre>
    <?php
    session_start();
    session_register("test")
    ........................
    ?>
    <html>
    <head><title>this is a error exm!</title>
    </head>
    <body>
    <?php
    .................
    ?>
    </body></html></pre>
    ========================================

    understand?Please email to me,if U want!
  18. #55
  19. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: Cannot send session cache limiter


    Give U two Exmaple!One is right,other is error!
    <p>This is an error <br>
    ****************************<br>
    &lt;pre&gt;<br>
    &lt;html&gt;<br>
    &lt;head&gt;&lt;title&gt;this is a error exm!&lt;/title&gt;<br>
    &lt;/head&gt;<br>
    &lt;body&gt;<br>
    &lt;?php<br>
    session_start();<br>
    session_register(&quot;test&quot;)<br>
    ........................<br>
    ?&gt;<br>
    &lt;/body&gt;&lt;/html&gt;&lt;/pre&gt;<br>
    *************************************</p>
    <p>this right<br>
    ======================================<br>
    &lt;pre&gt;<br>
    &lt;?php<br>
    session_start();<br>
    session_register(&quot;test&quot;)<br>
    ........................<br>
    ?&gt;<br>
    &lt;html&gt;<br>
    &lt;head&gt;&lt;title&gt;this is a error exm!&lt;/title&gt;<br>
    &lt;/head&gt;<br>
    &lt;body&gt;<br>
    &lt;?php<br>
    .................<br>
    ?&gt;<br>
    &lt;/body&gt;&lt;/html&gt;&lt;/pre&gt;<br>
    ========================================</p>
    <p>understand?Please email to me,if U want!</p>
  20. #56
  21. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Good!


    Thanks for intoduction!
    It's funny :)

  22. #57
  23. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: Cannot send session cache limiter


    At the begining i thought that you were joking. After 10-20 differnt ways that i tried and nothing, i finaly decided to do what you recomented. IT WORKS!!!!!!!!!!!!!!!!!!!!!No more cache limiter just with a few backspaces! THX
  24. #58
  25. No Profile Picture
    Ducani
    Guest
    Devshed Newbie (0 - 499 posts)

    Couch Sessions


    Couch Sessions

    May 02, 2000 - Need to build an online shopping cart in a hurry? This article takes a look at session management, an important component of transaction-based Web sites, and explains the fundamentals of adding session support to your site. Examples in PHP4 and PHP3 with PHPLib.

    Please discuss this article in this thread. You can read the article here .
  26. #59
  27. No Profile Picture
    Ducani
    Guest
    Devshed Newbie (0 - 499 posts)
    If you would like to see an article covering a particular topic, please post your request here.
Page 4 of 4 First ... 234
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo