php-general Digest 26 Mar 2008 16:57:51 -0000 Issue 5369

Topics (messages 272106 through 272131):

Re: Cookie Trouble: getting the information back out...
        272106 by: Mark Weaver
        272112 by: tedd
        272113 by: Mark Weaver
        272114 by: tedd
        272121 by: Richard Lynch
        272122 by: Daniel Brown
        272125 by: Daniel Brown

optimilize web page loading
        272107 by: Alain Roger
        272108 by: Paul Scott
        272109 by: Aschwin Wesselius
        272110 by: dhorton.iprimus.com.au
        272118 by: Richard Lynch
        272127 by: Philip Thompson
        272130 by: Wolf

Re: Beware of round() function
        272111 by: tedd
        272120 by: Colin Guthrie

Re: loosing session in new window (IE only)
        272115 by: Lamp Lists
        272116 by: Lamp Lists
        272117 by: Richard Lynch
        272123 by: Lamp Lists
        272124 by: Lamp Lists
        272128 by: Stefan Langwald

Re: session var not changed if file not found error
        272119 by: Richard Lynch

Re: Array and Object
        272126 by: Nathan Nobbe

Re: Date math
        272129 by: Richard Lynch

PHP Book
        272131 by: alexus

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
Jim Lucas wrote:
Mark Weaver wrote:
Andrew Ballard wrote:
On Tue, Mar 25, 2008 at 9:59 PM, Mark Weaver <[EMAIL PROTECTED]> wrote:
Thank you Andrew... Now it all makes perfect sense. Good grief! there's
 so much to learn. It seems that Java was easier. ;)

That's not specific to PHP. It's just how http works, so it's the same
for ASP, Perl, I suspect Java and most (if not all) other languages.
There might be a language that sets a cookie when you assign a value
to a special cookie variable, but I'm not familiar with any.

Andrew


Unless I was doing something differently when I originally wrote this in PERL I don't recall having this issue. At that time I would set the cookie and then redirect (load the index with the full menu) if cookie existed.

Geez! now my $_SESSION isn't persisting to the next page when the screen refreshes. The only thing preventing me from gouging out my eyes right now is that I know I'll get this stuff. It's just a matter of time...


The "problem" that you are encountering is because the $_COOKIE array is "populated" when the script is executed. More then likely the other languages that you used, would allow you to set a cookie and then they would enter them into the "global" array for you, and not make you wait until the next page load.

You could accomplish this yourself by making a wrapper function for the setcookie() function and have your function set the data using setcookie() and having it enter the data directly into the $_COOKIE array.

Something like this should do the trick

<?php
/*
bool setcookie ( string $name
              [, string $value
              [, int $expire
              [, string $path
              [, string $domain
              [, bool $secure
              [, bool $httponly  ]]]]]] )
*/

function mySetCookie($name,
                     $value=null,
                     $expire=0,
                     $path='/',
                     $domain=null,
                     $secure=FALSE,
                     $httponly=FALSE) {

    if ( is_null($domain) )
        $domain = $_SERVER['SERVER_NAME'];

    if ( setcookie( $name, $value, $expire,
                        $path, $domain, $secure, $httponly) ) {
        $_COOKIE[$name] = $value;
        return true;
    }
    return false;
}


?>

Wow! very sweet!!

Thank you Jim. I'm getting my brain good and wrinkled today.

--

Mark
-------------------------
the rule of law is good, however the rule of tyrants just plain sucks!
Real Tax Reform begins with getting rid of the IRS.
==============================================
Powered by CentOS5 (RHEL5)

--- End Message ---
--- Begin Message ---
Mark:

You said:

 I'm gonna shit and go blind cause I haven't got a clue...

and

 The only thing preventing me from gouging out my eyes right now is ...

Are you sure that programming is right for you?

It sounds like you're going to hurt yourself.  This was just a cookie.  :-)

Cheers,

tedd
--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
tedd wrote:
Mark:

You said:

 I'm gonna shit and go blind cause I haven't got a clue...

and

 The only thing preventing me from gouging out my eyes right now is ...

Are you sure that programming is right for you?

It sounds like you're going to hurt yourself.  This was just a cookie.  :-)

Cheers,

tedd

There's an old proverb that basically says that if you present a mule with two choices, (1) a easy, meandering path up the side of a mountain that triples the time it would take to get to the top, and (2) a brutally hard path that goes straight up the mountain, but would most certainly have a good chance of killing the mule if taken, the mule will take path number 2 each and every time.

