php-general Digest 20 Aug 2009 09:28:55 -0000 Issue 6295

Topics (messages 296985 through 297002):

Re: How to make sure that the target file to read is not        under writing 
by others?
        296985 by: Clancy

Re: PHP/Ajax Framework - Call for Developers & Testers
        296986 by: Raymond Irving

Re: daemon without pcntl_fork
        296987 by: Lars Torben Wilson

How to download and configure php mvc website locally
        296988 by: Sumit Sharma
        296991 by: Sudheer Satyanarayana
        297000 by: Sumit Sharma

Re: SESSIONS lost sometimes
        296989 by: Angelo Zanetti
        296990 by: Leon du Plessis
        296993 by: Arno Kuhl
        296994 by: Leon du Plessis
        296995 by: Nitebirdz
        296996 by: Peter Ford
        296997 by: Nitebirdz
        296998 by: Leon du Plessis
        296999 by: Leon du Plessis
        297002 by: Leon du Plessis

Re: DB Question | A hotel reservation scenario
        296992 by: Behzad

Re: PDF Width
        297001 by: Nitebirdz

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
On Wed, 19 Aug 2009 08:13:56 -0400, kyle.sm...@inforonics.com (Kyle Smith) 
wrote:

>Nitebirdz wrote:
>> On Wed, Aug 19, 2009 at 11:59:39AM +0100, Ashley Sheridan wrote:
>>   
>>>  
>>> No, what you're saying is 'use a log file in order to know when to look
>>> at another log file'. What would happen if you tried to access the
>>> control log file whilst it was in the process of being written to?
>>> Admittedly, you reduce your chances of failure because there is less
>>> data being written to the control log than the actual log, but the
>>> chance of reading incomplete data is still there!
>>>
>>>     
>>
>> WARNING: total newbie here.
>>
>> If I understood Arno correctly, he was recommending to implement
>> something like the old "/var/run/*pid" files in UNIX.  That way, you can
>> control whether or not the previous run is already done with the file
>> before you move on. 
>That is definitely the correct approach.  Have the script which copies 
>the log file touch a file called 'log_file.write' or some such.  When 
>it's done, remove the file.  Your PHP script should exit if that file 
>exists.  Of course, given the 30 minute cron cycle, it would then have 
>to wait until the next cycle.  Maybe run it more often.

I gather from this discussion that PHP allows two users to open a file for R/W? 
I had
assumed it wouldn't.

Anyway, how about:

        $user = 'Fred'; $try_again = true;
        If (!file_exists('Busy.txt'))
                {
                File_put_contents ('Busy.txt', $user);
                If ($user == File_get_contents ('Busy.txt')
                        {
// Do what you have to
                        Unlink ('Busy.txt');
                        $try_again = false;
                        }
                }
        if ($try_again)
                {
// Come back in 5 minutes
                }

This has a theoretical weakness, in that Joe could check for Busy.txt in the 
interval
between your checking and writing it, and then write his copy after you had 
read your
copy. A moments delay between writing and re-reading would fix this.


--- End Message ---
--- Begin Message ---
Hi Nathan,

Many thanks for the feedback. There many other useful features built into the 
API but my favorite is the embedded feature.

You can see a live example here:
http://raxanpdi.com/shoutbox-embedded-example.html

Best regards,
__
Raymond Irving


--- On Wed, 8/19/09, Nathan Nobbe <quickshif...@gmail.com> wrote:

From: Nathan Nobbe <quickshif...@gmail.com>
Subject: Re: [PHP] PHP/Ajax Framework - Call for Developers & Testers
To: "Raymond Irving" <xwis...@yahoo.com>
Cc: php-gene...@lists.php.net
Date: Wednesday, August 19, 2009, 11:56 AM

On Wed, Aug 19, 2009 at 7:06 AM, Raymond Irving <xwis...@yahoo.com> wrote:

> Hello,
>
> I've just released Raxan Beta 2 with lots for features for both PHP and
> Ajax developers.
>
> I'm looking for persons to help me test and improve the framework. If
> you're interested, then please download the framework , join the community
> and share your thoughts and ideas. Feel free to send me an email if you have
> any questions.
>
> You can check out the new features here:
> http://raxanpdi.com/new-in-beta-2.html


you have a neat feature list here Raymond, thanks for sharing.

-nathan

--- End Message ---
--- Begin Message ---
2009/8/19 Per Jessen <p...@computer.org>:
> Jim Lucas wrote:

[snip]

> I probably wouldn't have chosen PHP for the first one, but there's no
> reason it shouldn't work.  For the second one, did you mean to
> write "serial port"?  That's a bit of a different animal, I'm not sure
> how far you'll get with php.
>
>> Here is what I have come up with so far.  Looks to satisfying my
>> needs:
>>
>> tms_daemon
> [snip]
>> # END OF SCRIPT
>
> Looks good to me. It'll certainly do the job.
>
>
> /Per

I agree with Per on all points--I probably wouldn't choose PHP as a
first choice for the first task, but the startup script you have shown
looks like a bog-standard startup script and should serve you well. I
haven't really gone over it with a fine-toothed comb though. Typos
etc. are still up to to you. :) Of course, the whole thing depends on
how tms_daemon behaves, but the startup script looks OK.

