Re: [PHP] Session updates ok first time only.
On Tue, 29 Jan 2002 12:11:02 +0800, you wrote: >On Tuesday 29 January 2002 06:36, Floyd Baker wrote: > >> Yes I have a c:\tmp directory and I see the session being created in >> it. And the page_view value of 1 after the first increment. The >> editor wants to reload each time I hit the submit button after that >> but the value does not increase beyond 1. It is also the same session >> each time. No new sessions are being created. >> >> I have turned on the log and keep getting undefined_variables for >> those two lines in each page that call $page_view before it's >> incremented, unless I am engaging the $_SESSION call. Then >> $table_view becomes 1 and there are no errors. But the incremented >> value doesn't hold up. >> >> Almost like nothing is happening.., except the *editor* thinks there >> is something going on when looking at the session file?? Like a one >> is being loaded each time. How could that be? Or the original one is >> staying even though an overwrite is being attempted. > >Here's an interesting snippet from the manual: > >The track_vars and register_globals configuration settings influence how the >session variables get stored and restored. > >Note: As of PHP 4.0.3, track_vars is > always turned on. > >If track_vars is enabled and register_globals is disabled, only members of >the global associative array $HTTP_SESSION_VARS can be registered as session >variables. The restored session variables will only be available in the array >$HTTP_SESSION_VARS. > >Try the simple example in the manual: > >session_register("count"); >$_SESSION["count"]++; >echo "Count is " . $_SESSION["count"]; >?> > >> Now I have uploaded these scripts to my isp and they do not work up >> there either. That is, using his ini, his php 4.0 with >> register_globals on, etc. Could you perhaps test these scripts on >> your machine or create an 'accumulating' routine of your own that >> works? So I can see where the difference might be coming in? > >Your original scripts with the changes I suggested works on my system. This is what I am seeing now using your code above. The increment works when done directly into the session register but when done on the page, it does not get applied. I am incrementing both ways in succession and reloading. These are the results I get on each reload. RegisterPage 1 1-2 2 2-3 3 3-4 4 4-5 or similar. Any changes done outside the register just do not get recorded into the register. They must be done in the register itself. Many thanks again Jason. That was a good one. I am off and looking for the next problem now. Floyd -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Session updates ok first time only.
Jason put a little snip from the man that he found that works just fine on my pages. It looks like you increment or change the variable directly in the session register instead of doing it on the page. That sounds suspiciously like what you were trying to tell me. :-) What do you think... On Tue, 29 Jan 2002 12:11:02 +0800, you wrote: >On Tuesday 29 January 2002 06:36, Floyd Baker wrote: > >> Yes I have a c:\tmp directory and I see the session being created in >> it. And the page_view value of 1 after the first increment. The >> editor wants to reload each time I hit the submit button after that >> but the value does not increase beyond 1. It is also the same session >> each time. No new sessions are being created. >> >> I have turned on the log and keep getting undefined_variables for >> those two lines in each page that call $page_view before it's >> incremented, unless I am engaging the $_SESSION call. Then >> $table_view becomes 1 and there are no errors. But the incremented >> value doesn't hold up. >> >> Almost like nothing is happening.., except the *editor* thinks there >> is something going on when looking at the session file?? Like a one >> is being loaded each time. How could that be? Or the original one is >> staying even though an overwrite is being attempted. > >Here's an interesting snippet from the manual: > >The track_vars and register_globals configuration settings influence how the >session variables get stored and restored. > >Note: As of PHP 4.0.3, track_vars is > always turned on. > >If track_vars is enabled and register_globals is disabled, only members of >the global associative array $HTTP_SESSION_VARS can be registered as session >variables. The restored session variables will only be available in the array >$HTTP_SESSION_VARS. > >Try the simple example in the manual: > >session_register("count"); >$_SESSION["count"]++; >echo "Count is " . $_SESSION["count"]; >?> Wow... That works. Al right! You mean you can only increment directly in the session register and *then* pull the value.., instead of pulling it first and then incrementing? Is that the basic concept that I should to keep in mind? I can do that... :0) You're all right Jason. This is a terrific help for me. And I'm definitely going to print a hardcopy of the man... Looks like using the on-line or even the pd on screen isn't working out too well. With the changes going on, this is probably something that will come up again and again for some time to come. Nice to have it figured out, eh? And I'll do some more tests, etc. and put a little follow up here on anything else I see. Floyd >> Now I have uploaded these scripts to my isp and they do not work up >> there either. That is, using his ini, his php 4.0 with >> register_globals on, etc. Could you perhaps test these scripts on >> your machine or create an 'accumulating' routine of your own that >> works? So I can see where the difference might be coming in? > >Your original scripts with the changes I suggested works on my system. -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Session updates ok first time only.
On Tue, 29 Jan 2002 12:11:02 +0800, you wrote: >On Tuesday 29 January 2002 06:36, Floyd Baker wrote: > >> Yes I have a c:\tmp directory and I see the session being created in >> it. And the page_view value of 1 after the first increment. The >> editor wants to reload each time I hit the submit button after that >> but the value does not increase beyond 1. It is also the same session >> each time. No new sessions are being created. >> >> I have turned on the log and keep getting undefined_variables for >> those two lines in each page that call $page_view before it's >> incremented, unless I am engaging the $_SESSION call. Then >> $table_view becomes 1 and there are no errors. But the incremented >> value doesn't hold up. >> >> Almost like nothing is happening.., except the *editor* thinks there >> is something going on when looking at the session file?? Like a one >> is being loaded each time. How could that be? Or the original one is >> staying even though an overwrite is being attempted. > >Here's an interesting snippet from the manual: > >The track_vars and register_globals configuration settings influence how the >session variables get stored and restored. > >Note: As of PHP 4.0.3, track_vars is > always turned on. > >If track_vars is enabled and register_globals is disabled, only members of >the global associative array $HTTP_SESSION_VARS can be registered as session >variables. The restored session variables will only be available in the array >$HTTP_SESSION_VARS. > >Try the simple example in the manual: > >session_register("count"); >$_SESSION["count"]++; >echo "Count is " . $_SESSION["count"]; >?> Wow... That works. Al right! You mean you can only increment directly in the session register and *then* pull the value.., instead of pulling it first and then incrementing? Is that the basic concept that I should to keep in mind? I can do that... :0) You're all right Jason. This is a terrific help for me. And I'm definitely going to print a hardcopy of the man... Looks like using the on-line or even the pd on screen isn't working out too well. With the changes going on, this is probably something that will come up again and again for some time to come. Nice to have it figured out, eh? And I'll do some more tests, etc. and put a little follow up here on anything else I see. Floyd >> Now I have uploaded these scripts to my isp and they do not work up >> there either. That is, using his ini, his php 4.0 with >> register_globals on, etc. Could you perhaps test these scripts on >> your machine or create an 'accumulating' routine of your own that >> works? So I can see where the difference might be coming in? > >Your original scripts with the changes I suggested works on my system. -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Session updates ok first time only.
On Tuesday 29 January 2002 06:36, Floyd Baker wrote: > Yes I have a c:\tmp directory and I see the session being created in > it. And the page_view value of 1 after the first increment. The > editor wants to reload each time I hit the submit button after that > but the value does not increase beyond 1. It is also the same session > each time. No new sessions are being created. > > I have turned on the log and keep getting undefined_variables for > those two lines in each page that call $page_view before it's > incremented, unless I am engaging the $_SESSION call. Then > $table_view becomes 1 and there are no errors. But the incremented > value doesn't hold up. > > Almost like nothing is happening.., except the *editor* thinks there > is something going on when looking at the session file?? Like a one > is being loaded each time. How could that be? Or the original one is > staying even though an overwrite is being attempted. Here's an interesting snippet from the manual: The track_vars and register_globals configuration settings influence how the session variables get stored and restored. Note: As of PHP 4.0.3, track_vars is always turned on. If track_vars is enabled and register_globals is disabled, only members of the global associative array $HTTP_SESSION_VARS can be registered as session variables. The restored session variables will only be available in the array $HTTP_SESSION_VARS. Try the simple example in the manual: > Now I have uploaded these scripts to my isp and they do not work up > there either. That is, using his ini, his php 4.0 with > register_globals on, etc. Could you perhaps test these scripts on > your machine or create an 'accumulating' routine of your own that > works? So I can see where the difference might be coming in? Your original scripts with the changes I suggested works on my system. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Session updates ok first time only.
On Sunday, January 27, 2002, at 10:39 PM, Jason Wong wrote: > On Monday 28 January 2002 04:37, Floyd Baker wrote: >> I have 4.1, register globals off, on Windows 98. >> //pull value from session file: >> $page_views = $_SESSION['page_views']; > No need for this, in fact this is what is preventing it from working! > Once > you've used session_register('var'), $var is available for use. > I thought that when register_globals = off, all you need is session_start() at the top of every page and from then on session_register() isn't even needed. I also thought that in fact it was safer to use $_SESSION['variablename'] than to use session_register() each time (well, not safer, but a better habit for the register_globals = off crowd). I'm not disagreeing with you, just asking for clarification. I base this on what I've read in the PHP manual on using session variables (there are some indented blockquotes that suggest this technique for PHP4.1-using register_globals=off-turning PHP coders). Erik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Session updates ok first time only.
On Mon, 28 Jan 2002 21:10:02 +0800, you wrote: >On Monday 28 January 2002 20:52, Floyd Baker wrote: >> On Mon, 28 Jan 2002 15:20:05 +0800, you wrote: >> >On Monday 28 January 2002 14:27, you wrote: > >> >2) session.save_path = c:/tmp, I don't use PHP on Windows, but looking at >> > the other settings, paths for Windows systems are specified with a >> > backslash. Try >> > >> > session.save_path = c:\tmp > >> >> Refreshing was what I was doing in the original single page, but it >> wasn't working. I went to two pages to try and help show what was >> going on. Still reloading doesn't help. Neither does the dos slash >> reversal. I thought that might be going to do it for a while, but >> nothing. :-< > >But you *do* have a c:\tmp directory ? > >This is where php will store the session info and if it doesn't find that >directory your sessions stuff wouldn't work. > >> I only listed the *un* rem'ed lines of the ini session portion. Is it >> possible I need to remove a rem on one of those that were rem'ed? >> It's a vanilla 'suggested' ini. > >If it were the vanilla 'suggested' ini as per the standard php distribution >then it *should* work, as those are more or less the same settings that I use >myself (but under Linux). > >> Or maybe an error log I can look at? Can such a report be created? > >Yes, in php.ini, > >log_errors = On >error_log = c:\tmp\php-error.log > > >Don't forget to restart your webserver or whatever. > > >-- >Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > Yes I have a c:\tmp directory and I see the session being created in it. And the page_view value of 1 after the first increment. The editor wants to reload each time I hit the submit button after that but the value does not increase beyond 1. It is also the same session each time. No new sessions are being created. I have turned on the log and keep getting undefined_variables for those two lines in each page that call $page_view before it's incremented, unless I am engaging the $_SESSION call. Then $table_view becomes 1 and there are no errors. But the incremented value doesn't hold up. Almost like nothing is happening.., except the *editor* thinks there is something going on when looking at the session file?? Like a one is being loaded each time. How could that be? Or the original one is staying even though an overwrite is being attempted. Now I have uploaded these scripts to my isp and they do not work up there either. That is, using his ini, his php 4.0 with register_globals on, etc. Could you perhaps test these scripts on your machine or create an 'accumulating' routine of your own that works? So I can see where the difference might be coming in? Floyd -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Session updates ok first time only.
On Monday 28 January 2002 20:52, Floyd Baker wrote: > On Mon, 28 Jan 2002 15:20:05 +0800, you wrote: > >On Monday 28 January 2002 14:27, you wrote: > >2) session.save_path = c:/tmp, I don't use PHP on Windows, but looking at > > the other settings, paths for Windows systems are specified with a > > backslash. Try > > > > session.save_path = c:\tmp > > Refreshing was what I was doing in the original single page, but it > wasn't working. I went to two pages to try and help show what was > going on. Still reloading doesn't help. Neither does the dos slash > reversal. I thought that might be going to do it for a while, but > nothing. :-< But you *do* have a c:\tmp directory ? This is where php will store the session info and if it doesn't find that directory your sessions stuff wouldn't work. > I only listed the *un* rem'ed lines of the ini session portion. Is it > possible I need to remove a rem on one of those that were rem'ed? > It's a vanilla 'suggested' ini. If it were the vanilla 'suggested' ini as per the standard php distribution then it *should* work, as those are more or less the same settings that I use myself (but under Linux). > Or maybe an error log I can look at? Can such a report be created? Yes, in php.ini, log_errors = On error_log = c:\tmp\php-error.log Don't forget to restart your webserver or whatever. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk /* "I've finally learned what `upward compatible' means. It means we get to keep all our old mistakes." -- Dennie van Tassel */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Session updates ok first time only.
On Mon, 28 Jan 2002 15:20:05 +0800, you wrote: >On Monday 28 January 2002 14:27, you wrote: > >Please keep discussion on the list! Sorry about that. I meant to.. >> >> //pull value from session file: >> >> $page_views = $_SESSION['page_views']; >> > >> >No need for this, in fact this is what is preventing it from working! Once >> >you've used session_register('var'), $var is available for use. >> >> Still ng.. I've eliminated the line on each and both pages in turn >> but still no improvement. The count is going from 0 to 1 on the first >> invoke, then from 1 to 3 after passed to the second page. From there >> on it falls apart, repeating 1 to 2 or 1 to 3 depending on the page. >> The session file never sees a higher value once the initial 1 is >> input. It just keeps starting over from that same point. >> >> >> print "Return Page"; >> >> print "Before increment = $page_views"; >> >> >> >> //increment the counter: >> >> $page_views++; >> >> $page_views++; >> > >> >You're inc'ing $page_views twice, this is what makes you *think* the >> > session is working when in fact it isn't! >> > >> >hth >> >> The double increment was to give me a different count for the second >> page just to tell where I was at any time. I see the count go >> 1-2-1-3-1-2-1-3-1-2 etc., as it passes back and forth. > >Ahh, but I thought that was what the "Send Page" and "Return Page" was for :) > >> But it's still not climbing. > >1) You could try reloading (F5 if using IE) the "Send Page", if sessions were >working you should see the counter counting. > >2) session.save_path = c:/tmp, I don't use PHP on Windows, but looking at the >other settings, paths for Windows systems are specified with a backslash. Try > > session.save_path = c:\tmp Refreshing was what I was doing in the original single page, but it wasn't working. I went to two pages to try and help show what was going on. Still reloading doesn't help. Neither does the dos slash reversal. I thought that might be going to do it for a while, but nothing. :-< I only listed the *un* rem'ed lines of the ini session portion. Is it possible I need to remove a rem on one of those that were rem'ed? It's a vanilla 'suggested' ini. Or maybe an error log I can look at? Can such a report be created? Floyd -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Session updates ok first time only.
On Monday 28 January 2002 14:27, you wrote: Please keep discussion on the list! > >> > >> //pull value from session file: > >> $page_views = $_SESSION['page_views']; > > > >No need for this, in fact this is what is preventing it from working! Once > >you've used session_register('var'), $var is available for use. > > Still ng.. I've eliminated the line on each and both pages in turn > but still no improvement. The count is going from 0 to 1 on the first > invoke, then from 1 to 3 after passed to the second page. From there > on it falls apart, repeating 1 to 2 or 1 to 3 depending on the page. > The session file never sees a higher value once the initial 1 is > input. It just keeps starting over from that same point. > > >> print "Return Page"; > >> print "Before increment = $page_views"; > >> > >> //increment the counter: > >> $page_views++; > >> $page_views++; > > > >You're inc'ing $page_views twice, this is what makes you *think* the > > session is working when in fact it isn't! > > > >hth > > The double increment was to give me a different count for the second > page just to tell where I was at any time. I see the count go > 1-2-1-3-1-2-1-3-1-2 etc., as it passes back and forth. Ahh, but I thought that was what the "Send Page" and "Return Page" was for :) > But it's still not climbing. 1) You could try reloading (F5 if using IE) the "Send Page", if sessions were working you should see the counter counting. 2) session.save_path = c:/tmp, I don't use PHP on Windows, but looking at the other settings, paths for Windows systems are specified with a backslash. Try session.save_path = c:\tmp -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk /* Preserve wildlife -- pickle a squirrel today! */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Session updates ok first time only.
On Monday 28 January 2002 04:37, Floyd Baker wrote: > Can someone tell me why this is not working right? Two pages are > basically the same, passing an accumulating value back and forth. > There is no other session being created. The first time it increments > and passes to the second page, and is picked up. It puts a 1 in the > session file. After that, it seems to try, as in editor wanting to > reload, but the contents don't increase beyond 1. > > I have 4.1, register globals off, on Windows 98. > > TIA > //pull value from session file: > $page_views = $_SESSION['page_views']; No need for this, in fact this is what is preventing it from working! Once you've used session_register('var'), $var is available for use. > print "Return Page"; > print "Before increment = $page_views"; > > //increment the counter: > $page_views++; > $page_views++; You're inc'ing $page_views twice, this is what makes you *think* the session is working when in fact it isn't! hth -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk /* On the road, ZIPPY is a pinhead without a purpose, but never without a POINT. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]