It's the mule in me! :) I can't help myself. It's like sitting a pair of shoes down in front of a leprechaun; he can't resist the compulsion the shine and clean those shoes. I can't resist the compulsion to solve a problem by coding a solution for it.

I really enjoy programming. It satisfies a creative bent in me, but from time to time I do get very frustrated with it. Especially when, as in this case, it's only a cookie and an easy concept. What frustrates me is I know I'm missing something, but for the life of me I can't see it. Therefore the shoe that I'm compelled to clean and shine keeps dipping itself back into the mud.

For me moving from procedural PERL programming to OOP PHP feels like a paradigm shift! some of it coming back easily and some of it not so easily. Ya know... old dog new tricks... that sort of thing. But if I don't challenge myself and learn new things I could run the risk of getting stuck in a rut of thinking the same way about things and well... never mind... shit! more mud on that shoe again. :)

--

Mark
-------------------------
the rule of law is good, however the rule of tyrants just plain sucks!
Real Tax Reform begins with getting rid of the IRS.
==============================================
Powered by CentOS5 (RHEL5)

--- End Message ---
--- Begin Message ---
At 8:37 AM -0400 3/26/08, Mark Weaver wrote:
I really enjoy programming. It satisfies a creative bent in me, but from time to time I do get very frustrated with it. Especially when, as in this case, it's only a cookie and an easy concept. What frustrates me is I know I'm missing something, but for the life of me I can't see it. Therefore the shoe that I'm compelled to clean and shine keeps dipping itself back into the mud.

Well, if it's any solace to you I remember facing the same problem and finally resorted to a refresh. But it did slow me down a bit.

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
On Tue, March 25, 2008 8:11 pm, Mark Weaver wrote:
> I suspect I already know part of the answer to this, but I'm not sure
> which way to go with it. I've got a project I'm working on and one of
> the things it's got to do is set cookies and then read them later.
> When
> the app was first written I was doing everything in PERL and cookies
> are
> fairly straight-forward, however I'm finding cookies in PHP somewhat
> problematic.
>
> Setting the cookie is a snap, however getting the info back out is,
> well... problematic.
>
> this is basically what I'm doing, what I'm seeing in the cookie, and
> what I'm getting back out.
>
> Setting the cookie
> ==========================
> $values = "blah|blah|blah";
> setcookie("cookiename", $values, time()+$timevalue);

Because IE engineers CANNOT READ a technical document to save their
lives, you MUST supply a "path" if you supply a "time":

setcookie("cookiename", $values, time() + $timevalue, "/");

You also don't tell use what $timevalue is, so that could be something
very wrong... :-)

> Inside the Cookie
> ==========================
> Content: blah%7Cblah%7Cblah
>
>
> Getting info Out Of Cookie
> ==========================
> list($first,$second,$third) = explode("|", $values);

Unless you have register_globals set to "ON" (bad!) then $values will
only have meaning in the setcookie script...

> Cookie Test Page
> ==========================
> if (isset($_COOKIE["cookiename"])){
>       list($first,$second,$third) = explode('|',$_COOKIE["cookiename"]);
>       echo "<p>I found your cookie</p>\n";
>       echo "<p>The following Values were Contained in the cookie:<BR>
>             Username: $first<BR>
>             Password: $second<BR>
>             Type    : $third</p>\n";

You should NOT NOT NOT NOT NOT be storing a username *or* password in
a cookie!!!

> }
> else{
>       echo "<p>I wasn't able to find your cookie.</p>\n";
> }
>
> Now, I've constructed a cookie_test.php page to check things out and
> the
> strange behavior I'm seeing is, upon first execution I get the "else"
> block, but if I hit the browser's reload button I get the "if" block.
> At
> first I thought the cookie wasn't being read at all because of weird
> characters, but then upon reloading the page and seeing the "if" block
> being displayed I'm thoroughly confused. It's gotta something simple
> I'm
> missing.

What *is* in your cookies?

var_dump($_COOKIES);

Perhaps putting '|' in there is not a valid character?

You could base64 encode it or ...

> and I swear if someone tells me to RTFM I'm gonna shit and go blind
> cause I haven't got a clue as to "which" part of the FM to read
> concerning this. :)

It would be some chunk of the Netscape Cookie spec.

Google for "Netscape Cookie spec" and read that.  It's only a page.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?