Can you explain in a bit more detail exactly what the second part (the
serial-network data logger) needs to do? I've written similar daemons
in C but not PHP--when I've needed to get something like that going
with a PHP script, I've used ser2net (which I linked to in an earlier
post) and been quite happy. Maybe you don't even have to do the hard
work yourself (or buy extra hardware to do it for you).


Cheers,

Torben

--- End Message ---
--- Begin Message ---
Hi,
Please help as I have downloaded a php website for my client which is
developed using model view controller pattern. Now when I am accessing this
site locally it is not showing any thing. Please tell me the what's the
problem

Thanks,
      Sumit Sharma

--- End Message ---
--- Begin Message ---
Sumit Sharma wrote:
Hi,
Please help as I have downloaded a php website for my client which is
developed using model view controller pattern. Now when I am accessing this
site locally it is not showing any thing. Please tell me the what's the
problem

Thanks,
      Sumit Sharma

It should at least show some error messages. Look into the logs of your web server and try to fix them.

We will be able to help you if you provide us more information about your application.



--

With warm regards,
Sudheer. S
Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, 
Personal: http://sudheer.net


--- End Message ---
--- Begin Message ---
Hi all,
The site I have download was developed using cake php. Now when trying to
access the website it is showing a blank page. As Sudheer suggested I went
to error log and noted down the errors there, which are as follows:

[Thu Aug 20 14:10:16 2009] [error] [client 127.0.0.1] File does not exist:
F:/Rabin/xampp/htdocs/favicon.ico

I think there is no file called favicon.ico but how to create this file. Is
this something related to cakephp configuration.

Regards,
    Sumit



On Wed, Aug 19, 2009 at 8:25 PM, Sumit Sharma <sumitp...@gmail.com> wrote:

> Hi,
> Please help as I have downloaded a php website for my client which is
> developed using model view controller pattern. Now when I am accessing this
> site locally it is not showing any thing. Please tell me the what's the
> problem
>
> Thanks,
>       Sumit Sharma
>

--- End Message ---
--- Begin Message ---

-----Original Message-----
From: Ben Dunlap [mailto:bdun...@agentintellect.com] 
Sent: 19 August 2009 08:18 PM
To: Angelo Zanetti
Cc: php-gene...@lists.php.net
Subject: Re: [PHP] SESSIONS lost sometimes

> We have a server with a site that does some XML calls. After lots of
testing
> I have found that the server is losing session variables.
[8<]
> Also the site goes from HTTP to HTTPS at some point but this isn't the
issue
> as it loses the sessions as soon as they are set sometimes.
>
> Therefore I would like to know what I could check. I have read in other

Can you clarify what you mean by "losing sessions"? Have you taken a
network trace to see whether the client is consistently sending the
session ID with every request?

When the problem happens, is $_SESSION completely empty or is it only
missing some variables? Does it seem to happen on any page, or only
certain ones?

Thanks,

Ben


Hi Ben, 

When the problem happens the $_SESSION is partially empty. It only has the
some of the variables set.

It happens on a certain page only, but the strange thing is that it never
happened before its only happening now. But the code hasn't changed so is it
safe to assume that it's a server issue?

Thanks
Angelo

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
Since we are on the subject: I have the following similar problem:

When testing page on internet explorer, I find that one tab's variables can
affect another tab's variables. Thus when having the same web-site open and
using SESSION variables but for different users, Internet explorer can
become "disorientated". This also "sometimes" happen when I have two
separate browsing windows open with Internet Explorer for the same site.

I have yet to determine if this is an internet explorer, or PHP or
combination of the two that is causing this condition. 

To my understanding _SESSION variables should be maintained per session, tab
or window. If this has been addressed already, my apologies, but thought it
worthwhile to mention.  

If someone perhaps have a solution or can confirm this as a known issue and
maybe is the same or related to Angelo's problem?


-----Original Message-----
From: Angelo Zanetti [mailto:ang...@zlogic.co.za] 
Sent: 20 August 2009 08:53 AM
To: 'Ben Dunlap'
Cc: php-gene...@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes



-----Original Message-----
From: Ben Dunlap [mailto:bdun...@agentintellect.com] 
Sent: 19 August 2009 08:18 PM
To: Angelo Zanetti
Cc: php-gene...@lists.php.net
Subject: Re: [PHP] SESSIONS lost sometimes

> We have a server with a site that does some XML calls. After lots of
testing
> I have found that the server is losing session variables.
[8<]
> Also the site goes from HTTP to HTTPS at some point but this isn't the
issue
> as it loses the sessions as soon as they are set sometimes.
>
> Therefore I would like to know what I could check. I have read in other

Can you clarify what you mean by "losing sessions"? Have you taken a
network trace to see whether the client is consistently sending the
session ID with every request?

When the problem happens, is $_SESSION completely empty or is it only
missing some variables? Does it seem to happen on any page, or only
certain ones?

Thanks,

Ben


Hi Ben, 

When the problem happens the $_SESSION is partially empty. It only has the
some of the variables set.

It happens on a certain page only, but the strange thing is that it never
happened before its only happening now. But the code hasn't changed so is it
safe to assume that it's a server issue?

Thanks
Angelo

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
-----Original Message-----
From: Leon du Plessis [mailto:l...@dsgnit.com] 
Sent: 20 August 2009 09:44 AM
To: php-gene...@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

Since we are on the subject: I have the following similar problem:

When testing page on internet explorer, I find that one tab's variables can
affect another tab's variables. Thus when having the same web-site open and
using SESSION variables but for different users, Internet explorer can
become "disorientated". This also "sometimes" happen when I have two
separate browsing windows open with Internet Explorer for the same site.

I have yet to determine if this is an internet explorer, or PHP or
combination of the two that is causing this condition. 

To my understanding _SESSION variables should be maintained per session, tab
or window. If this has been addressed already, my apologies, but thought it
worthwhile to mention.  

If someone perhaps have a solution or can confirm this as a known issue and
maybe is the same or related to Angelo's problem?

--------------------

If different browser windows/tabs on the same client-side computer didn't
share session info then you'd get the effect of being able to log onto a
site with one browser window, but find in a second browser window that you
were not yet logged on. Experience will tell you that you're logged on in
both browser windows (try it with your online bank). It's not an issue, it's
a feature. If you want to be able to use different browser windows as though
they were different users then use different browsers e.g. IE and FF on the
same client-side computer will look like two separate end users to the
server, and they don't share session info or cookies.

Cheers
Arno


--- End Message ---
--- Begin Message ---
">> It's not an issue, it's a feature."

Thanks Arno...but it is a pain also.
If I work with user A in Tab1 (window1), I want to work with user B
separately in Tab2. When user in Tab2 logs off, I still want user A to work,
and not suddenly have to re-login. Same with bank. If I work with my company
account, then my personal account must not become an issue because I am on
the same machine and site. 

I have no issue with using FF and IE to do testing as that takes care of
browser compatibility testing at the same time :-), but I think when you
start a new session with new values, it should be kept under that window/tab
alone. Cookies can take care of more details, but my opinion is data should
never be affected across windows/tabs unless the same user is logged in on
both....even then I would expect PHP to keep data per session. Maybe it goes
beyond being an IE or FF issue..the questiojn is...will PHP allow variables
from session A become corrupted when session B is in progress when they
should actually be handled seperately?

In the end I think it is something I do wrong in PHP with the SESSION
variables and how I clear them....if so...I don't think PHP should allow
clearing SESSION variables from other sessions.
 
