php-general Digest 21 Jul 2007 19:20:11 -0000 Issue 4916
php-general Digest 21 Jul 2007 19:20:11 - Issue 4916 Topics (messages 259291 through 259310): Re: Pirate PHP books online? 259291 by: Crayon Shin Chan 259293 by: Jim Lucas 259294 by: Dotan Cohen 259295 by: Crayon Shin Chan 259296 by: Crayon Shin Chan 259301 by: David Powers 259305 by: Larry Garfield 259306 by: Larry Garfield Re: How to skipping the range of values from each element of array?? 259292 by: Jim Lucas PHP parent-child form 259297 by: Man-wai Chang Re: Denial of Service Attack 259298 by: Crayon Shin Chan 259302 by: Dotan Cohen Re: Symfony versus CakePHP? 259299 by: AmirBehzad Eslami 259303 by: Greg Donald 259304 by: Greg Donald 259307 by: Larry Garfield Re: Cannot send session cache limiter... 259300 by: Wesley Acheson Re: PHP Performance and System Load 259308 by: Nathan Nobbe Re: About Login Authentication 259309 by: Nathan Nobbe Re: Save email as .eml file 259310 by: Manuel Lemos 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--- On Saturday 21 July 2007 04:15, Tijnema wrote: Old paper can be recycled, lost energy from computers can't ;) Recycling old paper use energy as well. -- Crayon ---End Message--- ---BeginMessage--- Crayon Shin Chan wrote: On Saturday 21 July 2007 04:15, Tijnema wrote: Old paper can be recycled, lost energy from computers can't ;) Recycling old paper use energy as well. more then likely, recycling a stack of newspapers would cost more then running my computer for a month. -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare ---End Message--- ---BeginMessage--- On 21/07/07, Crayon Shin Chan [EMAIL PROTECTED] wrote: On Saturday 21 July 2007 04:15, Tijnema wrote: Old paper can be recycled, lost energy from computers can't ;) Recycling old paper use energy as well. Oh, the entropy! I believe that the topic was well covered in Asimov's The Last Question. Let there be light! Dotan Cohen http://lyricslist.com/ http://what-is-what.com/ ---End Message--- ---BeginMessage--- On Saturday 21 July 2007 16:20, Jim Lucas wrote: more then likely, recycling a stack of newspapers would cost more then running my computer for a month. Also reminds me of how some people (especially Americans) who drive miles and miles in their big gas-guzzling SUVs so they could drop off their recyclables at a recycling centre. -- Crayon ---End Message--- ---BeginMessage--- On Saturday 21 July 2007 08:58, Richard Lynch wrote: In the olden days, it often turned into slash the cover and donate it and collect tax break, I do believe, but I think that practice was decried and has decreased. Just curious, which part was decried: slash the cover or donate it and collect tax break or collect tax break? -- Crayon ---End Message--- ---BeginMessage--- Richard Lynch wrote: I've got a pretty good idea what your advance was, and what your royalties are. I suspect that your estimate of the advances paid by Apress/friends of Ed is inflated. Royalties are no secret: Apress publishes its standard contract on the web for prospective authors to see. The basic rate is 10% of the net income received by the publisher. Since heavy discounting is prevalent in the publishing industry, this means the author ends up with less than 5% of the book's cover price. So on a book with a cover price of $40, the author gets less than $2. You need to sell a very large number of books to make a reasonable return on the time invested. I'm sticking to my statement that, surprisingly, you've probably made more than some rock stars with bad contract who had only one hit song. I have no doubt that a lot of musicians end up with a very poor deal. So do many authors. The point is that the pirate site in question seems to take particular pleasure in defying the big movie and recording companies. Those companies are profitable enough to sustain the loss of royalties, and big-name artists do get a large enough advance to enjoy a high-octane lifestyle. However, piracy hits the individual author or musician disproportionately. I'm under no illusion that the 2,000+ downloads of my book would have turned into legitimate sales if illegal copies weren't available. But writing about PHP is a highly competitive niche market. Any loss of sales is unwelcome. David Powers ---End Message--- ---BeginMessage--- On Friday 20 July 2007, Richard Lynch wrote: Perhaps your day job should stop paying you, because after you've spent that time, you'll never get it
[PHP] How to skipping the range of values from each element of array??
Hi All, I have an array like that below, array( 'test %ts.%03tu %6tr %a %Ss/%03Hs %st %rm %ru %un %Sh/%A %mt %rv %st', 'squid %ts.%03tu %6tr %a %Ss/%03Hs %st %rm %ru %un %Sh/%A %mt %ea %st %st %lp' 'tmp %ts.%03tu %6tr %a %Ss/%03Hs %st %rm %ru %un %Sh/%A % mt %lp %us %ue %ea' ); In that i need to skip the values from 1 to 10 of each line... could u help me to find the solutions?? Thanks in advance
Re: [PHP] Pirate PHP books online?
On Saturday 21 July 2007 04:15, Tijnema wrote: Old paper can be recycled, lost energy from computers can't ;) Recycling old paper use energy as well. -- Crayon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to skipping the range of values from each element of array??
sivasakthi wrote: Hi All, I have an array like that below, array( 'test %ts.%03tu %6tr %a %Ss/%03Hs %st %rm %ru %un %Sh/%A %mt %rv %st', 'squid %ts.%03tu %6tr %a %Ss/%03Hs %st %rm %ru %un %Sh/%A %mt %ea %st %st %lp' 'tmp %ts.%03tu %6tr %a %Ss/%03Hs %st %rm %ru %un %Sh/%A % mt %lp %us %ue %ea' ); In that i need to skip the values from 1 to 10 of each line... could u help me to find the solutions?? Thanks in advance would you be so kind as to point out the values from 1 to 10. what do you want your output to look like? and when you say skip, do you want to leave them out of the results, or skip the entire row of data? -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pirate PHP books online?
Crayon Shin Chan wrote: On Saturday 21 July 2007 04:15, Tijnema wrote: Old paper can be recycled, lost energy from computers can't ;) Recycling old paper use energy as well. more then likely, recycling a stack of newspapers would cost more then running my computer for a month. -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pirate PHP books online?
On Saturday 21 July 2007 16:20, Jim Lucas wrote: more then likely, recycling a stack of newspapers would cost more then running my computer for a month. Also reminds me of how some people (especially Americans) who drive miles and miles in their big gas-guzzling SUVs so they could drop off their recyclables at a recycling centre. -- Crayon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pirate PHP books online?
On 21/07/07, Crayon Shin Chan [EMAIL PROTECTED] wrote: On Saturday 21 July 2007 04:15, Tijnema wrote: Old paper can be recycled, lost energy from computers can't ;) Recycling old paper use energy as well. Oh, the entropy! I believe that the topic was well covered in Asimov's The Last Question. Let there be light! Dotan Cohen http://lyricslist.com/ http://what-is-what.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Pirate PHP books online?
On Saturday 21 July 2007 08:58, Richard Lynch wrote: In the olden days, it often turned into slash the cover and donate it and collect tax break, I do believe, but I think that practice was decried and has decreased. Just curious, which part was decried: slash the cover or donate it and collect tax break or collect tax break? -- Crayon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP parent-child form
Is there a good book that shows good techniques in coding parent-child forms, for example, an invoice object which has a header(invoice no, date, customer code, invoice total) and multiple items (item no, item name, quantity, price, amount)? -- @~@ Might, Courage, Vision, SINCERITY. / v \ Simplicity is Beauty! May the Force and Farce be with you! /( _ )\ (Xubuntu 7.04) Linux 2.6.22.1 ^ ^ 16:47:01 up 9 days 18:51 0 users load average: 1.01 1.03 1.00 news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Denial of Service Attack
On Saturday 21 July 2007 10:24, Jim Lucas wrote: So, I guess to sum up what the guy is talking about, I think he is right. Some of us might have been DDOSed from making posts on this list. my email address points right back to my web server. What does everybody else think? There are some mailing list archive websites that goes to the website derived from your email address domain and links the favicon (if any) for display next to your posts. Whether that is enough to lead to a DOS is debatable. -- Crayon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Symfony versus CakePHP?
What is difference between Zend Framwork and other frameworks like CakePHP? I'm trying to develop a sample blog for educational purposes in Zend Framwork, but some times I feel that I'm learning a new language or a new programming paradigm. On 7/21/07, Larry Garfield [EMAIL PROTECTED] wrote: Back in January I was looking for a framework for a project that ended up being canceled anyway. :-) I considered both CakePHP and Symfony, and had decided on CakePHP for a very simple reason: It was smaller. It was pure PHP while Symfony relied on Propel which in turn used YAML syntax to define its object model, which it then compiled to XML, which in turn was used to generate both the SQL tables and the base classes in PHP. I saw no reason to learn Yet Another Markup Language (I can't take seriously any markup system that acknowledges that it serves no useful purpose) and install/load/use a multi-meg system when Cake was far smaller, built its classes off of the SQL directly, and didn't require me to learn still more obscure syntax. Of course, I hate Rails-style code-generation frameworks anyway, so I'm kinda glad I never actually built that project. :-) YMMV. On Friday 20 July 2007, Steve Finkelstein wrote: All, I'm terribly sorry if this is a redundant inquiry. I'm a rather inexperienced developer who's catching on quickly, and looking for a framework to build out a project I've been assigned. I'm more of a read a book and try things out type of learner. My question to those with more experience, what exactly is the difference between CakePHP and Symfony? I'm looking into both of them for a potential framework to make robust and scalable code. They both seem to try to obtain the same goals with their project, however Symfony has text written about it, etc. Anyway, thank you for any insight. - sf -- Larry Garfield AIM: LOLG42 [EMAIL PROTECTED] ICQ: 6817012 If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it. -- Thomas Jefferson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session_start(): Cannot send session cache limiter...
From: Richard Lynch [EMAIL PROTECTED] To: Vanessa Vega [EMAIL PROTECTED] Date: Fri, 20 Jul 2007 16:39:51 -0500 (CDT) Subject: Re: [PHP] session_start(): Cannot send session cache limiter... On Fri, July 20, 2007 3:17 am, Paul Scott wrote: On Fri, 2007-07-20 at 16:01 +0800, Vanessa Vega wrote: I already put session_start() on topmost part of the file..but i saved the file as utf-8..and that seems to be the problem..can anyone share their knowledge on this? Set your error_reporting to at least E_ALL and check that there are no problems there first. That should give you more of a clue as to what is happening. Did you save it as UTF-8 with that byte-order-mark (BOM) thingie? Does UTF-8 even HAVE a BOM? I believe a BOM has messed others up in the past. Perhaps Google for your problem before posting will find an answer quicker... :-) -- 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/browse/from/lynch Yeah, I get a buck. So? I believe on Windows with word for example it inserts a byte order mark incorrectly. \ufeff. is what it comes out if I run the native2ascii program.This isn't technically correct behaviour and it shouldn't occur. Regards, Wesley Acheson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pirate PHP books online?
Richard Lynch wrote: I've got a pretty good idea what your advance was, and what your royalties are. I suspect that your estimate of the advances paid by Apress/friends of Ed is inflated. Royalties are no secret: Apress publishes its standard contract on the web for prospective authors to see. The basic rate is 10% of the net income received by the publisher. Since heavy discounting is prevalent in the publishing industry, this means the author ends up with less than 5% of the book's cover price. So on a book with a cover price of $40, the author gets less than $2. You need to sell a very large number of books to make a reasonable return on the time invested. I'm sticking to my statement that, surprisingly, you've probably made more than some rock stars with bad contract who had only one hit song. I have no doubt that a lot of musicians end up with a very poor deal. So do many authors. The point is that the pirate site in question seems to take particular pleasure in defying the big movie and recording companies. Those companies are profitable enough to sustain the loss of royalties, and big-name artists do get a large enough advance to enjoy a high-octane lifestyle. However, piracy hits the individual author or musician disproportionately. I'm under no illusion that the 2,000+ downloads of my book would have turned into legitimate sales if illegal copies weren't available. But writing about PHP is a highly competitive niche market. Any loss of sales is unwelcome. David Powers -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Denial of Service Attack
On 21/07/07, Crayon Shin Chan [EMAIL PROTECTED] wrote: On Saturday 21 July 2007 10:24, Jim Lucas wrote: So, I guess to sum up what the guy is talking about, I think he is right. Some of us might have been DDOSed from making posts on this list. my email address points right back to my web server. What does everybody else think? There are some mailing list archive websites that goes to the website derived from your email address domain and links the favicon (if any) for display next to your posts. Whether that is enough to lead to a DOS is debatable. It might also query SPF records. That could lead to server load as well, as could anything else that 'leads to your server'. But I doubt that a favicon, even if requested by 1000 clients going over the archives in an hour, would cause heavy enough traffic to DDoS a serious webserver. Dotan Cohen http://lyricslist.com/ http://what-is-what.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Symfony versus CakePHP?
On 7/20/07, Larry Garfield [EMAIL PROTECTED] wrote: I saw no reason to learn Yet Another Markup Language (I can't take seriously any markup system that acknowledges that it serves no useful purpose) and YAML takes 5 minutes to learn. It's very useful for quickly adding test fixtures to Rails apps, sample data, and the like. It's a gazillion times lighter weight than XML and just as easy to use as JSON. Much like anything opensource, don't let the name scare you, YAML is good stuff. -- Greg Donald http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Symfony versus CakePHP?
On 7/21/07, AmirBehzad Eslami [EMAIL PROTECTED] wrote: What is difference between Zend Framwork and other frameworks like CakePHP? In a nutshell Zend Framework if bigger, heavier, and does more stuff. I find many parts of it look exactly like parts from the Mojavi MVC framework. Could be a coincidence I guess.. I'm trying to develop a sample blog for educational purposes in Zend Framwork, but some times I feel that I'm learning a new language or a new programming paradigm. It's a learning curve for sure, but once you have one MVC framework in your tool belt, you can pick up others easily. I started off using it for simple things like email address validation and sending HTML emails. You certainly don't have to use the whole thing to get some very good uses from it. -- Greg Donald http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Pirate PHP books online?
On Friday 20 July 2007, Richard Lynch wrote: Perhaps your day job should stop paying you, because after you've spent that time, you'll never get it back? Is this make up things that Larry said day? It must be, because I know you're not that stupid, Richard. If my boss doesn't pay me, it's breach of contract. There's nothing in dispute there. My point was only that when the book was written is irrelevant. It's just as irrelevant as the lag time between your work and your paycheck. No, it is quite relevant. The time spent on the book/program/creative work cannot be gotten back whether you are paid for it or not, therefore that time cannot be stolen from you. There may, however, be a breach of contract involved in either case. It is an important distinction. See below. It's not a semantic game. Copyright infringement is not theft, under the laws of the USA or the laws of physics. To call it such is wrong, inaccurate, misleading, disingenuous, ignorant, and otherwise inappropriate. and a violation of the author's reasonable expectations, Artificially created by the law, yes. And is not the ability to enforce a contract between two people not artificially created by the law as well? One could just as easily argue that all civil law suits, artificial creations by law and not having actual criminal behaviour, should also be thrown out. I never said that artificial laws should all be thrown out. They should, however, be understood in their proper context. A physical object can only be in the possession of one person at a time, per the laws of physics. Property law enhances and structures that natural situation. Information, which includes both ideas and their creative expression, by nature becomes known to anyone it touches without depriving the originator of it. It can be possessed by more than one person simultaneously. Copyright law artificially creates such a restriction on movement in an attempt to make its creation more economically attractive. It is not, however, directly based on physical laws. Note that I am not making a statement about right or wrong about either of the above sorts of laws. I am simply explaining them in proper context, because one cannot make a viable statement about whether they are right or wrong without understanding them in proper context. Speeding while driving is also an artificial law in that regard, as there is no physical law that says a car can only go 30 mph. That doesn't make speeding OK or less illegal, it just means that it is not a natural law. Really people. I find it hard to believe that the otherwise-intelligent people on this list have such a hard time with the concept that something should not be done for reasons that don't involve physical property, just as I find it hard to believe that making up things that someone supposedly said has suddenly become the in thing to do. Your post made it seem that you were in favor of those who choose to infringe on copyright. In every online copyright debate I've gotten into, people always seem to assume that either you're with us or you're with the evil terr'ist pirates. Nothing could be further from the truth, nor further from actual sense. That's why I keep getting into these debates; to point out that it's not a simple copyright is moral and eternal vs. rampant theft and economic downfall question. -- Larry Garfield AIM: LOLG42 [EMAIL PROTECTED] ICQ: 6817012 If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it. -- Thomas Jefferson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Pirate PHP books online?
On Friday 20 July 2007, Richard Lynch wrote: On Wed, July 18, 2007 6:35 am, Jay Blanchard wrote: [snip] Artificially created by the law, yes. [/snip] Just curious, if this artificiality did not exist what could an author's reasonable expectation be? Starvation. I eat quite well giving away code, thank you. It's under the GPL, but most of our clients would really not hurt us if they spread it around without the GPL. It's just some business models that would lead to starvation. Musicians would still have performances, as they have for hundreds of years and as they do now. :-) -- Larry Garfield AIM: LOLG42 [EMAIL PROTECTED] ICQ: 6817012 If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it. -- Thomas Jefferson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Symfony versus CakePHP?
Disclaimer: I have not used Zend Framework. What I am about to say is based on a blog entry by someone whose name I forget so I can't go track it down now. :-) CakePHP, Symfony, Drupal, etc. are full stack systems. That is, they provide an integrated structure and you match your development to that structure. That means doing things the system's way makes life quite straightforward, but going against the grain makes life quite difficult. Zend Framework, ezComponents, etc. are component systems. They're more of a collection of robust tools that you can put together your own way to build something without having a structure presented to you already. That means you're not bound by a given structure, but you also don't have a structure to fall back on. Both are appropriate in different situations. On Saturday 21 July 2007, AmirBehzad Eslami wrote: What is difference between Zend Framwork and other frameworks like CakePHP? I'm trying to develop a sample blog for educational purposes in Zend Framwork, but some times I feel that I'm learning a new language or a new programming paradigm. On 7/21/07, Larry Garfield [EMAIL PROTECTED] wrote: Back in January I was looking for a framework for a project that ended up being canceled anyway. :-) I considered both CakePHP and Symfony, and had decided on CakePHP for a very simple reason: It was smaller. It was pure PHP while Symfony relied on Propel which in turn used YAML syntax to define its object model, which it then compiled to XML, which in turn was used to generate both the SQL tables and the base classes in PHP. I saw no reason to learn Yet Another Markup Language (I can't take seriously any markup system that acknowledges that it serves no useful purpose) and install/load/use a multi-meg system when Cake was far smaller, built its classes off of the SQL directly, and didn't require me to learn still more obscure syntax. Of course, I hate Rails-style code-generation frameworks anyway, so I'm kinda glad I never actually built that project. :-) YMMV. On Friday 20 July 2007, Steve Finkelstein wrote: All, I'm terribly sorry if this is a redundant inquiry. I'm a rather inexperienced developer who's catching on quickly, and looking for a framework to build out a project I've been assigned. I'm more of a read a book and try things out type of learner. My question to those with more experience, what exactly is the difference between CakePHP and Symfony? I'm looking into both of them for a potential framework to make robust and scalable code. They both seem to try to obtain the same goals with their project, however Symfony has text written about it, etc. Anyway, thank you for any insight. - sf -- Larry Garfield AIM: LOLG42 [EMAIL PROTECTED] ICQ: 6817012 If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it. -- Thomas Jefferson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Larry Garfield AIM: LOLG42 [EMAIL PROTECTED] ICQ: 6817012 If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it. -- Thomas Jefferson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Performance and System Load
on the point of class size; i think this is more a design issue than a performance issue. i worked at a place where we had several files w/ classes that were several thousand lines in size. one i remember was over 6000 lines long. personally i would never let something grow that large, but all im saying is we had large classes like that and the system wasnt crawling. -nathan On 7/20/07, Larry Garfield [EMAIL PROTECTED] wrote: On Friday 20 July 2007, Sascha Braun, CEO @ ejackup.com wrote: Dear People, The webserver does only contain the webspace filesystem structure as well as 5 line of PHP Code dummies, for every document in the content management system, to avoid the usage of mod_rewrite. I inherited a CMS at work that did that. Stop. Now. Use mod_rewrite. You'll live longer and spend less on hair-regrowth medication. mod_rewrite is not itself a huge performance hit. If you're on a dedicated server then you can move the mod_rewrite directive to the apache.conf file and disable .htaccess files, which can give you a performance boost, but if a reasonably simple mod_rewrite is the difference that is killing your server then you need to rethink your server. It's a minor issue. You'll get a better performance gain out of a slightly faster processor. Your PHP coding style itself likely has little if any impact on performance. pre vs. post increment is going to be a tiny fraction of a percent compared to the time taken to parse code, hit the database, hit the disk, etc. As others have said, benchmark benchmark benchmark. As a general guideline, the big performance killers I've run in to include: - Parsing. Opcode cache is good, but if you can give it less to cache that helps, too. You said you're already using autoload(), which helps, but make sure that you're not loading gobs of code that you don't use. Even with an opcode cache, that will eat up RAM. - SQL in loops. Never do this. - Cache pretty much everything that you get back from the database if you can, using a static variable. (Not a global; a static variable local to a function or method, or a private class variable.) If you're loading complex objects, cache the fully prepared version. That not only provides a performance boost, but also provides you with a good single-point-of-optimization because it's then much easier to shift that from a static variable or static array to a memcached storage. - Limit your individual transfers. Oft-forgotten, but remember that every file the browser has to request is another HTTP hit on the server. Even if the response from the server is nope, no change, it's still an HTTP hit. That can really hurt your effective performance, both on the server side and client side. Merge your CSS and JS into as few files as reasonable, even if that means that you send more than you need to on the first page request. It helps overall. You can do that manually or automatically. (Drupal, for instance, auto-aggregates CSS and in the next version will auto-aggregate JS, too. That's been a big performance boost.) The same goes for image files. - Apropos of the last, Firebug! The latest version has a great profiler that can show you how long each HTTP request takes. You may find that you spend most of your browser-load time on things that don't involve PHP at all. - EXPLAIN your SQL. That is, the MySQL EXPLAIN command prefixed to any SELECT query will tell you how MySQL is going to parse and process it. Odds are good that adding a few well-placed keys/indexes will make your SQL an order of magnitude faster or more. Also, watch out for filesort. Any time a query has to do a filesort, it gets slow. It always has to filesort if you are doing a WHERE and ORDER BY that use fields in different tables. Avoid that if you can. Much more information in a MySQL group. :-) Again, benchmark it from every direction you can. Odds are, though, that your PHP code itself is not the bottleneck but the server configuration, SQL server, HTTP traffic, etc. are where you're really dying. Cheers. -- Larry Garfield AIM: LOLG42 [EMAIL PROTECTED] ICQ: 6817012 If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it. -- Thomas Jefferson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] About Login Authentication
heres an article http://phpsec.org/articles/2005/password-hashing.htmlfrom the php security consortium. -nathan On 7/21/07, Stephen Johnson [EMAIL PROTECTED] wrote: What type of authentication are you looking to do ??? How secure, and how detailed do you want to be with it? On 7/20/07 9:49 PM, Kelvin Park [EMAIL PROTECTED] wrote: What's a good place in the Internet where I could learn about creating login and member authentication enabled web site? I would appreciate any good references. -- Stephen Johnson The Lone Coder http://www.thumbnailresume.com *Network with your Resume, not just your card.* [EMAIL PROTECTED] http://www.thelonecoder.com *Continuing the struggle against bad code* -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Save email as .eml file
Hello, on 07/18/2007 10:56 AM Rosen said the following: Hi, Is there a way to create e-mail with PHP and save it to .eml file (without sending)? You can use the GetMessage function of this class. It can compose messages like you want, and then it can return the composed message in .eml format as a text string. http://www.phpclasses.org/mimemessage -- Regards, Manuel Lemos Metastorage - Data object relational mapping layer generator http://www.metastorage.net/ 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: filter input; escape output; Email Text
Hello, on 07/20/2007 06:03 PM Richard Lynch said the following: So, I'm trying to be more consistent about escaping my output. I do something like this (only prettier): if (!isset($_REQUEST['blah_id'])) error_out(Bad blah_id input); $blah_id = (int) $_REQUEST['blah_id']; $blah_id_sql = mysql_real_escape_string($blah_id, $connection); $query = select title from blah where blah_id = $blah_id_sql; $blah = mysql_query($query, $connection) or die(DB Error); list($title) = mysql_fetch_row($blah); $title_html = htmlentities($title); $title_email = SOME_FUNCTION_HERE($title); What function should be used to escape output to make it 100% kosher for an email Subject and/or Body, in a plain-text email? The original title came from the outside world, had mysql_real_escape_string() applied to it, and was crammed into the DB. It could have ANY kind of malicious text in it. We do NOT send (and will NEVER send) HTML enhanced (cough, cough) emails. For simplicity sake, I'd probably be happy with a more restrictive function that covered both Subject and Body in this instance. Message headers should be encoded with q-encoding, which is a variant of quoted-printable that includes character set information. This is a bit complicated (too many RFCs to read) but you can use this MIME message composing class to encode your message headers properly. This class also escapes properly line breaks in headers. Malicious line breaks are used by spammers to attack form mail like scripts. They inject line breaks to insert new headers to the message that can make the messages be sent to other addresses. http://www.phpclasses.org/mimemessage -- Regards, Manuel Lemos Metastorage - Data object relational mapping layer generator http://www.metastorage.net/ 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] Re: Pirate PHP books online?
On 21/07/07, Larry Garfield [EMAIL PROTECTED] wrote: I never said that artificial laws should all be thrown out. They should, however, be understood in their proper context. A physical object can only be in the possession of one person at a time, per the laws of physics. Property law enhances and structures that natural situation. Uh, what was all that about quantum mechanics and superposition? Could you please run that by me again? Information, which includes both ideas and their creative expression, by nature becomes known to anyone it touches without depriving the originator of it. It can be possessed by more than one person simultaneously. Copyright law artificially creates such a restriction on movement in an attempt to make its creation more economically attractive. It is not, however, directly based on physical laws. Note that I am not making a statement about right or wrong about either of the above sorts of laws. I am simply explaining them in proper context, because one cannot make a viable statement about whether they are right or wrong without understanding them in proper context. Speeding while driving is also an artificial law in that regard, as there is no physical law that says a car can only go 30 mph. That doesn't make speeding OK or less illegal, it just means that it is not a natural law. In Germany, there is. Get up to 250 KPH and the speed limiter kicks in. It also almost kicks you out of your seat. In every online copyright debate I've gotten into, people always seem to assume that either you're with us or you're with the evil terr'ist pirates. Nothing could be further from the truth, nor further from actual sense. That's why I keep getting into these debates; to point out that it's not a simple copyright is moral and eternal vs. rampant theft and economic downfall question. M$ has already stated how they depend upon the pirates. If eveybody who could not afford Windows as a student switched to linux, then they would have nobody to sell Windows to when those students grow up. Dotan Cohen http://lyricslist.com/ http://what-is-what.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Pirate PHP books online?
Dotan Cohen wrote: On 21/07/07, Larry Garfield [EMAIL PROTECTED] wrote: Speeding while driving is also an artificial law in that regard, as there is no physical law that says a car can only go 30 mph. That doesn't make speeding OK or less illegal, it just means that it is not a natural law. In Germany, there is. Get up to 250 KPH and the speed limiter kicks in. It also almost kicks you out of your seat. If you can't see that that's also an artificial limit and not an actual law of physics...!! -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Denial of Service Attack
Crayon Shin Chan wrote: On Saturday 21 July 2007 10:24, Jim Lucas wrote: So, I guess to sum up what the guy is talking about, I think he is right. Some of us might have been DDOSed from making posts on this list. my email address points right back to my web server. What does everybody else think? There are some mailing list archive websites that goes to the website derived from your email address domain and links the favicon (if any) for display next to your posts. Whether that is enough to lead to a DOS is debatable. Problem with your answer is, is that there would then be logs entires in apache. There were none at all. -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Denial of Service Attack
Dotan Cohen wrote: On 21/07/07, Crayon Shin Chan [EMAIL PROTECTED] wrote: On Saturday 21 July 2007 10:24, Jim Lucas wrote: So, I guess to sum up what the guy is talking about, I think he is right. Some of us might have been DDOSed from making posts on this list. my email address points right back to my web server. What does everybody else think? There are some mailing list archive websites that goes to the website derived from your email address domain and links the favicon (if any) for display next to your posts. Whether that is enough to lead to a DOS is debatable. It might also query SPF records. That could lead to server load as well, as could anything else that 'leads to your server'. But I doubt that a favicon, even if requested by 1000 clients going over the archives in an hour, would cause heavy enough traffic to DDoS a serious webserver. Dotan Cohen http://lyricslist.com/ http://what-is-what.com/ You don't fetch SPF records form port 80 do you? -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pirate PHP books online?
David Powers wrote: I suspect that your estimate of the advances paid by Apress/friends of Ed is inflated. Royalties are no secret: Apress publishes its standard contract on the web for prospective authors to see. The basic rate is 10% of the net income received by the publisher. Since heavy discounting is prevalent in the publishing industry, this means the author ends up with less than 5% of the book's cover price. So on a book with a cover price of $40, the author gets less than $2. Based on the fact that this is almost identical to every other publisher (O'Reilly, Sams, etc.), and based on the fact that Richard said he has a lot of experience in this industry, I suspect his estimate was spot on. You're right, though, it's difficult to get any return on your time investment. :-) Chris -- Chris Shiflett http://shiflett.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Bundled GD compiling?
I'm confused as to certain issues regarding the bundled version. The documentation says:: To use the recommended bundled version of the GD library (which was first bundled in PHP 4.3.0), use the configure option --with-gd. GD library requires libpng and libjpeg to compile. Note: When compiling PHP with libpng, you must use the same version that was linked with the GD library. This (to me) seems ambiguous. How am I suppose to know which libpng the bundled GD library used? So how should I configure? http://www.libgd.org/FAQ_PHP ./configure --with-gd -with-png-dir=/usr --with-jpeg-dir=/usr --with-freetype-dir=/usr' The FAQ says this is all the features? Thanks a bunch. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pirate PHP books online?
I'm living in a country where people do not afford to buy real books. Most people earn $250~$400 per month. $50 for a book is too damn expensive. In addition, since US has restricted business with us, no body ships books to us. And we don't have Credit Card, since Master Card, Visa, Paypal do not offer services to us. How can we read books in such a country? I would like to know your opinions. Thank you. On 7/22/07, Chris Shiflett [EMAIL PROTECTED] wrote: David Powers wrote: I suspect that your estimate of the advances paid by Apress/friends of Ed is inflated. Royalties are no secret: Apress publishes its standard contract on the web for prospective authors to see. The basic rate is 10% of the net income received by the publisher. Since heavy discounting is prevalent in the publishing industry, this means the author ends up with less than 5% of the book's cover price. So on a book with a cover price of $40, the author gets less than $2. Based on the fact that this is almost identical to every other publisher (O'Reilly, Sams, etc.), and based on the fact that Richard said he has a lot of experience in this industry, I suspect his estimate was spot on. You're right, though, it's difficult to get any return on your time investment. :-) Chris -- Chris Shiflett http://shiflett.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session_decode from session handler
I have a similar problem I am facing with session data stored in the database from the set_session_handler. What I am trying to do is show a list of online users and the page they are currenlty viewing. For this purpose I am query the sessions table to get the list of session and from that I loop through to get the session data of each online user. But for some reason, I cannot decode/un-serialise the session data. Any pointers ? cheers, Jeffery On Friday 20 July 2007 08:25, Ryan Graciano wrote: PHP passed $data to my write($id) function, and then I wrote it to the database. In the code below, I have retrieved it from the database. I presume that it used encode_session to generate $data. I tried calling unserialize() on it for good measure, but it wasn't able to parse the data. When I return $data from my method, though, PHP is able to turn it into a $_SESSION. Thanks, - Ryan - Original Message From: Tijnema [EMAIL PROTECTED] To: Ryan Graciano [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Thursday, July 19, 2007 5:28:32 PM Subject: Re: [PHP] session_decode from session handler On 7/19/07, Ryan Graciano [EMAIL PROTECTED] wrote: I'm having an issue getting session_decode to work from my session handler in PHP 5.2.3. Here's a short code snippet that demonstrates what I'm trying to do (from my read handler) - public function read($id) { var_dump($data); // prints out the serialized session correctly $retval = session_decode($data); var_dump($_SESSION); // prints out array(0) {} echo $retval; // prints false return $data; } In my calling function, $_SESSION is updated with everything that was held in $data, which means that $data was not corrupt - it worked when I returned it, but it did not work when I used session_decode. This is a problem because I want to change my read($id) function so that it decodes $data, adds something extra to the $_SESSION, then re-encodes $data and returns it. Thanks, - Ryan How did you get $data? If it's just serialized data, you can simply call unserialize instead of session_decode. Tijnema -- Powered by openSUSE 10.2 (i586) Kernel: 2.6.18.8-0.5-default KDE: 3.5.5 release 45.4 2:19pm up 11 days 18:32, 7 users, load average: 0.42, 0.58, 0.54 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session_decode from session handler
On Sunday 22 July 2007 14:19, Jeffery Fernandez wrote: I have a similar problem I am facing with session data stored in the database from the set_session_handler. What I am trying to do is show a list of online users and the page they are currenlty viewing. For this purpose I am query the sessions table to get the list of session and from that I loop through to get the session data of each online user. But for some reason, I cannot decode/un-serialise the session data. Any pointers ? just following up on this problem. I am using PHP 5.2.3. I also do remember that previously in older versions of PHP, I used to see the session data was the actual serialised data. But now with my testing it just seems to be one long string. Which leads me to beleive that there is some kind of encoding taking place. cheers, Jeffery On Friday 20 July 2007 08:25, Ryan Graciano wrote: PHP passed $data to my write($id) function, and then I wrote it to the database. In the code below, I have retrieved it from the database. I presume that it used encode_session to generate $data. I tried calling unserialize() on it for good measure, but it wasn't able to parse the data. When I return $data from my method, though, PHP is able to turn it into a $_SESSION. Thanks, - Ryan - Original Message From: Tijnema [EMAIL PROTECTED] To: Ryan Graciano [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Thursday, July 19, 2007 5:28:32 PM Subject: Re: [PHP] session_decode from session handler On 7/19/07, Ryan Graciano [EMAIL PROTECTED] wrote: I'm having an issue getting session_decode to work from my session handler in PHP 5.2.3. Here's a short code snippet that demonstrates what I'm trying to do (from my read handler) - public function read($id) { var_dump($data); // prints out the serialized session correctly $retval = session_decode($data); var_dump($_SESSION); // prints out array(0) {} echo $retval; // prints false return $data; } In my calling function, $_SESSION is updated with everything that was held in $data, which means that $data was not corrupt - it worked when I returned it, but it did not work when I used session_decode. This is a problem because I want to change my read($id) function so that it decodes $data, adds something extra to the $_SESSION, then re-encodes $data and returns it. Thanks, - Ryan How did you get $data? If it's just serialized data, you can simply call unserialize instead of session_decode. Tijnema -- Powered by openSUSE 10.2 (i586) Kernel: 2.6.18.8-0.5-default KDE: 3.5.5 release 45.4 2:19pm up 11 days 18:32, 7 users, load average: 0.42, 0.58, 0.54 -- Powered by openSUSE 10.2 (i586) Kernel: 2.6.18.8-0.5-default KDE: 3.5.5 release 45.4 2:24pm up 11 days 18:38, 7 users, load average: 0.45, 0.42, 0.47 pgpMhC1sICAJ7.pgp Description: PGP signature
Re: [PHP] Pirate PHP books online?
On 22/07/07, AmirBehzad Eslami [EMAIL PROTECTED] wrote: I'm living in a country where people do not afford to buy real books. Most people earn $250~$400 per month. $50 for a book is too damn expensive. In addition, since US has restricted business with us, no body ships books to us. And we don't have Credit Card, since Master Card, Visa, Paypal do not offer services to us. How can we read books in such a country? I would like to know your opinions. Thank you. Pirate them? As the books are unavailable for sale in your country, it would be tough for the publisher to make an argument about a lost sale. Dotan Cohen http://lyricslist.com/ http://what-is-what.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Denial of Service Attack
On 22/07/07, Jim Lucas [EMAIL PROTECTED] wrote: It might also query SPF records. That could lead to server load as well, as could anything else that 'leads to your server'. But I doubt that a favicon, even if requested by 1000 clients going over the archives in an hour, would cause heavy enough traffic to DDoS a serious webserver. Dotan Cohen http://lyricslist.com/ http://what-is-what.com/ You don't fetch SPF records form port 80 do you? I was referring to server load, not apache load. Dotan Cohen http://lyricslist.com/ http://what-is-what.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php