Re: [PHP] Closing Session (Revisited)

2011-05-21 Thread Roger Riordan
On Thu, 05 May 2011 08:28:53 -0400, sstap...@mnsi.net (Steve Staples) wrote:

>On Thu, 2011-05-05 at 21:41 +1000, Roger Riordan wrote:
>> 
>> I have developed a common engine which I use for several different websites. 
>> I had been
>> using PHP 5.2.? and IE6 (yes; I know!), and had been able to have multiple 
>> sessions open
>> at once, displaying the same or different websites, without them interfering 
>> with each
>> other. This was incredibly useful; I could be looking at, or even edit, 
>> different parts of
>> the same, or different, websites simultaneously without any problems.
>> 
>> But I recently had a hard disk crash and had to re-install all the system 
>> software. Now I
>> have PHP 5.3 and IE 8, and find that if I try to do this the various 
>> sessions interfere
>> with each other. From the above comment I gather that this is because IE 8 
>> combines all
>> the instances, whereas previously each instance was treated as a different 
>> user.
>> 
>> Is there any simple way to make IE 8 treat each instance as a new user, or 
>> should I switch
>> to Chrome and use the Incognito feature?
>> 
>> Roger Riordan AM
>> http://www.corybas.com/
>> 
>
>The Incognito feature wont give you the results you're looking for.
>>From my experience, the incognito window(s) and tab(s) share the same
>memory/cookie/session space, which is different from the main window...
>which means you will run into the same issue.
>
>Once you close all your incognito windows/tabs, you will release those
>cookies/sessions/memory space and if you open a new one afterwards, then
>you will be fine, but if one tabs stays open, no go :(
>
>Have you looked at the http://ca3.php.net/session_name function, and
>putting that into your site just after your session_start() ?  I believe
>that will fix your issues (as long as your session names are unique),
>but i am not 100% sure.
>
>Steve
>

Thank you for this suggestion. This has solved the more serious half of my 
problems; I can
easily generate a different session name for each website, so that the various 
websites
don't interfere with each other, but I have not been able to devise a way to 
differentiate
between multiple sessions of the same website.

For example, if I open one copy of a website as a visitor I am shown as 
Visitor, but if I
then open another window, and log in as Manager, then go back to the first 
window I am
shown as Manager (with appropriate privileges) there also.

The only way I can think of to overcome this would be to generate a new named 
session
every time I log in, and then to pass the session name as a parameter every 
time I load a
new page. Unfortunately my program is sufficiently complicated that this is 
effectively
impractical, as it would involve tracking down and modifying every point in the 
program at
which a new page can be launched.

It also has a theoretical disadvantage that if someone bookmarks a page they 
will book
mark the session name, but this can fairly readily be overcome.

Is there any alternative way in which a different session name (or equivalent 
flag) can be
attached to each instance of the browser?

(Effectively these problems only affect the developer, as they only apply to 
multiple
instances of the same browser on the same PC.)


PS. At this stage I devised a really nasty kludge, which enables me to run 
multiple copies
without them interfering. In my program new pages are always launched by a 
command of the
general type:

http://localhost/cypalda.com/index.php?level=1&item=22

This loads the file index.php, which is a very brief file in the public 
directory
(cypalda.com in this case). It sets a couple of constants and then transfers 
control to a
file Begin.php, in a private directory. This in turn sets up a whole lot more 
constants,
and then transfers control to the main program, which is common to 5 different 
websites.

I realised that if I specify the session name in index.php, I can make several 
copies of
this file, e.g. index.php, index1.php, index2.php, each of which specified a 
different
session name. I thought this still left me the problem of modifying all the 
points at
which a new page was launched, but then I found that by great good fortune (or 
foresight!)
I had defined a constant $home_page = index.php, and always launched a new page 
with the
basic command
echo ('http://www.corybas.com/

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



Re: [PHP] Closing Session (Revisited)

2011-05-05 Thread Roger Riordan
On Thu, 31 Mar 2011 16:40:06 -0400, eth...@earthlink.net (Ethan Rosenberg) 
wrote:
...
>> > > Can you rephrase the question, Ethan, or give more details?  From
>> > >the way it sounds, you're concerned that destroying a session will
>> > >have implications for other sessions as well, which is not the case
>> > >(unless all sessions are shared).  For example, if you have Chrome,
>> > >Firefox, and Internet Exploder all active, the sessions should be
>> > >different, if even from the very same computer.  However, multiple
>> > >tabs in the same browser will generally be the same session (unless
>> > >it's something like Chrome's Incognito feature).
...

I have developed a common engine which I use for several different websites. I 
had been
using PHP 5.2.? and IE6 (yes; I know!), and had been able to have multiple 
sessions open
at once, displaying the same or different websites, without them interfering 
with each
other. This was incredibly useful; I could be looking at, or even edit, 
different parts of
the same, or different, websites simultaneously without any problems.

But I recently had a hard disk crash and had to re-install all the system 
software. Now I
have PHP 5.3 and IE 8, and find that if I try to do this the various sessions 
interfere
with each other. From the above comment I gather that this is because IE 8 
combines all
the instances, whereas previously each instance was treated as a different user.

Is there any simple way to make IE 8 treat each instance as a new user, or 
should I switch
to Chrome and use the Incognito feature?

Roger Riordan AM
http://www.corybas.com/

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



Re: [PHP] PHP5.3.5: error message for date()

2011-03-05 Thread Roger Riordan
PS. What is "date.sunrise_zenith"? I am surprised that PHP contains a function 
to return
the time of sunrise for a given location, but I thought that latitude, 
longitude, date and
time zone would be all you had to know.


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



Re: [PHP] PHP5.3.5: error message for date()

2011-03-05 Thread Roger Riordan
On Sat, 5 Mar 2011 20:42:07 +1300, si...@welsh.co.nz (Simon J Welsh) wrote:

>On 5/03/2011, at 8:29 PM, clanc...@cybec.com.au wrote:
>
>> After a long battle to get my system back on air after a hard disk crash, I 
>> got PHP 5.3.5
>> running under Apache 2.2.3. I now get a diagnostic every time I call date(), 
>> complaining
>> about a missing parameter. The manual states that the second parameter is 
>> optional, and
>> even phpinfo doesn't know about this new requirement, as it contains the 
>> same diagnostic:
>> 
>> "Warning: phpinfo(): It is not safe to rely on the system's timezone 
>> settings. You are
>> *required* to use the date.timezone setting or the 
>> date_default_timezone_set() function.
>> In case you used any of those methods and you are still getting this 
>> warning, you most
>> likely misspelled the timezone identifier. We selected 'Australia/Melbourne' 
>> for
>> '11.0/DST' instead in D:\Websites\index.php on line 1 Warning: phpinfo(): It 
>> is not safe
>> to rely on the system's timezone settings. You are *required* to use the 
>> date.timezone
>> setting or the date_default_timezone_set() function. In case you used any of 
>> those methods
>> and you are still getting this warning, you most likely misspelled the 
>> timezone
>> identifier. We selected 'Australia/Melbourne' for '11.0/DST' instead in
>> D:\Websites\index.php on line 1 ".
>> 
>> Is this a bug, or a new requirement we will have to get used to?
>> 
>> 
>> 
>> Roger Riordan AM
>
>It's not complaining about a missing parameter, it's complaining about the 
>lack of a specified timezone.
>
>This warning was introduced in PHP5.1, and you either need to set the 
>date.timezone INI setting, either in your php.ini or by using ini_set(), or by 
>passing a valid timezone to date_default_timezone_set() before calling any 
>other date-related functions.
>---
>Simon Welsh
>Admin of http://simon.geek.nz/
>
>Who said Microsoft never created a bug-free program? The blue screen never, 
>ever crashes!
>
>http://www.thinkgeek.com/brain/gimme.cgi?wid=81d520e5e

Thanks for this.  I have put date_default_timezone_set() at the start of my 
program, which
clears up all my bugs, but leaves the bug in PHP.ini. This doesn't worry me.

And now I know where my son found the "10 types of people" T-shirt. 
Unfortunately I seldom
wear T-shirts, and my friends wouldn't get the joke anyway.

With my best wishes,


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