-----Original Message-----
From: Arno Kuhl [mailto:ak...@telkomsa.net] 
Sent: 20 August 2009 10:03 AM
To: 'Leon du Plessis'; php-gene...@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

-----Original Message-----
From: Leon du Plessis [mailto:l...@dsgnit.com] 
Sent: 20 August 2009 09:44 AM
To: php-gene...@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

Since we are on the subject: I have the following similar problem:

When testing page on internet explorer, I find that one tab's variables can
affect another tab's variables. Thus when having the same web-site open and
using SESSION variables but for different users, Internet explorer can
become "disorientated". This also "sometimes" happen when I have two
separate browsing windows open with Internet Explorer for the same site.

I have yet to determine if this is an internet explorer, or PHP or
combination of the two that is causing this condition. 

To my understanding _SESSION variables should be maintained per session, tab
or window. If this has been addressed already, my apologies, but thought it
worthwhile to mention.  

If someone perhaps have a solution or can confirm this as a known issue and
maybe is the same or related to Angelo's problem?

--------------------

If different browser windows/tabs on the same client-side computer didn't
share session info then you'd get the effect of being able to log onto a
site with one browser window, but find in a second browser window that you
were not yet logged on. Experience will tell you that you're logged on in
both browser windows (try it with your online bank). It's not an issue, it's
a feature. If you want to be able to use different browser windows as though
they were different users then use different browsers e.g. IE and FF on the
same client-side computer will look like two separate end users to the
server, and they don't share session info or cookies.

Cheers
Arno


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
On Thu, Aug 20, 2009 at 09:44:02AM +0200, Leon du Plessis wrote:
> 
> Since we are on the subject: I have the following similar problem:
> 
> When testing page on internet explorer, I find that one tab's variables can
> affect another tab's variables. Thus when having the same web-site open and
> using SESSION variables but for different users, Internet explorer can
> become "disorientated". This also "sometimes" happen when I have two
> separate browsing windows open with Internet Explorer for the same site.
> 
> I have yet to determine if this is an internet explorer, or PHP or
> combination of the two that is causing this condition. 
> 
> To my understanding _SESSION variables should be maintained per session, tab
> or window. If this has been addressed already, my apologies, but thought it
> worthwhile to mention.  
> 

I'm a total newbie when it comes to these issues, but it seems to me
that Firefox behaves in the very same manner.  It's not limited to PHP
sessions either.  It's always been my experience on any website that
requires authentication, including the likes of Google Mail, etc.  When
I want to run multiple sessions for different GMail accounts, for
example, I just create a different user profile in Firefox. 

It'd make sense for things to run this way, I think.  After all, I'd
find it quite confusing if I log into Google Docs, open a document (by
default, it opens in a new tab) and I had to log in yet again to be able
to edit it.  


--- End Message ---
--- Begin Message ---
Leon du Plessis wrote:
> ">> It's not an issue, it's a feature."
> 
> Thanks Arno...but it is a pain also.
> If I work with user A in Tab1 (window1), I want to work with user B
> separately in Tab2. When user in Tab2 logs off, I still want user A to work,
> and not suddenly have to re-login. Same with bank. If I work with my company
> account, then my personal account must not become an issue because I am on
> the same machine and site. 
> 
> I have no issue with using FF and IE to do testing as that takes care of
> browser compatibility testing at the same time :-), but I think when you
> start a new session with new values, it should be kept under that window/tab
> alone. Cookies can take care of more details, but my opinion is data should
> never be affected across windows/tabs unless the same user is logged in on
> both....even then I would expect PHP to keep data per session. Maybe it goes
> beyond being an IE or FF issue..the questiojn is...will PHP allow variables
> from session A become corrupted when session B is in progress when they
> should actually be handled seperately?
> 
> In the end I think it is something I do wrong in PHP with the SESSION
> variables and how I clear them....if so...I don't think PHP should allow
> clearing SESSION variables from other sessions.
>  
> -----Original Message-----
> From: Arno Kuhl [mailto:ak...@telkomsa.net] 
> Sent: 20 August 2009 10:03 AM
> To: 'Leon du Plessis'; php-gene...@lists.php.net
> Subject: RE: [PHP] SESSIONS lost sometimes
> 
> -----Original Message-----
> From: Leon du Plessis [mailto:l...@dsgnit.com] 
> Sent: 20 August 2009 09:44 AM
> To: php-gene...@lists.php.net
> Subject: RE: [PHP] SESSIONS lost sometimes
> 
> Since we are on the subject: I have the following similar problem:
> 
> When testing page on internet explorer, I find that one tab's variables can
> affect another tab's variables. Thus when having the same web-site open and
> using SESSION variables but for different users, Internet explorer can
> become "disorientated". This also "sometimes" happen when I have two
> separate browsing windows open with Internet Explorer for the same site.
> 
> I have yet to determine if this is an internet explorer, or PHP or
> combination of the two that is causing this condition. 
> 
> To my understanding _SESSION variables should be maintained per session, tab
> or window. If this has been addressed already, my apologies, but thought it
> worthwhile to mention.  
> 
> If someone perhaps have a solution or can confirm this as a known issue and
> maybe is the same or related to Angelo's problem?
> 
> --------------------
> 
> If different browser windows/tabs on the same client-side computer didn't
> share session info then you'd get the effect of being able to log onto a
> site with one browser window, but find in a second browser window that you
> were not yet logged on. Experience will tell you that you're logged on in
> both browser windows (try it with your online bank). It's not an issue, it's
> a feature. If you want to be able to use different browser windows as though
> they were different users then use different browsers e.g. IE and FF on the
> same client-side computer will look like two separate end users to the
> server, and they don't share session info or cookies.
> 
> Cheers
> Arno
> 
> 

