Professional Web Applications Themes

PHP Sessions - PHP Development

Stephen Reid wrote: > Yep page 3 has the session_start as its included with the included file > (session_header.php), so where else could the problem be as I have no idea? > > Thanks :-) > > > "^MisterJingo^" <misterjingokeysurf.net> wrote in message > news:wxXJa.1874$5b3.1269news-binary.blueyonder.co.uk... > >>"Stephen Reid" <newspokeycam.net> wrote in message >>news:3ef84286news.comindico.com.au >> >>>Hello, >>> >>>I've create a 3 page site using sessions. I can pass the value from >>>the login page to the second page but when the user goes to third >>>page nothing is echoed from the session variables. I've included the >>>files so please let me ...

  1. #1

    Default Re: PHP Sessions

    Stephen Reid wrote:
    > Yep page 3 has the session_start as its included with the included file
    > (session_header.php), so where else could the problem be as I have no idea?
    >
    > Thanks :-)
    >
    >
    > "^MisterJingo^" <misterjingokeysurf.net> wrote in message
    > news:wxXJa.1874$5b3.1269news-binary.blueyonder.co.uk...
    >
    >>"Stephen Reid" <newspokeycam.net> wrote in message
    >>news:3ef84286news.comindico.com.au
    >>
    >>>Hello,
    >>>
    >>>I've create a 3 page site using sessions. I can pass the value from
    >>>the login page to the second page but when the user goes to third
    >>>page nothing is echoed from the session variables. I've included the
    >>>files so please let me know what I'm doing wrong as I'm just new to
    >>>sessions.
    >>>
    >>>Thanks :-)
    >>
    >>on each page where session vars are needed to be accessed do you call
    >>session_start(); ?
    >>
    >> If so we know the problem doesn't lie there and we can look elsewhere :)
    >>
    >>
    >
    >
    >
    first page has _POST variables (form)
    second doesn't have _POST parameters, only session variables which are
    overwritten in session_header.php

    --
    Marc.

    Marc Cuypers Guest

  2. #2

    Default Re: PHP Sessions

    So how do I fix this so they will carry over to the third page. Do I have
    to set them to _post variables on the seconds and third pages?

    Thanks :-)

    "Marc Cuypers" <mc-newsmgvd.be> wrote in message
    news:Q4gKa.66590$1u5.5274afrodite.telenet-ops.be...
    > Stephen Reid wrote:
    >
    > > Yep page 3 has the session_start as its included with the included file
    > > (session_header.php), so where else could the problem be as I have no
    idea?
    > >
    > > Thanks :-)
    > >
    > >
    > > "^MisterJingo^" <misterjingokeysurf.net> wrote in message
    > > news:wxXJa.1874$5b3.1269news-binary.blueyonder.co.uk...
    > >
    > >>"Stephen Reid" <newspokeycam.net> wrote in message
    > >>news:3ef84286news.comindico.com.au
    > >>
    > >>>Hello,
    > >>>
    > >>>I've create a 3 page site using sessions. I can pass the value from
    > >>>the login page to the second page but when the user goes to third
    > >>>page nothing is echoed from the session variables. I've included the
    > >>>files so please let me know what I'm doing wrong as I'm just new to
    > >>>sessions.
    > >>>
    > >>>Thanks :-)
    > >>
    > >>on each page where session vars are needed to be accessed do you call
    > >>session_start(); ?
    > >>
    > >> If so we know the problem doesn't lie there and we can look elsewhere
    :)
    > >>
    > >>
    > >
    > >
    > >
    > first page has _POST variables (form)
    > second doesn't have _POST parameters, only session variables which are
    > overwritten in session_header.php
    >
    > --
    > Marc.
    >

    Stephen Reid Guest

  3. #3

    Default Re: PHP Sessions

    Try checking on session_name()

    "Stephen Reid" <newspokeycam.net> wrote in message
    news:3ef84286news.comindico.com.au...
    > Hello,
    >
    > I've create a 3 page site using sessions. I can pass the value from the
    > login page to the second page but when the user goes to third page nothing
    > is echoed from the session variables. I've included the files so please
    let
    > me know what I'm doing wrong as I'm just new to sessions.
    >
    > Thanks :-)
    >
    >
    >

    South Guest

  4. #4

    Default PHP Sessions

    Hi Curt,

    No I didn't see a post about space on /tmp... Using df it shows the file
    system to only be about 70% full, so there's plenty of space there. Did
    you mean something else?

    Any other thoughts on where to look?

    Thanks,
    Lee

    >* Thus wrote Lee Stewart (lstewartdsgroup.com):
    >
    > > Using the $_SESSION[] style produces the same results... Zero length
    > > session file in /tmp, and no data passed... (available at
    > > [url]http://4.43.81.92/page1a.php[/url])
    >
    >
    >You did see my post about space left on /tmp?
    >
    >
    > >
    > > So where do I go from here... Is there any way to debug it? Like I
    > > said, I suspect it's not a PHP code bug, but I'm at a loss as to where to
    > > go from here (other than re-writing the entire application in some other
    > > language -- which I really don't want to do)...
    >
    >
    >another language? how dare you say such thing here on this list :)
    >
    >Curt
    >-- "I used to think I was indecisive, but now I'm not so sure."

    ----------
    Lee Stewart, Senior SE
    Sytek Services, a Division of DSG
    (719) 566-0188 , Fax (719) 566-0655
    [email]lstewartdsgroup.com[/email]
    [url]www.sytek-services.com[/url]
    [url]www.dsgroup.com[/url]

    Lee Stewart Guest

  5. #5

    Default PHP Sessions

    Hi All,

    I have a login page that which verifies he username & password against a
    MySql database and then passes the username to another page as a session.
    I created this on my PC, which is running PHP version 4.3.2, and it works
    with no problem.

    My host has the following set on the server which is running PHP Version
    4.3.3:
    1. register_globals set to off,
    2. Session.bug_compa4_42 set to on
    3. Session.bug.Compat-Warn set to on.

    When I submit the form I get a warning about :

    "Warning: Unknown(): Your script possibly relies on a session side-effect
    which existed until PHP 4.2.3.
    Please be advised that the session extension does not consider global
    variables as a source of data, unless register_globals is enabled. You can
    disable this functionality and this warning by setting session.bug_compat_42
    or session.bug_compat_warn to off, respectively. in Unknown on line 0"

    I have tried using :
    ini_set ("session.bug_compat_42", "0") and ini_set
    ("session.bug_compat_warn", "0"), to override the PHP.ini on the server but
    now when I submit the form on the Login page the server just hangs and then
    the services on that server stop.

    Can anyone shed any light on why a simple login page could crash a server.?

    Thanks for any advice so that I can pass information to my host to rectify
    what maybe a configuration error.

    Thanks again.

    Phil.
    Phil Guest

  6. #6

    Default php sessions

    Hi,

    I'm developing a web application which is making use of sessions. I
    have the following configuration is my php.ini file

    session.use_cookies = 0

    session.use_trans_sid = 1

    session.auto_start = 0

    register_globals = On

    This does not give me a new session_id when the application is opened
    in the same machine. If opened from different machines it gives me a
    different session_id.

    I create sessions using session_register() function. My php version
    is 4.2.2

    How to create a unique session for every new browser instance?

    -vimala/.
    S.P.Vimala Guest

  7. #7

    Default Re: [PHP] php sessions

    --- "S.P.Vimala" <ernet.in> wrote: 

    I'm not sure if this fits your definition of "new browser instance", but there
    is no way for a remote Web server to distinguish between two instances of the
    same browser running on the client machine.

    Maybe that explains something?

    Chris

    =====
    My Blog
    http://shiflett.org/
    HTTP Developer's Handbook
    http://httphandbook.org/
    RAMP Training Courses
    http://www.nyphp.org/ramp
    Chris Guest

  8. #8

    Default Re: [PHP] php sessions

    "Chris Shiflett" <net> wrote in message
    news:mail.... 
    >
    > I'm not sure if this fits your definition of "new browser instance", but[/ref]
    there 
    the 


    That can't be true. I don't claim to understand exactly how it works, but
    here is what happens for me. I have an application that I log into. Once
    I'm logged in, if I open the URL in another browser window, it just gives me
    the login page. My guess is that the first browser window is passing a
    cookie identifying the session that the second one doesn't know about. In
    your case, when you're not using cookies, the session ID must be passed on
    the URL. I don't know much about using trans_sid, so i can't help you
    further.

    -- Rob



     
    Rob Guest

  9. #9

    Default Re: [PHP] php sessions

    --- Rob Adams <com> wrote: 
    >
    > That can't be true.[/ref]

    It can, and it is.

    The only way a Web server could distinguish between them is if the browsers
    sent something unique per instance within the HTTP request. So, you could write
    a browser that does this in theory, but that doesn't really do you much good
    unless you can convince your users to use it.

    It would be very unusual behavior, so I doubt anyone would want this.

    Chris

    =====
    My Blog
    http://shiflett.org/
    HTTP Developer's Handbook
    http://httphandbook.org/
    RAMP Training Courses
    http://www.nyphp.org/ramp
    Chris Guest

  10. #10

    Default Re: [PHP] php sessions


    "Chris Shiflett" <net> wrote in message
    news:mail.... 
    > >
    > > That can't be true.[/ref]
    >
    > It can, and it is.
    >
    > The only way a Web server could distinguish between them is if the[/ref]
    browsers

    So there is a way, and it's not true.

    Test it yourself. Login to a PHP app using a standard browser and session
    cookies and see for yourself. I understand the philosophy of the web server
    only seeing what the client sends it, but it looks like my client (IE6,
    right here) does send different requests per instance. It's not just 'in
    theory.'

     
    write 
    good 
    Rob Guest

  11. #11

    Default Re: [PHP] php sessions

    --- Rob Adams <com> wrote: 

    With all due respect, it seems you should be doing the testing.
     

    Then show us these requests and point out how they are different. Otherwise, I
    have to assume you have no idea what you're talking about.

    Chris

    =====
    My Blog
    http://shiflett.org/
    HTTP Developer's Handbook
    http://httphandbook.org/
    RAMP Training Courses
    http://www.nyphp.org/ramp
    Chris Guest

  12. #12

    Default Re: [PHP] php sessions

    I will test it, because it seems I don't understand this issue as much as I
    could. But I can already tell you results I see right now:

    I open a web browser (IE) and login to my application. I open another
    window (IE) and goto the web application, and it asks me to login. This is
    all on the same computer. (As I've explained all this before.) Now,
    perhaps I don't know what I'm talking about, and this is a different issue.
    If so, I'm pretty sure you'll certainly try to set me straight. If not,
    then it certainly seems relevant to the discussion, and that my one client
    (IE) is sending two different requests from two different windows on the
    same computer.

    -- Rob


    "Chris Shiflett" <net> wrote in message
    news:mail.... 
    >
    > With all due respect, it seems you should be doing the testing.

    >
    > Then show us these requests and point out how they are different.[/ref]
    Otherwise, I 
    Rob Guest

  13. #13

    Default Re: [PHP] php sessions

    From: "Chris Shiflett" <net>

     
    >
    > With all due respect, it seems you should be doing the testing.

    >
    > Then show us these requests and point out how they are different.[/ref]
    Otherwise, I 

    If you are not relying on a cookie based session, then this will work. Each
    login could be assigned a different session ID, so the requests for each
    browser will be different because of the different session IDs.

    ---John Holmes...
    Cpt Guest

  14. #14

    Default Re: [PHP] php sessions

    So you're saying if the session ID is passed in on the URL it will work.
    But I'm using cookies. The only thing that gets passed on the URL is a
    pagename. Perhaps there is something funky about my setup, but it has
    always worked this way for me.

    -- Rob


    "Cpt John W. Holmes" <net> wrote in message
    news:00f301c39d8e$44db1070$.. 
    > >
    > > With all due respect, it seems you should be doing the testing.
    > > 
    > >
    > > Then show us these requests and point out how they are different.[/ref]
    > Otherwise, I 
    >
    > If you are not relying on a cookie based session, then this will work.[/ref]
    Each 
    Rob Guest

  15. #15

    Default Re: [PHP] php sessions


    "Curt Zirzow" <dyndns.org> wrote in message
    news:shire... [/ref]
    as I [/ref]
    is [/ref]
    issue. [/ref]
    client 
    >
    > This is entirely up to the client, deciding to send a cookie or not
    > when opening a new browser window. You can even turn the behaviour,
    > you describe, off in IE.
    >
    > The problem is the php script doesn't know that the browser you
    > opened (that give you back the login screen) is even related to the
    > other browser window. All the php script knows is that you simply
    > don't have a cookie.[/ref]

    That has been my point all along. Perhaps I misunderstood you:

    "there is no way for a remote Web server to distinguish between two
    instances of the
    same browser running on the client machine."
    vs.
    "The problem is the php script doesn't know that the browser you
    opened (that give you back the login screen) is even related to the
    other browser window."

    Aren't these almost exactly opposite statements?
    Isn't the web server distinguishing between the two instances? Using the
    cookie?

    -- Rob



     
    Rob Guest

  16. #16

    Default Re: [PHP] php sessions

    * Thus wrote Rob Adams (com): 

    This is entirely up to the client, deciding to send a cookie or not
    when opening a new browser window. You can even turn the behaviour,
    you describe, off in IE.

    The problem is the php script doesn't know that the browser you
    opened (that give you back the login screen) is even related to the
    other browser window. All the php script knows is that you simply
    don't have a cookie.


    Curt
    --
    "My PHP key is worn out"

    PHP List stats since 1997:
    http://zirzow.dyndns.org/html/mlists/
    Curt Guest

  17. #17

    Default Re: [PHP] php sessions

    Another test:

    I just downloaded and installed Mozilla (1.5). I logged into my site,
    opened another window, and was logged in there also. I logged out of the
    second window, hit a "Home" link on the first window, and got a login
    screen. This is new behavior for a browser for me, but now I understand how
    it works. Thanks for the discussion.

    -- Rob



    "Rob Adams" <com> wrote in message
    news:pair.com... [/ref]
    > as I [/ref][/ref]
    This [/ref]
    > issue. [/ref][/ref]
    not, [/ref]
    > client [/ref][/ref]
    the 
    > >
    > > This is entirely up to the client, deciding to send a cookie or not
    > > when opening a new browser window. You can even turn the behaviour,
    > > you describe, off in IE.
    > >
    > > The problem is the php script doesn't know that the browser you
    > > opened (that give you back the login screen) is even related to the
    > > other browser window. All the php script knows is that you simply
    > > don't have a cookie.[/ref]
    >
    > That has been my point all along. Perhaps I misunderstood you:
    >
    > "there is no way for a remote Web server to distinguish between two
    > instances of the
    > same browser running on the client machine."
    > vs.
    > "The problem is the php script doesn't know that the browser you
    > opened (that give you back the login screen) is even related to the
    > other browser window."
    >
    > Aren't these almost exactly opposite statements?
    > Isn't the web server distinguishing between the two instances? Using the
    > cookie?
    >
    > -- Rob
    >
    >
    >
    > [/ref]
    Rob Guest

  18. #18

    Default Re: [PHP] php sessions

    --- "CPT John W. Holmes" <net> wrote: 

    What John is explaining here is that the URLs could be different if that is how
    the session ID is propogated, thus making the requests different (they're for
    different URLs). So, if you click a link from:

    http://example.org/foo.php?PHPSESSID=12345

    it could be for:

    http://example.org/bar.php?PHPSESSID=12345

    Hope that helps.

    Chris

    =====
    My Blog
    http://shiflett.org/
    HTTP Developer's Handbook
    http://httphandbook.org/
    RAMP Training Courses
    http://www.nyphp.org/ramp
    Chris Guest

  19. #19

    Default Re: [PHP] php sessions


    "Chris Shiflett" <net> wrote in message
    news:mail.... 
    >
    > What John is explaining here is that the URLs could be different if that[/ref]
    is how 
    for 

    That doesn't seem to be what he's saying.

    "because of the different session IDs."

    It seems to me a better example of what he is saying would be:
    http://example.org/foo.php?PHPSESSID=12345
    vs.
    http://example.org/foo.php?PHPSESSID=67890

    But I was talking about cookies anyway. Which is where different browsers
    have different behaviors. In IE, by default, it will not pass a cookie from
    a new browser window. In Mozilla, by default, a new window keeps all the
    cookies currently set. I've mostly used IE, so I've always thought that it
    never passed cookies from a new browser window. Apparently, it just depends
    on which browser you're using and how it is setup.

    -- Rob



     
    Rob Guest

  20. #20

    Default $_SESSION[''] variable not get passed

    Hi,

    I have apache, php 4.1.2 running on windows machine. The
    following are the seetings related to sessions in php.ini file

    register_globals =off
    session.autostart=1
    session.use cookies=0
    session.use_trans_sid=1

    Now i have the following code in my default.php
    <html>
    <head> test</head>
    <body>
    <form name=form1 method=post action=frm2.php>
    <?php
    session_start();
    $_SESSION['mytest']="value";
    ?>
    </form>
    </body>
    </html>



    frm2.php

    <html>
    <head>session value</head>
    <body>
    <form name=frm2>
    <?php if (isset($_SESSION['mytest']))
    echo "set<BR>;
    echo "the session value is ". $_SESSION['mytest']
    .."<br>";
    ?>
    </form>
    </body>
    </html>



    Now the session_id get passwd across forms but the session
    variable does not get passwed.

    Any guess what is the problem.

    -vimala/.
    S.P.Vimala Guest

Page 1 of 2 12 LastLast

Similar Threads

  1. CGI::Sessions : Deleting expired sessions
    By Vito Corleone in forum PERL Modules
    Replies: 1
    Last Post: June 15th, 02:49 PM
  2. Replies: 4
    Last Post: November 22nd, 08:36 PM
  3. Database sessions and file sessions
    By Cditty in forum PHP Development
    Replies: 1
    Last Post: September 9th, 01:34 AM
  4. Relationship between IIS Sessions and ASP.NET Sessions?
    By Luther Miller in forum ASP.NET General
    Replies: 0
    Last Post: August 8th, 03:22 PM
  5. sessions help
    By Dante o. cabrera h. in forum PHP Development
    Replies: 1
    Last Post: July 18th, 12:53 AM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139