php-general Digest 26 Mar 2008 16:57:51 -0000 Issue 5369
php-general Digest 26 Mar 2008 16:57:51 - 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] -- ---BeginMessage--- 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--- ---BeginMessage--- 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--- ---BeginMessage--- 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
[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
Re: [PHP] optimilize web page loading
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] optimilize web page loading
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'/
RE: [PHP] optimilize web page loading
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 php-general@lists.php.net 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Beware of round() function
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cookie Trouble: getting the information back out...
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cookie Trouble: getting the information back out...
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) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cookie Trouble: getting the information back out...
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] loosing session in new window (IE only)
- 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=_blankview 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
Re: [PHP] loosing session in new window (IE only)
- 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=_blankview 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
Re: [PHP] loosing session in new window (IE only)
On Tue, March 25, 2008 4:07 pm, Lamp Lists wrote: - Original Message From: Andrew Ballard [EMAIL PROTECTED] To: PHP General list php-general@lists.php.net 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=_blankview 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
Re: [PHP] session var not changed if file not found error
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? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Beware of round() function
[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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cookie Trouble: getting the information back out...
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 pI found your cookie/p\n; echo pThe following Values were Contained in the cookie:BR Username: $firstBR Password: $secondBR Type: $third/p\n; You should NOT NOT NOT NOT NOT be storing a username *or* password in a cookie!!! } else{ echo pI 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? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cookie Trouble: getting the information back out...
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] loosing session in new window (IE only)
--- 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 php-general@lists.php.net 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=_blankview 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
Re: [PHP] Cookie Trouble: getting the information back out...
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: Page1session_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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array and Object
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 = 'mab//ac//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
Re: [PHP] optimilize web page loading
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] loosing session in new window (IE only)
href=person.php?id=123SESSIONID=... 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 php-general@lists.php.net 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=_blankview 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
Re: [PHP] optimilize web page loading
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? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date math
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.958333 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? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] optimilize web page loading
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Book
What's the good PHP book to learn PHP? -- http://alexus.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Book
alexus [EMAIL PROTECTED] wrote: What's the good PHP book to learn PHP? -- http://alexus.org/ STFA - this was gone over last week -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Book
On Wed, Mar 26, 2008 at 1:01 PM, Wolf [EMAIL PROTECTED] wrote: alexus [EMAIL PROTECTED] wrote: What's the good PHP book to learn PHP? -- http://alexus.org/ STFA - this was gone over last week STFU would be better. ;-P He was the same one who posted the same question on 20 March. -- /Daniel P. Brown Forensic Services, Senior Unix Engineer 1+ (570-) 362-0283 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Quick email address check
I'm scripting a simple registry where the user can input their name and email address. I'd like to do a quick validity check on the email address they just inputted. I can check the syntax, etc. but want check if the address exists. I realize that servers can take a long time to bounce etc. I'll just deal with this separately. Is there a better way than simply sending a test email to see if it bounces? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: optimilize web page loading
You are really asking an HTML question, if you think about it. At the PHP level, either use output buffering or assemble all your html string as a variable and then echo it. The goal is to compress the string into the minimum number of packets. 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 ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Quick email address check
On Wed, Mar 26, 2008 at 1:28 PM, Al [EMAIL PROTECTED] wrote: I'm scripting a simple registry where the user can input their name and email address. I'd like to do a quick validity check on the email address they just inputted. I can check the syntax, etc. but want check if the address exists. I realize that servers can take a long time to bounce etc. I'll just deal with this separately. Is there a better way than simply sending a test email to see if it bounces? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php You could use PEAR Validate::email() with the hostname lookup. It isn't exactly what you're asking for but I use it a lot with fairly good success. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] date CDT CST UTC
Today, we are in Central Daylight Time CDT in Dallas, Texas, USA -- yes? date on: mail server: Wed Mar 26 11:45:00 CDT 2008 (CORRECT) web server: Wed Mar 26 11:45:00 CST 2008 Note CDT versus CST. date -u mail server: Wed Mar 26 16:45:00 UTC 2008 (CORRECT at 11:45 AM local time [Central Daylight Time (CDT) is UTC minus 5 hours]) web server: Wed Mar 26 17:45:00 UTC 2008 From a test CLI script and from the web page test script on the web server, echo date(Y-m-d H:i:s); returns 2008-03-26 11:45:00. An application PHP script ran on the web server, uses date(Y-m-d H:i:s) to generate a timestamp to put in the body of an email sent with PHP mail(). I think the mail() command on the web server forwards to the actual mail server (but I am not sure -- how do I verify this?). An example email (only after we switched to daylight savings time on 3/10 and I'm sure our admin had to manually update the clock) shows the email header as Mon, 10 Mar 2008 14:35:44 -0500 and in the email client without looking at raw source as Date: March 10, 2008 2:35:44 PM CDT, but the body of the email (which used PHP date(Y-m-d H:i:s)) shows 2008-03-10 13:35:44. Note 13 instead of 14. I've asked the admin to make sure the web server reports CDT (I'm still waiting), but it seems strange that date(Y-m-d H:i:s) from the test scripts already shows the correct info before this change. Any thoughts? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Quick email address check
On Wed, March 26, 2008 12:28 pm, Al wrote: Is there a better way than simply sending a test email to see if it bounces? Yes. Force the user to click on a link to prove that they actually CHECK that email address. Just because it doesn't bounce doesn't mean it's a valid email address. -- 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
Re: [PHP] date CDT CST UTC
On Wed, March 26, 2008 12:50 pm, Dee Ayy wrote: Today, we are in Central Daylight Time CDT in Dallas, Texas, USA -- yes? date on: mail server: Wed Mar 26 11:45:00 CDT 2008 (CORRECT) web server: Wed Mar 26 11:45:00 CST 2008 Note CDT versus CST. date -u mail server: Wed Mar 26 16:45:00 UTC 2008 (CORRECT at 11:45 AM local time [Central Daylight Time (CDT) is UTC minus 5 hours]) web server: Wed Mar 26 17:45:00 UTC 2008 From a test CLI script and from the web page test script on the web server, echo date(Y-m-d H:i:s); returns 2008-03-26 11:45:00. An application PHP script ran on the web server, uses date(Y-m-d H:i:s) to generate a timestamp to put in the body of an email sent with PHP mail(). I think the mail() command on the web server forwards to the actual mail server (but I am not sure -- how do I verify this?). An example email (only after we switched to daylight savings time on 3/10 and I'm sure our admin had to manually update the clock) shows the email header as Mon, 10 Mar 2008 14:35:44 -0500 and in the email client without looking at raw source as Date: March 10, 2008 2:35:44 PM CDT, but the body of the email (which used PHP date(Y-m-d H:i:s)) shows 2008-03-10 13:35:44. Note 13 instead of 14. I've asked the admin to make sure the web server reports CDT (I'm still waiting), but it seems strange that date(Y-m-d H:i:s) from the test scripts already shows the correct info before this change. Any thoughts? Because too many sysadmins were NOT updating their time zone database with package/software updates as they should, the PHP Dev Team got tired of bug reports et al about messed up dates, and they now include a CURRENT copy of the timezone database built-in to PHP. This, of course, violates the principle of having the source in one place... But it saves them a lot of headaches. So PHP knows about the recent date-change of when daylight savings kicks in, but since your sysadmin didn't update the time zone db on the web server the OS does *not* know the correct time. Daylight Savings Time must die! Really, there cannot be any real savings here... The time wasted by humanity to reset clocks and fix all the buglets from this stupid clock-changing game MUST outweight any debatable benefits -- 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
Re: [PHP] Re: optimilize web page loading
On Wed, Mar 26, 2008 at 1:18 PM, Al [EMAIL PROTECTED] wrote: You are really asking an HTML question, if you think about it. At the PHP level, either use output buffering or assemble all your html string as a variable and then echo it. The goal is to compress the string into the minimum number of packets. Yes, but do so smartly. Excessive string concatenation can slow things down as well. On most pages you probably won't notice much difference, but I have seen instances where the difference was painfully obvious. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Quick email address check
Al wrote: I'm scripting a simple registry where the user can input their name and email address. I'd like to do a quick validity check on the email address they just inputted. I can check the syntax, etc. but want check if the address exists. I realize that servers can take a long time to bounce etc. I'll just deal with this separately. Is there a better way than simply sending a test email to see if it bounces? Do an MX lookup on the domain, maybe attempt a brief connection to it. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Quick email address check
Al wrote: I'm scripting a simple registry where the user can input their name and email address. I'd like to do a quick validity check on the email address they just inputted. I can check the syntax, etc. but want check if the address exists. I realize that servers can take a long time to bounce etc. I'll just deal with this separately. Is there a better way than simply sending a test email to see if it bounces? Thanks There may be a SMTP class to help you do it, or you can do it manually but here is a quick process. Look up the MX for thedomain.com. maybe use checkdnsrr(). If not found then it is bad, if found connect and issue the following SMTP commands: MAIL FROM: [EMAIL PROTECTED] 250 ok RCPT TO: [EMAIL PROTECTED] 550 sorry, no mailbox here by that name. (#5.7.17) Optimally you want to see: 250 ok You could also see: 553 sorry, that domain isn't in my list of allowed rcpthosts (#5.7.1) This would mean that there is an MX record for thedomain.com pointing to this server but this server isn't configured to accept mail for this domain. -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Quick email address check
All good suggestions guys. Richard's has the advantage of solving the potential for a delay by the user's email server. I'll have the user submit and tell'm to wait while I check the email address for them. Solves several problems. Al wrote: I'm scripting a simple registry where the user can input their name and email address. I'd like to do a quick validity check on the email address they just inputted. I can check the syntax, etc. but want check if the address exists. I realize that servers can take a long time to bounce etc. I'll just deal with this separately. Is there a better way than simply sending a test email to see if it bounces? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] character encoding
2008. 03. 26, szerda keltezéssel 15.57-kor Bill ezt írta: Hi LAMP A column in a table has Brbeuf in it. (3rd caracter is eacute;) I use that table to send emails. In the body that column shows Brébeuf in Windows Outlook. How could I translate to the correct encoding so that accents show correctly in Outlook ? based on the encoding of your e-mail, my guess is that your data is in some ISO-8859-1 encoding or something like that. of course, you should verify that first. so try to send those emails with that encoding, or what's much better, use utf8 for both your data and your email. I think outlook can cope with that, though I'm not sure ;) greets, Zoltán Németh Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] character encoding
Hi Zoltan, A column in a table has Brbeuf in it. (3rd caracter is eacute;) In the body that column shows Brébeuf in Windows Outlook. How could I translate to the correct encoding so that accents show correctly in Outlook ? based on the encoding of your e-mail, my guess is that your data is in some ISO-8859-1 encoding or something like that. of course, you should verify that first. so try to send those emails with that encoding, or what's much better, use utf8 for both your data and your email. I think outlook can cope with that, though I'm not sure ;) The encoding can be set to utf-8 in the recieved email, what translates the encoding but the sender's outlook window doesn't. It's a site where you can ask the owner to upgrade your account limit by clicking on a mailto link who writes most of the email body. The data used is your record from a Mysql table. When you use that link it opens a email window and the body of that message isn't translated. So the people will see some garbage and may not send the email. If I try to change the encoding in the editing window of Outlook while this garbaged email shows it doesn't work. I still see the garbage, yet my outlook is set for utf-8 !! Bill -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] character encoding
2008. 03. 26, szerda keltezéssel 18.04-kor Bill ezt írta: Hi Zoltan, A column in a table has Brbeuf in it. (3rd caracter is eacute;) In the body that column shows Brbeuf in Windows Outlook. How could I translate to the correct encoding so that accents show correctly in Outlook ? based on the encoding of your e-mail, my guess is that your data is in some ISO-8859-1 encoding or something like that. of course, you should verify that first. so try to send those emails with that encoding, or what's much better, use utf8 for both your data and your email. I think outlook can cope with that, though I'm not sure ;) The encoding can be set to utf-8 in the recieved email, what translates the encoding but the sender's outlook window doesn't. It's a site where you can ask the owner to upgrade your account limit by clicking on a mailto link who writes most of the email body. The data used is your record from a Mysql table. When you use that link it opens a email window and the body of that message isn't translated. So the people will see some garbage and may not send the email. If I try to change the encoding in the editing window of Outlook while this garbaged email shows it doesn't work. I still see the garbage, yet my outlook is set for utf-8 !! then change the collation of that table to utf8 and store all data in utf8 greets Zoltán Németh Bill -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] APC FastCGI != upload progress ?
We can get upload progress to work with the APC extension for PHP 5.2.x only on machines that are not using FastCGI. (Apache2.2 if it matters). Does anyone have a suggestion where to look? Will it even be possible? Thanks in advance, -s -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: optimilize web page loading
Depends on the server and it's load. I've strung together some rather large html strings and they aways take far less time than the transient time on the internet. I used to use OB extensively until one day I took the time to measure the difference. I don't recall the numbers; but, I do recall it was not worth the slight extra trouble to use OB. Now, I simple assemble by html strings with $report .= foo; And then echo $report at the end. It also makes the code very easy to read and follow. Andrew Ballard wrote: On Wed, Mar 26, 2008 at 1:18 PM, Al [EMAIL PROTECTED] wrote: You are really asking an HTML question, if you think about it. At the PHP level, either use output buffering or assemble all your html string as a variable and then echo it. The goal is to compress the string into the minimum number of packets. Yes, but do so smartly. Excessive string concatenation can slow things down as well. On most pages you probably won't notice much difference, but I have seen instances where the difference was painfully obvious. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Quick email address check
Hello, on 03/26/2008 02:28 PM Al said the following: I'm scripting a simple registry where the user can input their name and email address. I'd like to do a quick validity check on the email address they just inputted. I can check the syntax, etc. but want check if the address exists. I realize that servers can take a long time to bounce etc. I'll just deal with this separately. Is there a better way than simply sending a test email to see if it bounces? You may want to try this E-mail validation PHP class that does just that. It simulates an attempt to send a message to the SMTP server of the e-mail domain. It does not finish to send the message. The message could still bounce later, but at least you will still detect some invalid addresses. http://www.phpclasses.org/emailvalidation -- Regards, Manuel Lemos PHP professionals looking for PHP jobs http://www.phpclasses.org/professionals/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: character encoding
Hello, on 03/26/2008 04:57 PM Bill said the following: A column in a table has Brébeuf in it. (3rd caracter is eacute;) I use that table to send emails. In the body that column shows Brébeuf in Windows Outlook. How could I translate to the correct encoding so that accents show correctly in Outlook ? You should not send 8 bit data in your messages without proper quoted printable encoding. Also you need to specify the character set of text you are sending. You may want to try this MIME message composing and sending class that supports quoted printable encoding with any character set either in the text and in the message body. Take a look test_email_message.php for single by character sets or even the test_multibyte_message.php if you are not using multibyte character sets. http://www.phpclasses.org/mimemessage -- Regards, Manuel Lemos PHP professionals looking for PHP jobs http://www.phpclasses.org/professionals/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] APC FastCGI != upload progress ?
steve wrote: We can get upload progress to work with the APC extension for PHP 5.2.x only on machines that are not using FastCGI. (Apache2.2 if it matters). Does anyone have a suggestion where to look? Will it even be possible? Thanks in advance, -s I built a work around. It requires you to run a PHP daemon. It handles the uploads and passes the information off how ever you want. To a DB, to the filesystem. Your choice. From that information, you can create a progress meter. I haven't fleshed out all the bugs, but it seems to work like I want it too at least. Jim Lucas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php