The key thing is that both tabs (or windows) from the same browser are in the
*same* session - they send the *same* PHPID cookie. PHP is essentially stateless
- it doesn't care where the request comes from, and ties a session to the PHPID
cookie if it gets one. As far as PHP knows, requests from different tabs with
the same PHPID cookie are requests from the same place in the same session.

To get a different session you need a different instance of the browser - that's
the way browsers have been coded to work. It's not too hard with Firefox, since
you can set up multiple profiles to have independent Firefox windows on the same
screen.

-- 
Peter Ford                              phone: 01580 893333
Developer                               fax:   01580 893399
Justcroft International Ltd., Staplehurst, Kent

--- End Message ---
--- Begin Message ---
On Thu, Aug 20, 2009 at 10:26:35AM +0200, Leon du Plessis wrote:
> ">> It's not an issue, it's a feature."
> 
> Thanks Arno...but it is a pain also.
> If I work with user A in Tab1 (window1), I want to work with user B
> separately in Tab2. When user in Tab2 logs off, I still want user A to work,
> and not suddenly have to re-login. Same with bank. If I work with my company
> account, then my personal account must not become an issue because I am on
> the same machine and site. 
> 

As mentioned in my other email, I've only been able to get this to work
by using different user profiles under Firefox.  If you need to run them
both at the same time, the following document helps explaining how to
accomplish it:

http://lifehacker.com/software/firefox/geek-to-live--manage-multiple-firefox-profiles-231646.php


I never tested it because I don't run Windows, but a similar setup works
just fine for Linux. 



--- End Message ---
--- Begin Message ---
">> It'd make sense for things to run this way, I think.  After all, I'd
find it quite confusing if I log into Google Docs, open a document (by
default, it opens in a new tab) and I had to log in yet again to be able to
edit it."

Yes. I agree. But in this case the Tab being opened is used with the same
authentication details either via POST, GET or Cookie variables. The problem
comes in when a totally different set of login credentials are being used
(for the same tab/window).  Other user's login particulars should not affect
your login variables.

-----Original Message-----
From: Nitebirdz [mailto:nitebi...@sacredchaos.com] 
Sent: 20 August 2009 10:40 AM
To: php-gene...@lists.php.net
Subject: Re: [PHP] SESSIONS lost sometimes

On Thu, Aug 20, 2009 at 09:44:02AM +0200, Leon du Plessis wrote:
> 
> Since we are on the subject: I have the following similar problem:
> 
> When testing page on internet explorer, I find that one tab's variables
can
> affect another tab's variables. Thus when having the same web-site open
and
> using SESSION variables but for different users, Internet explorer can
> become "disorientated". This also "sometimes" happen when I have two
> separate browsing windows open with Internet Explorer for the same site.
> 
> I have yet to determine if this is an internet explorer, or PHP or
> combination of the two that is causing this condition. 
> 
> To my understanding _SESSION variables should be maintained per session,
tab
> or window. If this has been addressed already, my apologies, but thought
it
> worthwhile to mention.  
> 