--- End Message ---
--- Begin Message ---
On Tue, Mar 25, 2008 at 9:49 PM, Andrew Ballard <[EMAIL PROTECTED]> wrote:
> On Tue, Mar 25, 2008 at 9:31 PM, Daniel Brown <[EMAIL PROTECTED]> wrote:
>  >
>  >     Is this block of code executed immediately after the cookie is
>  >  set?  Sometimes PHP works too fast for its own good and the client
>  >  doesn't even realize it has a cookie yet.  Try setting it with one
>  >  page and either sleep()'ing for a bit or forcing a link-click or page
>  >  refresh before checking for the cookie.
>
>  Um... Cookie data ISN'T available to the same script that sets it. If
>  you use setcookie(), all it does is send a header to the browser
>  immediately ahead of the output of your script telling the browser to
>  store those values in either memory or on disk. The value will not
>  appear in the $_COOKIE array until the browser requests the next page
>  and includes the Cookie: header as part of the request.

    You're correct. I was saying basically the same thing, but
re-reading it, it sure doesn't look like it in English.  ;-P

    The sentences should've instead been rewritten like so:
        "Try setting it with one page and forcing a link-click or
sleep()'ing for a bit and then refreshing."

    It wasn't meant to insinuate

-- 
</Daniel P. Brown>
Forensic Services, Senior Unix Engineer
1+ (570-) 362-0283

--- End Message ---
--- Begin Message ---
On Tue, Mar 25, 2008 at 10:22 PM, Mark Weaver <[EMAIL PROTECTED]> wrote:
>
>  Geez! now my $_SESSION isn't persisting to the next page when the screen
>  refreshes. The only thing preventing me from gouging out my eyes right
>  now is that I know I'll get this stuff. It's just a matter of time...

    Sessions are only good on the same server as which they were set.
This is because the server writes the data to a file on its side, then
sends just a session ID cookie to the browser.  This session ID holds
no information except the key to the session file on the server with
which it's associated.

    However, if you're still on the same server, make sure that you've
used session_start() at the top of every page to which you want the
session to carry over.

    EXAMPLE:

Page1    session_start() is used and the UID of the visitor is set.
Page 2   session_start() is used, but no data is read/written.
Page 3   session_start() is NOT used, no $_SESSION data available.
Page 4   session_start() is used, and is re-initialized despite missing Page 3.

-- 
</Daniel P. Brown>
Forensic Services, Senior Unix Engineer
1+ (570-) 362-0283

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

i would like to know if there is a way to know how long does a web page need
to be loaded into browser ?
this is interesting fact for me, as i will optimilize my PHP code in order
to reduce this time to minimum.