I'm a total newbie when it comes to these issues, but it seems to me
that Firefox behaves in the very same manner.  It's not limited to PHP
sessions either.  It's always been my experience on any website that
requires authentication, including the likes of Google Mail, etc.  When
I want to run multiple sessions for different GMail accounts, for
example, I just create a different user profile in Firefox. 

It'd make sense for things to run this way, I think.  After all, I'd
find it quite confusing if I log into Google Docs, open a document (by
default, it opens in a new tab) and I had to log in yet again to be able
to edit it.  


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---

That is how I know browsers to work, yet for a while the bahaviour has
changed. The question in light of this then is, should a new browser or tab
not open a new PHP SESSION ID. Session ID's should be kept if called from
existing pages or ID's? But new pages has no parent? Just wondering.

-----Original Message-----
From: Peter Ford [mailto:p...@justcroft.com] 
Sent: 20 August 2009 10:47 AM
To: php-gene...@lists.php.net
Subject: Re: [PHP] SESSIONS lost sometimes

Leon du Plessis wrote:
> ">> It's not an issue, it's a feature."
> 
> Thanks Arno...but it is a pain also.
> If I work with user A in Tab1 (window1), I want to work with user B
> separately in Tab2. When user in Tab2 logs off, I still want user A to
work,
> and not suddenly have to re-login. Same with bank. If I work with my
company
> account, then my personal account must not become an issue because I am on
> the same machine and site. 
> 
> I have no issue with using FF and IE to do testing as that takes care of
> browser compatibility testing at the same time :-), but I think when you
> start a new session with new values, it should be kept under that
window/tab
> alone. Cookies can take care of more details, but my opinion is data
should
> never be affected across windows/tabs unless the same user is logged in on
> both....even then I would expect PHP to keep data per session. Maybe it
goes
> beyond being an IE or FF issue..the questiojn is...will PHP allow
variables
> from session A become corrupted when session B is in progress when they
> should actually be handled seperately?
> 
> In the end I think it is something I do wrong in PHP with the SESSION
> variables and how I clear them....if so...I don't think PHP should allow
> clearing SESSION variables from other sessions.
>  
> -----Original Message-----
> From: Arno Kuhl [mailto:ak...@telkomsa.net] 
> Sent: 20 August 2009 10:03 AM
> To: 'Leon du Plessis'; php-gene...@lists.php.net
> Subject: RE: [PHP] SESSIONS lost sometimes
> 
> -----Original Message-----
> From: Leon du Plessis [mailto:l...@dsgnit.com] 
> Sent: 20 August 2009 09:44 AM
> To: php-gene...@lists.php.net
> Subject: RE: [PHP] SESSIONS lost sometimes
> 
> Since we are on the subject: I have the following similar problem:
> 
> When testing page on internet explorer, I find that one tab's variables
can
> affect another tab's variables. Thus when having the same web-site open
and
> using SESSION variables but for different users, Internet explorer can
> become "disorientated". This also "sometimes" happen when I have two
> separate browsing windows open with Internet Explorer for the same site.
> 
> I have yet to determine if this is an internet explorer, or PHP or
> combination of the two that is causing this condition. 
> 
> To my understanding _SESSION variables should be maintained per session,
tab
> or window. If this has been addressed already, my apologies, but thought
it
> worthwhile to mention.  
> 
> If someone perhaps have a solution or can confirm this as a known issue
and
> maybe is the same or related to Angelo's problem?
> 
> --------------------
> 
> If different browser windows/tabs on the same client-side computer didn't
> share session info then you'd get the effect of being able to log onto a
> site with one browser window, but find in a second browser window that you
> were not yet logged on. Experience will tell you that you're logged on in
> both browser windows (try it with your online bank). It's not an issue,
it's
> a feature. If you want to be able to use different browser windows as
though
> they were different users then use different browsers e.g. IE and FF on
the
> same client-side computer will look like two separate end users to the
> server, and they don't share session info or cookies.
> 
> Cheers
> Arno
> 
> 

The key thing is that both tabs (or windows) from the same browser are in
the
*same* session - they send the *same* PHPID cookie. PHP is essentially
stateless
- it doesn't care where the request comes from, and ties a session to the
PHPID
cookie if it gets one. As far as PHP knows, requests from different tabs
with
the same PHPID cookie are requests from the same place in the same session.

To get a different session you need a different instance of the browser -
that's
the way browsers have been coded to work. It's not too hard with Firefox,
since
you can set up multiple profiles to have independent Firefox windows on the
same
screen.

-- 
Peter Ford                              phone: 01580 893333
Developer                               fax:   01580 893399
Justcroft International Ltd., Staplehurst, Kent

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
Hi, 

Just a re-iteration on the problem:

Browser 1 has user A details 

Browser 2 has user B details

User B logs off, then user A is suddenly in logged of status also.

The method used to destroy the session is:
// Unset all of the session variables.
$_SESSION = array();

// Finally, destroy the session.
session_destroy();

Problem. User's A session is also destroyed. The concern is, that this
should not be the case. User A must happily continue to work.

So, should PHP destroy the whole browser's session id's variables? My answer
is "No".

User A and user B should have different session ids, if not, then it is
wrong. A new window should have PHP to spawn a new session id (that is, the
request does not come from an existing page where an id has been created
already. If the ids are different, then session_destroy should only clear
variables for relevant session_id, ie only User B's details In this example.


The problem then probably lies in the session_ids being either the same for
the two different logins (although they are on different browser) or
session_destroy clearing data across sessions. (I will test that later). It
would then seem that session ids is setup per location/machine by MS Windows
as per Peter's explanation. Setting up profiles is the the resolution as
suggested. Otherwise, it would be nice if Windows/IE/FF/PHP could identify
when a BRAND NEW page is being opened and then create a brand new session id
for that window/tab.

It is not a huge issue, I was just wondering if someone else had the same
annoying condition. I am happy with the responses and the functionality
somewhere on a wish-list. 

Now Back to Angelo's SESSION problem which sounded like it could be related.

Greetings!
Leon

-----Original Message-----
From: Leon du Plessis [mailto:l...@dsgnit.com] 
Sent: 20 August 2009 10:57 AM
To: 'Peter Ford'; php-gene...@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes



That is how I know browsers to work, yet for a while the bahaviour has
changed. The question in light of this then is, should a new browser or tab
not open a new PHP SESSION ID. Session ID's should be kept if called from
existing pages or ID's? But new pages has no parent? Just wondering.

-----Original Message-----
From: Peter Ford [mailto:p...@justcroft.com] 
Sent: 20 August 2009 10:47 AM
To: php-gene...@lists.php.net
Subject: Re: [PHP] SESSIONS lost sometimes

Leon du Plessis wrote:
> ">> It's not an issue, it's a feature."
> 
> Thanks Arno...but it is a pain also.
> If I work with user A in Tab1 (window1), I want to work with user B
> separately in Tab2. When user in Tab2 logs off, I still want user A to
work,
> and not suddenly have to re-login. Same with bank. If I work with my
company
> account, then my personal account must not become an issue because I am on
> the same machine and site. 
> 
> I have no issue with using FF and IE to do testing as that takes care of
> browser compatibility testing at the same time :-), but I think when you
> start a new session with new values, it should be kept under that
window/tab
> alone. Cookies can take care of more details, but my opinion is data
should
> never be affected across windows/tabs unless the same user is logged in on
> both....even then I would expect PHP to keep data per session. Maybe it
goes
> beyond being an IE or FF issue..the questiojn is...will PHP allow
variables
> from session A become corrupted when session B is in progress when they
> should actually be handled seperately?
> 
> In the end I think it is something I do wrong in PHP with the SESSION
> variables and how I clear them....if so...I don't think PHP should allow
> clearing SESSION variables from other sessions.
>  
> -----Original Message-----
> From: Arno Kuhl [mailto:ak...@telkomsa.net] 
> Sent: 20 August 2009 10:03 AM
> To: 'Leon du Plessis'; php-gene...@lists.php.net
> Subject: RE: [PHP] SESSIONS lost sometimes
> 
> -----Original Message-----
> From: Leon du Plessis [mailto:l...@dsgnit.com] 
> Sent: 20 August 2009 09:44 AM
> To: php-gene...@lists.php.net
> Subject: RE: [PHP] SESSIONS lost sometimes
> 
> Since we are on the subject: I have the following similar problem:
> 
> When testing page on internet explorer, I find that one tab's variables
can
> affect another tab's variables. Thus when having the same web-site open
and
> using SESSION variables but for different users, Internet explorer can
> become "disorientated". This also "sometimes" happen when I have two
> separate browsing windows open with Internet Explorer for the same site.
> 
> I have yet to determine if this is an internet explorer, or PHP or
> combination of the two that is causing this condition. 
> 
> To my understanding _SESSION variables should be maintained per session,
tab
> or window. If this has been addressed already, my apologies, but thought
it
> worthwhile to mention.  
> 
> If someone perhaps have a solution or can confirm this as a known issue
and
> maybe is the same or related to Angelo's problem?
> 
> --------------------
> 
> If different browser windows/tabs on the same client-side computer didn't
> share session info then you'd get the effect of being able to log onto a
> site with one browser window, but find in a second browser window that you
> were not yet logged on. Experience will tell you that you're logged on in
> both browser windows (try it with your online bank). It's not an issue,
it's
> a feature. If you want to be able to use different browser windows as
though
> they were different users then use different browsers e.g. IE and FF on
the
> same client-side computer will look like two separate end users to the
> server, and they don't share session info or cookies.
> 
> Cheers
> Arno
> 
> 