i was thinking to use some timestamp but as it will be in PHP, it mean that
it should take time from server and therefore it is not fully representative
from client browser time needed to load page :-(
purpose :
mywebpage.php -> 23 s before optimalization
mywebpage.php -> 12 s after optimalization

do you have any idea ?

-- 
Alain
------------------------------------
Windows XP SP2
PostgreSQL 8.2.4 / MS SQL server 2005
Apache 2.2.4
PHP 5.2.4
C# 2005-2008

--- End Message ---
--- Begin Message ---
On Wed, 2008-03-26 at 09:25 +0100, Alain Roger wrote:
> i would like to know if there is a way to know how long does a web page need
> to be loaded into browser ?
> this is interesting fact for me, as i will optimilize my PHP code in order
> to reduce this time to minimum.

Try using microtime() http://www.php.net/microtime/ on either side of
your output statement(s).

--Paul
> 
-- 
------------------------------------------------------------.
| Chisimba PHP5 Framework - http://avoir.uwc.ac.za           |
:------------------------------------------------------------:

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

--- End Message ---
--- Begin Message ---
Alain Roger wrote:
Hi,

i would like to know if there is a way to know how long does a web page need
to be loaded into browser ?
this is interesting fact for me, as i will optimilize my PHP code in order
to reduce this time to minimum.

i was thinking to use some timestamp but as it will be in PHP, it mean that
it should take time from server and therefore it is not fully representative
from client browser time needed to load page :-(
purpose :
mywebpage.php -> 23 s before optimalization
mywebpage.php -> 12 s after optimalization

do you have any idea ?

Hi,

If you make use of Firefox, you can use the Yslow extension. This will show you the bottlenecks of the page loaded (images, stylesheets, javascripts, total duration, total size etc.).
--

Aschwin Wesselius

/'What you would like to be done to you, do that to the other....'/

--- End Message ---
--- Begin Message ---
Get hold of 
Steve Souders: "High Performance Web Sites: 14 Rules for Faster Pages"
http://www.oreilly.com/catalog/9780596529307/index.html#details 

There is a video at
http://www.oreillynet.com/fyi/blog/2007/09/steve_souders_high_performance.html

Browse the links from which you can see what he is suggesting without getting
the book.

Some of the things suggested are 
- minimise number of files (css, js) downloaded by concatenating
- add an expires header so pages come from browser cache instead of download
- put style sheets at the top of downloaded page and (js) scripts to bottom

Someone else mentioned Yslow, which is one of the tools the author suggests.

David

>-- Original Message --
>Date: Wed, 26 Mar 2008 09:25:46 +0100
>From: "Alain Roger" <[EMAIL PROTECTED]>
>To: "PHP General List" <[EMAIL PROTECTED]>
>Subject: [PHP] optimilize web page loading
>
>
>Hi,
>
>i would like to know if there is a way to know how long does a web page
need
>to be loaded into browser ?
>this is interesting fact for me, as i will optimilize my PHP code in order
>to reduce this time to minimum.
>
>i was thinking to use some timestamp but as it will be in PHP, it mean that
>it should take time from server and therefore it is not fully representative
>from client browser time needed to load page :-(
>purpose :
>mywebpage.php -> 23 s before optimalization
>mywebpage.php -> 12 s after optimalization
>
>do you have any idea ?
>
>-- 
>Alain
>------------------------------------
>Windows XP SP2
>PostgreSQL 8.2.4 / MS SQL server 2005
>Apache 2.2.4
>PHP 5.2.4
>C# 2005-2008


--- End Message ---
--- Begin Message ---
You can use onload and XmlHttpRequest to send back the desktop client
computer date/time and compare that with your start time.

Note that you'll need to test on [a] computer[s] where you know the
date/time is set correctly, which is not true of the general visitor.

On Wed, March 26, 2008 3:25 am, Alain Roger wrote:
> Hi,
>
> i would like to know if there is a way to know how long does a web
> page need
> to be loaded into browser ?
> this is interesting fact for me, as i will optimilize my PHP code in
> order
> to reduce this time to minimum.
>
> i was thinking to use some timestamp but as it will be in PHP, it mean
> that
> it should take time from server and therefore it is not fully
> representative
> from client browser time needed to load page :-(
> purpose :
> mywebpage.php -> 23 s before optimalization
> mywebpage.php -> 12 s after optimalization
>
> do you have any idea ?
>
> --
> Alain
> ------------------------------------
> Windows XP SP2
> PostgreSQL 8.2.4 / MS SQL server 2005
> Apache 2.2.4
> PHP 5.2.4
> C# 2005-2008
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?


--- End Message ---
--- Begin Message ---
On Mar 26, 2008, at 3:40 AM, Aschwin Wesselius wrote:
Alain Roger wrote:
Hi,

i would like to know if there is a way to know how long does a web page need
to be loaded into browser ?
this is interesting fact for me, as i will optimilize my PHP code in order
to reduce this time to minimum.

i was thinking to use some timestamp but as it will be in PHP, it mean that it should take time from server and therefore it is not fully representative
from client browser time needed to load page :-(
purpose :
mywebpage.php -> 23 s before optimalization
mywebpage.php -> 12 s after optimalization

do you have any idea ?

Hi,

If you make use of Firefox, you can use the Yslow extension. This will show you the bottlenecks of the page loaded (images, stylesheets, javascripts, total duration, total size etc.).
--

Aschwin Wesselius


Firebug for Firefox.

~Philip

--- End Message ---
--- Begin Message ---
---- Alain Roger <[EMAIL PROTECTED]> wrote: 
> Hi,
> 
> i would like to know if there is a way to know how long does a web page need
> to be loaded into browser ?
> this is interesting fact for me, as i will optimilize my PHP code in order
> to reduce this time to minimum.
> 
> i was thinking to use some timestamp but as it will be in PHP, it mean that
> it should take time from server and therefore it is not fully representative
> from client browser time needed to load page :-(
> purpose :
> mywebpage.php -> 23 s before optimalization
> mywebpage.php -> 12 s after optimalization
> 
> do you have any idea ?

General rule of thumb used to be 2 seconds...  If your page hasn't outputted 
some form of usable information in 2 seconds or less, people don't stick around.

What's worse is that some browsers require the whole page contents before they 
will draw the page, so you get a white page while the page is loading into the 
browser and the client gets nothing.

Firebug/Yslow are both good extensions to load for Firefox to see where the 
bottlenecks are.

Wolf

--- End Message ---
--- Begin Message ---
At 10:55 AM -0600 3/25/08, [EMAIL PROTECTED] wrote:
Thanks for the info, Jeremy. Regardless of the technical details, my code
still broke. I am little discouraged that an operation that should be so
simple has these sorts of gotchas.

Not that this helps/hurts your observation.

What I find interesting is that the round function has a bias to round down.

I've proved it, but it takes a lot of calculations to demonstrate any significant difference.

Cheers,

tedd


--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:
> Thanks for the info, Jeremy. Regardless of the technical details, my code 
> still broke. I am little discouraged that an operation that should be so 
> simple has these sorts of gotchas.

There can also be some surprisingly awkward to find bugs that are not
even "deliberate" as this appears to be:

See: https://qa.mandriva.com/show_bug.cgi?id=37171

Here GCC optimisations can cause "Buggy float to string conversion (ex
"0.0:" instead of "0.1")".

Comment 16 or there abouts highlights the "solution" for those
interested. It's not a PHP bug but still thought it worth mentioning on
this thread.

Col


--- End Message ---
--- Begin Message ---
----- Original Message ----
From: Hélio Rocha <[EMAIL PROTECTED]>
To: Lamp Lists <[EMAIL PROTECTED]>
Sent: Wednesday, March 26, 2008 5:14:40 AM
Subject: Re: [PHP] loosing session in new window (IE only)

If u open the link in the same window, what's the behaviour?

On Tue, Mar 25, 2008 at 7:49 PM, Lamp Lists <[EMAIL PROTECTED]> wrote:
hi,
i have a list of people on one page. each row, on the end has link <a 
href=person.php?id=123 target=_blank>view details</a>.
it's requested to open detail page in new window.
very few people complained they can't open detail page. all of them use IE.
I wasn't able to reproduce the error, though using GoToMeeting I was able to 
look while customer was doing it.
I put session info on screen to see what's going on and found that new window 
doesn't have session info from "old" window?!? like, new window - new session..

does anybody knows anything about this?

thanks.

-ll




      
____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search.  
http://tools.search.yahoo.com/newsearch/category.php?category=shopping





Works fine. No problems.






      
____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

--- End Message ---
--- Begin Message ---
----- Original Message ----
From: Hélio Rocha <[EMAIL PROTECTED]>
To: Lamp Lists <[EMAIL PROTECTED]>
Sent: Wednesday, March 26, 2008 5:14:40 AM
Subject: Re: [PHP] loosing session in new window (IE only)

If u open the link in the same window, what's the behaviour?

On Tue, Mar 25, 2008 at 7:49 PM, Lamp Lists <[EMAIL PROTECTED]> wrote:
hi,
i have a list of people on one page. each row, on the end has link <a 
href=person.php?id=123 target=_blank>view details</a>.
it's requested to open detail page in new window.
very few people complained they can't open detail page. all of them use IE.
I wasn't able to reproduce the error, though using GoToMeeting I was able to 
look while customer was doing it.
I put session info on screen to see what's going on and found that new window 
doesn't have session info from "old" window?!? like, new window - new session..

does anybody knows anything about this?

thanks.

-ll




Also, forgot one thing: it's not happening to everybody. Just few people. Just 
few IE users.
?!?!?!?

-ll






      
____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

--- End Message ---
--- Begin Message ---
On Tue, March 25, 2008 4:07 pm, Lamp Lists wrote:
> ----- Original Message ----
> From: Andrew Ballard <[EMAIL PROTECTED]>
> To: PHP General list <[EMAIL PROTECTED]>
> Sent: Tuesday, March 25, 2008 3:41:35 PM
> Subject: Re: [PHP] loosing session in new window (IE only)
>
> On Tue, Mar 25, 2008 at 3:49 PM, Lamp Lists <[EMAIL PROTECTED]>
> wrote:
>> hi,
>>  i have a list of people on one page. each row, on the end has link
>> <a href=person.php?id=123 target=_blank>view details</a>.
>>  it's requested to open detail page in new window.
>>  very few people complained they can't open detail page. all of them
>> use IE.
>>  I wasn't able to reproduce the error, though using GoToMeeting I
>> was able to look while customer was doing it.
>>  I put session info on screen to see what's going on and found that
>> new window doesn't have session info from "old" window?!? like, new
>> window - new session.
>>
>>  does anybody knows anything about this?
>>
>>  thanks.
>>
>>  -ll
>
> If they open a new window by clicking on IE (say, on the desktop, the
> QuickLaunch bar, or the Start menu), Windows actually opens a new,
> totally separate process of IE along side the first. The new one will
> share any persistent cookies with the first, since they are written to
> the file system, but sessions do not usually use persistent cookies.
> As long as your users are opening the new window by clicking a link or
> by pressing  Ctrl+N from the first window, the session information
> *should* remain in tact.
>
> Andrew
>
> should - but don't :D
> you're right and  I understand opening new window from "desktop"
> starts new process, but this is happening after visitor hits the link
> "detail view" and that is confusing :(

WILD GUESS ALERT!

Perhaps the MS version of "open popup in new tab/window" is to start a
whole new process?

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?


--- End Message ---
--- Begin Message ---
--- Richard Lynch <[EMAIL PROTECTED]> wrote:

> On Tue, March 25, 2008 4:07 pm, Lamp Lists wrote:
> > ----- Original Message ----
> > From: Andrew Ballard <[EMAIL PROTECTED]>
> > To: PHP General list <[EMAIL PROTECTED]>
> > Sent: Tuesday, March 25, 2008 3:41:35 PM
> > Subject: Re: [PHP] loosing session in new window
> (IE only)
> >
> > On Tue, Mar 25, 2008 at 3:49 PM, Lamp Lists
> <[EMAIL PROTECTED]>
> > wrote:
> >> hi,
> >>  i have a list of people on one page. each row,
> on the end has link
> >> <a href=person.php?id=123 target=_blank>view
> details</a>.
> >>  it's requested to open detail page in new
> window.
> >>  very few people complained they can't open
> detail page. all of them
> >> use IE.
> >>  I wasn't able to reproduce the error, though
> using GoToMeeting I
> >> was able to look while customer was doing it.
> >>  I put session info on screen to see what's going
> on and found that
> >> new window doesn't have session info from "old"
> window?!? like, new
> >> window - new session.
> >>
> >>  does anybody knows anything about this?
> >>
> >>  thanks.
> >>
> >>  -ll
> >
> > If they open a new window by clicking on IE (say,
> on the desktop, the
> > QuickLaunch bar, or the Start menu), Windows
> actually opens a new,
> > totally separate process of IE along side the
> first. The new one will
> > share any persistent cookies with the first, since
> they are written to
> > the file system, but sessions do not usually use
> persistent cookies.
> > As long as your users are opening the new window
> by clicking a link or
> > by pressing  Ctrl+N from the first window, the
> session information
> > *should* remain in tact.
> >
> > Andrew
> >
> > should - but don't :D
> > you're right and  I understand opening new window
> from "desktop"
> > starts new process, but this is happening after
> visitor hits the link
> > "detail view" and that is confusing :(
> 
> WILD GUESS ALERT!
> 
> Perhaps the MS version of "open popup in new
> tab/window" is to start a
> whole new process?
> 
> -- 
> Some people have a "gift" link here.
> Know what I want?
> I want you to buy a CD from some indie artist.
> http://cdbaby.com/from/lynch
> Yeah, I get a buck. So?
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

exactly.
now, what would be my solution to keep session info in
new window?

-ll


      
____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ


--- End Message ---
--- Begin Message ---
--- Richard Lynch <[EMAIL PROTECTED]> wrote:

> On Tue, March 25, 2008 4:07 pm, Lamp Lists wrote:
> > ----- Original Message ----
> > From: Andrew Ballard <[EMAIL PROTECTED]>
> > To: PHP General list <[EMAIL PROTECTED]>
> > Sent: Tuesday, March 25, 2008 3:41:35 PM
> > Subject: Re: [PHP] loosing session in new window
> (IE only)
> >
> > On Tue, Mar 25, 2008 at 3:49 PM, Lamp Lists
> <[EMAIL PROTECTED]>
> > wrote:
> >> hi,
> >>  i have a list of people on one page. each row,
> on the end has link
> >> <a href=person.php?id=123 target=_blank>view
> details</a>.
> >>  it's requested to open detail page in new
> window.
> >>  very few people complained they can't open
> detail page. all of them
> >> use IE.
> >>  I wasn't able to reproduce the error, though
> using GoToMeeting I
> >> was able to look while customer was doing it.
> >>  I put session info on screen to see what's going
> on and found that
> >> new window doesn't have session info from "old"
> window?!? like, new
> >> window - new session.
> >>
> >>  does anybody knows anything about this?
> >>
> >>  thanks.
> >>
> >>  -ll
> >
> > If they open a new window by clicking on IE (say,
> on the desktop, the
> > QuickLaunch bar, or the Start menu), Windows
> actually opens a new,
> > totally separate process of IE along side the
> first. The new one will
> > share any persistent cookies with the first, since
> they are written to
> > the file system, but sessions do not usually use
> persistent cookies.
> > As long as your users are opening the new window
> by clicking a link or
> > by pressing  Ctrl+N from the first window, the
> session information
> > *should* remain in tact.
> >
> > Andrew
> >
> > should - but don't :D
> > you're right and  I understand opening new window
> from "desktop"
> > starts new process, but this is happening after
> visitor hits the link
> > "detail view" and that is confusing :(
> 
> WILD GUESS ALERT!
> 
> Perhaps the MS version of "open popup in new
> tab/window" is to start a
> whole new process?
> 
> -- 
> Some people have a "gift" link here.
> Know what I want?
> I want you to buy a CD from some indie artist.
> http://cdbaby.com/from/lynch
> Yeah, I get a buck. So?
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

exactly.
now, what would be my solution to keep session info in
new window?

-ll


      
____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ


--- End Message ---
--- Begin Message ---
href="person.php?id=123&SESSIONID=..." maybe.. ev0l but works..



2008/3/26, Lamp Lists <[EMAIL PROTECTED]>:
>
>  --- Richard Lynch <[EMAIL PROTECTED]> wrote:
>
>  > On Tue, March 25, 2008 4:07 pm, Lamp Lists wrote:
>  > > ----- Original Message ----
>  > > From: Andrew Ballard <[EMAIL PROTECTED]>
>  > > To: PHP General list <[EMAIL PROTECTED]>
>  > > Sent: Tuesday, March 25, 2008 3:41:35 PM
>  > > Subject: Re: [PHP] loosing session in new window
>  > (IE only)
>  > >
>  > > On Tue, Mar 25, 2008 at 3:49 PM, Lamp Lists
>  > <[EMAIL PROTECTED]>
>  > > wrote:
>  > >> hi,
>  > >>  i have a list of people on one page. each row,
>  > on the end has link
>  > >> <a href=person.php?id=123 target=_blank>view
>  > details</a>.
>  > >>  it's requested to open detail page in new
>  > window.
>  > >>  very few people complained they can't open
>  > detail page. all of them
>  > >> use IE.
>  > >>  I wasn't able to reproduce the error, though
>  > using GoToMeeting I
>  > >> was able to look while customer was doing it.
>  > >>  I put session info on screen to see what's going
>  > on and found that
>  > >> new window doesn't have session info from "old"
>  > window?!? like, new
>  > >> window - new session.
>  > >>
>  > >>  does anybody knows anything about this?
>  > >>
>  > >>  thanks.
>  > >>
>  > >>  -ll
>  > >
>  > > If they open a new window by clicking on IE (say,
>  > on the desktop, the
>  > > QuickLaunch bar, or the Start menu), Windows
>  > actually opens a new,
>  > > totally separate process of IE along side the
>  > first. The new one will
>  > > share any persistent cookies with the first, since
>  > they are written to
>  > > the file system, but sessions do not usually use
>  > persistent cookies.
>  > > As long as your users are opening the new window
>  > by clicking a link or
>  > > by pressing  Ctrl+N from the first window, the
>  > session information
>  > > *should* remain in tact.
>  > >
>  > > Andrew
>  > >
>  > > should - but don't :D
>  > > you're right and  I understand opening new window
>  > from "desktop"
>  > > starts new process, but this is happening after
>  > visitor hits the link
>  > > "detail view" and that is confusing :(
>  >
>  > WILD GUESS ALERT!
>  >
>  > Perhaps the MS version of "open popup in new
>  > tab/window" is to start a
>  > whole new process?
>  >
>  > --
>  > Some people have a "gift" link here.
>  > Know what I want?
>  > I want you to buy a CD from some indie artist.
>  > http://cdbaby.com/from/lynch
>  > Yeah, I get a buck. So?
>  >
>  >
>  > --
>  > PHP General Mailing List (http://www.php.net/)
>  > To unsubscribe, visit: http://www.php.net/unsub.php
>  >
>  >
>
>
> exactly.
>  now, what would be my solution to keep session info in
>  new window?
>
>
>  -ll
>
>
>       
> ____________________________________________________________________________________
>  Be a better friend, newshound, and
>  know-it-all with Yahoo! Mobile.  Try it now.  
> http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
>
>
>
> --
>  PHP General Mailing List (http://www.php.net/)
>  To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Mit freundlichen Grüßen

Stefan Langwald

--- End Message ---
--- Begin Message ---
On Tue, March 25, 2008 8:29 pm, Eric Wood wrote:
> This has baffled me all day on my FC6 php-5.1.6 based server.
>
> On a normal working page, I set a session variable at the top and
> another session variable in the middle of the page/script.  This page
> has no errors nor missing links.  So everything works great.
>
> Now, if I cause at least 1 image in the page to become missing on the
> server (ie, by deleting a .jpg file), then Apache logs the error as
> usual, ie: "File does not exist".  But in addition, my two session
> variables seem to get deleted.  If I put the picture(s) back, then no
> apache errors, and my session vars are set fine.
>
> I've even enabled detailed php error reporting and I get no errors.
>
> Is this normal session behavior?  Please say no.  Any ideas?  I can't
> understand why missing links would cause a session variable's
> annihilation.

It's not normal.

Perhaps you have some kind of 404 error handler that is destroying the
session.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?


--- End Message ---
--- Begin Message ---
On Mon, Mar 24, 2008 at 11:23 AM, VamVan <[EMAIL PROTECTED]> wrote:

> Well anyways please let me handle the problems with decoding. I just
> want to know if there is a way that I could traverse through all the
> elements of the simplexmlobject and still keep the same structure of
> the array. What I mean is
>
>  [Advanced Virtualization Technologies in Workstation 6-20080320 1604]
> => SimpleXMLElement Object
>       (
>           [recordingID] => 932467
>           [hostWebExID] => marketingprograms
>           [name] => Title
>           [createTime] => 03/20/2008 09:04:42
>           [timeZoneID] => 4
>           [size] => 49.441048
>            [recordingType] => 0
>           [duration] => 3218
>       )
>
> Go through all the elements of the object and do some encoding and get
> back the same array structure.
>
> In raw terms I need to know the procedure that does this and still
> keep the same structure of the array.
>
> [Advanced Virtualization Technologies in Workstation 6-20080320 1604]
> => SimpleXMLElement Object
>       (
>            [recordingID] => utf8_decode(932467)
>           [hostWebExID] => utf8_decode(marketingprograms)
>           [name] => utf8_decode(Title)
>           [createTime] => utf8_decode(03/20/2008 09:04:42)
>           [timeZoneID] => utf8_decode(4)
>           [size] => utf8_decode(49.441048)
>            [recordingType] => utf8_decode(0)
>           [duration] => utf8_decode(3218)
>       )


first of all, SimpleXMLElement is not an array, its a class.  It does
support iteration via the foreach construct though.  the foreach iteration
will only go through the first set of elements in the structure, that is it
will only cover the children of the root element.  if you want to traverse
all elements of the structure recursively, use SimpleXMLIterator (and
RecursiveIteratorIterator) from SPL.

heres a simple xample to get you started:

<?php
$xml = '<m><a><b/></a><c/></m>';
$m = new SimpleXMLElement($xml);
foreach($m as $k => $v) { echo "k:$k => v:$v" . PHP_EOL; }
/* outputs
k:a => v:
k:c => v:
*/
$m = new SimpleXMLIterator($xml);
foreach(new RecursiveIteratorIterator($m,
RecursiveIteratorIterator::CHILD_FIRST) as $k => $v) { echo "k:$k => v:$v" .
PHP_EOL; }
/* outputs
k:b => v:
k:a => v:
k:c => v:
*/
-nathan

--- End Message ---
--- Begin Message ---
On Sun, March 23, 2008 11:17 pm, Ron Piggott wrote:
> I have this math equation this list helped me generate a few weeks
> ago.
> The purpose is to calculate how many days have passed between 2 dates.
>
> Right now my output ($difference) is 93.9583333333 days.
>
> I am finding this a little weird.  Does anyone see anything wrong with
> the way this is calculated:
>
> $date1 = strtotime($date1); (March 21st 2008)
> $date2 = strtotime($date2); (December 18th 2007)
>
> echo $date1 => 1206072000
> echo $date2 => 1197954000
>
> #86400 is 60 seconds x 60 minutes x 24 hours (in other words 1 days
> worth of seconds)
>
> $factor = 86400;
>
> $difference = (($date1 - $date2) / $factor);

float division introduces rounding errors, by the nature of a floating
point representation in a finite number of bits.

Use http://php.net/round and http://php.net/int

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?


--- End Message ---
--- Begin Message ---
What's the good PHP book to learn PHP?

-- 
http://alexus.org/

--- End Message ---

Reply via email to