The key thing is that both tabs (or windows) from the same browser are in
the
*same* session - they send the *same* PHPID cookie. PHP is essentially
stateless
- it doesn't care where the request comes from, and ties a session to the
PHPID
cookie if it gets one. As far as PHP knows, requests from different tabs
with
the same PHPID cookie are requests from the same place in the same session.

To get a different session you need a different instance of the browser -
that's
the way browsers have been coded to work. It's not too hard with Firefox,
since
you can set up multiple profiles to have independent Firefox windows on the
same
screen.

-- 
Peter Ford                              phone: 01580 893333
Developer                               fax:   01580 893399
Justcroft International Ltd., Staplehurst, Kent

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
Good questions, I need to talk to the client to determine the exact
requirements and
specifications. Thank you every one for helping me to figure out the
potential db-scheme
and for opening my view with your answers :)

On Wed, Aug 19, 2009 at 10:39 PM, Bob McConnell <r...@cbord.com> wrote:

> From: Ashley Sheridan
> > On Tue, 2009-08-18 at 19:15 +0430, Behzad wrote:
> >>
> >> I'm faced with an interesting and challenging problem.
> >>
> >> Consider a database, designed for a hotel.
> >> At any given time, each room has a different status: It's Busy or
> Reserved,
> >> or Free.
> >>
> >> It's easy to retrieve number of Free rooms at the current time.
> >> But how can I count the number of rooms that were busy during the
> last week
> >> ?
> >>
> >> I would appreciate if you take a brief moment of your time and share
> your
> >> opinion.
> >
> > Keep a table that lists all the rooms along with their current status
> >
> > Keep another table that has these fields:
> >       * room_id (the id from above table)
> >       * status (enumerated value - 'busy','reserved')
> >       * start_date
> >       * end_date
> >
> > Then you perform your query using a join of these two tables, within a
> > particular date range. I've left out 'free' from the second table
> > because there's no point updating the table for a period if a room is
> > not being used.
> >
> > You could also have start_date and end_date as datetime fields, as
> every
> > hotel i've ever been in has a set time for check-in and another for
> > check-out.
>
> It would be easier if you kept a record of the status changes to and
> from busy (check-in and check-out) as a transaction log. Then you can
> scan the log to see the status changes for any time period. But you
> still have to deal with a room that stayed busy for the entire period.
>
> First question, does busy include the time needed by housekeeping to
> clean the room after checkout? You might want to consider a separate
> status for that.
>
> Second question, does the system keep track of when each room is
> reserved? If one is reserved for three nights beginning Friday, can it
> still be used Wednesday for a one or two night stay?
>
> Bob McConnell
>



-- 
Kind regards,
-behzad

--- End Message ---
--- Begin Message ---
On Wed, Aug 19, 2009 at 02:59:43PM -0400, Floyd Resler wrote:
>
> Does anyone know how I can find the width of a PDF in PHP?
>

Would this help?  Search for "width" within the page. 

http://www.php.net/manual/en/ref.pdf.php



--- End Message ---

Reply via email to