From danielc at analysisandsolutions.com Sat Dec 1 08:54:34 2007 From: danielc at analysisandsolutions.com (Daniel Convissor) Date: Sat, 1 Dec 2007 08:54:34 -0500 Subject: [nycphp-talk] Include vs Include_once In-Reply-To: <6299.33361.qm@web60217.mail.yahoo.com> References: <20071201041142.GA270@panix.com> <6299.33361.qm@web60217.mail.yahoo.com> Message-ID: <20071201135433.GA4645@panix.com> Hi John: On Fri, Nov 30, 2007 at 08:51:57PM -0800, John Zabroski wrote: > > How do you address the fact __autoload magic method is > part of the global namespace and that when two blocks > of code with the same signature are loaded on demand, > the function closest to the top of the stack is > selected? What do you mean by "the function closest to the top of the stack is selected?" You can only have one __autoload() function in your code base otherwise you'll get a fatal error. Also __autoload() does whatever you program it to do. > Do you even use __autoload directly? If so, do you > think your comments above contradict using __autoload > as a best practice for structuring code? No, autoload is not meant to be called directly. I didn't say using autoload is a best practice, though that doesn't mean that it isn't a good/best practice. > Do you use spl_autoload_register, and if so, how? I have not. I just manually declare it the "normal" way in my functions.inc file: function __autoload($class) {} > In my humble opinion, it is these questions that truly > complicate inclusion semantics in PHP. I think you're over-complicating things. > However, such a suggestion > ignores the fact maintenance programming can create > *gaps* and *overlaps* in logic that cause two > functions to exist in the same namespace, Then you haven't written good code. For example, you can "namespace" your functions and classes by prefixing or postfixing them with something unique, like the initials of your company. --Dan -- T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y data intensive web and database programming http://www.AnalysisAndSolutions.com/ 4015 7th Ave #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409 From rolan at omnistep.com Sat Dec 1 09:04:05 2007 From: rolan at omnistep.com (Rolan Yang) Date: Sat, 01 Dec 2007 09:04:05 -0500 Subject: [nycphp-talk] Error from PHP system function In-Reply-To: <200711302129.lAULT7TU017462@ms-smtp-04.rdc-nyc.rr.com> References: <200711302129.lAULT7TU017462@ms-smtp-04.rdc-nyc.rr.com> Message-ID: <475169D5.5060300@omnistep.com> Nelly Yusupova wrote: > Here is the command that I'm trying to execute..... > > system ("/usr/bin/wget -P/tmp --post-data > 'subscribees=$email&adminpw=$password&send_welcome_msg_to_this_batch=0&send_ > notifications_to_list_owner=0' > http://www.emdrhap.org/mailman/admin/$list/members/add", $returnval); > > Nelly. > Try something like $cmd= "/usr/bin/wget -P/tmp --post-data 'subscribees=$email&adminpw=$password&send_welcome_msg_to_this_batch=0&send_notifications_to_list_owner=0' http://www.emdrhap.org/mailman/admin/$list/members/add"; print $cmd; system($cmd,$returnval); to see if there might be something funky going on with the command line. Have you properly escaped the $list, $email, and $password? If a space creeps up in there it could throw it all off. If all else fails, you might want to try the CURL functions to post and retrieve data from a remote script. ~Rolan From ramons at gmx.net Sat Dec 1 12:23:34 2007 From: ramons at gmx.net (David Krings) Date: Sat, 01 Dec 2007 12:23:34 -0500 Subject: [nycphp-talk] switch cases Message-ID: <47519896.7050907@gmx.net> Hi! I make use of a switch statement, but now need to execute the same code of one case for a different case (it is a switch on a file type and some types are to be handled the same). I know how to craft this case using if, but how would I do that with using case within a switch? Is it something like this switch ($a) { case 'a' or 'b': // this is for the case that $a is 'a' or 'b' case 'c': // this is for the case that $a is 'c' default: // this is for the case that $a is neither 'a', 'b', or 'c' } For now I duplicate the code as that for sure works, but that seems to be not that great in case I need to change something within the block of code (have to do it in two places). The PHP manual doesn't cover this case. Any tips are greatly appreciated. David From kenrbnsn at rbnsn.com Sat Dec 1 12:47:36 2007 From: kenrbnsn at rbnsn.com (Ken Robinson) Date: Sat, 01 Dec 2007 12:47:36 -0500 Subject: [nycphp-talk] switch cases In-Reply-To: <47519896.7050907@gmx.net> References: <47519896.7050907@gmx.net> Message-ID: At 12:23 PM 12/1/2007, David Krings wrote: >Hi! > >I make use of a switch statement, but now need to execute the same >code of one case for a different case (it is a switch on a file type >and some types are to be handled the same). I know how to craft this >case using if, but how would I do that with using case within a switch? >Is it something like this >switch ($a) { > case 'a' or 'b': > // this is for the case that $a is 'a' or 'b' > case 'c': > // this is for the case that $a is 'c' > default: > // this is for the case that $a is neither 'a', 'b', or 'c' >} You would list each case, one after another: switch ($a) { case 'a': case 'b': // // stuff for 'a' or 'b' // break; case 'c': // // ..... // break; default: } Ken From ramons at gmx.net Sat Dec 1 13:23:14 2007 From: ramons at gmx.net (David Krings) Date: Sat, 01 Dec 2007 13:23:14 -0500 Subject: [nycphp-talk] switch cases In-Reply-To: <20071201174733.7163gmx1@mx014.gmx.net> References: <47519896.7050907@gmx.net> <20071201174733.7163gmx1@mx014.gmx.net> Message-ID: <4751A692.5080005@gmx.net> Ken Robinson wrote: > At 12:23 PM 12/1/2007, David Krings wrote: >> Hi! >> >> I make use of a switch statement, but now need to execute the same >> code of one case for a different case (it is a switch on a file type >> and some types are to be handled the same). I know how to craft this >> case using if, but how would I do that with using case within a switch? > You would list each case, one after another: > > switch ($a) { > case 'a': > case 'b': Now that was far too easy! Thank you very much! David From jmcgraw1 at gmail.com Sat Dec 1 13:59:12 2007 From: jmcgraw1 at gmail.com (Jake McGraw) Date: Sat, 1 Dec 2007 13:59:12 -0500 Subject: [nycphp-talk] switch cases In-Reply-To: <4751A692.5080005@gmx.net> References: <47519896.7050907@gmx.net> <20071201174733.7163gmx1@mx014.gmx.net> <4751A692.5080005@gmx.net> Message-ID: I've found the following useful if you don't want to use a bunch of if / else if but you need to do more than a simple comparison: switch(true) { case ($a=='a') : // Behaves like a normal switch break; case ($a===1) : // Strict check break; case ($a>$b) : // Do whatever test you'd like break; } - jake On Dec 1, 2007 1:23 PM, David Krings wrote: > Ken Robinson wrote: > > At 12:23 PM 12/1/2007, David Krings wrote: > >> Hi! > >> > >> I make use of a switch statement, but now need to execute the same > >> code of one case for a different case (it is a switch on a file type > >> and some types are to be handled the same). I know how to craft this > >> case using if, but how would I do that with using case within a switch? > > > You would list each case, one after another: > > > > switch ($a) { > > case 'a': > > case 'b': > > Now that was far too easy! Thank you very much! > > David > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > -------------- next part -------------- An HTML attachment was scrubbed... URL: From nelly at cgim.com Sun Dec 2 12:20:21 2007 From: nelly at cgim.com (Nelly Yusupova) Date: Sun, 2 Dec 2007 12:20:21 -0500 Subject: [nycphp-talk] Error from PHP system function In-Reply-To: <475169D5.5060300@omnistep.com> Message-ID: <200712021720.lB2HKWQ5015697@ms-smtp-04.rdc-nyc.rr.com> Thank you all for your suggestions. Although I have no idea why the old script stopped working on the new server, I was able to accomplish the same task with CURL functions. Thank you again! Sincerely, Nelly Yusupova Webgrrls International nelly at cgim.com 917 603-9226 (phone) http://www.webgrrls.com *************************************************************** JOIN WEBGRRLS AT THE NYC WEBGRRLS HOLIDAY CELEBRATION ON DECEMBER 6TH! For more details and to RSVP, go to: http://www.webgrrls.com/newyork-ny/ *************************************************************** -----Original Message----- From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On Behalf Of Rolan Yang Sent: Saturday, December 01, 2007 9:04 AM To: NYPHP Talk Subject: Re: [nycphp-talk] Error from PHP system function Nelly Yusupova wrote: > Here is the command that I'm trying to execute..... > > system ("/usr/bin/wget -P/tmp --post-data > 'subscribees=$email&adminpw=$password&send_welcome_msg_to_this_batch=0 > &send_ > notifications_to_list_owner=0' > http://www.emdrhap.org/mailman/admin/$list/members/add", $returnval); > > Nelly. > Try something like $cmd= "/usr/bin/wget -P/tmp --post-data 'subscribees=$email&adminpw=$password&send_welcome_msg_to_this_batch=0&send_ notifications_to_list_owner=0' http://www.emdrhap.org/mailman/admin/$list/members/add"; print $cmd; system($cmd,$returnval); to see if there might be something funky going on with the command line. Have you properly escaped the $list, $email, and $password? If a space creeps up in there it could throw it all off. If all else fails, you might want to try the CURL functions to post and retrieve data from a remote script. ~Rolan _______________________________________________ New York PHP Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk NYPHPCon 2006 Presentations Online http://www.nyphpcon.com Show Your Participation in New York PHP http://www.nyphp.org/show_participation.php From ramons at gmx.net Sun Dec 2 13:33:56 2007 From: ramons at gmx.net (David Krings) Date: Sun, 02 Dec 2007 13:33:56 -0500 Subject: [nycphp-talk] Error from PHP system function In-Reply-To: <200712021720.lB2HKWQ5015697@ms-smtp-04.rdc-nyc.rr.com> References: <200712021720.lB2HKWQ5015697@ms-smtp-04.rdc-nyc.rr.com> Message-ID: <4752FA94.7070902@gmx.net> Nelly Yusupova wrote: > Thank you all for your suggestions. > > Although I have no idea why the old script stopped working on the new > server, I was able to accomplish the same task with CURL functions. > > Thank you again! Good to read that you got it working. I was following some time ago advice from NYPHP and also made use of cURL, which worked out nicely. That is one of the many reason I like PHP. It has an answer for about everything, cooks your breakfast, and is easy to learn. David From ken at secdat.com Mon Dec 3 08:10:29 2007 From: ken at secdat.com (Kenneth Downs) Date: Mon, 03 Dec 2007 08:10:29 -0500 Subject: [nycphp-talk] [ANNOUNCE] Blog on Databases Message-ID: <47540045.7060705@secdat.com> I've begun a blog series on database skills. Last week was the first post and this week is part 2. Each Monday there will be an entry on one very specific database concept, from the most basic to the advanced. Enjoy! URL: http://database-programmer.blogspot.com -- Kenneth Downs Secure Data Software, Inc. www.secdat.com www.andromeda-project.org 631-689-7200 Fax: 631-689-0527 cell: 631-379-0010 From jmcgraw1 at gmail.com Mon Dec 3 09:29:55 2007 From: jmcgraw1 at gmail.com (Jake McGraw) Date: Mon, 3 Dec 2007 09:29:55 -0500 Subject: [nycphp-talk] [ANNOUNCE] Blog on Databases In-Reply-To: <47540045.7060705@secdat.com> References: <47540045.7060705@secdat.com> Message-ID: Ken: I can already see that this will be a successful series, even though I've been working with databases for the past 5 years, I'm always up for reviewing the basics (this is especially important for anyone who is self taught). - jake ps What was incorrect with last weeks data? On Dec 3, 2007 8:10 AM, Kenneth Downs wrote: > I've begun a blog series on database skills. Last week was the first > post and this week is part 2. Each Monday there will be an entry on one > very specific database concept, from the most basic to the advanced. > Enjoy! > > URL: http://database-programmer.blogspot.com > > -- > Kenneth Downs > Secure Data Software, Inc. > www.secdat.com www.andromeda-project.org > 631-689-7200 Fax: 631-689-0527 > cell: 631-379-0010 > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ken at secdat.com Mon Dec 3 09:35:48 2007 From: ken at secdat.com (Kenneth Downs) Date: Mon, 03 Dec 2007 09:35:48 -0500 Subject: [nycphp-talk] [ANNOUNCE] Blog on Databases In-Reply-To: References: <47540045.7060705@secdat.com> Message-ID: <47541444.1050001@secdat.com> Jake McGraw wrote: > Ken: > > I can already see that this will be a successful series, even though > I've been working with databases for the past 5 years, I'm always up > for reviewing the basics (this is especially important for anyone who > is self taught). > > - jake > > ps What was incorrect with last weeks data? One of the periods ends five minutes after the next period begins, it's the fourth from the bottom. That suggests another post later on about constraints :) > > On Dec 3, 2007 8:10 AM, Kenneth Downs > wrote: > > I've begun a blog series on database skills. Last week was the first > post and this week is part 2. Each Monday there will be an entry > on one > very specific database concept, from the most basic to the > advanced. Enjoy! > > URL: http://database-programmer.blogspot.com > > -- > Kenneth Downs > Secure Data Software, Inc. > www.secdat.com > www.andromeda-project.org > 631-689-7200 Fax: 631-689-0527 > cell: 631-379-0010 > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > > > ------------------------------------------------------------------------ > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php -- Kenneth Downs Secure Data Software, Inc. www.secdat.com www.andromeda-project.org 631-689-7200 Fax: 631-689-0527 cell: 631-379-0010 -------------- next part -------------- An HTML attachment was scrubbed... URL: From johnzabroski at yahoo.com Mon Dec 3 17:01:30 2007 From: johnzabroski at yahoo.com (John Zabroski) Date: Mon, 3 Dec 2007 14:01:30 -0800 (PST) Subject: [nycphp-talk] [ANNOUNCE] Blog on Databases In-Reply-To: Message-ID: <286433.51995.qm@web60217.mail.yahoo.com> Ken already replied to this, however... There is a trick to figuring it out that is really lazy, and doesn't involve scanning with your eyes but scanning with the database itself. Here's a quick hint: Ken formatted the data such that column by column there is a specific delimiter, a pipe ("|"), and row by row there is a specific delimiter, an endline. That means it is trivial to parse it into insert statements on a database. Why not only follow along with Ken's tutorial, but create a database on your home computer and build the sample one table database. I won't say any more because it would be stealing Ken's thunder. --- Jake McGraw wrote: > Ken: > > I can already see that this will be a successful > series, even though I've > been working with databases for the past 5 years, > I'm always up for > reviewing the basics (this is especially important > for anyone who is self > taught). > > - jake > > ps What was incorrect with last weeks data? > > On Dec 3, 2007 8:10 AM, Kenneth Downs > wrote: > > > I've begun a blog series on database skills. Last > week was the first > > post and this week is part 2. Each Monday there > will be an entry on one > > very specific database concept, from the most > basic to the advanced. > > Enjoy! > > > > URL: http://database-programmer.blogspot.com > > > > -- > > Kenneth Downs > > Secure Data Software, Inc. > > www.secdat.com www.andromeda-project.org > > 631-689-7200 Fax: 631-689-0527 > > cell: 631-379-0010 > > > > _______________________________________________ > > New York PHP Community Talk Mailing List > > http://lists.nyphp.org/mailman/listinfo/talk > > > > NYPHPCon 2006 Presentations Online > > http://www.nyphpcon.com > > > > Show Your Participation in New York PHP > > http://www.nyphp.org/show_participation.php > > > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php ____________________________________________________________________________________ Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now. http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ From jmcgraw1 at gmail.com Mon Dec 3 17:21:22 2007 From: jmcgraw1 at gmail.com (Jake McGraw) Date: Mon, 3 Dec 2007 17:21:22 -0500 Subject: [nycphp-talk] [ANNOUNCE] Blog on Databases In-Reply-To: <286433.51995.qm@web60217.mail.yahoo.com> References: <286433.51995.qm@web60217.mail.yahoo.com> Message-ID: Thanks for the tips, my query :-P was not made after giving the problem a real try, I thought the solution would be presented in the second post. - jake On Dec 3, 2007 5:01 PM, John Zabroski wrote: > Ken already replied to this, however... > > There is a trick to figuring it out that is really > lazy, and doesn't involve scanning with your eyes but > scanning with the database itself. Here's a quick > hint: Ken formatted the data such that column by > column there is a specific delimiter, a pipe ("|"), > and row by row there is a specific delimiter, an > endline. That means it is trivial to parse it into > insert statements on a database. > > Why not only follow along with Ken's tutorial, but > create a database on your home computer and build the > sample one table database. > > I won't say any more because it would be stealing > Ken's thunder. > > --- Jake McGraw wrote: > > > Ken: > > > > I can already see that this will be a successful > > series, even though I've > > been working with databases for the past 5 years, > > I'm always up for > > reviewing the basics (this is especially important > > for anyone who is self > > taught). > > > > - jake > > > > ps What was incorrect with last weeks data? > > > > On Dec 3, 2007 8:10 AM, Kenneth Downs > > wrote: > > > > > I've begun a blog series on database skills. Last > > week was the first > > > post and this week is part 2. Each Monday there > > will be an entry on one > > > very specific database concept, from the most > > basic to the advanced. > > > Enjoy! > > > > > > URL: http://database-programmer.blogspot.com > > > > > > -- > > > Kenneth Downs > > > Secure Data Software, Inc. > > > www.secdat.com www.andromeda-project.org > > > 631-689-7200 Fax: 631-689-0527 > > > cell: 631-379-0010 > > > > > > _______________________________________________ > > > New York PHP Community Talk Mailing List > > > http://lists.nyphp.org/mailman/listinfo/talk > > > > > > NYPHPCon 2006 Presentations Online > > > http://www.nyphpcon.com > > > > > > Show Your Participation in New York PHP > > > http://www.nyphp.org/show_participation.php > > > > > > _______________________________________________ > > New York PHP Community Talk Mailing List > > http://lists.nyphp.org/mailman/listinfo/talk > > > > NYPHPCon 2006 Presentations Online > > http://www.nyphpcon.com > > > > Show Your Participation in New York PHP > > http://www.nyphp.org/show_participation.php > > > > > ____________________________________________________________________________________ > Be a better sports nut! Let your teams follow you > with Yahoo Mobile. Try it now. > http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > -------------- next part -------------- An HTML attachment was scrubbed... URL: From davidalanroth at gmail.com Mon Dec 3 22:03:24 2007 From: davidalanroth at gmail.com (David A. Roth) Date: Mon, 3 Dec 2007 22:03:24 -0500 Subject: [nycphp-talk] Best open source package for doing charts and graphs in PHP? Message-ID: I need to produce charts and graphs in PHP for a web site. I have googled and see a lot of things out there. It would be very helpful to get some recommendations on what's best to use in open source to accomplish this in PHP. Thanks in advance, David Roth davidalanroth at gmail.com From rmarscher at beaffinitive.com Tue Dec 4 00:25:22 2007 From: rmarscher at beaffinitive.com (Rob Marscher) Date: Tue, 4 Dec 2007 00:25:22 -0500 Subject: [nycphp-talk] Best open source package for doing charts and graphs in PHP? In-Reply-To: References: Message-ID: On Dec 3, 2007, at 10:03 PM, David A. Roth wrote: > I need to produce charts and graphs in PHP for a web site. I have > googled and see a lot of things out there. It would be very helpful > to get some recommendations on what's best to use in open source to > accomplish this in PHP. JpGraph http://www.aditus.nu/jpgraph/ and/or PHP/SWF Charts http://www.maani.us/charts/index.php Last time this topic came up, the javascript library Plotr was also suggested: http://code.google.com/p/plotr/ From ali at vpproperty.com Tue Dec 4 02:20:03 2007 From: ali at vpproperty.com (ali mohammad) Date: Tue, 4 Dec 2007 02:20:03 -0500 Subject: [nycphp-talk] Best open source package for doing charts and graphsin PHP? In-Reply-To: References: Message-ID: <3E6F267FA8AEC34B88F8E679637000630C8702@S48286.vpproperty.com> Or the pear/image_graph library, if you don't mind using alpha/beta releases. They work great for my web app: http://pear.veggerby.dk/samples/ -----Original Message----- From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On Behalf Of Rob Marscher Sent: Tuesday, December 04, 2007 12:25 AM To: NYPHP Talk Subject: Re: [nycphp-talk] Best open source package for doing charts and graphsin PHP? On Dec 3, 2007, at 10:03 PM, David A. Roth wrote: > I need to produce charts and graphs in PHP for a web site. I have > googled and see a lot of things out there. It would be very helpful > to get some recommendations on what's best to use in open source to > accomplish this in PHP. JpGraph http://www.aditus.nu/jpgraph/ and/or PHP/SWF Charts http://www.maani.us/charts/index.php Last time this topic came up, the javascript library Plotr was also suggested: http://code.google.com/p/plotr/ _______________________________________________ New York PHP Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk NYPHPCon 2006 Presentations Online http://www.nyphpcon.com Show Your Participation in New York PHP http://www.nyphp.org/show_participation.php From jusheehy at vassar.edu Tue Dec 4 08:18:47 2007 From: jusheehy at vassar.edu (Julia Sheehy) Date: Tue, 04 Dec 2007 08:18:47 -0500 Subject: [nycphp-talk] PHP Question -- SID in Oracle Message-ID: <475553B7.70303@vassar.edu> My question is: how can I accurately capture and display the name of the db to which I am connected? We use Oracle here. If you know of a solid online resource for PHP/Oracle guidance which I can tap, please redirect. I'm developing a little application connected to our pre-production database. Once the application is live I'll be pointing it to the live database. In the interim I'd like to note on the screen which database the user is connected to so that the folks beta testing are kept aware (and don't stress out when they've deleted several things they didn't intend to remove). I am attempting to use the getenv function for this purpose: $ORACLE_SID = getenv("ORACLE_SID"); but when I echo it echo "ORACLE_SID = $ORACLE_SID
"; It shows that I am connected to the live database when I am certain (I checked both the connection params and all the data after posting changes) I am connected to pre-production. Thanks either way. I am searching via other sources too. Julia Sheehy Vassar College -------------- next part -------------- A non-text attachment was scrubbed... Name: jusheehy.vcf Type: text/x-vcard Size: 474 bytes Desc: not available URL: From bz-gmort at beezifies.com Tue Dec 4 08:26:03 2007 From: bz-gmort at beezifies.com (Gary Mort) Date: Tue, 04 Dec 2007 08:26:03 -0500 Subject: [nycphp-talk] PHP Question -- SID in Oracle In-Reply-To: <475553B7.70303@vassar.edu> References: <475553B7.70303@vassar.edu> Message-ID: <4755556B.4000708@beezifies.com> Julia Sheehy wrote: > > My question is: how can I accurately capture and display the name of > the db to which I am connected? > > We use Oracle here. If you know of a solid online resource for > PHP/Oracle guidance which I can tap, please redirect. > I don't know about the variable your asking about, but looking over http://www.oracle.com/technology/tech/php/pdf/underground-php-oracle-manual.pdf the examples I see there the database name is specified when the connection is made, so wouldn't that be where to set the name to display to the user? From jusheehy at vassar.edu Tue Dec 4 09:56:05 2007 From: jusheehy at vassar.edu (Julia Sheehy) Date: Tue, 04 Dec 2007 09:56:05 -0500 Subject: [nycphp-talk] PHP Question -- SID in Oracle References: 475553B7.70303@vassar.edu Message-ID: <47556A85.3080300@vassar.edu> *Gary Mort* bz-gmort at beezifies.com Dear Gary, Yes. I can set the database name while making the connection. I use an include file for the connection and make a small change just to the name of the SID when I want to point the whole shebang to the production data. My problem is that the SID name I return in using getenv is wrong. But you gave me a really good idea. Instead of using the standard oci connection $Ora_conn = OCILogon(DB_USER,DB_PASS,DB_NAME) or die ("Couldn't Connect to Oracle"); which uses the define that follows: define('DB_NAME' , '(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = somemachinehere.vassar.edu)(PORT = XXXX)) (CONNECT_DATA = (SID = testserverX)))'); define('DB_USER','myadminuserid'); define('DB_PASS','myadminuserpassword'); I could instead use: $conn = OCILogon($dbuser, $dbpass, $dbtns); $dbuser = 'myadminuserid'; $dbpass = 'myadminpassword'; $dbtns = 'testerverX'; and $dbtns is a variable I can recall accurately. This is fine as long as the web app can resolve the TNS on it's own (in the config) I am playing with this and am hopeful that it will work -------------- next part -------------- A non-text attachment was scrubbed... Name: jusheehy.vcf Type: text/x-vcard Size: 474 bytes Desc: not available URL: From bz-gmort at beezifies.com Tue Dec 4 10:59:32 2007 From: bz-gmort at beezifies.com (Gary Mort) Date: Tue, 04 Dec 2007 10:59:32 -0500 Subject: [nycphp-talk] PHP Question -- SID in Oracle In-Reply-To: <47556A85.3080300@vassar.edu> References: 475553B7.70303@vassar.edu <47556A85.3080300@vassar.edu> Message-ID: <47557964.5090001@beezifies.com> Julia Sheehy wrote: > *Gary Mort* bz-gmort at beezifies.com > > > > Dear Gary, > > Yes. I can set the database name while making the connection. I use > an include file for the connection and make a small change just to > the name of the SID when I want to point the whole shebang to the > production data. > > My problem is that the SID name I return in using getenv is wrong. I guess the question I was driving out is what /sets/ the getenv variable to begin with. From glancing through the docs, I didn't see that mentioned. Generall, an environmental variable is set by the server prior to the script even being executed. In which case, that SID is really just your server setup being "helpful" and expecting you to use the environmental variable in your connection statement. It doesn't actually mean or represent anything beyond what Oracle connection information the server thinks most PHP scripts run on it would want to use. In short, the SID is a broken clock, it will be right twice a day(when your using the database the server is configured to use) but otherwise it is useless information for you. Instead, I'd build up the connection string in a more procedural manner, such as: define('DB_NAME' , 'testserverX'); define('DB_SERVER' , 'somemachinehere.vassar.edu'); define('DB_PORT' , 'XXXX'); define('DB_CONNECTION' , '(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = '. DB_SERVER . ')(PORT = '.DB_PORT.')) (CONNECT_DATA = (SID ='.DB_NAME.' )))'); So if you want to display something conditional in the program, for example: if (DB_NAME == 'testserverX') { echo "

You are using the test server, updates will not affect live data!

"; } Than you can(and yes, 'proper' formatting of the above would be to use CSS to define the text size and text color rather than embedding ugly old h2 and font tags. I'm just too lazy to write out all the styling in an email message.) From tgales at tgaconnect.com Tue Dec 4 11:42:51 2007 From: tgales at tgaconnect.com (Tim Gales) Date: Tue, 04 Dec 2007 11:42:51 -0500 Subject: [nycphp-talk] PHP Question -- SID in Oracle In-Reply-To: <47556A85.3080300@vassar.edu> References: 475553B7.70303@vassar.edu <47556A85.3080300@vassar.edu> Message-ID: <4755838B.1020800@tgaconnect.com> Julia Sheehy wrote: > I could instead use: $conn = OCILogon($dbuser, $dbpass, $dbtns); > > $dbuser = 'myadminuserid'; > $dbpass = 'myadminpassword'; > $dbtns = 'testerverX'; > > and $dbtns is a variable I can recall accurately. This is fine as long > as the web app can resolve the TNS on it's own (in the config) > > I am playing with this and am hopeful that it will work > You might consider creating a table called version_info (or something like that) with things in it like last date of modification to the schema, and maybe whether the database is for QA, Dev, or Production. Then you can check if you're in the right place. (I mean instead of just relying on access denied when someone mungs the config file and forgets to point it to right SID) -- T. Gales & Associates 'Helping People Connect with Technology' http://www.tgaconnect.com From aaron at aarond.com Tue Dec 4 12:59:21 2007 From: aaron at aarond.com (Aaron Deutsch) Date: Tue, 4 Dec 2007 12:59:21 -0500 Subject: [nycphp-talk] zipcode lookup Message-ID: sent on behalf of a co-worker.... I am building a zip code area UI. For instance, a resource is assigned a range of zip codes that they can recruit prospective clients from. The table fields are: RESOURCE_CODE | ZIPCODE Each available zip code is listed with the relative resource code. My problem is the query. On the UI end I don't want to list all 1000 zips for a resource, I'd like to show ranges where possible (e.g. 07748; 07750-07790) in a delimited format. I can then do the inserts without any issues. Is there a way in Oracle to recognize row values that have an increment of one from the previous row in order to split them into a range? Therefore, if I wanted the zips from code M99 it would return any single zips and ranges (07750-07790) as opposed to listing them individually. Requested Row Output Example: Row1: 07748 Row2: 07750-07790 And so on.. I can do this with PHP, but I figure if Oracle can do it the application would be a lot faster. I believe another way to do this would be to change the chapter table to have low and high values, but I'd still have the problem of initially populating the new table with the ranges. Also, I'm sure there are other ways do this. If I'm off track please guide me. Thanks for your help. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dorgan at donaldorgan.com Tue Dec 4 13:26:54 2007 From: dorgan at donaldorgan.com (Donald J Organ IV) Date: Tue, 04 Dec 2007 13:26:54 -0500 Subject: [nycphp-talk] zipcode lookup In-Reply-To: References: Message-ID: <47559BEE.4010201@donaldorgan.com> An HTML attachment was scrubbed... URL: From cliff at pinestream.com Wed Dec 5 13:58:50 2007 From: cliff at pinestream.com (Cliff Hirsch) Date: Wed, 05 Dec 2007 13:58:50 -0500 Subject: [nycphp-talk] Canonical hostname help Message-ID: If I want to redirect domain.com to www.domain.com (or for that matter anything.domain.com to www.domain.com I have figured out (but not tested) the following so far: RewriteEngine on RewriteCond %{HTTP_HOST} ^domain\.com$ [NC] RewriteRule ^(.*)$ http://www.domain.com/$1 [L, R=301] But what about https? How can I make the redirect work for both http and https transactions, redirecting http to http and https to https? Cliff -------------- next part -------------- An HTML attachment was scrubbed... URL: From jcampbell1 at gmail.com Wed Dec 5 14:28:16 2007 From: jcampbell1 at gmail.com (John Campbell) Date: Wed, 5 Dec 2007 14:28:16 -0500 Subject: [nycphp-talk] Canonical hostname help In-Reply-To: References: Message-ID: <8f0676b40712051128r34fefd0q5aba7766458e5ad0@mail.gmail.com> This should work: RewriteEngine on RewriteCond %{HTTP_HOST} !^www\.example\.com [NC] RewriteCond %{HTTP_HOST} !^$ RewriteCond %{SERVER_PORT} !^443$ RewriteRule ^/(.*)$ http://www.example.com/$1 [R=301,L] RewriteCond %{HTTP_HOST} !^www\.example\.com [NC] RewriteCond %{HTTP_HOST} !^$ RewriteCond %{SERVER_PORT} ^443$ RewriteRule ^/(.*)$ https://www.example.com/$1 [R=301,L] -john c From cliff at pinestream.com Wed Dec 5 14:44:43 2007 From: cliff at pinestream.com (Cliff Hirsch) Date: Wed, 05 Dec 2007 14:44:43 -0500 Subject: [nycphp-talk] Canonical hostname help In-Reply-To: <8f0676b40712051128r34fefd0q5aba7766458e5ad0@mail.gmail.com> Message-ID: On 12/5/07 2:28 PM, "John Campbell" wrote: > This should work: > > RewriteEngine on > > RewriteCond %{HTTP_HOST} !^www\.example\.com [NC] > RewriteCond %{HTTP_HOST} !^$ > RewriteCond %{SERVER_PORT} !^443$ > RewriteRule ^/(.*)$ http://www.example.com/$1 [R=301,L] > > RewriteCond %{HTTP_HOST} !^www\.example\.com [NC] > RewriteCond %{HTTP_HOST} !^$ > RewriteCond %{SERVER_PORT} ^443$ > RewriteRule ^/(.*)$ https://www.example.com/$1 [R=301,L] > Thanks John! That should do the trick. From paulcheung at tiscali.co.uk Wed Dec 5 16:39:31 2007 From: paulcheung at tiscali.co.uk (PaulCheung) Date: Wed, 5 Dec 2007 21:39:31 -0000 Subject: [nycphp-talk] MySQL table updating References: <001601c82a1b$5699c220$0300a8c0@X9183> <4740A874.9060402@nyphp.com> Message-ID: <001701c83787$522b6f30$0300a8c0@X9183> I am using the MySQL Update for the first time and do not think I am doing it correctly. I have checked coding examples and my coding (to me) looks correct. but am not updating my table and I cannot see what it is I am doing wrong. "); echo('================' . "
"); echo('$self = ' . $self . "
"); echo('$referer = ' . $referer . "
"); echo('$access = ' . $access . "
"); echo('$nr0 = ' . $nr0 . "
"); echo('$testno = ' . $testno . "
"); echo('$actualdata = ' . $actualdata . "
"); echo('$actualresult = ' . $actualresult . "
"); echo('$testnote = ' . $testnote . "
"); #connect to MySQL $conn = mysql_connect("localhost", "paul", "enter") or die( "Err:Conn" ); #select the specified database $rs = mysql_select_db( "test_db", $conn ) or die( "Err:Db" ); #create $rs = mysql_query( $sql, $conn ); $query = ("UPDATE tr_test_record SET tr_actualdata = '$actualdata', tr_actualresult = '$actualresult', tr_testnote = '$testnote' WHERE tr_access = '$access' AND tr_testno = '$testno' LIMIT 1"); echo("
" . '$query = ' . "
" . $query . "
"); mysql_close($conn); exit(); ?> ***************************** OUTPUT RESULTS ***************************** NEW_UPDATE_TR.PHP ================ $self = /tp_update_tr.php $referer = http://localhost/new_tp_update.php $access = 73226318 $nr0 = 9 $testno = 001 $actualdata = AO $actualresult = AR $testnote = TN $query = UPDATE tr_test_record SET tr_actualdata = 'AO', tr_actualresult = 'AR', tr_testnote = 'TN' WHERE tr_access = '73226318' AND tr_testno = '001' LIMIT 1 From ben at projectskyline.com Wed Dec 5 16:50:10 2007 From: ben at projectskyline.com (Ben Sgro) Date: Wed, 05 Dec 2007 16:50:10 -0500 Subject: [nycphp-talk] MySQL table updating In-Reply-To: <001701c83787$522b6f30$0300a8c0@X9183> References: <001601c82a1b$5699c220$0300a8c0@X9183> <4740A874.9060402@nyphp.com> <001701c83787$522b6f30$0300a8c0@X9183> Message-ID: <47571D12.8080004@projectskyline.com> Hello, Looks good to me. Maybe the where clause is never getting met. - Ben PaulCheung wrote: > I am using the MySQL Update for the first time and do not think I am > doing it correctly. I have checked coding examples and my coding (to > me) looks correct. but am not updating my table and I cannot see what > it is I am doing wrong. > > > $self = $_SERVER['PHP_SELF']; > $referer = $_SERVER['HTTP_REFERER']; > $access = $_SESSION['access']; > $nr0 = $_SESSION['nr0']; > $testno = $_SESSION['testno']; > $actualdata = $_POST['actualdata']; > $actualresult = $_POST['actualresult']; > $testnote = $_POST['testnote']; > > $_SESSION['actualdata'] = $actualdata; > $_SESSION['actualresult'] = $actualresult; > $_SESSION['testnote'] = $testnote; > > echo('NEW_UPDATE_TR.PHP' . "
"); > echo('================' . "
"); > echo('$self = ' . $self . "
"); > echo('$referer = ' . $referer . "
"); > echo('$access = ' . $access . "
"); > echo('$nr0 = ' . $nr0 . "
"); > echo('$testno = ' . $testno . "
"); > echo('$actualdata = ' . $actualdata . "
"); > echo('$actualresult = ' . $actualresult . "
"); > echo('$testnote = ' . $testnote . "
"); > > #connect to MySQL > $conn = mysql_connect("localhost", "paul", "enter") or die( "Err:Conn" ); > > #select the specified database > $rs = mysql_select_db( "test_db", $conn ) or die( "Err:Db" ); > > #create > $rs = mysql_query( $sql, $conn ); > > $query = ("UPDATE tr_test_record > SET tr_actualdata = '$actualdata', tr_actualresult > = '$actualresult', tr_testnote = '$testnote' > WHERE tr_access = '$access' > AND tr_testno = '$testno' > LIMIT 1"); > > echo("
" . '$query = ' . "
" . $query . "
"); > > mysql_close($conn); > exit(); > ?> > > > > > ***************************** > OUTPUT RESULTS > ***************************** > > > NEW_UPDATE_TR.PHP > ================ > $self = /tp_update_tr.php > $referer = http://localhost/new_tp_update.php > $access = 73226318 > $nr0 = 9 > $testno = 001 > $actualdata = AO > $actualresult = AR > $testnote = TN > > $query = > UPDATE tr_test_record SET tr_actualdata = 'AO', tr_actualresult = > 'AR', tr_testnote = 'TN' WHERE tr_access = '73226318' AND tr_testno = > '001' LIMIT 1 > > > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > From ramons at gmx.net Wed Dec 5 17:07:34 2007 From: ramons at gmx.net (David Krings) Date: Wed, 05 Dec 2007 17:07:34 -0500 Subject: [nycphp-talk] MySQL table updating In-Reply-To: <001701c83787$522b6f30$0300a8c0@X9183> References: <001601c82a1b$5699c220$0300a8c0@X9183> <4740A874.9060402@nyphp.com> <001701c83787$522b6f30$0300a8c0@X9183> Message-ID: <47572126.7040908@gmx.net> PaulCheung wrote: > I am using the MySQL Update for the first time and do not think I am > doing it correctly. I have checked coding examples and my coding (to me) > looks correct. but am not updating my table and I cannot see what it is > I am doing wrong. Does it generate an error when you paste the resulting query into the MySQL Query Browser? When I craft queries I often test them first using the query browser. That way I can find out much quicker what is going wrong and modified the query there and test again before changing it in code. Just looking at things I cannot see anything wrong, but pipe it into the query browser and see what happens. If you don't like the MySQL tools, take a look at EnginSiteSite's MySQL client. What MySQL splits into three tools is in EnginSite's single client. Also, when looking at the table, did you refresh the view? If you use the MySQL query browser to look and edit the table values you need to refresh the query result to see any changes. Regardless of all that, you can write echos just like this: echo 'Some text'; or if you ever happen to use the \n and don't want to make sure that you don't forget to use the " for that case, just use the " all the time as in echo "Some text"; And make use of concatenating strings when you want to output an entire block, such as echo "Line 1". "Line 2". "Line 3"; Which is what you already do with the break tag. You can also concatenate strings with it. I also use the echo for small pieces of static HTML as I find that to be easier to deal with than having the >?php ?> tags floating around. Yes, it is slower, but I guess for our pruposes we can spare that millisecond for now. David From ajai at bitblit.net Wed Dec 5 17:26:12 2007 From: ajai at bitblit.net (Ajai Khattri) Date: Wed, 5 Dec 2007 17:26:12 -0500 (EST) Subject: [nycphp-talk] Canonical hostname help In-Reply-To: <8f0676b40712051128r34fefd0q5aba7766458e5ad0@mail.gmail.com> Message-ID: On Wed, 5 Dec 2007, John Campbell wrote: > This should work: > > RewriteEngine on > > RewriteCond %{HTTP_HOST} !^www\.example\.com [NC] > RewriteCond %{HTTP_HOST} !^$ > RewriteCond %{SERVER_PORT} !^443$ > RewriteRule ^/(.*)$ http://www.example.com/$1 [R=301,L] > > RewriteCond %{HTTP_HOST} !^www\.example\.com [NC] > RewriteCond %{HTTP_HOST} !^$ > RewriteCond %{SERVER_PORT} ^443$ > RewriteRule ^/(.*)$ https://www.example.com/$1 [R=301,L] Shouldn't the first rule use port 80 instead of 443? -- Aj. From dirn at dirnonline.com Wed Dec 5 17:30:31 2007 From: dirn at dirnonline.com (Andy Dirnberger) Date: Wed, 5 Dec 2007 17:30:31 -0500 Subject: [nycphp-talk] MySQL table updating In-Reply-To: <001701c83787$522b6f30$0300a8c0@X9183> References: <001601c82a1b$5699c220$0300a8c0@X9183> <4740A874.9060402@nyphp.com> <001701c83787$522b6f30$0300a8c0@X9183> Message-ID: <000601c8378e$728917d0$579b4770$@com> > #select the specified database > $rs = mysql_select_db( "test_db", $conn ) or die( "Err:Db" ); > > #create > $rs = mysql_query( $sql, $conn ); > > $query = ("UPDATE tr_test_record > SET tr_actualdata = '$actualdata', tr_actualresult = > '$actualresult', tr_testnote = '$testnote' > WHERE tr_access = '$access' > AND tr_testno = '$testno' > LIMIT 1"); > Perhaps I am reading this wrong, but it appears you are calling mysql_query() using a variable called $sql which never has a value (thus executing no query at all), and then in the next line of code you are setting $query equal to your query. Try doing $rs = mysql_query ($query, $conn); after you assign the string to $query. From dirn at dirnonline.com Wed Dec 5 17:31:53 2007 From: dirn at dirnonline.com (Andy Dirnberger) Date: Wed, 5 Dec 2007 17:31:53 -0500 Subject: [nycphp-talk] Canonical hostname help In-Reply-To: References: <8f0676b40712051128r34fefd0q5aba7766458e5ad0@mail.gmail.com> Message-ID: <000701c8378e$a340b630$e9c22290$@com> > > RewriteCond %{SERVER_PORT} !^443$ [snip] > > Shouldn't the first rule use port 80 instead of 443? > The first rule uses not 443. From cliff at pinestream.com Wed Dec 5 17:35:23 2007 From: cliff at pinestream.com (Cliff Hirsch) Date: Wed, 05 Dec 2007 17:35:23 -0500 Subject: [nycphp-talk] Canonical hostname help In-Reply-To: Message-ID: On 12/5/07 5:26 PM, "Ajai Khattri" wrote: > On Wed, 5 Dec 2007, John Campbell wrote: > >> This should work: >> >> RewriteEngine on >> >> RewriteCond %{HTTP_HOST} !^www\.example\.com [NC] >> RewriteCond %{HTTP_HOST} !^$ >> RewriteCond %{SERVER_PORT} !^443$ >> RewriteRule ^/(.*)$ http://www.example.com/$1 [R=301,L] >> >> RewriteCond %{HTTP_HOST} !^www\.example\.com [NC] >> RewriteCond %{HTTP_HOST} !^$ >> RewriteCond %{SERVER_PORT} ^443$ >> RewriteRule ^/(.*)$ https://www.example.com/$1 [R=301,L] > > > Shouldn't the first rule use port 80 instead of 443? There's a ! on the 443, so it should work. Otherwise ^80 From ajai at bitblit.net Wed Dec 5 18:19:48 2007 From: ajai at bitblit.net (Ajai Khattri) Date: Wed, 5 Dec 2007 18:19:48 -0500 (EST) Subject: [nycphp-talk] Canonical hostname help In-Reply-To: Message-ID: On Wed, 5 Dec 2007, Cliff Hirsch wrote: > On 12/5/07 5:26 PM, "Ajai Khattri" wrote: > > > On Wed, 5 Dec 2007, John Campbell wrote: > > > >> This should work: > >> > >> RewriteEngine on > >> > >> RewriteCond %{HTTP_HOST} !^www\.example\.com [NC] > >> RewriteCond %{HTTP_HOST} !^$ > >> RewriteCond %{SERVER_PORT} !^443$ > >> RewriteRule ^/(.*)$ http://www.example.com/$1 [R=301,L] > >> > >> RewriteCond %{HTTP_HOST} !^www\.example\.com [NC] > >> RewriteCond %{HTTP_HOST} !^$ > >> RewriteCond %{SERVER_PORT} ^443$ > >> RewriteRule ^/(.*)$ https://www.example.com/$1 [R=301,L] > > > > > > Shouldn't the first rule use port 80 instead of 443? > > There's a ! on the 443, so it should work. Otherwise ^80 Just seems like a strange way to write it: if (not port 443) is not logically the same as: if (port 80) -- Aj. From jcampbell1 at gmail.com Wed Dec 5 19:20:49 2007 From: jcampbell1 at gmail.com (John Campbell) Date: Wed, 5 Dec 2007 19:20:49 -0500 Subject: [nycphp-talk] Canonical hostname help In-Reply-To: References: Message-ID: <8f0676b40712051620t31593ddaw3accb09f04e0a3c8@mail.gmail.com> > Just seems like a strange way to write it: > > > if (not port 443) > > > is not logically the same as: > > > if (port 80) You make a good point. The original will not work for ports other than 80 even though it looks like it might, I think it would be better to write the script like this: RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC] RewriteCond %{HTTP_HOST} !^$ RewriteCond %{SERVER_PORT} ^80$ RewriteRule ^/(.*)$ http://www.example.com/$1 [R=301,L] RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC] RewriteCond %{HTTP_HOST} !^$ RewriteCond %{SERVER_PORT} ^443$ RewriteRule ^/(.*)$ https://www.example.com/$1 [R=301,L] RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC] RewriteCond %{HTTP_HOST} !^$ RewriteCond %{SERVER_PORT} !^443|80$ RewriteRule ^/(.*)$ http://www.example.com:%{SERVER_PORT}/$1 [R=301,L] This way http://foo.example.com:8080/ -> http://www.example.com:8080/. Regards, John From rick at click-rick.net Thu Dec 6 09:58:39 2007 From: rick at click-rick.net (Rick Retzko) Date: Thu, 6 Dec 2007 09:58:39 -0500 Subject: [nycphp-talk] Help with a self:: ish problem Message-ID: <005301c83818$7d7c0730$0301a8c0@adam> Gents/Ladies - Some help please with my PHP5 OOP learning curve: I'm trying to use a $this variable to call a function within a class. I know the following works: class actions { private $_aData; private $_table; public function __construct(){ $this->_aData=array(); $this->_table=FALSE; } private function update(){ echo 'Update being executed!'; return TRUE; } //public functions ================================== public function do_action($table,$data){ //direct action activity //assumption: $data['action'] will contain action definition $this->_table=$table; $this->_aData=$data; $completed=self::update(); //<== THIS IS THE PROBLEM LINE return $completed; } } When I change that line to "$completed=self::$this->_aData['action'].'()';" (which contains the string 'update'), the line is read, but nothing happens. When I add "$action=$this->_aData['action'].'()';", then change the line to "$completed=self::$action;", I get the following error message: Fatal error: Access to undeclared static property: actions::$action in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\cjmea\hs_choir\classes\class.actions.php5 on line 37. All help is appreciated! Best Regards - Rick rick at click-rick.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From rick at click-rick.net Thu Dec 6 10:07:24 2007 From: rick at click-rick.net (Rick Retzko) Date: Thu, 6 Dec 2007 10:07:24 -0500 Subject: [nycphp-talk] Canonical hostname help In-Reply-To: References: Message-ID: <005e01c83819$b60dba70$0301a8c0@adam> Hi - I don't have an answer on this, but a good article on mod Rewrite was in the latest issue of PHP|architect. Advise if you need a copy. Best Regards - Rick ============ rick at click-rick.net _____ From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On Behalf Of Cliff Hirsch Sent: Wednesday, December 05, 2007 1:59 PM To: NYPHP Talk Subject: [nycphp-talk] Canonical hostname help If I want to redirect domain.com to www.domain.com (or for that matter anything.domain.com to www.domain.com I have figured out (but not tested) the following so far: RewriteEngine on RewriteCond %{HTTP_HOST} ^domain\.com$ [NC] RewriteRule ^(.*)$ http://www.domain.com/$1 [L, R=301] But what about https? How can I make the redirect work for both http and https transactions, redirecting http to http and https to https? Cliff -------------- next part -------------- An HTML attachment was scrubbed... URL: From jmcgraw1 at gmail.com Thu Dec 6 10:08:24 2007 From: jmcgraw1 at gmail.com (Jake McGraw) Date: Thu, 6 Dec 2007 10:08:24 -0500 Subject: [nycphp-talk] Help with a self:: ish problem In-Reply-To: <005301c83818$7d7c0730$0301a8c0@adam> References: <005301c83818$7d7c0730$0301a8c0@adam> Message-ID: Have you tried using a callback? If the function name passed to do_action is declared within the current object you should be able to perform the following: call_user_func($this,'update'); Check out the section on callbacks: http://us.php.net/callback and the function call_user_func: http://us.php.net/manual/en/function.call-user-func.php - jake On Dec 6, 2007 9:58 AM, Rick Retzko wrote: > Gents/Ladies - > > Some help please with my PHP5 OOP learning curve: > > I'm trying to use a $this variable to call a function within a class. I > know the following works: > > class actions { > > private $_aData; > private $_table; > > public function __construct(){ > $this->_aData=array(); > $this->_table=FALSE; > } > > private function update(){ > echo 'Update being executed!'; > return TRUE; > } > > //public functions ================================== > public function do_action($table,$data){ > //direct action activity > //assumption: $data['action'] will contain action definition > $this->_table=$table; > $this->_aData=$data; > > $completed=self::update(); //<== THIS IS THE PROBLEM LINE > > return $completed; > > } > } > > When I change that line to > "$completed=self::$this->_aData['action'].'()';" (which contains the string > 'update'), the line is read, but nothing happens. > When I add "$action=$this->_aData['action'].'()';", then change the line > to "$completed=self::$action;", I get the following error message: > *Fatal error*: Access to undeclared static property: actions::$action in *C:\Program > Files\Apache Software > Foundation\Apache2.2\htdocs\cjmea\hs_choir\classes\class.actions.php5* on > line *37.* > ** > All help is appreciated! > > > Best Regards - > > Rick > rick at click-rick.net > > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cliff at pinestream.com Thu Dec 6 10:19:31 2007 From: cliff at pinestream.com (Cliff Hirsch) Date: Thu, 06 Dec 2007 10:19:31 -0500 Subject: [nycphp-talk] Help with a self:: ish problem In-Reply-To: Message-ID: >> class actions { >> >> private function update(){ >> echo 'Update being executed!'; >> return TRUE; >> } >> >> //public functions ================================== >> public function do_action($table,$data){ >> //direct action activity >> //assumption: $data['action'] will contain action definition >> $this->_table=$table; >> $this->_aData=$data; >> >> $completed=self::update(); //<== THIS IS THE PROBLEM LINE >> Try $completed=$this->update() Update is not a static function. If you want to use self, use static function update()..... -------------- next part -------------- An HTML attachment was scrubbed... URL: From rick at click-rick.net Thu Dec 6 10:29:09 2007 From: rick at click-rick.net (Rick Retzko) Date: Thu, 6 Dec 2007 10:29:09 -0500 Subject: [nycphp-talk] Help with a self:: ish problem In-Reply-To: References: Message-ID: <007801c8381c$bff9ad70$0301a8c0@adam> Hi Cliff - Thanks. Maybe I'm using the wrong implementation here. My design is that $this->_aData['action'] could resolve to an 'update', 'insert' or 'delete' request and thus be directed to the appropriate function. I didn't want to use a literal, but have the decision made by the calling routine. Best Regards - Rick ============ rick at click-rick.net _____ From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On Behalf Of Cliff Hirsch Sent: Thursday, December 06, 2007 10:20 AM To: NYPHP Talk Subject: Re: [nycphp-talk] Help with a self:: ish problem class actions { private function update(){ echo 'Update being executed!'; return TRUE; } //public functions ================================== public function do_action($table,$data){ //direct action activity //assumption: $data['action'] will contain action definition $this->_table=$table; $this->_aData=$data; $completed=self::update(); //<== THIS IS THE PROBLEM LINE Try $completed=$this->update() Update is not a static function. If you want to use self, use static function update()..... -------------- next part -------------- An HTML attachment was scrubbed... URL: From danielc at analysisandsolutions.com Thu Dec 6 10:33:20 2007 From: danielc at analysisandsolutions.com (Daniel Convissor) Date: Thu, 6 Dec 2007 10:33:20 -0500 Subject: [nycphp-talk] MySQL table updating In-Reply-To: <001701c83787$522b6f30$0300a8c0@X9183> References: <001601c82a1b$5699c220$0300a8c0@X9183> <4740A874.9060402@nyphp.com> <001701c83787$522b6f30$0300a8c0@X9183> Message-ID: <20071206153320.GA7494@panix.com> Paul: Several issues, including basic logic and security matters. * calling mysql_query() without setting $sql. * setting $query without ever calling mysql_query(). * not using mysql_real_escape_string() on values you're putting in the SQL string. * echoing input out as HTML without using htmlspecialchars(). * you're setting all sorts of variables with values from other pre-existing variables. This wastes time and makes things harder to follow. * learn about XHTML rather than the old-world HTML. --Dan -- T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y data intensive web and database programming http://www.AnalysisAndSolutions.com/ 4015 7th Ave #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409 From danielc at analysisandsolutions.com Thu Dec 6 10:40:01 2007 From: danielc at analysisandsolutions.com (Daniel Convissor) Date: Thu, 6 Dec 2007 10:40:01 -0500 Subject: [nycphp-talk] Help with a self:: ish problem In-Reply-To: <007801c8381c$bff9ad70$0301a8c0@adam> References: <007801c8381c$bff9ad70$0301a8c0@adam> Message-ID: <20071206154001.GB7494@panix.com> Rick: On Thu, Dec 06, 2007 at 10:29:09AM -0500, Rick Retzko wrote: > Hi Cliff - Thanks. Maybe I'm using the wrong implementation here. My > design is that $this->_aData['action'] could resolve to an 'update', > 'insert' or 'delete' request and thus be directed to the appropriate > function. I didn't want to use a literal, but have the decision made by the > calling routine. What Cliff was trying to explain was you wrote the class' update() method to be called from an instantiated object, using the "->" syntax. But you're calling it as a static method via the "::" syntax. You need to pick one way or the other and carry it through the whole implementation. Static and :: are covered here: http://us3.php.net/manual/en/language.oop5.paamayim-nekudotayim.php http://us3.php.net/manual/en/language.oop5.static.php Read up on the whole OOP deal here: http://us3.php.net/manual/en/language.oop5.php --Dan ... snip ... -- T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y data intensive web and database programming http://www.AnalysisAndSolutions.com/ 4015 7th Ave #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409 From rmarscher at beaffinitive.com Thu Dec 6 21:11:10 2007 From: rmarscher at beaffinitive.com (Rob Marscher) Date: Thu, 6 Dec 2007 21:11:10 -0500 Subject: [nycphp-talk] Help with a self:: ish problem In-Reply-To: <005301c83818$7d7c0730$0301a8c0@adam> References: <005301c83818$7d7c0730$0301a8c0@adam> Message-ID: On Dec 6, 2007, at 9:58 AM, Rick Retzko wrote: ...snip... > $completed=self::update(); //<== THIS IS THE PROBLEM LINE ...snip... > When I change that line to "$completed=self::$this- > >_aData['action'].'()';" (which contains the string 'update'), the > line is read, but nothing happens. > When I add "$action=$this->_aData['action'].'()';", then change the > line to "$completed=self::$action;", I get the following error > message: > Fatal error: Access to undeclared static property: actions::$action > in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\cjmea > \hs_choir\classes\class.actions.php5 on line 37. Here's what you're looking for. Also... my two cents... name your class something less common than actions and capitalize your class names - this helps with readability and making it clear that something is a class. Use protected instead of private unless you really need visibility contained to the current class for some reason. If you extended your actions class, the new class wouldn't be able to access the private methods and variables. _aData = array(); $this->_table = false; } protected function update() { echo "Update being executed!\n"; return true; } public function do_action($table, $data) { $this->_aData = $data; $this->{$this->_aData['action']}(); // as you can see this is hard to read... // so it's probably worth doing this $action = $this->_aData['action']; $this->$action(); } } $instance = new RetzkoActions(); $instance->do_action('someTable', array('action' => 'update')); ?> -------------- next part -------------- An HTML attachment was scrubbed... URL: From nynj.tech at hotmail.com Thu Dec 6 23:13:04 2007 From: nynj.tech at hotmail.com (chad qian) Date: Thu, 6 Dec 2007 23:13:04 -0500 Subject: [nycphp-talk] distances between two zip codes Message-ID: Hi, I want to program php to calculate the distance between two zip codes.I only have zip codes,nothing else.How to do it?I'm completely lost. Thanks! chad _________________________________________________________________ Share life as it happens with the new Windows Live.Download today it's FREE! http://www.windowslive.com/share.html?ocid=TXT_TAGLM_Wave2_sharelife_112007 -------------- next part -------------- An HTML attachment was scrubbed... URL: From rmarscher at beaffinitive.com Thu Dec 6 23:57:20 2007 From: rmarscher at beaffinitive.com (Rob Marscher) Date: Thu, 6 Dec 2007 23:57:20 -0500 Subject: [nycphp-talk] distances between two zip codes In-Reply-To: References: Message-ID: <9F9A3AE7-AB2F-41D3-A0CA-FBDE597392CD@beaffinitive.com> On Dec 6, 2007, at 11:13 PM, chad qian wrote: > I want to program php to calculate the distance between two zip > codes.I only have zip codes,nothing else.How to do it?I'm completely > lost. You need to find out the latitude and longitude of the zip codes. That's the only way. You can purchase zipcode databases that will give you the latitude and longitude. Usually it's something you get a subscription for so you can be updated when zipcodes change. My company uses this service: http://www.zipcodeworld.com An alternative to purchasing your own zipcode database, is to use a web service to get the latitude and longitude: http://developer.yahoo.com/maps/rest/V1/geocode.html Rasmus Lerdorf (creator of php) even posted a great article on how to use that web service: http://toys.lerdorf.com/archives/35-GeoCool!.html Once you have the latitude and longitude, you want to search google for "distance latitude longitude php." The first hit is coincidentally the site that sells the zipcode databases: http://www.zipcodeworld.com/samples/distance.php.html If you go the route of buying a subscription to the zipcode database (probably only if you have too high a level of web traffic to use the Yahoo! ), you should import the CSV file into a mysql database. Donald J Organ IV just posted a mysql query to this list last week that can find all the zipcodes in a range: On Dec 4, 2007, at 1:26 PM, Donald J Organ IV wrote: > replace the follwing fields with value: > > [origin-lat] > [origin-long] > [dest-lat] > [dest-long] > [radius] > SELECT distinct zipcode, > ROUND((ACOS((SIN([origin-lat]/57.2958) * SIN([dest-latitude]/ > 57.2958)) + > (COS([origin-lat]/57.2958) * COS([dest-lat]/57.2958) * > COS([dest-long]/57.2958 - [origin-long]/57.2958)))) * 3963, 3) AS > distance > FROM zipcodes > WHERE (latitude >= [origin-lat] - ([radius]/111)) > AND (latitude <= [origin-lat] + ([radius]/111)) > AND (longitude >= [origin-long] - ([radius]/111)) > AND (longitude <= [origin-long] + ([radius]/111)) > ORDER BY distance > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jcampbell1 at gmail.com Fri Dec 7 00:09:39 2007 From: jcampbell1 at gmail.com (John Campbell) Date: Fri, 7 Dec 2007 00:09:39 -0500 Subject: [nycphp-talk] distances between two zip codes In-Reply-To: References: Message-ID: <8f0676b40712062109j5464c293jfeba5899be8d3cbe@mail.gmail.com> > I want to program php to calculate the distance between two zip codes.I > only have zip codes,nothing else.How to do it?I'm completely lost. You need to calculate the distance between the centroids of the zip codes. Zip codes centroids (lat,lng pairs) are free and published. (Search for "zip code centroid") 1) import the zip code data into your database 2) Use a formula to calculate the distance between the lat,lng pairs. (just google for "haversine formula") I assume you can fill in the rest, but let me know if that is not enough. Regards, John Campbell From rick at click-rick.net Fri Dec 7 05:49:07 2007 From: rick at click-rick.net (Rick Retzko) Date: Fri, 7 Dec 2007 05:49:07 -0500 Subject: [nycphp-talk] Help with a self:: ish problem In-Reply-To: References: <005301c83818$7d7c0730$0301a8c0@adam> Message-ID: <009801c838be$cbc387f0$0301a8c0@adam> Thanks all! I've got it working now. Great suggestions and truly helpful references and links. Best Regards - Rick ============ rick at click-rick.net _____ From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On Behalf Of Rob Marscher Sent: Thursday, December 06, 2007 9:11 PM To: NYPHP Talk Subject: Re: [nycphp-talk] Help with a self:: ish problem On Dec 6, 2007, at 9:58 AM, Rick Retzko wrote: ...snip... $completed=self::update(); //<== THIS IS THE PROBLEM LINE ...snip... When I change that line to "$completed=self::$this->_aData['action'].'()';" (which contains the string 'update'), the line is read, but nothing happens. When I add "$action=$this->_aData['action'].'()';", then change the line to "$completed=self::$action;", I get the following error message: Fatal error: Access to undeclared static property: actions::$action in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\cjmea\hs_choir\classes\class.actions.php5 on line 37. Here's what you're looking for. Also... my two cents... name your class something less common than actions and capitalize your class names - this helps with readability and making it clear that something is a class. Use protected instead of private unless you really need visibility contained to the current class for some reason. If you extended your actions class, the new class wouldn't be able to access the private methods and variables. _aData = array(); $this->_table = false; } protected function update() { echo "Update being executed!\n"; return true; } public function do_action($table, $data) { $this->_aData = $data; $this->{$this->_aData['action']}(); // as you can see this is hard to read... // so it's probably worth doing this $action = $this->_aData['action']; $this->$action(); } } $instance = new RetzkoActions(); $instance->do_action('someTable', array('action' => 'update')); ?> -------------- next part -------------- An HTML attachment was scrubbed... URL: From paul at gubavision.com Fri Dec 7 07:16:03 2007 From: paul at gubavision.com (Paul Guba) Date: Fri, 7 Dec 2007 07:16:03 -0500 Subject: [nycphp-talk] distances between two zip codes In-Reply-To: <9F9A3AE7-AB2F-41D3-A0CA-FBDE597392CD@beaffinitive.com> References: <9F9A3AE7-AB2F-41D3-A0CA-FBDE597392CD@beaffinitive.com> Message-ID: might want to look here. http://www.micahcarrick.com/04-19-2005/php- zip-code-range-and-distance-calculation.html On Dec 6, 2007, at 11:57 PM, Rob Marscher wrote: > On Dec 6, 2007, at 11:13 PM, chad qian wrote: >> I want to program php to calculate the distance between two zip >> codes.I only have zip codes,nothing else.How to do it?I'm >> completely lost. > > You need to find out the latitude and longitude of the zip codes. > That's the only way. > > You can purchase zipcode databases that will give you the latitude > and longitude. Usually it's something you get a subscription for > so you can be updated when zipcodes change. My company uses this > service: > http://www.zipcodeworld.com > > An alternative to purchasing your own zipcode database, is to use a > web service to get the latitude and longitude: > http://developer.yahoo.com/maps/rest/V1/geocode.html > > Rasmus Lerdorf (creator of php) even posted a great article on how > to use that web service: > http://toys.lerdorf.com/archives/35-GeoCool!.html > > Once you have the latitude and longitude, you want to search google > for "distance latitude longitude php." The first hit is > coincidentally the site that sells the zipcode databases: > http://www.zipcodeworld.com/samples/distance.php.html > > If you go the route of buying a subscription to the zipcode > database (probably only if you have too high a level of web traffic > to use the Yahoo! ), you should import the CSV file into a mysql > database. Donald J Organ IV just posted a mysql query to this list > last week that can find all the zipcodes in a range: > On Dec 4, 2007, at 1:26 PM, Donald J Organ IV wrote: >> replace the follwing fields with value: >> >> [origin-lat] >> [origin-long] >> [dest-lat] >> [dest-long] >> [radius] >> SELECT distinct zipcode, >> ROUND((ACOS((SIN([origin-lat]/57.2958) * SIN([dest-latitude]/ >> 57.2958)) + >> (COS([origin-lat]/57.2958) * COS([dest-lat]/57.2958) * >> COS([dest-long]/57.2958 - [origin-long]/57.2958)))) * 3963, 3) AS >> distance >> FROM zipcodes >> WHERE (latitude >= [origin-lat] - ([radius]/111)) >> AND (latitude <= [origin-lat] + ([radius]/111)) >> AND (longitude >= [origin-long] - ([radius]/111)) >> AND (longitude <= [origin-long] + ([radius]/111)) >> ORDER BY distance >> > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php -------------- next part -------------- An HTML attachment was scrubbed... URL: From ka at kacomputerconsulting.com Fri Dec 7 13:13:00 2007 From: ka at kacomputerconsulting.com (Kristina Anderson) Date: Fri, 7 Dec 2007 10:13:00 -0800 Subject: [nycphp-talk] MySQL/Flash/Apostrophe issue Message-ID: <1197051180.7635@coral.he.net> Hi Everyone, This is my first post to the list and I appreciate any feedback, thanks. I'm debugging a site someone else built in PHP & MySQL and on a few places in the site, there are Flash applets (.swf files) that are directly pulling strings from the MySQL database. The previous programmers neglected to properly handle apostrophes and there are many text strings displayed in the .swf files, unfortunately what exists now is that whenever an apostrophe occurs, it cuts off the rest of the string. One thing that I tried was to go into the MySQL database itself and add the escape character before the apostrophes, this resulted in the display of the encoded HTML for the apostrophe and not the actual apostrophe. Is there any trick with MySQL which I'm not aware of that will enable me to fix this without decompiling the .swf file just for this (which I really, really do not want to do)? ------------------- Kristina D. H. Anderson Senior Application Developer/Consultant "Building a Better Tomorrow, One Line of Code at a Time" 646-247-4987 From bz-gmort at beezifies.com Fri Dec 7 13:22:23 2007 From: bz-gmort at beezifies.com (Gary Mort) Date: Fri, 07 Dec 2007 13:22:23 -0500 Subject: [nycphp-talk] MySQL/Flash/Apostrophe issue In-Reply-To: <1197051180.7635@coral.he.net> References: <1197051180.7635@coral.he.net> Message-ID: <47598F5F.4070104@beezifies.com> Kristina Anderson wrote: > The previous programmers neglected to properly handle apostrophes and > there are many text strings displayed in the .swf files, unfortunately > what exists now is that whenever an apostrophe occurs, it cuts off the > rest of the string. > > One thing that I tried was to go into the MySQL database itself and > add the escape character before the apostrophes, this resulted in the > display of the encoded HTML for the apostrophe and not the actual > apostrophe. > > Well, it sounds like the apostrophe was properly escaped when placed into the MySQL database. If it is escaped, it doesn't store the escape charector in the database, it stores it as it is. What I'm guessing you need to do is escape/convert the apostrophe for Flash/Actionscript. At a guess, since Flash is so HTML centric, try converting the ' to ' From ereyes at totalcreations.com Fri Dec 7 13:30:19 2007 From: ereyes at totalcreations.com (Edgar Reyes) Date: Fri, 07 Dec 2007 13:30:19 -0500 Subject: [nycphp-talk] MySQL/Flash/Apostrophe issue In-Reply-To: <47598F5F.4070104@beezifies.com> References: <1197051180.7635@coral.he.net> <47598F5F.4070104@beezifies.com> Message-ID: <02c101c838ff$389a2060$a400a8c0@ERTop> Have you looked at the action script in flash? It may just be an easy fix there too. ER -----Original Message----- From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On Behalf Of Gary Mort Sent: Friday, December 07, 2007 1:22 PM To: NYPHP Talk Subject: Re: [nycphp-talk] MySQL/Flash/Apostrophe issue Kristina Anderson wrote: > The previous programmers neglected to properly handle apostrophes and > there are many text strings displayed in the .swf files, unfortunately > what exists now is that whenever an apostrophe occurs, it cuts off the > rest of the string. > > One thing that I tried was to go into the MySQL database itself and > add the escape character before the apostrophes, this resulted in the > display of the encoded HTML for the apostrophe and not the actual > apostrophe. > > Well, it sounds like the apostrophe was properly escaped when placed into the MySQL database. If it is escaped, it doesn't store the escape charector in the database, it stores it as it is. What I'm guessing you need to do is escape/convert the apostrophe for Flash/Actionscript. At a guess, since Flash is so HTML centric, try converting the ' to ' _______________________________________________ New York PHP Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk NYPHPCon 2006 Presentations Online http://www.nyphpcon.com Show Your Participation in New York PHP http://www.nyphp.org/show_participation.php From ka at kacomputerconsulting.com Fri Dec 7 13:43:42 2007 From: ka at kacomputerconsulting.com (Kristina Anderson) Date: Fri, 7 Dec 2007 10:43:42 -0800 Subject: [nycphp-talk] MySQL/Flash/Apostrophe issue Message-ID: <1197053022.18589@coral.he.net> Yes it's definitely a flash issue. I will replace the apostrophes in the strings with ' before database insert and let you know how that works! > Kristina Anderson wrote: > > The previous programmers neglected to properly handle apostrophes and > > there are many text strings displayed in the .swf files, unfortunately > > what exists now is that whenever an apostrophe occurs, it cuts off the > > rest of the string. > > > > One thing that I tried was to go into the MySQL database itself and > > add the escape character before the apostrophes, this resulted in the > > display of the encoded HTML for the apostrophe and not the actual > > apostrophe. > > > > > > Well, it sounds like the apostrophe was properly escaped when placed > into the MySQL database. If it is escaped, it doesn't store the escape > charector in the database, it stores it as it is. > > What I'm guessing you need to do is escape/convert the apostrophe for > Flash/Actionscript. > > At a guess, since Flash is so HTML centric, try converting the ' to ' > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > > ------------------- Kristina D. H. Anderson Senior Application Developer/Consultant "Building a Better Tomorrow, One Line of Code at a Time" 646-247-4987 From pjlists at pobox.com Fri Dec 7 13:47:38 2007 From: pjlists at pobox.com (=?BIG5?B?UC4gSnUgKKa2un7moik=?=) Date: Fri, 7 Dec 2007 13:47:38 -0500 Subject: [nycphp-talk] MySQL/Flash/Apostrophe issue In-Reply-To: <1197053022.18589@coral.he.net> References: <1197053022.18589@coral.he.net> Message-ID: <7fb2405d0712071047w191a30fan11d4cbd24c632803@mail.gmail.com> Hi Kristina, PHP has a function to take care of this for you: mysql_escape_string http://www.php.net/mysql_escape_string PJ On Dec 7, 2007 1:43 PM, Kristina Anderson wrote: > Yes it's definitely a flash issue. I will replace the apostrophes in > the strings with ' before database insert and let you know how > that works! > > > Kristina Anderson wrote: > > > The previous programmers neglected to properly handle apostrophes > and > > > there are many text strings displayed in the .swf files, > unfortunately > > > what exists now is that whenever an apostrophe occurs, it cuts off > the > > > rest of the string. > > > > > > One thing that I tried was to go into the MySQL database itself > and > > > add the escape character before the apostrophes, this resulted in > the > > > display of the encoded HTML for the apostrophe and not the actual > > > apostrophe. > > > > > > > > > > Well, it sounds like the apostrophe was properly escaped when placed > > into the MySQL database. If it is escaped, it doesn't store the > escape > > charector in the database, it stores it as it is. > > > > What I'm guessing you need to do is escape/convert the apostrophe > for > > Flash/Actionscript. > > > > At a guess, since Flash is so HTML centric, try converting the ' to > ' > > > > _______________________________________________ > > New York PHP Community Talk Mailing List > > http://lists.nyphp.org/mailman/listinfo/talk > > > > NYPHPCon 2006 Presentations Online > > http://www.nyphpcon.com > > > > Show Your Participation in New York PHP > > http://www.nyphp.org/show_participation.php > > > > > > ------------------- > Kristina D. H. Anderson > Senior Application Developer/Consultant > "Building a Better Tomorrow, One Line of Code at a Time" > 646-247-4987 > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > -- Patricia Ju phj at pobox.com +1-646-717-3871 success = fn(perseverance) -------------- next part -------------- An HTML attachment was scrubbed... URL: From kenrbnsn at rbnsn.com Fri Dec 7 14:14:28 2007 From: kenrbnsn at rbnsn.com (Ken Robinson) Date: Fri, 07 Dec 2007 14:14:28 -0500 Subject: [nycphp-talk] MySQL/Flash/Apostrophe issue In-Reply-To: <1197053022.18589@coral.he.net> References: <1197053022.18589@coral.he.net> Message-ID: <20071207141428.5ah2dh3j1cg8ssoc@www.rbnsn.com> Quoting Kristina Anderson : > Yes it's definitely a flash issue. I will replace the apostrophes in > the strings with ' before database insert and let you know how > that works! Don't replace the single quotes in the database. Use the htmlentities() function on the output with the ENT_QUOTES option. This will replace the quotes (and other symbols) with the appropriate "&" strings. Ken From kenrbnsn at rbnsn.com Fri Dec 7 14:16:14 2007 From: kenrbnsn at rbnsn.com (Ken Robinson) Date: Fri, 07 Dec 2007 14:16:14 -0500 Subject: [nycphp-talk] MySQL/Flash/Apostrophe issue In-Reply-To: <7fb2405d0712071047w191a30fan11d4cbd24c632803@mail.gmail.com> References: <1197053022.18589@coral.he.net> <7fb2405d0712071047w191a30fan11d4cbd24c632803@mail.gmail.com> Message-ID: <20071207141614.5nnxz6r5jc40csws@www.rbnsn.com> Quoting "P. Ju (???)" : > Hi Kristina, > > PHP has a function to take care of this for you: mysql_escape_string > > http://www.php.net/mysql_escape_string That's not her problem. That escapes quotes and other symbols so they can be stored in the database. Her problem is that the single quote is disrupting the output. Escaping it with a backslash won't help. Ken From ramons at gmx.net Fri Dec 7 14:24:59 2007 From: ramons at gmx.net (David Krings) Date: Fri, 07 Dec 2007 14:24:59 -0500 Subject: [nycphp-talk] MySQL/Flash/Apostrophe issue In-Reply-To: <20071207141428.5ah2dh3j1cg8ssoc@www.rbnsn.com> References: <1197053022.18589@coral.he.net> <20071207141428.5ah2dh3j1cg8ssoc@www.rbnsn.com> Message-ID: <47599E0B.5080701@gmx.net> Ken Robinson wrote: > Quoting Kristina Anderson : > >> Yes it's definitely a flash issue. I will replace the apostrophes in >> the strings with ' before database insert and let you know how >> that works! > > Don't replace the single quotes in the database. Use the htmlentities() > function on the output with the ENT_QUOTES option. This will replace the > quotes (and other symbols) with the appropriate "&" strings. > > Ken > If memory serves me right, Flash doesn't adhere to the HTML or ASCII entities, at least it didn't a few years back when I ran into this issue. What I did is replace the characters with the ones that Flash understands before writing it to the database alongside with the properly escaped 'real' string. In my case the strings were pulled from an XML by Flash and not from a database, so that and the fact that my encounters are years past may put a different spin on this. So if you get something, but not what you expected, this could be the reason why. David From ka at kacomputerconsulting.com Fri Dec 7 14:41:00 2007 From: ka at kacomputerconsulting.com (Kristina Anderson) Date: Fri, 7 Dec 2007 11:41:00 -0800 Subject: [nycphp-talk] MySQL/Flash/Apostrophe issue Message-ID: <1197056460.8652@coral.he.net> Thanks Ken, so what you're saying is there is no way to do this without going into the .swf file itself. By the way -- $caption = str_replace("'", "'", $caption) yields record in database of A Reporter's Life Displays in Flash applet as A Reporter&#39;s Life (it's encoding the & apparently). > Quoting Kristina Anderson : > > > Yes it's definitely a flash issue. I will replace the apostrophes in > > the strings with ' before database insert and let you know how > > that works! > > Don't replace the single quotes in the database. Use the > htmlentities() function on the output with the ENT_QUOTES option. This > will replace the quotes (and other symbols) with the appropriate "&" > strings. > > Ken > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > > ------------------- Kristina D. H. Anderson Senior Application Developer/Consultant "Building a Better Tomorrow, One Line of Code at a Time" 646-247-4987 From jcampbell1 at gmail.com Fri Dec 7 14:51:03 2007 From: jcampbell1 at gmail.com (John Campbell) Date: Fri, 7 Dec 2007 14:51:03 -0500 Subject: [nycphp-talk] MySQL/Flash/Apostrophe issue In-Reply-To: <1197056460.8652@coral.he.net> References: <1197056460.8652@coral.he.net> Message-ID: <8f0676b40712071151m3ef3e010n74ba7aed8b3f55f5@mail.gmail.com> A swf file cannot directly access the database because it runs on the client side (I'll assume you are not using remoting). The swf accesses a php script on the server that outputs something. There are two major methods, load vars and xml. My guess is that the php script outputs data for flash's load vars. In that case the quotes need to be urlencoded not htmlencoded. Try $caption = url_encode($caption) Regards, John Campbell From ka at kacomputerconsulting.com Fri Dec 7 15:21:04 2007 From: ka at kacomputerconsulting.com (Kristina Anderson) Date: Fri, 7 Dec 2007 12:21:04 -0800 Subject: [nycphp-talk] MySQL/Flash/Apostrophe issue Message-ID: <1197058864.25340@coral.he.net> allowScriptAccess is set to "sameDomain" but the name of any script calling the database is not immediately apparent from the page code...? > A swf file cannot directly access the database because it runs on the > client side (I'll assume you are not using remoting). The swf > accesses a php script on the server that outputs something. There are > two major methods, load vars and xml. > > My guess is that the php script outputs data for flash's load vars. > In that case the quotes need to be urlencoded not htmlencoded. Try > $caption = url_encode($caption) > > Regards, > John Campbell > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > > ------------------- Kristina D. H. Anderson Senior Application Developer/Consultant "Building a Better Tomorrow, One Line of Code at a Time" 646-247-4987 From jcampbell1 at gmail.com Fri Dec 7 15:34:28 2007 From: jcampbell1 at gmail.com (John Campbell) Date: Fri, 7 Dec 2007 15:34:28 -0500 Subject: [nycphp-talk] MySQL/Flash/Apostrophe issue In-Reply-To: <1197058864.25340@coral.he.net> References: <1197058864.25340@coral.he.net> Message-ID: <8f0676b40712071234r70c9bce3p2d3145cf4611a031@mail.gmail.com> > allowScriptAccess is set to "sameDomain" but the name of any script > calling the database is not immediately apparent from the page code...? Do you use firebug? You need to open the page, and look through the list of downloaded files (firebug is the way I do it, it is built in in Safari, and I don't have a clue for IE). From there you probably guess at which request is providing the data. To do this with firebug, just open it, and click on the "Net" tab. It will show you a list of every thing that was downloaded to render the page. You can even inspect the contents of each request. If you want, just post a link and I'll let you know what scripts the flash is accessing, what they return, and why there is an error. Regards, John Campbell From ka at kacomputerconsulting.com Fri Dec 7 15:51:52 2007 From: ka at kacomputerconsulting.com (Kristina Anderson) Date: Fri, 7 Dec 2007 12:51:52 -0800 Subject: [nycphp-talk] MySQL/Flash/Apostrophe issue Message-ID: <1197060712.4125@coral.he.net> I don't think you can do any of that sort of thing with IE...what a piece of sh%t it truly is. Is there any Windows software that can give me this functionality? > > allowScriptAccess is set to "sameDomain" but the name of any script > > calling the database is not immediately apparent from the page code...? > > Do you use firebug? You need to open the page, and look through the > list of downloaded files (firebug is the way I do it, it is built in > in Safari, and I don't have a clue for IE). From there you probably > guess at which request is providing the data. To do this with > firebug, just open it, and click on the "Net" tab. It will show you a > list of every thing that was downloaded to render the page. You can > even inspect the contents of each request. > > If you want, just post a link and I'll let you know what scripts the > flash is accessing, what they return, and why there is an error. > > Regards, > John Campbell > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > > ------------------- Kristina D. H. Anderson Senior Application Developer/Consultant "Building a Better Tomorrow, One Line of Code at a Time" 646-247-4987 From jcampbell1 at gmail.com Fri Dec 7 16:00:05 2007 From: jcampbell1 at gmail.com (John Campbell) Date: Fri, 7 Dec 2007 16:00:05 -0500 Subject: [nycphp-talk] MySQL/Flash/Apostrophe issue In-Reply-To: <1197060712.4125@coral.he.net> References: <1197060712.4125@coral.he.net> Message-ID: <8f0676b40712071300y316810do189ed10fb73c6ec@mail.gmail.com> On Dec 7, 2007 3:51 PM, Kristina Anderson wrote: > I don't think you can do any of that sort of thing with IE...what a > piece of sh%t it truly is. Is there any Windows software that can > give me this functionality? firefox with the firebug extension. Now that I think about it, you can also use the IE7 developer toolbar (which is modeled after firebug). From ka at kacomputerconsulting.com Fri Dec 7 16:02:26 2007 From: ka at kacomputerconsulting.com (Kristina Anderson) Date: Fri, 7 Dec 2007 13:02:26 -0800 Subject: [nycphp-talk] MySQL/Flash/Apostrophe issue Message-ID: <1197061346.7926@coral.he.net> Nifty, thanks! I will keep you posted. > On Dec 7, 2007 3:51 PM, Kristina Anderson wrote: > > I don't think you can do any of that sort of thing with IE...what a > > piece of sh%t it truly is. Is there any Windows software that can > > give me this functionality? > > firefox with the firebug extension. Now that I think about it, you > can also use the IE7 developer toolbar (which is modeled after > firebug). > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > > ------------------- Kristina D. H. Anderson Senior Application Developer/Consultant "Building a Better Tomorrow, One Line of Code at a Time" 646-247-4987 From cahoyos at us.ibm.com Fri Dec 7 16:12:59 2007 From: cahoyos at us.ibm.com (Carlos A Hoyos) Date: Fri, 7 Dec 2007 16:12:59 -0500 Subject: [nycphp-talk] MySQL/Flash/Apostrophe issue In-Reply-To: <1197060712.4125@coral.he.net> References: <1197060712.4125@coral.he.net> Message-ID: talk-bounces at lists.nyphp.org wrote on 12/07/2007 03:51:52 PM: > I don't think you can do any of that sort of thing with IE...what a > piece of sh%t it truly is. Is there any Windows software that can > give me this functionality? If you do need to use IE, Fiddler is pretty useful to intercept and manage requests... http://www.fiddlertool.com/fiddler/ Also, the IE developer toolbar is helpful. Carlos From ramons at gmx.net Fri Dec 7 18:41:49 2007 From: ramons at gmx.net (David Krings) Date: Fri, 07 Dec 2007 18:41:49 -0500 Subject: [nycphp-talk] MySQL/Flash/Apostrophe issue In-Reply-To: <1197060712.4125@coral.he.net> References: <1197060712.4125@coral.he.net> Message-ID: <4759DA3D.5060101@gmx.net> Kristina Anderson wrote: > I don't think you can do any of that sort of thing with IE...what a > piece of sh%t it truly is. Is there any Windows software that can > give me this functionality? There is a firebug plugin for FireFox. From ka at kacomputerconsulting.com Fri Dec 7 19:50:55 2007 From: ka at kacomputerconsulting.com (Kristina Anderson) Date: Fri, 7 Dec 2007 16:50:55 -0800 Subject: [nycphp-talk] MySQL/Flash/Apostrophe issue Message-ID: <1197075055.17204@coral.he.net> Thanks -- I have downloaded Firefox and think this is life changing....lots of new toys to play with :) > Kristina Anderson wrote: > > I don't think you can do any of that sort of thing with IE...what a > > piece of sh%t it truly is. Is there any Windows software that can > > give me this functionality? > > There is a firebug plugin for FireFox. > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > > ------------------- Kristina D. H. Anderson Senior Application Developer/Consultant "Building a Better Tomorrow, One Line of Code at a Time" 646-247-4987 From ben at projectskyline.com Fri Dec 7 20:09:08 2007 From: ben at projectskyline.com (Ben Sgro) Date: Fri, 07 Dec 2007 20:09:08 -0500 Subject: [nycphp-talk] MySQL/Flash/Apostrophe issue In-Reply-To: <1197075055.17204@coral.he.net> References: <1197075055.17204@coral.he.net> Message-ID: <4759EEB4.7020803@projectskyline.com> Welcome to the internet! Kristina Anderson wrote: > Thanks -- I have downloaded Firefox and think this is life > changing....lots of new toys to play with :) > > >> Kristina Anderson wrote: >> >>> I don't think you can do any of that sort of thing with IE...what >>> > a > >>> piece of sh%t it truly is. Is there any Windows software that can >>> give me this functionality? >>> >> There is a firebug plugin for FireFox. >> _______________________________________________ >> New York PHP Community Talk Mailing List >> http://lists.nyphp.org/mailman/listinfo/talk >> >> NYPHPCon 2006 Presentations Online >> http://www.nyphpcon.com >> >> Show Your Participation in New York PHP >> http://www.nyphp.org/show_participation.php >> >> >> > > ------------------- > Kristina D. H. Anderson > Senior Application Developer/Consultant > "Building a Better Tomorrow, One Line of Code at a Time" > 646-247-4987 > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > > From ka at kacomputerconsulting.com Fri Dec 7 20:05:24 2007 From: ka at kacomputerconsulting.com (Kristina Anderson) Date: Fri, 7 Dec 2007 17:05:24 -0800 Subject: [nycphp-talk] MySQL/Flash/Apostrophe issue Message-ID: <1197075924.21687@coral.he.net> you guys are the best! > Welcome to the internet! > > > Kristina Anderson wrote: > > Thanks -- I have downloaded Firefox and think this is life > > changing....lots of new toys to play with :) > > > > > >> Kristina Anderson wrote: > >> > >>> I don't think you can do any of that sort of thing with IE...what > >>> > > a > > > >>> piece of sh%t it truly is. Is there any Windows software that can > >>> give me this functionality? > >>> > >> There is a firebug plugin for FireFox. > >> _______________________________________________ > >> New York PHP Community Talk Mailing List > >> http://lists.nyphp.org/mailman/listinfo/talk > >> > >> NYPHPCon 2006 Presentations Online > >> http://www.nyphpcon.com > >> > >> Show Your Participation in New York PHP > >> http://www.nyphp.org/show_participation.php > >> > >> > >> > > > > ------------------- > > Kristina D. H. Anderson > > Senior Application Developer/Consultant > > "Building a Better Tomorrow, One Line of Code at a Time" > > 646-247-4987 > > > > _______________________________________________ > > New York PHP Community Talk Mailing List > > http://lists.nyphp.org/mailman/listinfo/talk > > > > NYPHPCon 2006 Presentations Online > > http://www.nyphpcon.com > > > > Show Your Participation in New York PHP > > http://www.nyphp.org/show_participation.php > > > > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > > ------------------- Kristina D. H. Anderson Senior Application Developer/Consultant "Building a Better Tomorrow, One Line of Code at a Time" 646-247-4987 From anthony at adcl.biz Sat Dec 8 02:36:37 2007 From: anthony at adcl.biz (Anthony Papillion) Date: Sat, 08 Dec 2007 01:36:37 -0600 Subject: [nycphp-talk] distances between two zip codes In-Reply-To: References: Message-ID: <475A4985.50701@adcl.biz> I had to get something like this working a few weeks ago and ended up using Google Maps. It's not an elegant solution but it works and it's free. Go to Google Maps and do a search. Do something like 74354 to 70601. You will notices that on the left hand panel of the returned page will be something like Drive: 602 mi. Look at the HTML generated. You can parse that and get the distance. Pretty simple actually. Hope it helps, Anthony Papillion OpenEMR HQ, Inc www.openemrhq.com (918) 926-0139 chad qian wrote: > Hi, > I want to program php to calculate the distance between two zip > codes.I only have zip codes,nothing else.How to do it?I'm completely lost. > > Thanks! > > chad > > ------------------------------------------------------------------------ > Share life as it happens with the new Windows Live. Share now! > > > ------------------------------------------------------------------------ > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php From rizwan_nawaz786 at hotmail.com Sat Dec 8 09:08:52 2007 From: rizwan_nawaz786 at hotmail.com (Muhammad Rizwan Nawaz) Date: Sat, 8 Dec 2007 14:08:52 +0000 Subject: [nycphp-talk] How to execute external program in php Message-ID: Hello, I have apache 2 , php5 on windows 2003 server. I want to execute the external command like, system( 'c:/PHP/safedir/pdftk.exe C:/AppServ/www/mylegalwork/images/pdf_files/PROD-5298b6/MLW_Demo_Form_1.pdf dump_data_fields > C:/AppServ/www/mylegalwork/images/pdf_files/PROD-5298b6/rizwan') basicaly pdftk.exe is pdf utility. I have put it in safe directory. The problem is when i try to access the page its not execute the command. I have try it with passthru, exec and with shell_command but all do nothing. Its working fine on my local machine and on linux server where i install pdftk but on windows 2003 server its not working. I have found an article at http://bugs.php.net/bug.php?id=20951 which says there is security issue thats why its not allow php to execute the command. If anyone of you know anything about it than do let me know. I really want to run the command. Thanks Best Regards, Muhammad Rizwan Nawaz Email / MSN Messenger: rizwan_nawaz786 at hotmail.com Gmail: rizwannawaz at gmail.com Yahoo IM: rizwan051 AOL IM: riznawaz Skype: rizwannawaz ICQ: 442047681 ============= SECURITY NOTICE ============= THE INFORMATION CONTAINED IN THIS TRANSMISSION IS PRIVILEGED AND CONFIDENTIAL. IT IS INTENDED FOR THE USE OF THE INDIVIDUAL OR ENTITY NAMED ABOVE. IF THE READER OF THIS MESSAGE IS NOT THE INTENDED RECIPIENT, YOU ARE HEREBY NOTIFIED THAT ANY DISSEMINATION, DISTRIBUTION OR COPY OF THIS COMMUNICATION IS STRICTLY PROHIBITED. IF YOU HAVE RECEIVED THIS COMMUNICATION IN ERROR, PLEASE IMMEDIATELY NOTIFY AND RETURN THE ORIGINAL MESSAGE TO THE SENDER AND DELETE IT. THANK YOU. _________________________________________________________________ Share life as it happens with the new Windows Live.Download today it's FREE! http://www.windowslive.com/share.html?ocid=TXT_TAGLM_Wave2_sharelife_112007 -------------- next part -------------- An HTML attachment was scrubbed... URL: From nyphp at summit7solutions.com Sat Dec 8 09:38:52 2007 From: nyphp at summit7solutions.com (Jeff Wilhelm - NYPHP) Date: Sat, 8 Dec 2007 09:38:52 -0500 Subject: [nycphp-talk] distances between two zip codes In-Reply-To: <475A4985.50701@adcl.biz> References: <475A4985.50701@adcl.biz> Message-ID: <011701c839a8$1065b8d0$327ba8c0@ERNIE> If you're going to do that you should use Google's API, otherwise when they make a change to their HTML your code will fail. -----Original Message----- From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On Behalf Of Anthony Papillion Sent: Saturday, December 08, 2007 2:37 AM To: NYPHP Talk Subject: Re: [nycphp-talk] distances between two zip codes I had to get something like this working a few weeks ago and ended up using Google Maps. It's not an elegant solution but it works and it's free. Go to Google Maps and do a search. Do something like 74354 to 70601. You will notices that on the left hand panel of the returned page will be something like Drive: 602 mi. Look at the HTML generated. You can parse that and get the distance. Pretty simple actually. Hope it helps, Anthony Papillion OpenEMR HQ, Inc www.openemrhq.com (918) 926-0139 chad qian wrote: > Hi, > I want to program php to calculate the distance between two zip > codes.I only have zip codes,nothing else.How to do it?I'm completely lost. > > Thanks! > > chad > > ---------------------------------------------------------------------- > -- Share life as it happens with the new Windows Live. Share now! > 112007> > > ---------------------------------------------------------------------- > -- > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php _______________________________________________ New York PHP Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk NYPHPCon 2006 Presentations Online http://www.nyphpcon.com Show Your Participation in New York PHP http://www.nyphp.org/show_participation.php From brian at realm3.com Sat Dec 8 10:58:24 2007 From: brian at realm3.com (Brian D.) Date: Sat, 8 Dec 2007 10:58:24 -0500 Subject: [nycphp-talk] distances between two zip codes In-Reply-To: <011701c839a8$1065b8d0$327ba8c0@ERNIE> References: <475A4985.50701@adcl.biz> <011701c839a8$1065b8d0$327ba8c0@ERNIE> Message-ID: Here's a more efficient method: use this guy's free class file. I've used it for similar solutions, and it's pretty easy to hack to make it fit into whatever architecture you need. The code is fairly straightforward. http://www.micahcarrick.com/04-19-2005/php-zip-code-range-and-distance-calculation.html On Dec 8, 2007 9:38 AM, Jeff Wilhelm - NYPHP wrote: > If you're going to do that you should use Google's API, otherwise when they > make a change to their HTML your code will fail. > > > > -----Original Message----- > From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On > Behalf Of Anthony Papillion > Sent: Saturday, December 08, 2007 2:37 AM > To: NYPHP Talk > Subject: Re: [nycphp-talk] distances between two zip codes > > I had to get something like this working a few weeks ago and ended up using > Google Maps. It's not an elegant solution but it works and it's free. Go to > Google Maps and do a search. Do something like 74354 to 70601. You will > notices that on the left hand panel of the returned page will be something > like Drive: 602 mi. Look at the HTML generated. You can parse that and get > the distance. Pretty simple actually. > > Hope it helps, > Anthony Papillion > OpenEMR HQ, Inc > www.openemrhq.com > (918) 926-0139 > > > chad qian wrote: > > Hi, > > I want to program php to calculate the distance between two zip > > codes.I only have zip codes,nothing else.How to do it?I'm completely lost. > > > > Thanks! > > > > chad > > > > ---------------------------------------------------------------------- > > -- Share life as it happens with the new Windows Live. Share now! > > > 112007> > > > > ---------------------------------------------------------------------- > > -- > > > > _______________________________________________ > > New York PHP Community Talk Mailing List > > http://lists.nyphp.org/mailman/listinfo/talk > > > > NYPHPCon 2006 Presentations Online > > http://www.nyphpcon.com > > > > Show Your Participation in New York PHP > > http://www.nyphp.org/show_participation.php > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > -- realm3 web applications [realm3.com] freelance consulting, application development (423) 506-0349 From aw at sap8.com Sat Dec 8 11:20:55 2007 From: aw at sap8.com (Anthony) Date: Sat, 08 Dec 2007 11:20:55 -0500 Subject: [nycphp-talk] How to execute external program in php In-Reply-To: References: Message-ID: <475AC467.7040407@sap8.com> On w2k3 getting exec() to work is a PITA. If you are running fastcgi you will have to give that user permission to execute cmd.exe. Since it will be running as a network service PHP needs to execute both the program and cmd.exe. First I would try and figure out who is requesting the file (who do you have PHP running as) and then give that user access to cmd.exe. Also you can use "filemon" to figure that out. Hope this helps. -Anthony Muhammad Rizwan Nawaz wrote: > Hello, > > I have apache 2 , php5 on windows 2003 server. I want to execute the > external command like, > > system( 'c:/PHP/safedir/pdftk.exe > C:/AppServ/www/mylegalwork/images/pdf_files/PROD-5298b6/MLW_Demo_Form_1.pdf > dump_data_fields > > C:/AppServ/www/mylegalwork/images/pdf_files/PROD-5298b6/rizwan') > > basicaly pdftk.exe is pdf utility. I have put it in safe directory. > The problem is when i try to access the page its not execute the > command. I have try it with passthru, exec and with shell_command but > all do nothing. Its working fine on my local machine and on linux > server where i install pdftk but on windows 2003 server its not > working. I have found an article at > http://bugs.php.net/bug.php?id=20951 which says there is security > issue thats why its not allow php to execute the command. If anyone of > you know anything about it than do let me know. I really want to run > the command. > > > > Thanks > Best Regards, > Muhammad Rizwan Nawaz > Email / MSN Messenger: rizwan_nawaz786 at hotmail.com > > Gmail: rizwannawaz at gmail.com > Yahoo IM: rizwan051 > AOL IM: riznawaz > Skype: rizwannawaz > ICQ: 442047681 > > ============= > SECURITY NOTICE > ============= > > THE INFORMATION CONTAINED IN THIS TRANSMISSION IS PRIVILEGED AND > CONFIDENTIAL. IT IS INTENDED FOR THE USE OF THE INDIVIDUAL OR ENTITY > NAMED ABOVE. IF THE READER OF THIS MESSAGE IS NOT THE INTENDED > RECIPIENT, YOU ARE HEREBY NOTIFIED THAT ANY DISSEMINATION, > DISTRIBUTION OR COPY OF THIS COMMUNICATION IS STRICTLY PROHIBITED. > > IF YOU HAVE RECEIVED THIS COMMUNICATION IN ERROR, PLEASE IMMEDIATELY > NOTIFY AND RETURN THE ORIGINAL MESSAGE TO THE SENDER AND DELETE IT. > THANK YOU. > > > ------------------------------------------------------------------------ > Share life as it happens with the new Windows Live. Share now! > > > ------------------------------------------------------------------------ > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php From rizwan_nawaz786 at hotmail.com Sat Dec 8 12:12:58 2007 From: rizwan_nawaz786 at hotmail.com (Muhammad Rizwan Nawaz) Date: Sat, 8 Dec 2007 17:12:58 +0000 Subject: [nycphp-talk] How to execute external program in php In-Reply-To: <475AC467.7040407@sap8.com> References: <475AC467.7040407@sap8.com> Message-ID: Hi, Thanks for your reply. I have allow the apache server to login as admin. Its works and now its start executing the external program. Thanks Best Regards, Muhammad Rizwan Nawaz Email / MSN Messenger: rizwan_nawaz786 at hotmail.com Gmail: rizwannawaz at gmail.com Yahoo IM: rizwan051 AOL IM: riznawaz Skype: rizwannawaz ICQ: 442047681 ============= SECURITY NOTICE ============= THE INFORMATION CONTAINED IN THIS TRANSMISSION IS PRIVILEGED AND CONFIDENTIAL. IT IS INTENDED FOR THE USE OF THE INDIVIDUAL OR ENTITY NAMED ABOVE. IF THE READER OF THIS MESSAGE IS NOT THE INTENDED RECIPIENT, YOU ARE HEREBY NOTIFIED THAT ANY DISSEMINATION, DISTRIBUTION OR COPY OF THIS COMMUNICATION IS STRICTLY PROHIBITED. IF YOU HAVE RECEIVED THIS COMMUNICATION IN ERROR, PLEASE IMMEDIATELY NOTIFY AND RETURN THE ORIGINAL MESSAGE TO THE SENDER AND DELETE IT. THANK YOU. > Date: Sat, 8 Dec 2007 11:20:55 -0500 > From: aw at sap8.com > To: talk at lists.nyphp.org > Subject: Re: [nycphp-talk] How to execute external program in php > > On w2k3 getting exec() to work is a PITA. If you are running fastcgi > you will have to give that user permission to execute cmd.exe. Since it > will be running as a network service PHP needs to execute both the > program and cmd.exe. First I would try and figure out who is requesting > the file (who do you have PHP running as) and then give that user access > to cmd.exe. Also you can use "filemon" to figure that out. > > Hope this helps. > > -Anthony > > Muhammad Rizwan Nawaz wrote: > > Hello, > > > > I have apache 2 , php5 on windows 2003 server. I want to execute the > > external command like, > > > > system( 'c:/PHP/safedir/pdftk.exe > > C:/AppServ/www/mylegalwork/images/pdf_files/PROD-5298b6/MLW_Demo_Form_1.pdf > > dump_data_fields > > > C:/AppServ/www/mylegalwork/images/pdf_files/PROD-5298b6/rizwan') > > > > basicaly pdftk.exe is pdf utility. I have put it in safe directory. > > The problem is when i try to access the page its not execute the > > command. I have try it with passthru, exec and with shell_command but > > all do nothing. Its working fine on my local machine and on linux > > server where i install pdftk but on windows 2003 server its not > > working. I have found an article at > > http://bugs.php.net/bug.php?id=20951 which says there is security > > issue thats why its not allow php to execute the command. If anyone of > > you know anything about it than do let me know. I really want to run > > the command. > > > > > > > > Thanks > > Best Regards, > > Muhammad Rizwan Nawaz > > Email / MSN Messenger: rizwan_nawaz786 at hotmail.com > > > > Gmail: rizwannawaz at gmail.com > > Yahoo IM: rizwan051 > > AOL IM: riznawaz > > Skype: rizwannawaz > > ICQ: 442047681 > > > > ============= > > SECURITY NOTICE > > ============= > > > > THE INFORMATION CONTAINED IN THIS TRANSMISSION IS PRIVILEGED AND > > CONFIDENTIAL. IT IS INTENDED FOR THE USE OF THE INDIVIDUAL OR ENTITY > > NAMED ABOVE. IF THE READER OF THIS MESSAGE IS NOT THE INTENDED > > RECIPIENT, YOU ARE HEREBY NOTIFIED THAT ANY DISSEMINATION, > > DISTRIBUTION OR COPY OF THIS COMMUNICATION IS STRICTLY PROHIBITED. > > > > IF YOU HAVE RECEIVED THIS COMMUNICATION IN ERROR, PLEASE IMMEDIATELY > > NOTIFY AND RETURN THE ORIGINAL MESSAGE TO THE SENDER AND DELETE IT. > > THANK YOU. > > > > > > ------------------------------------------------------------------------ > > Share life as it happens with the new Windows Live. Share now! > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > New York PHP Community Talk Mailing List > > http://lists.nyphp.org/mailman/listinfo/talk > > > > NYPHPCon 2006 Presentations Online > > http://www.nyphpcon.com > > > > Show Your Participation in New York PHP > > http://www.nyphp.org/show_participation.php > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php _________________________________________________________________ Share life as it happens with the new Windows Live.Download today it's FREE! http://www.windowslive.com/share.html?ocid=TXT_TAGLM_Wave2_sharelife_112007 -------------- next part -------------- An HTML attachment was scrubbed... URL: From danielc at analysisandsolutions.com Sun Dec 9 11:00:32 2007 From: danielc at analysisandsolutions.com (Daniel Convissor) Date: Sun, 9 Dec 2007 11:00:32 -0500 Subject: [nycphp-talk] How to execute external program in php In-Reply-To: References: <475AC467.7040407@sap8.com> Message-ID: <20071209160031.GA13153@panix.com> On Sat, Dec 08, 2007 at 05:12:58PM +0000, Muhammad Rizwan Nawaz wrote: > I have allow the apache server to login as admin. That's REALLY dangerous. Services like Apache should have very minimal permissions. --Dan ... snip ... -- T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y data intensive web and database programming http://www.AnalysisAndSolutions.com/ 4015 7th Ave #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409 From anthony at adcl.biz Mon Dec 10 03:24:24 2007 From: anthony at adcl.biz (Anthony Papillion) Date: Mon, 10 Dec 2007 02:24:24 -0600 Subject: [nycphp-talk] Question about random selection Message-ID: <475CF7B8.4080801@adcl.biz> Hello Everyone, I have a problem that I'm hoping someone here can help me solve. It's plagued me for a while now and, to be honest, I'm not terribly sure there actually is a workable solution. Here's the deal. I have a 'secret santa' type application that I designed for a Yahoo Group my wife owns. The way it works is that people go to the site, enter their email address and are randomly matched with some other person. The two filtering criteria for the match are 1) the persons match can't be taken )as indicated in an 'isTaken' field) and 2) the persons match can't be themselves. The systems works very well unless there are an odd number of people on the list. Then, one person is left out. We've just run into this problem a few minutes ago. There are 7 people on the list and everyone is owned by someone else except one person. Any idea how I can make this workable on an odd numbered list? Your help is really appreciated. Thanks, Anthony Papillion From rolan at omnistep.com Mon Dec 10 03:43:16 2007 From: rolan at omnistep.com (Rolan Yang) Date: Mon, 10 Dec 2007 03:43:16 -0500 Subject: [nycphp-talk] Question about random selection In-Reply-To: <475CF7B8.4080801@adcl.biz> References: <475CF7B8.4080801@adcl.biz> Message-ID: <475CFC24.5050700@omnistep.com> Anthony Papillion wrote: > Hello Everyone, > > > I have a 'secret santa' type application that I designed for a Yahoo > Group my wife owns. The way it works is that people go to the site, > enter their email address and are randomly matched with some other > person. The two filtering criteria for the match are 1) the persons > match can't be taken )as indicated in an 'isTaken' field) and 2) the > persons match can't be themselves. > > The systems works very well unless there are an odd number of people > on the list. Then, one person is left out. We've just run into this > problem a few minutes ago. There are 7 people on the list and everyone > is owned by someone else except one person. > > Any idea how I can make this workable on an odd numbered list? > Your help is really appreciated. > Do they have to be matched as pairs? If so, then it's simply not possible. If they only need to be matched to another person, then pick any pair off the list (Santa A & B) and the left out Santa (C) and match A->B, B->C, C->A ~Rolan From anthony at adcl.biz Mon Dec 10 04:18:12 2007 From: anthony at adcl.biz (Anthony Papillion) Date: Mon, 10 Dec 2007 03:18:12 -0600 Subject: [nycphp-talk] Question about random selection In-Reply-To: <475CFC24.5050700@omnistep.com> References: <475CF7B8.4080801@adcl.biz> <475CFC24.5050700@omnistep.com> Message-ID: <475D0454.9020701@adcl.biz> > > Do they have to be matched as pairs? If so, then it's simply not > possible. If they only need to be matched to another person, then pick > any pair off the list (Santa A & B) and the left out Santa (C) and > match A->B, B->C, C->A > > ~Rolan Hi Rolan, Thanks for the input. Works like a charm. I was approaching the problem from the wrong angle. Thanks again. Anthony Papillion From rolan at omnistep.com Mon Dec 10 10:00:01 2007 From: rolan at omnistep.com (Rolan Yang) Date: Mon, 10 Dec 2007 10:00:01 -0500 Subject: [nycphp-talk] Question about random selection In-Reply-To: <475D0454.9020701@adcl.biz> References: <475CF7B8.4080801@adcl.biz> <475CFC24.5050700@omnistep.com> <475D0454.9020701@adcl.biz> Message-ID: <475D5471.4050403@omnistep.com> Anthony Papillion wrote: > > Hi Rolan, > > Thanks for the input. Works like a charm. I was approaching the > problem from the wrong angle. Thanks again. > you should probably randomize the entire list and do an A->B,B->C,C->D,D->E, etc.. instead of pairing up because by the 4th or 5'th gift, people might catch on that all their gift givers are paired together (not that it really matters but...) ~Rolan From ben at projectskyline.com Mon Dec 10 11:06:59 2007 From: ben at projectskyline.com (Ben Sgro) Date: Mon, 10 Dec 2007 11:06:59 -0500 Subject: [nycphp-talk] Encrypting/Decrypting data w/php Message-ID: <475D6423.1090605@projectskyline.com> Hello All, I'm going to be storing some simple data in an xml file. The data will have information for session, including username/passwords. I want to encrypt the username & password associated w/the session. What's the easiest method/functions to do this? I've only done md5 and matched the input against the stored string. The program would: 1) Prompt the user for the password when starting. This is the password used to decrypt all sessions, and has nothing to do w/the stored/encrypted password. 2) Decrypt the session data in the xml files 3) Store the decrypted session data in memory. 4) Only if the user changes the session username/password would I write to the file (the encrypted) version. Thanks, - Ben From chsnyder at gmail.com Mon Dec 10 11:35:11 2007 From: chsnyder at gmail.com (csnyder) Date: Mon, 10 Dec 2007 11:35:11 -0500 Subject: [nycphp-talk] Encrypting/Decrypting data w/php In-Reply-To: <475D6423.1090605@projectskyline.com> References: <475D6423.1090605@projectskyline.com> Message-ID: On Dec 10, 2007 11:06 AM, Ben Sgro wrote: > Hello All, > > I'm going to be storing some simple data in an xml file. > > The data will have information for session, including username/passwords. > > I want to encrypt the username & password associated w/the session. > > What's the easiest method/functions to do this? I've only done md5 and > matched > the input against the stored string. > > The program would: > 1) Prompt the user for the password when starting. This is the password > used to decrypt all sessions, > and has nothing to do w/the stored/encrypted password. > 2) Decrypt the session data in the xml files > 3) Store the decrypted session data in memory. > 4) Only if the user changes the session username/password would I write > to the file (the encrypted) version. > > > Thanks, > > - Ben Hi Ben, So the password in 1) is the decryption key, right? PHP's mcrypt functions will allow you to encrypt and decrypt using AES or Blowfish in CBC mode, which is most likely what you want. I give this advice with a _huge_ grain of salt, do not proceed unless you feel fully informed about the practical application of cryptography. -- Chris Snyder http://chxo.com/ From bz-gmort at beezifies.com Mon Dec 10 11:38:34 2007 From: bz-gmort at beezifies.com (Gary Mort) Date: Mon, 10 Dec 2007 11:38:34 -0500 Subject: [nycphp-talk] Encrypting/Decrypting data w/php In-Reply-To: References: <475D6423.1090605@projectskyline.com> Message-ID: <475D6B8A.80002@beezifies.com> Speaking of encryption/decryption where the notes from the last presentation posted up somewhere? From nickg at modp.com Mon Dec 10 12:23:44 2007 From: nickg at modp.com (Nick Galbreath) Date: Mon, 10 Dec 2007 12:23:44 -0500 Subject: [nycphp-talk] Encrypting/Decrypting data w/php In-Reply-To: <475D6B8A.80002@beezifies.com> References: <475D6423.1090605@projectskyline.com> <475D6B8A.80002@beezifies.com> Message-ID: <4c95589d0712100923q30b79975ua172e31a8faae850@mail.gmail.com> Hi, I'm the speaker from last week's NYPHP talk on cryptography. 1) SLIDES Sorry for delay. I will be posting my slides shortly! I've been reworking them and getting source code online. I will post here when they are up. 2) ENCRYPTED SESSIONS Most importantly, before any technical questions is "what threats are you trying model"? and what type of data are you trying to protect? (I ask since certain data, i.e. such as credit cards, have certain standards). For example: 1) hacker "breaks in" and scans session data for ??? 2) hacker scans network traffic from database to php-app to get ??? 3) hacker hijacks session and takes over another account etc etc... Then there are some product questions: 1) Do you have "user database" or are these just anonymous sessions? 2) Is _all_ data in the session sensitive? Do you want an encrypted XML file or an XML file with encrypted data? And why? 3) How much data per user per session is expected? 4) What is anticipated volume/growth of the website? 5) Is this data, _just_ going to live in session? It's never going into a database or other file? If not how do we protect those items? 6) Do you need password recovery? Or what if the user forgets the password the data is gone? 7) How are you currently storing session data (are sessions sticky to a machine? or are sessions on a separate box) >From this a solution can be crafted. Maybe there is an simple out of the box solution (e.g.an encrypted disk volume might be all you need!). If you need more help, please contact me directly thanks, -- Nick Galbreath nickg at modp.com On 12/10/07, Gary Mort wrote: > > Speaking of encryption/decryption where the notes from the last > presentation posted up somewhere? > _______________________________________________ > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ramons at gmx.net Mon Dec 10 12:49:32 2007 From: ramons at gmx.net (David Krings) Date: Mon, 10 Dec 2007 12:49:32 -0500 Subject: [nycphp-talk] Reading in strings from text file Message-ID: <475D7C2C.30205@gmx.net> Hi! I am about to start on a module for i18n and wonder if anyone has experience on how long it takes to read in let's say 1,000 strings of about 30 characters on average from a text file that has numeric keys, with those keys becoming the key of an array that in the end is to be stored in $_SESSION. Is there a better place than $_SESSION to hold this? What I really want to prevent is to have each script that generates text output have to read in its own strings as this adds management needs to make sure the right strings are picked up. Anyone knows how well this would scale with 10,000 or 100,000 strings? Sure, I could try it out, but asking NYPHP is way faster. David From jcampbell1 at gmail.com Mon Dec 10 14:23:31 2007 From: jcampbell1 at gmail.com (John Campbell) Date: Mon, 10 Dec 2007 14:23:31 -0500 Subject: [nycphp-talk] Reading in strings from text file In-Reply-To: <475D7C2C.30205@gmx.net> References: <475D7C2C.30205@gmx.net> Message-ID: <8f0676b40712101123y3ae00976q8b74f6dee0688da5@mail.gmail.com> > I am about to start on a module for i18n and wonder if anyone has experience > on how long it takes to read in let's say 1,000 strings of about 30 characters > on average from a text file that has numeric keys, with those keys becoming > the key of an array that in the end is to be stored in $_SESSION. Is there a > better place than $_SESSION to hold this? What I really want to prevent is to > have each script that generates text output have to read in its own strings as > this adds management needs to make sure the right strings are picked up. > Anyone knows how well this would scale with 10,000 or 100,000 strings? Sure, I > could try it out, but asking NYPHP is way faster. I highly recommend *not* doing it this way. 1) A session is the worst place to put the data because there is a different session file for each user. If you do want to do this, use a singleton pattern to access the array bundle. 2) Plurals, and translation re-ordering will be nearly impossible. 3) Performance will be suboptimal. 4) You will have to build your own tools for the translators. 5) Dealing with merges is going to be a pain. 6) You need to give the translators context for the strings. 7) Your system will have to deal with non-translated strings appropriately. The good news is that all of these problems associated with i18n, have been solved. Gettext is the GNU standard and you get all of the tools for free (PoEdit for translators, msgmerge, binary encoding for performance) Gettext seems confusing and complicated at first, but you will appreciate it once you have tried something else. I know this doesn't answer your question about the performance, but it is unlikely that you will be able to successfully internationalize an application with 1000+ strings if your plan is to use array bundles. Just so you understand the difficulty of i18n'ing an app, consider this string: "Your Visa card with last four digits 1234 expires on Dec 15, 2007". In another language, it may need to be written as: "On 15:Drb:2007, expires, last 4 digits 1234, is your Visa" Also, your application code will become unreadable if you use array bundles. Consider: echo $translation_bundle[ERR::CC_EXP]; vs the gettext way: echo _("Your credit card has expired"); I find the latter much more readable. Cheers, John Campbell From ben at projectskyline.com Mon Dec 10 16:50:05 2007 From: ben at projectskyline.com (Ben Sgro) Date: Mon, 10 Dec 2007 16:50:05 -0500 Subject: [nycphp-talk] Encrypting/Decrypting data w/php In-Reply-To: <4c95589d0712100923q30b79975ua172e31a8faae850@mail.gmail.com> References: <475D6423.1090605@projectskyline.com> <475D6B8A.80002@beezifies.com> <4c95589d0712100923q30b79975ua172e31a8faae850@mail.gmail.com> Message-ID: <475DB48D.3000805@projectskyline.com> Hello, Just to clarify, when I say "session" I don't mean "session" data. Just a previous "session" of work performed by the user. I want to save their settings. This is a tool for company use only, specifically debugging/QA and is CL driven. Now to answer your other questions: Nick Galbreath wrote: > > > Hi, I'm the speaker from last week's NYPHP talk on cryptography. > > 1) SLIDES > > Sorry for delay. I will be posting my slides shortly! I've been > reworking them and getting source code online. I will post here when > they are up. > > > > 2) ENCRYPTED SESSIONS > > > Most importantly, before any technical questions is "what threats are > you trying model"? and what type of data are you trying to protect? > (I ask since certain data, i.e. such as credit cards, have certain > standards). For example: > > > 1) hacker "breaks in" and scans session data for ??? Username/Logins - This would be the most valuable data in the xml file. > 2) hacker scans network traffic from database to php-app to get ??? It doesn't provide a web interface. And the XML wouldn't be served by HTTP. This wouldn't be in web root. > 3) hacker hijacks session and takes over another account I wouldn't think so. Unless they hijack a tty. But honestly, if they have root on the box we have other problems. > > > etc etc... > > > Then there are some product questions: > > 1) Do you have "user database" or are these just anonymous sessions? Work sessions. > 2) Is _all_ data in the session sensitive? Do you want an encrypted > XML file or an XML file with encrypted data? And why? No. Just the username/password. > 3) How much data per user per session is expected? Not that much. 20k? > 4) What is anticipated volume/growth of the website? CL App. > 5) Is this data, _just_ going to live in session? It's never going > into a database or other file? If not how do we protect those items? Nope. > 6) Do you need password recovery? Or what if the user forgets the > password the data is gone? They'd have to create a new "session". > 7) How are you currently storing session data (are sessions sticky to > a machine? or are sessions on a separate box) Local. > > > From this a solution can be crafted. Maybe there is an simple out of > the box solution ( e.g.an encrypted disk volume might > be all you need!). If you need more help, please contact me directly > > thanks, > > -- Nick Galbreath > nickg at modp.com > > > On 12/10/07, * Gary Mort* > wrote: > > Speaking of encryption/decryption where the notes from the last > presentation posted up somewhere? > _______________________________________________ > > ------------------------------------------------------------------------ > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php From ramons at gmx.net Mon Dec 10 17:07:15 2007 From: ramons at gmx.net (David Krings) Date: Mon, 10 Dec 2007 17:07:15 -0500 Subject: [nycphp-talk] Reading in strings from text file In-Reply-To: <8f0676b40712101123y3ae00976q8b74f6dee0688da5@mail.gmail.com> References: <475D7C2C.30205@gmx.net> <8f0676b40712101123y3ae00976q8b74f6dee0688da5@mail.gmail.com> Message-ID: <475DB893.2010209@gmx.net> John Campbell wrote: > > I highly recommend *not* doing it this way. I am not surprised about this advice. > 1) A session is the worst place to put the data because there is a > different session file for each user. If you do want to do this, use > a singleton pattern to access the array bundle. I have no idea what a singleton pattern is. > 3) Performance will be suboptimal. That is what I considered to be the case and thus the reason why I asked. > 2) Plurals, and translation re-ordering will be nearly impossible. > 4) You will have to build your own tools for the translators. > 5) Dealing with merges is going to be a pain. > 6) You need to give the translators context for the strings. I did not mention this before, but I have collected first hand experience in i18n as both project manager and translator. Context for strings would have been the application. I expect from any translator who is halfways serious about a useful translation that he/she knows the app. Most of the time translators do not as the companies hiring them don't want to pay for their time spent in training. In my case, the app is gosh darn easy and there will be CSH available. > 7) Your system will have to deal with non-translated strings appropriately. That is something that I would have considered if going ahead with my now shattered plan. > The good news is that all of these problems associated with i18n, have > been solved. Gettext is the GNU standard and you get all of the tools > for free (PoEdit for translators, msgmerge, binary encoding for > performance) Gettext seems confusing and complicated at first, but > you will appreciate it once you have tried something else. > > I know this doesn't answer your question about the performance, but it > is unlikely that you will be able to successfully internationalize an > application with 1000+ strings if your plan is to use array bundles. > > Just so you understand the difficulty of i18n'ing an app, consider this string: > "Your Visa card with last four digits 1234 expires on Dec 15, 2007". > > In another language, it may need to be written as: > "On 15:Drb:2007, expires, last 4 digits 1234, is your Visa" I know about the difficulties in dealing with i18n. I never heard about gettext and I will take a look at it. I just hope it uses a string text file format that allows for using spellcheckers, but maybe that is included in PoEdit? > Also, your application code will become unreadable if you use array > bundles. Consider: > echo $translation_bundle[ERR::CC_EXP]; > vs the gettext way: > echo _("Your credit card has expired"); > > I find the latter much more readable. I'll take a look at it and then cast my verdict. I worked with too many developers who implemented i18n in a way that made quick and easy translations close to impossible, for example by insisting on using alphanumeric monikers as keys. That totally sucked. Thanks for the tip and saving me from spending time on something stupid. :) David From chsnyder at gmail.com Mon Dec 10 17:17:24 2007 From: chsnyder at gmail.com (csnyder) Date: Mon, 10 Dec 2007 17:17:24 -0500 Subject: [nycphp-talk] Reading in strings from text file In-Reply-To: <475D7C2C.30205@gmx.net> References: <475D7C2C.30205@gmx.net> Message-ID: On Dec 10, 2007 12:49 PM, David Krings wrote: > Hi! > > I am about to start on a module for i18n and wonder if anyone has experience > on how long it takes to read in let's say 1,000 strings of about 30 characters > on average from a text file that has numeric keys, with those keys becoming > the key of an array that in the end is to be stored in $_SESSION. Is there a > better place than $_SESSION to hold this? What I really want to prevent is to > have each script that generates text output have to read in its own strings as > this adds management needs to make sure the right strings are picked up. > Anyone knows how well this would scale with 10,000 or 100,000 strings? Sure, I > could try it out, but asking NYPHP is way faster. > > David +1 for gettext. It's extremely fast, very capable, and there is the weight of many other projects behind it. In the simplest case, you simply wrap all of your output strings in _( ) and keep going. When you're ready to translate, the command line scripts will scan your code for all those instances, and then generate plain text files that you can give to translators to work on. That said, it is not the easiest thing to learn how to make it all work. And the downside to the lightning fast speed is that you have to restart Apache whenever you change one of the .po files. In practice this isn't such a big deal. Anyway, feel free to ask specific questions here when/if you start using it. -- Chris Snyder http://chxo.com/ From jcampbell1 at gmail.com Mon Dec 10 18:29:29 2007 From: jcampbell1 at gmail.com (John Campbell) Date: Mon, 10 Dec 2007 18:29:29 -0500 Subject: [nycphp-talk] Reading in strings from text file In-Reply-To: <475DB893.2010209@gmx.net> References: <475D7C2C.30205@gmx.net> <8f0676b40712101123y3ae00976q8b74f6dee0688da5@mail.gmail.com> <475DB893.2010209@gmx.net> Message-ID: <8f0676b40712101529m14a0b549lc85111b3a0773f18@mail.gmail.com> > I have no idea what a singleton pattern is. It is worth your time to google search for "singleton pattern php" and do some reading. I don't mean to sound smug by sending you to google, but others can explain it much better than I can. > That is something that I would have considered if going ahead with my now > shattered plan. I am glad I have shattered you plan, because I went down the road you were headed and hit a brick wall. I wasted dozens of hours instead of intelligently posting to a list. I now know: - i18n is a hard problem. - it has already been solved - gettext is the free solution - gettext works well as an afterthought to an already existing application. The caveat is that gettext is "As simple as possible, but not simpler". My advice is to spend a day reading he man pages for "msgfmt", "msgmerge", and "msgfmt" and reading php.net/gettext. Regards, John Campbell From ramons at gmx.net Mon Dec 10 21:31:49 2007 From: ramons at gmx.net (David Krings) Date: Mon, 10 Dec 2007 21:31:49 -0500 Subject: [nycphp-talk] Reading in strings from text file In-Reply-To: <8f0676b40712101529m14a0b549lc85111b3a0773f18@mail.gmail.com> References: <475D7C2C.30205@gmx.net> <8f0676b40712101123y3ae00976q8b74f6dee0688da5@mail.gmail.com> <475DB893.2010209@gmx.net> <8f0676b40712101529m14a0b549lc85111b3a0773f18@mail.gmail.com> Message-ID: <475DF695.9070708@gmx.net> John Campbell wrote: > I now know: > - i18n is a hard problem. Not really when done right, coding is harder. > - it has already been solved Well, this is for a picture and video viewer. There are tons out there. I am sure that with most of my endeavours in PHP I can find a faster, better, safer, more featured version in 5 seconds on the web ready for download and use. My goal is to learn on how to do it myself. I do want to learn and get experience. That said, my plan was to create string files one for each language with the following format or as an example line 12345 "This is a test!" Plus some simple formatting codes or even a small subset of XHTML tags so that I can control line breaks, make text bold, and such. From all string files I ever worked with the ones following the format worked the best. As a tool one needs a plain old text editor, one can run a spellchecker against the flat file (and it doesn't choke on the numeric keys), and when selecting the keys so that they build groups for each section or page it is very easy to put new blocks in and take blocks out. Comparisons and cross-checks can be made with a spreadsheet, although I would have built a simple tool for doing so. And changing anything is as easy as editing the file in place or dropping in a new one. Sure, plurals and potential segments would need to be their own string, but German being the first language to translate to, I know that there isn't an easy algorithm to pluralize the words. It is not as easy as in English were slapping and "s" or "es" at the end works in 99% of the cases. In German there are several endings, the entire word stem may change, or the singular word is the same as the plural word and the only difference is the different article in front of it. I am very sure that having a few strings more in the string file is more efficient than to figure out the inner workings of the German language. > - gettext is the free solution That is a must anyway. > - gettext works well as an afterthought to an already existing application. So how would one go ahead when starting a new application? Not use gettext, but something else? > The caveat is that gettext is "As simple as possible, but not > simpler". My advice is to spend a day reading he man pages for > "msgfmt", "msgmerge", and "msgfmt" and reading php.net/gettext. And simple is a very relative term. From what I have seen, gettext's .po format is quite different from what I was going for, but it may just be the better approach. I start reading and try it with a small sample script. Thanks for all the pointers. David From jcampbell1 at gmail.com Tue Dec 11 09:30:24 2007 From: jcampbell1 at gmail.com (John Campbell) Date: Tue, 11 Dec 2007 09:30:24 -0500 Subject: [nycphp-talk] Reading in strings from text file In-Reply-To: <475DF695.9070708@gmx.net> References: <475D7C2C.30205@gmx.net> <8f0676b40712101123y3ae00976q8b74f6dee0688da5@mail.gmail.com> <475DB893.2010209@gmx.net> <8f0676b40712101529m14a0b549lc85111b3a0773f18@mail.gmail.com> <475DF695.9070708@gmx.net> Message-ID: <8f0676b40712110630l61e2edb6udcda0f25ade26c8f@mail.gmail.com> On Dec 10, 2007 9:31 PM, David Krings wrote: > > - gettext works well as an afterthought to an already existing application. > So how would one go ahead when starting a new application? Not use gettext, > but something else? Gettext works well with existing and new applications. I am not aware of anything better. -John Campbell From anangtt at hotmail.com Tue Dec 11 12:16:49 2007 From: anangtt at hotmail.com (anang tawiah) Date: Tue, 11 Dec 2007 12:16:49 -0500 Subject: [nycphp-talk] Help in creating multiple columns and rows to display product name pice and images Message-ID: I am a relative php amateur who is trying to kind of master the php 5 syntax and I have using Larry Ulmanns php and mysql 2nd edition book. The problem I am facing is that in the authors example he lists all the results. What I want to do for this project is to display the following product information in rows and columns whereby; i could specify the number of columns and rows per page (using php 5 syntax)And finally I also want to paginate the result set (using php 5 syntax) I know this might sound trivial to most of you ?Gurus? on this list (which is why I finally decided to stop trying to figure it out myself and ask for help) and I appreciate your help in advance. 0) { $query = "SELECT artists.artist_id, CONCAT_WS(' ', first_name, middle_name, last_name) AS name, print_name, price, description, print_id FROM artists, prints WHERE artists.artist_id = prints.artist_id AND prints.artist_id =$aid ORDER BY prints.print_name"; } else { $query = "SELECT artists.artist_id, CONCAT_WS(' ', first_name, middle_name, last_name) AS name, print_name, price, description, print_id FROM artists, prints WHERE artists.artist_id = prints.artist_id ORDER BY artists.last_name ASC, prints.print_name ASC"; } } else { $query = "SELECT artists.artist_id, CONCAT_WS(' ', first_name, middle_name, last_name) AS name, print_name, price, description, print_id FROM artists, prints WHERE artists.artist_id = prints.artist_id ORDER BY artists.last_name ASC, prints.print_name ASC"; } // Create the table head. echo ''; // Display all the prints, linked to URLs. $result = mysqli_query ($dbc, $query); while ($row = mysqli_fetch_array ($result, MYSQL_ASSOC)) { // Display each record. echo " \n"; } // End of while loop. echo '
Artist Print Name Description Price
{$row['name']} {$row['print_name']} {$row['description']} \${$row['price']}
'; // Close the table. mysqli_close($dbc); // Close the database connection. include ('./includes/footer.html'); ?> Thanks, -------------- next part -------------- An HTML attachment was scrubbed... URL: From anangtt at hotmail.com Tue Dec 11 12:16:56 2007 From: anangtt at hotmail.com (anang tawiah) Date: Tue, 11 Dec 2007 12:16:56 -0500 Subject: [nycphp-talk] Help in creating multiple columns and rows to display product name pice and images Message-ID: I am a relative php amateur who is trying to kind of master the php 5 syntax and I have using Larry Ulmanns php and mysql 2nd edition book. The problem I am facing is that in the authors example he lists all the results. What I want to do for this project is to display the following product information in rows and columns whereby; i could specify the number of columns and rows per page (using php 5 syntax)And finally I also want to paginate the result set (using php 5 syntax) I know this might sound trivial to most of you ?Gurus? on this list (which is why I finally decided to stop trying to figure it out myself and ask for help) and I appreciate your help in advance. 0) { $query = "SELECT artists.artist_id, CONCAT_WS(' ', first_name, middle_name, last_name) AS name, print_name, price, description, print_id FROM artists, prints WHERE artists.artist_id = prints.artist_id AND prints.artist_id =$aid ORDER BY prints.print_name"; } else { $query = "SELECT artists.artist_id, CONCAT_WS(' ', first_name, middle_name, last_name) AS name, print_name, price, description, print_id FROM artists, prints WHERE artists.artist_id = prints.artist_id ORDER BY artists.last_name ASC, prints.print_name ASC"; } } else { $query = "SELECT artists.artist_id, CONCAT_WS(' ', first_name, middle_name, last_name) AS name, print_name, price, description, print_id FROM artists, prints WHERE artists.artist_id = prints.artist_id ORDER BY artists.last_name ASC, prints.print_name ASC"; } // Create the table head. echo ''; // Display all the prints, linked to URLs. $result = mysqli_query ($dbc, $query); while ($row = mysqli_fetch_array ($result, MYSQL_ASSOC)) { // Display each record. echo " \n"; } // End of while loop. echo '
Artist Print Name Description Price
{$row['name']} {$row['print_name']} {$row['description']} \${$row['price']}
'; // Close the table. mysqli_close($dbc); // Close the database connection. include ('./includes/footer.html'); ?> Thanks, -------------- next part -------------- An HTML attachment was scrubbed... URL: From tonyf at buffnet.net Tue Dec 11 13:16:01 2007 From: tonyf at buffnet.net (Tony Furnivall) Date: Tue, 11 Dec 2007 12:16:01 -0600 Subject: [nycphp-talk] Managing form data with PHP Message-ID: Newbie request - I want to handle a form by redisplaying the submitted data, along with error information. Eg one of the forms has two dates (a FromDate and a ToDate) as well as an identifier. The usual error conditions apply to the dates - valid form, From <= To, etc. What I'd like to be able to do is to have a stack of error messages which identify a field in error, and the set of associated error messages. Ideally the fields in error would be shaded to indicate the severity of the error (no shading = fine; yellow shading=warning; red shading=error), and would also allow the user to see the list of errors for a field by hovering over the field. The 'pretty' enhancements are relatively easy - but I'm having a problem trying to get the form data to redisplay. Any pointers? ideas? suggestions? Thanks, Tony -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.503 / Virus Database: 269.17.0/1180 - Release Date: 12/10/2007 2:51 PM From jcampbell1 at gmail.com Tue Dec 11 13:47:26 2007 From: jcampbell1 at gmail.com (John Campbell) Date: Tue, 11 Dec 2007 13:47:26 -0500 Subject: [nycphp-talk] Managing form data with PHP In-Reply-To: References: Message-ID: <8f0676b40712111047m8ae62e3y854123349513339d@mail.gmail.com> > The 'pretty' enhancements are relatively easy - but I'm having a > problem trying to get the form data to redisplay. Start by submitting the form to the script that renders the page:
Then each field should of the form: If the post data is valid, redirect. Otherwise, the form will automatically redisplay with the original values intact. From ramons at gmx.net Tue Dec 11 14:02:14 2007 From: ramons at gmx.net (David Krings) Date: Tue, 11 Dec 2007 14:02:14 -0500 Subject: [nycphp-talk] Managing form data with PHP In-Reply-To: References: Message-ID: <475EDEB6.2020105@gmx.net> Tony Furnivall wrote: > The 'pretty' enhancements are relatively easy - but I'm having a problem > trying to get the form data to redisplay. > > Any pointers? ideas? suggestions? I am sure there are better ways, but this is what I do: I submit the script to itself and check with isset() which values in $_POST are set. With a good initialization of variables you get a very reliable means of checking if there was data submitted at all (after getting values from $_POST unsubmitted variables retain their initialization value) and when it was submitted (variable valuye is no longer the initialization value) one can check for plausibility, such as checking if a date entered really is a valid date (PHP has nice functions for that). Based on the outcome of all this checking I set the default value of the form elements to the submitted and accepted value or show an appropriate error message (which you say you have handled with the 'pretty' stuff). Upon a submit that generates no error I write the values to $_SESSION and redirect the browser to the next script, for example one that writes the values to the database. Of course, you can also show a message that all entries are OK and place a button on the page. Upon clicking that button the whole entires are submitted via hidden fields through $_POST to a different script. Or you could just stuff all the code into one big script and redirect to itself with commands sent along through the URL parameter that can be harvested from $_GET. You ideally create a huge switch statement that acts upon that activity tag. I like many script better than one big one, but I can see advantages for both approaches. There are some HTML form fields where you do not want to (or even cannot) set default values from previous submissions, such as password fields. It is common practice that those entries are not preserved. There are two ways to get the previously submitted value to show in drop-down lists as current selection. The easy, cheesy method is to make sure that it is the first entry in the list, which is the default selection if not specified otherwise. You will have that option then in the list twice. The nicer approach is to set the selected flag appropriately. Likewise for radio button groups and check boxes. I use this in some cases, but do so sparingly. If the form contains three fields I don't bother. It is nice to do this for large forms. It can get confusing at times and there is a lot of checking needed so that you don't get screwy results for the various states of the page/form. But, I found it to work well and in a way that I can comprehend and troubleshoot. Add a lot of comments so that in a week from now you still have a clue as to why there are all these checks in there. The script will get quite complex compared to one that 'only' shows a static form. Hope that helps, David From jmcgraw1 at gmail.com Tue Dec 11 14:03:51 2007 From: jmcgraw1 at gmail.com (Jake McGraw) Date: Tue, 11 Dec 2007 14:03:51 -0500 Subject: [nycphp-talk] Managing form data with PHP In-Reply-To: <8f0676b40712111047m8ae62e3y854123349513339d@mail.gmail.com> References: <8f0676b40712111047m8ae62e3y854123349513339d@mail.gmail.com> Message-ID: Smarty, Smarty, Smarty. smarty.php.net. Smarty Template File: Error "log" at the top of the page could look like this:
    {foreach from=$errors key=field item=message}
  • {$field} : {$message.text}
  • {/foreach}
Each field label could be marked up to include the above error: Note that the whole filter_var thing could be looped inside of your PHP script, I just included it because you should always cleanout POST and GET and REQUEST. - jake On Dec 11, 2007 1:47 PM, John Campbell wrote: > > The 'pretty' enhancements are relatively easy - but I'm having a > > problem trying to get the form data to redisplay. > > Start by submitting the form to the script that renders the page: > > Then each field should of the form: > > > If the post data is valid, redirect. Otherwise, the form will > automatically redisplay with the original values intact. > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben at projectskyline.com Tue Dec 11 16:26:12 2007 From: ben at projectskyline.com (Ben Sgro) Date: Tue, 11 Dec 2007 16:26:12 -0500 Subject: [nycphp-talk] OOP Books & Resources Message-ID: <475F0074.6080403@projectskyline.com> Hello, A while back I asked an OOP related question. Brian D suggested: If you're just starting out in the PHP5 OOP world, I highly recommend Zandstra's "PHP 5 Objects, Patterns, and Practice." I promise you it's worth the $20. Which I did and started reading it (twice) and it just assumes too much. I have zero OOP experience (well that's not really true) and need more explanation than that book provides. Here's a list of OOP books I've collected from Bookpool. Can anyone provide insight as to which are good. I've been coding for a few years now professionally, but dont have any real schooling in it. So, I'm kinda looking to fill in the gaps in my knowledge. So other books of interest I'm welcome to hear too. The list: http://www.bookpool.com/sm/0321247140 http://www.bookpool.com/sm/020163385X http://www.bookpool.com/sm/020189551X http://www.bookpool.com/sm/0672326116 - Which I just borrowed from work I'm also interested in learning UML. Thanks! - Ben From cliff at pinestream.com Tue Dec 11 16:53:55 2007 From: cliff at pinestream.com (Cliff Hirsch) Date: Tue, 11 Dec 2007 16:53:55 -0500 Subject: [nycphp-talk] Do you use Pretty URLs Message-ID: I posted this to the Boston list and received two replies: 1. Using pretty URLs via Joomla. 2. Try Horde Route: http://dev.horde.org/routes/integrate.html (btw, this looks like a good solution) Let?s see what NY has to say. Here?s what I posted. So...how many of you use ?pretty urls?? If you do, how do you do it? With a Framework (Cake, Symphony, Zend, etc.) that you are using? Rolled your own? Via php or mod_rewrite? Thoughts and ideas for introducing pretty urls into an existing application (i.e. can?t jump into a new Framework for a legacy app)? Happy holidays, Cliff -------------- next part -------------- An HTML attachment was scrubbed... URL: From nickg at modp.com Tue Dec 11 17:13:49 2007 From: nickg at modp.com (Nick Galbreath) Date: Tue, 11 Dec 2007 17:13:49 -0500 Subject: [nycphp-talk] Tamperproof URLs and PHP slides posted Message-ID: <4c95589d0712111413o68f76458r76ebcb835b4d331d@mail.gmail.com> Hello, First thanks everyone for coming out the NYPHP on 27-nov-2007 for my talk on "Tamperproof URLs and PHP" Based on your feedback, comments, and uhhh, a few blank stares, I completely revamped the slides. Right now, I've dumped the slides, the source code and the unit test here: http://modp.com/slides/securestring/ However I hope to move all of it to svn at code.google.com once they let me use more resources. If you have any comments, questions on the slides, or corrections what not, please post a comment on my blog: http://blog.modp.com/2007/12/tamperproof-urls-and-php.html thanks again, --nickg Nick Galbreath -------------- next part -------------- An HTML attachment was scrubbed... URL: From ajai at bitblit.net Tue Dec 11 17:24:15 2007 From: ajai at bitblit.net (Ajai Khattri) Date: Tue, 11 Dec 2007 17:24:15 -0500 (EST) Subject: [nycphp-talk] Do you use Pretty URLs In-Reply-To: Message-ID: On Tue, 11 Dec 2007, Cliff Hirsch wrote: > So...how many of you use ?pretty urls?? If you do, how do you do it? With a > Framework (Cake, Symphony, Zend, etc.) that you are using? Rolled your own? > Via php or mod_rewrite? Thoughts and ideas for introducing pretty urls into > an existing application (i.e. can?t jump into a new Framework for a legacy > app)? Perhaps it would be better to say its a legacy app up front so people don't waste time posting about routing in frameworks like symfony...? I would imagine mod_rewrite rules are probably your best bet. -- Aj. From cliff at pinestream.com Tue Dec 11 17:31:41 2007 From: cliff at pinestream.com (Cliff Hirsch) Date: Tue, 11 Dec 2007 17:31:41 -0500 Subject: [nycphp-talk] Do you use Pretty URLs In-Reply-To: Message-ID: >> So...how many of you use ?pretty urls?? If you do, how do you do it? With a >> Framework (Cake, Symphony, Zend, etc.) that you are using? Rolled your own? >> Via php or mod_rewrite? Thoughts and ideas for introducing pretty urls into >> an existing application (i.e. can?t jump into a new Framework for a legacy >> app)? > > Perhaps it would be better to say its a legacy app up front so people > don't waste time posting about routing in frameworks like symfony...? > > I would imagine mod_rewrite rules are probably your best bet. Good point. LEGACY APPLICATION. Many of us don't have the luxury of completely porting an existing application to a modern framework, but do have the wherewithal to potentially bolt in a pretty url module or parts of a front-end controller. From ajai at bitblit.net Tue Dec 11 19:21:13 2007 From: ajai at bitblit.net (Ajai Khattri) Date: Tue, 11 Dec 2007 19:21:13 -0500 (EST) Subject: [nycphp-talk] OOP Books & Resources In-Reply-To: <475F0074.6080403@projectskyline.com> Message-ID: On Tue, 11 Dec 2007, Ben Sgro wrote: > Which I did and started reading it (twice) and it just assumes too much. > I have zero OOP experience (well that's not really true) and need more > explanation than that book provides. > > Here's a list of OOP books I've collected from Bookpool. Can anyone > provide insight as to which are good. > I've been coding for a few years now professionally, but dont have any > real schooling in it. > > So, I'm kinda looking to fill in the gaps in my knowledge. So other > books of interest I'm welcome to hear too. I used Peter Lavin's book to learn PHP5 OOP: http://nostarch.com/frameset.php?startat=oophp > The list: > http://www.bookpool.com/sm/0321247140 > http://www.bookpool.com/sm/020163385X > http://www.bookpool.com/sm/020189551X > http://www.bookpool.com/sm/0672326116 Most of these are too dry and academic for me. I also looked into using UML and found it to be not of much value for what Im doing. -- A From ben at projectskyline.com Tue Dec 11 19:55:43 2007 From: ben at projectskyline.com (Ben Sgro) Date: Tue, 11 Dec 2007 19:55:43 -0500 Subject: [nycphp-talk] OOP Books & Resources In-Reply-To: References: Message-ID: <475F318F.7060104@projectskyline.com> Hello Ajai, I'll take a look at that. Thing is, it doesn't have to be a php oop book. I just want it to really flesh out all the OOP Design details. Strange as it may sound, I like the dry academic books. heh. UML would be great for what I'm doing. I find I'm lacking a way to describe a program, both verbally and visually. I think that's where UML will come in handy. Thanks Ajai, - Ben Ajai Khattri wrote: > On Tue, 11 Dec 2007, Ben Sgro wrote: > > >> Which I did and started reading it (twice) and it just assumes too much. >> I have zero OOP experience (well that's not really true) and need more >> explanation than that book provides. >> >> Here's a list of OOP books I've collected from Bookpool. Can anyone >> provide insight as to which are good. >> I've been coding for a few years now professionally, but dont have any >> real schooling in it. >> >> So, I'm kinda looking to fill in the gaps in my knowledge. So other >> books of interest I'm welcome to hear too. >> > > I used Peter Lavin's book to learn PHP5 OOP: > http://nostarch.com/frameset.php?startat=oophp > > >> The list: >> http://www.bookpool.com/sm/0321247140 >> http://www.bookpool.com/sm/020163385X >> http://www.bookpool.com/sm/020189551X >> http://www.bookpool.com/sm/0672326116 >> > > Most of these are too dry and academic for me. > > I also looked into using UML and found it to be not of much value for what > Im doing. > > > From selyah1 at yahoo.com Tue Dec 11 22:10:25 2007 From: selyah1 at yahoo.com (selyah) Date: Tue, 11 Dec 2007 19:10:25 -0800 (PST) Subject: [nycphp-talk] Help in creating multiple columns and rows to display product name pice and images Message-ID: <270222.65157.qm@web30804.mail.mud.yahoo.com> Hello: I am trying to understand what your are trying to accomplish. this is just a suggestion. if you are using a form to submit the data, then I would change the isset($_GET'aid'] to isset($_GET['submitted'])) to test if a form was submitted. The your could use $query="SELECT....VALUE..... items to be place into the database. if the result is ok then $result=mysql_query($query); the if($result) { print the results. That way all of the artist is into one database and you only use one statement to display the info from the data base using the aid. Good luck see a sample below: ///////////////////////////////////////////// if(isset($_POST['submitted'])) {//if the form was submitted if(!empty($_POST['artistfname'])) { $afn=$_POST['artistfname']; } else { $_POST['artistfname']=NULL; } if(!empty($_POST['artistlname'])) { $aln=$_POST['artistlname']; } else { $_POST['artistlname']=NULL; } if(!empty($_POST['description'])) { $desc=$_POST['description']; } else { $_POST['description']=NULL; } } require_once ('../mysql_connect.php'); // Connect to the database. // Are we looking at a particular artist? if(empty($errors)) { require_once('./connect/mysql_connect.php'); $query="INSERT INTO artisttable concat(artist_fname, artist_lname) as name,price, description) VALUES ('$afn','aln','$price', '$description'); $result=@mysql_query($query); if($result) { echo ''; // Display all the prints, linked to URLs. $result = mysqli_query ($dbc, $query); while ($row = mysqli_fetch_array ($result, MYSQL_ASSOC)) { // Display each record. echo " \n"; } // End of while loop. echo '
Artist Print Name Description Price
{$row['name']} {$row['print_name']} {$row['description']} \${$row['price']}
'; // Close the table. mysqli_close($dbc); // Close the database connection. include ('./includes/footer.html'); ?> /////////////////////////////// ----- Original Message ---- From: anang tawiah To: talk at lists.nyphp.org Sent: Tuesday, December 11, 2007 12:16:56 PM Subject: [nycphp-talk] Help in creating multiple columns and rows to display product name pice and images .hmmessage P { margin:0px;padding:0px;} body.hmmessage { FONT-SIZE:10pt;FONT-FAMILY:Tahoma;} I am a relative php amateur who is trying to kind of master the php 5 syntax and I have using Larry Ulmanns php and mysql 2nd edition book. The problem I am facing is that in the authors example he lists all the results. What I want to do for this project is to display the following product information in rows and columns whereby; i could specify the number of columns and rows per page (using php 5 syntax)And finally I also want to paginate the result set (using php 5 syntax) I know this might sound trivial to most of you ?Gurus? on this list (which is why I finally decided to stop trying to figure it out myself and ask for help) and I appreciate your help in advance. 0) { $query = "SELECT artists.artist_id, CONCAT_WS(' ', first_name, middle_name, last_name) AS name, print_name, price, description, print_id FROM artists, prints WHERE artists.artist_id = prints.artist_id AND prints.artist_id =$aid ORDER BY prints.print_name"; } else { $query = "SELECT artists.artist_id, CONCAT_WS(' ', first_name, middle_name, last_name) AS name, print_name, price, description, print_id FROM artists, prints WHERE artists.artist_id = prints.artist_id ORDER BY artists.last_name ASC, prints.print_name ASC"; } } else { $query = "SELECT artists.artist_id, CONCAT_WS(' ', first_name, middle_name, last_name) AS name, print_name, price, description, print_id FROM artists, prints WHERE artists.artist_id = prints.artist_id ORDER BY artists.last_name ASC, prints.print_name ASC"; } // Create the table head. echo ''; // Display all the prints, linked to URLs. $result = mysqli_query ($dbc, $query); while ($row = mysqli_fetch_array ($result, MYSQL_ASSOC)) { // Display each record. echo " \n"; } // End of while loop. echo '
Artist Print Name Description Price
{$row['name']} {$row['print_name']} {$row['description']} \${$row['price']}
'; // Close the table. mysqli_close($dbc); // Close the database connection. include ('./includes/footer.html'); ?> Thanks, -------------- next part -------------- An HTML attachment was scrubbed... URL: From 1j0lkq002 at sneakemail.com Wed Dec 12 00:11:41 2007 From: 1j0lkq002 at sneakemail.com (inforequest) Date: Tue, 11 Dec 2007 21:11:41 -0800 Subject: [nycphp-talk] Do you use Pretty URLs In-Reply-To: References: Message-ID: <11414-04015@sneakemail.com> Cliff Hirsch cliff-at-pinestream.com |nyphp dev/internal group use| wrote: >>>So...how many of you use ?pretty urls?? If you do, how do you do it? With a >>>Framework (Cake, Symphony, Zend, etc.) that you are using? Rolled your own? >>>Via php or mod_rewrite? Thoughts and ideas for introducing pretty urls into >>>an existing application (i.e. can?t jump into a new Framework for a legacy >>>app)? >>> >>> >>Perhaps it would be better to say its a legacy app up front so people >>don't waste time posting about routing in frameworks like symfony...? >> >>I would imagine mod_rewrite rules are probably your best bet. >> >> > >Good point. LEGACY APPLICATION. Many of us don't have the luxury of >completely porting an existing application to a modern framework, but do >have the wherewithal to potentially bolt in a pretty url module or parts of >a front-end controller. > > Of course I may be surprised by how advanced some of you are, but from where I sit, even the new apps on the new frameworks suffer from the same routing issues. If anyone is enjoying reliable, manageable, strict and pretty URLs on one of the "modern frameworks" I'd like to hear about it. That means content level control of "pretty" URLs, ability to manage redirection (at the content level), and enforced one-URL-per-document. At this point I'm all in favor of a neutral bolt-on rewrite router. From bz-gmort at beezifies.com Wed Dec 12 06:19:52 2007 From: bz-gmort at beezifies.com (Gary Mort) Date: Wed, 12 Dec 2007 06:19:52 -0500 Subject: [nycphp-talk] Do you use Pretty URLs In-Reply-To: <11414-04015@sneakemail.com> References: <11414-04015@sneakemail.com> Message-ID: <475FC3D8.3040501@beezifies.com> inforequest wrote: > Of course I may be surprised by how advanced some of you are, but from > where I sit, even the new apps on the new frameworks suffer from the > same routing issues. > > If anyone is enjoying reliable, manageable, strict and pretty URLs on > one of the "modern frameworks" I'd like to hear about it. That means > content level control of "pretty" URLs, ability to manage redirection > (at the content level), and enforced one-URL-per-document. I find Joomla + a SEF component comes pretty dang close, and if you remove the "breadcrumbs" feature support it can be almost 100%. The problem isn't so much the framework, as that the individual components also have to support the framework. Basically, you have a function Joomla will call to convert to/from SEF urls. It's built in SEF is ugly though. Than you have the SEF component that gives a better ruleset for SEF. Finally, all those components have a simple mechanism to customize them component per component. Now, control at the "content" level in what manner? For example, I used an ad component for user profiles, and I wanted to remap it to use the person's name as the end of the url, and special beginnings for different categories. About 20 lines of code and it was done, and this only because I was in a hurry and hardcoded a lot of rules that should be configurable. What do you mean by redirection? In any case, I don't think Joomla is unique in this manner, all the various routers provide the same goals and functions. As for how to use Pretty URL's, it really depends on the need. If you have a disciplined structure legacy app, you can use mod_rewrite and not much else. Maybe use obstart so you can postprocess the page generated and convert the ugly urls to their mod_rewrite formats. Using routers is nice, but main issue I see is that most everything is built to be generic. IE a router will maintain a list of pretty URL to internal URL entries in a table or the file system(or memcache) and so when a request comes into the system, the router has to remap it on the fly everytime. This allows the router to work with Apache, lighty, IIS, etc. But if you know you are using Apache, it seems a far better solution would be to have your router save the url to a mysql table in a format that Apache's mod_rewrite with mysql support can use(and then to work it out in such a manner as to consolidate rewrites as much as possible using regular expressions). And if your using Lighty, do it in a manner Lighty can use. Etc etc and so forth. I think in the end, "pretty urls" in a corporate/business setting are going to be 60-80% generic, and than a small bit of customization for just their specific needs. Thus leading to most people starting with generic and then upgrading later(which has it's own penalty, as if the business grew and is popular, you then need to maintain /both/ systems for legacy purposes) From chsnyder at gmail.com Wed Dec 12 08:42:45 2007 From: chsnyder at gmail.com (csnyder) Date: Wed, 12 Dec 2007 08:42:45 -0500 Subject: [nycphp-talk] Do you use Pretty URLs In-Reply-To: <11414-04015@sneakemail.com> References: <11414-04015@sneakemail.com> Message-ID: On Dec 12, 2007 12:11 AM, inforequest <1j0lkq002 at sneakemail.com> wrote: > If anyone is enjoying reliable, manageable, strict and pretty URLs on > one of the "modern frameworks" I'd like to hear about it. That means > content level control of "pretty" URLs, ability to manage redirection > (at the content level), and enforced one-URL-per-document. > > At this point I'm all in favor of a neutral bolt-on rewrite router. John, I can't believe you don't have something like this. You've been asking for it for a few years, so the requirements must not be as simple as they sound. Maybe it's a wiki-like version of a reverse proxy. This app would act as a reverse proxy for your site, so whenever someone requests a url, the app rewrites it, fetches and lightly caches the content, and returns it as a response. Whenever you (as editor) visit a url that doesn't exist, an interface kicks in that helps you map it to a resource in your site (or create a redirect to a different url). Since you require one-url-per-resource, the app would also add a redirect that sends a direct request for the mapped resource to the pretty url. Upside is that it would act as a caching/mirroring layer and improve scalability. Downside is that for some legacy apps, using a reverse proxy can involve non-trivial amounts of content rewriting and reverse engineering. -- Chris Snyder http://chxo.com/ From tedd at sperling.com Wed Dec 12 09:26:04 2007 From: tedd at sperling.com (tedd) Date: Wed, 12 Dec 2007 09:26:04 -0500 Subject: [nycphp-talk] Managing form data with PHP In-Reply-To: References: Message-ID: At 12:16 PM -0600 12/11/07, Tony Furnivall wrote: >Newbie request - >Any pointers? ideas? suggestions? Yes, use javascript and inform the user in real-time and before they send the junk to the server. Of course, you then have to scrub and clean everything, but you would have to anyway. Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com From ramons at gmx.net Wed Dec 12 09:34:11 2007 From: ramons at gmx.net (David Krings) Date: Wed, 12 Dec 2007 09:34:11 -0500 Subject: [nycphp-talk] Managing form data with PHP In-Reply-To: References: Message-ID: <475FF163.3060900@gmx.net> tedd wrote: > At 12:16 PM -0600 12/11/07, Tony Furnivall wrote: >> Newbie request - >> Any pointers? ideas? suggestions? > > > Yes, use javascript and inform the user in real-time and before they > send the junk to the server. Of course, you then have to scrub and clean > everything, but you would have to anyway. > That works OK for something like a date or making sure that a mandatory entry exists, but for example for a user name that has to be unique you need to check it against your tables. Can't do that with ECMAScript. David From ken at secdat.com Wed Dec 12 09:52:38 2007 From: ken at secdat.com (Kenneth Downs) Date: Wed, 12 Dec 2007 09:52:38 -0500 Subject: [nycphp-talk] Managing form data with PHP In-Reply-To: <475FF163.3060900@gmx.net> References: <475FF163.3060900@gmx.net> Message-ID: <475FF5B6.3010508@secdat.com> David Krings wrote: > tedd wrote: >> At 12:16 PM -0600 12/11/07, Tony Furnivall wrote: >>> Newbie request - >>> Any pointers? ideas? suggestions? >> >> >> Yes, use javascript and inform the user in real-time and before they >> send the junk to the server. Of course, you then have to scrub and >> clean everything, but you would have to anyway. >> > > That works OK for something like a date or making sure that a > mandatory entry exists, but for example for a user name that has to be > unique you need to check it against your tables. Can't do that with > ECMAScript. It helps to picture it this way: 1. Javascript is for user convenience, avoid submitting mismatched passwords, malformed dates and so forth. 2. Server checks are about integrity, unique, referential and other constraints > > David > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php -- Kenneth Downs Secure Data Software, Inc. www.secdat.com www.andromeda-project.org 631-689-7200 Fax: 631-689-0527 cell: 631-379-0010 From tedd at sperling.com Wed Dec 12 09:53:29 2007 From: tedd at sperling.com (tedd) Date: Wed, 12 Dec 2007 09:53:29 -0500 Subject: [nycphp-talk] Tamperproof URLs and PHP slides posted In-Reply-To: <4c95589d0712111413o68f76458r76ebcb835b4d331d@mail.gmail.com> References: <4c95589d0712111413o68f76458r76ebcb835b4d331d@mail.gmail.com> Message-ID: At 5:13 PM -0500 12/11/07, Nick Galbreath wrote: >Hello, > >First thanks everyone for coming out the NYPHP on 27-nov-2007 for my >talk on "Tamperproof URLs and PHP" > >Based on your feedback, comments, and uhhh, a few blank stares, I >completely revamped the slides. > >Right now, I've dumped the slides, the source code and the unit test here: > > > http://modp.com/slides/securestring/ > >However I hope to move all of it to svn at >code.google.com once they let me use more >resources. If you have any comments, questions on the slides, or >corrections what not, please post a comment on my blog: > > >http://blog.modp.com/2007/12/tamperproof-urls-and-php.html > >thanks again, > >--nickg > Nick Galbreath Very good. Thanks, Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com From tedd at sperling.com Wed Dec 12 09:56:11 2007 From: tedd at sperling.com (tedd) Date: Wed, 12 Dec 2007 09:56:11 -0500 Subject: [nycphp-talk] Managing form data with PHP In-Reply-To: <475FF163.3060900@gmx.net> References: <475FF163.3060900@gmx.net> Message-ID: At 9:34 AM -0500 12/12/07, David Krings wrote: >tedd wrote: >>At 12:16 PM -0600 12/11/07, Tony Furnivall wrote: >>>Newbie request - >>>Any pointers? ideas? suggestions? >> >> >>Yes, use javascript and inform the user in real-time and before >>they send the junk to the server. Of course, you then have to scrub >>and clean everything, but you would have to anyway. >> > >That works OK for something like a date or making sure that a >mandatory entry exists, but for example for a user name that has to >be unique you need to check it against your tables. Can't do that >with ECMAScript. > >David Ok, but wasn't the OP asking for a date thing? I must of missed the "user name" part. Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com From tedd at sperling.com Wed Dec 12 09:57:41 2007 From: tedd at sperling.com (tedd) Date: Wed, 12 Dec 2007 09:57:41 -0500 Subject: [nycphp-talk] Managing form data with PHP In-Reply-To: <475FF5B6.3010508@secdat.com> References: <475FF163.3060900@gmx.net> <475FF5B6.3010508@secdat.com> Message-ID: At 9:52 AM -0500 12/12/07, Kenneth Downs wrote: >David Krings wrote: >>tedd wrote: >>>At 12:16 PM -0600 12/11/07, Tony Furnivall wrote: >>>>Newbie request - >>>>Any pointers? ideas? suggestions? >>> >>> >>>Yes, use javascript and inform the user in real-time and before >>>they send the junk to the server. Of course, you then have to >>>scrub and clean everything, but you would have to anyway. >>> >> >>That works OK for something like a date or making sure that a >>mandatory entry exists, but for example for a user name that has to >>be unique you need to check it against your tables. Can't do that >>with ECMAScript. > >It helps to picture it this way: > >1. Javascript is for user convenience, avoid submitting mismatched >passwords, malformed dates and so forth. >2. Server checks are about integrity, unique, referential and other >constraints > Exactly. Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com From jcampbell1 at gmail.com Wed Dec 12 10:32:50 2007 From: jcampbell1 at gmail.com (John Campbell) Date: Wed, 12 Dec 2007 10:32:50 -0500 Subject: [nycphp-talk] Tamperproof URLs and PHP slides posted In-Reply-To: <4c95589d0712111413o68f76458r76ebcb835b4d331d@mail.gmail.com> References: <4c95589d0712111413o68f76458r76ebcb835b4d331d@mail.gmail.com> Message-ID: <8f0676b40712120732j4f0b492evf212387af0b60e39@mail.gmail.com> Thanks for the presentation. I have a question that is related, but along different lines. I have a flash game that saves high scores to the server and I want to prevent high scores from being forged. Initially the scores were send as a simple post request, e.g. name=john&score=1000. This is a problem because it is trivial to forge the request. So my solution was to create the post request as follows: name=john&score=1000&checksum= . md5(md5("My secret") . name . score) on the server side, I can verify the checksum. This works well enough, but an enterprising hacker can download my swf file and run `strings game.swf` to extract "My secret", and then they can forge the request. Is there any cryptography method that guarantees the request is coming from my code? Thanks, John Campbell From ajai at bitblit.net Wed Dec 12 10:47:48 2007 From: ajai at bitblit.net (Ajai Khattri) Date: Wed, 12 Dec 2007 10:47:48 -0500 (EST) Subject: [nycphp-talk] Do you use Pretty URLs In-Reply-To: <11414-04015@sneakemail.com> Message-ID: On Tue, 11 Dec 2007, inforequest wrote: > If anyone is enjoying reliable, manageable, strict and pretty URLs on > one of the "modern frameworks" I'd like to hear about it. That means > content level control of "pretty" URLs, ability to manage redirection > (at the content level), and enforced one-URL-per-document. I dont know if we satisfy all of the above but one of our new sites, built using symfony, has a lot of routing and pretty URLs. http://www.quamut.com (Yeah I know, some of the URLs look like static pages, that's deliberate :-) -- Aj. From ajai at bitblit.net Wed Dec 12 11:04:05 2007 From: ajai at bitblit.net (Ajai Khattri) Date: Wed, 12 Dec 2007 11:04:05 -0500 (EST) Subject: [nycphp-talk] OOP Books & Resources In-Reply-To: <475F318F.7060104@projectskyline.com> Message-ID: On Tue, 11 Dec 2007, Ben Sgro wrote: > I'll take a look at that. Thing is, it doesn't have to be a php oop > book. I just want > it to really flesh out all the OOP Design details. Sure, I understand. I just don't get much more than theory out of "generic" books (which is fine if you dont know the theory but if you've coded in several languages like me, its not so useful). The books that *do* include code talk about Java or C++. But not all the features of say, C++, are present in PHP5. So while its good to know about multiple inheritance, at some point you have to get more language-specific and realize that PHP5 doesn't have that. -- Aj. From nickg at modp.com Wed Dec 12 11:04:54 2007 From: nickg at modp.com (Nick Galbreath) Date: Wed, 12 Dec 2007 11:04:54 -0500 Subject: [nycphp-talk] Tamperproof URLs and PHP slides posted In-Reply-To: <8f0676b40712120732j4f0b492evf212387af0b60e39@mail.gmail.com> References: <4c95589d0712111413o68f76458r76ebcb835b4d331d@mail.gmail.com> <8f0676b40712120732j4f0b492evf212387af0b60e39@mail.gmail.com> Message-ID: <4c95589d0712120804m100b619rb09fbe7da3b97f62@mail.gmail.com> Hi John, Great question. Your general idea is sound, but sadly there is no such thing as a "secure client". If there were, every game client (unreal, wow, etc), IM client, dvd player, cable tv box, xbox, iphone, etc would use it. But these are routinely cracked. The only thing they do differently is to make is it 'real hard' to find the secret key (and other "tricks" but by careful reverse engineering these can all be broken) So for your application, you can a do a few things. 1) The dumbest is to make a string like 't' + 'h' + 'i' + 's' ... 2) or even better use ascii numeric values... chr(34) + chr(75) to build a string 3) and use indirection... make an array of values of numbers , and use these to build the string chr(myarray[i]) (or make myarray be a function). 4) or consider making your secret key be an integer that it is the result of a computation or iteration secret = highscore; for (i = 0; i < 10; i++) secret *= 2 + Math.cos(5 + math.sin(secret)) This way the secret depends on the score it self. The "secret" is the function that both the client and server must implement identically. I just made that up to give you an idea. This will prevent the "strings" attacks. more advanced stuff for flash is 1) use byte code obfuscators. 2) I know a lot of spy ware has a small shell that loads another file that is encrypted flash, then decrypts it then runs it. Or something like that. I'm not an expert on flash, but I'm sure if you look around on google you can find off-the-shelf solutions for this. But remember these are all hacks and a very determined person _could_ fake a high score. Hopefully it will be such a pain in the arse, no-one will bother. enjoy! --nickg On 12/12/07, John Campbell wrote: > > Thanks for the presentation. > > I have a question that is related, but along different lines. I have > a flash game that saves high scores to the server and I want to > prevent high scores from being forged. > > Initially the scores were send as a simple post request, e.g. > name=john&score=1000. This is a problem because it is trivial to > forge the request. So my solution was to create the post request as > follows: > > name=john&score=1000&checksum= . md5(md5("My secret") . name . score) > > on the server side, I can verify the checksum. > > This works well enough, but an enterprising hacker can download my swf > file and run `strings game.swf` to extract "My secret", and then they > can forge the request. Is there any cryptography method that > guarantees the request is coming from my code? > > > Thanks, > John Campbell > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben at projectskyline.com Wed Dec 12 11:23:26 2007 From: ben at projectskyline.com (Ben Sgro) Date: Wed, 12 Dec 2007 11:23:26 -0500 Subject: [nycphp-talk] OOP Books & Resources In-Reply-To: References: Message-ID: <47600AFE.2080909@projectskyline.com> Hello Ajai, I'm about two chapters deep in http://www.bookpool.com/sm/0672326116 and I'm pretty happy w/it so far. Great background into OOP and a gentle introduction into UML. Enjoying it so far, looking forward to getting more time into it. - Ben PS: BTW, just finished Hawkings, "the universe in a nutshell", great book, leaves you wanting more! http://www.amazon.com/Universe-Nutshell-Stephen-William-Hawking/dp/055380202X I need to dig up more books like that. Please email me off list if you have recommendations. Ajai Khattri wrote: > On Tue, 11 Dec 2007, Ben Sgro wrote: > > >> I'll take a look at that. Thing is, it doesn't have to be a php oop >> book. I just want >> it to really flesh out all the OOP Design details. >> > > Sure, I understand. I just don't get much more than theory out of > "generic" books (which is fine if you dont know the theory but if you've > coded in several languages like me, its not so useful). The books that > *do* include code talk about Java or C++. But not all the features of say, > C++, are present in PHP5. So while its good to know about multiple > inheritance, at some point you have to get more language-specific and > realize that PHP5 doesn't have that. > > > > From dell at sala.ca Wed Dec 12 11:55:40 2007 From: dell at sala.ca (Dell Sala) Date: Wed, 12 Dec 2007 11:55:40 -0500 Subject: [nycphp-talk] OOP Books & Resources In-Reply-To: <475F318F.7060104@projectskyline.com> References: <475F318F.7060104@projectskyline.com> Message-ID: On Dec 11, 2007, at 7:55 PM, Ben Sgro wrote: > Thing is, it doesn't have to be a php oop book. I just want > it to really flesh out all the OOP Design details. If language isn't an issue, I'd recommend Bruce Eckel's "Thinking In Java". It starts by covering OOP from the ground up, in a somewhat language-non-specific way. http://www.mindview.net/Books/TIJ/ I believe you can download electronic versions for free. Once you get the basics down, I'd recommend looking at design patterns. I happen to like "Head First Design Patterns". You either love this series or hate it. This also includes examples in Java. http://www.oreilly.com/catalog/hfdesignpat/ Another interesting read, from a somewhat philosophical perspective, is "Object Thinking", by David West. He is an XP and OOP evangelist. He proposes a way of thinking about objects and programming in general, as a simulation of real-world things. Really drives home great design principals. http://www.microsoft.com/MSPress/books/6820.aspx There's a podcast interview with him gives you a sense of what he's all about. http://polymorphicpodcast.com/shows/objectthinking/ -- Dell From patrick at hexane.org Wed Dec 12 12:03:41 2007 From: patrick at hexane.org (Patrick May) Date: Wed, 12 Dec 2007 12:03:41 -0500 Subject: [nycphp-talk] Do you use Pretty URLs In-Reply-To: <11414-04015@sneakemail.com> References: <11414-04015@sneakemail.com> Message-ID: <8dca81f00712120903t75dfc367k92c3f8003f459727@mail.gmail.com> On 12/12/07, inforequest <1j0lkq002 at sneakemail.com> wrote: > At this point I'm all in favor of a neutral bolt-on rewrite router. I'm using an agnostic router class: http://hexane.org/releases/2007.12.12/class.pm_router.txt I tried to stick to the basics. Let me know if this is useful. Also let me know if you have any patches or suggestions. Cheers, Patrick From jcampbell1 at gmail.com Wed Dec 12 12:19:24 2007 From: jcampbell1 at gmail.com (John Campbell) Date: Wed, 12 Dec 2007 12:19:24 -0500 Subject: [nycphp-talk] Tamperproof URLs and PHP slides posted In-Reply-To: <4c95589d0712120804m100b619rb09fbe7da3b97f62@mail.gmail.com> References: <4c95589d0712111413o68f76458r76ebcb835b4d331d@mail.gmail.com> <8f0676b40712120732j4f0b492evf212387af0b60e39@mail.gmail.com> <4c95589d0712120804m100b619rb09fbe7da3b97f62@mail.gmail.com> Message-ID: <8f0676b40712120919macbc377w86bbaa1e1938aa28@mail.gmail.com> Thanks Nick, I'll take some measures to obfuscate the "secret", but I just realized I have another potential hole. There is nothing to prevent someone from actually getting a high score, then replaying the request to get all of the top positions. I suppose the solution is to have the server create a random string, save it on the server, send it to the client, and use the token as anonther element of the checksum. Then once the score is saved, the token is deleted from the server. I think that will work, but now I am starting to feel sorry for the next guy that has to figure out what the hell the my code is doing. :) Cheers, John Campbell From guilhermeblanco at gmail.com Wed Dec 12 12:29:43 2007 From: guilhermeblanco at gmail.com (Guilherme Blanco) Date: Wed, 12 Dec 2007 15:29:43 -0200 Subject: [nycphp-talk] Do you use Pretty URLs In-Reply-To: <8dca81f00712120903t75dfc367k92c3f8003f459727@mail.gmail.com> References: <11414-04015@sneakemail.com> <8dca81f00712120903t75dfc367k92c3f8003f459727@mail.gmail.com> Message-ID: The simples way to achieve nifty URLs is using a ForceType directive. For example... you create a file named 'app' and fill this file with php code. It'll not be executed. Then you do the trick and ForceType this file to be interpreted by PHP: ForceType application/x-httpd-php Now it'll execute the source you defined there. To handle URLs like: http://www.domain.com/app/controller/action/arg1/arg2 You need to explode the URL you have: // URL Exploding $address = explode( $_SERVER['SCRIPT_NAME'], $_SERVER['PHP_SELF'] ); $address_exp = array(); // Parsing URL pieces if ( isset( $address[1] ) ) { $address_exp = explode( '/', $address[1] ); // Removing blank index array_shift( $address_exp ); } Now you have $address_exp with the pieces you want. In my framework, I used this way: Controller1/SubController1_1/.../Action/arg_name,arg_value/arg_array,arg_value1,arg_value2,... This can be easily achieved using some PHP. Now just open your imagination and you can create Search Engine Friendly URLs. Just remember that SE Spiders does not like ?, & and other weird characters on URL. If you have any other question, do not hesitate to send messages in this thread. Regards, On Dec 12, 2007 3:03 PM, Patrick May wrote: > On 12/12/07, inforequest <1j0lkq002 at sneakemail.com> wrote: > > At this point I'm all in favor of a neutral bolt-on rewrite router. > > I'm using an agnostic router class: > > http://hexane.org/releases/2007.12.12/class.pm_router.txt > > I tried to stick to the basics. Let me know if this is useful. Also > let me know if you have any patches or suggestions. > > Cheers, > > Patrick > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > -- Guilherme Blanco - Web Developer CBC - Certified Bindows Consultant Cell Phone: +55 (16) 9166-6902 MSN: guilhermeblanco at hotmail.com URL: http://blog.bisna.com S?o Carlos - SP/Brazil From chsnyder at gmail.com Wed Dec 12 12:43:29 2007 From: chsnyder at gmail.com (csnyder) Date: Wed, 12 Dec 2007 12:43:29 -0500 Subject: [nycphp-talk] Tamperproof URLs and PHP slides posted In-Reply-To: <8f0676b40712120732j4f0b492evf212387af0b60e39@mail.gmail.com> References: <4c95589d0712111413o68f76458r76ebcb835b4d331d@mail.gmail.com> <8f0676b40712120732j4f0b492evf212387af0b60e39@mail.gmail.com> Message-ID: On Dec 12, 2007 10:32 AM, John Campbell wrote: > Initially the scores were send as a simple post request, e.g. > name=john&score=1000. This is a problem because it is trivial to > forge the request. So my solution was to create the post request as > follows: > > name=john&score=1000&checksum= . md5(md5("My secret") . name . score) > > on the server side, I can verify the checksum. > > This works well enough, but an enterprising hacker can download my swf > file and run `strings game.swf` to extract "My secret", and then they > can forge the request. Is there any cryptography method that > guarantees the request is coming from my code? > Yes there is, John, but you may need to seriously consider whether implementation is worth it. You can use a public/private key pair to perform asymmetric encryption. That means that a value encrypted using one key can only be decrypted using the other. This is the encryption scheme used for SSL, where your browser uses the server's public key (aka Certificate) to encrypt the request. So you would use the game's public key to encrypt hash-of-score:random on the client side. And then on the server, you would use the game's private key to decrypt the value and check the hash. Your tasks, should you choose to go this route, are to find an RSA implementation in ActionScript to perform the encryption, and to use PHP's OpenSSL support to perform the decryption. I'm pretty sure the first task is going to be tougher than the second unless Adobe provides an api in the Flash player. -- Chris Snyder http://chxo.com/ From nickg at modp.com Wed Dec 12 12:44:07 2007 From: nickg at modp.com (Nick Galbreath) Date: Wed, 12 Dec 2007 12:44:07 -0500 Subject: [nycphp-talk] Tamperproof URLs and PHP slides posted In-Reply-To: <8f0676b40712120919macbc377w86bbaa1e1938aa28@mail.gmail.com> References: <4c95589d0712111413o68f76458r76ebcb835b4d331d@mail.gmail.com> <8f0676b40712120732j4f0b492evf212387af0b60e39@mail.gmail.com> <4c95589d0712120804m100b619rb09fbe7da3b97f62@mail.gmail.com> <8f0676b40712120919macbc377w86bbaa1e1938aa28@mail.gmail.com> Message-ID: <4c95589d0712120944r7dc14e13qcdbde9923bdc8156@mail.gmail.com> Aha! Good point. So there are a few ways you can do this. But i think the simplest is just to record the username (perhaps the ip), and highscore and time stamp. Then when a new message comes in check the db to see if this user's timestamp is close to now. If so, reject. More complicated ways are having the client send the timestamp and use it in your hmac/hash thing. If their timestamp is old then they are replaying and you can just reject it. Or some combination of the both. Without know your product & operations better it's hard to say, but something like this should get your started. have fun! --nickg On 12/12/07, John Campbell wrote: > > Thanks Nick, > > I'll take some measures to obfuscate the "secret", but I just realized > I have another potential hole. There is nothing to prevent someone > from actually getting a high score, then replaying the request to get > all of the top positions. I suppose the solution is to have the > server create a random string, save it on the server, send it to the > client, and use the token as anonther element of the checksum. Then > once the score is saved, the token is deleted from the server. I > think that will work, but now I am starting to feel sorry for the next > guy that has to figure out what the hell the my code is doing. :) > > Cheers, > John Campbell > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > -------------- next part -------------- An HTML attachment was scrubbed... URL: From patrick at hexane.org Wed Dec 12 12:44:51 2007 From: patrick at hexane.org (Patrick May) Date: Wed, 12 Dec 2007 12:44:51 -0500 Subject: [nycphp-talk] Do you use Pretty URLs In-Reply-To: <8dca81f00712120903t75dfc367k92c3f8003f459727@mail.gmail.com> References: <11414-04015@sneakemail.com> <8dca81f00712120903t75dfc367k92c3f8003f459727@mail.gmail.com> Message-ID: <8dca81f00712120944s73167943wfb1d43a4ee3645f5@mail.gmail.com> After re-reading the first post, I agree that Horde routes looks like a great agnostic router. ~ Patrick On 12/12/07, Patrick May wrote: > On 12/12/07, inforequest <1j0lkq002 at sneakemail.com> wrote: > > At this point I'm all in favor of a neutral bolt-on rewrite router. > > I'm using an agnostic router class: > > http://hexane.org/releases/2007.12.12/class.pm_router.txt > > I tried to stick to the basics. Let me know if this is useful. Also > let me know if you have any patches or suggestions. > > Cheers, > > Patrick > From ramons at gmx.net Wed Dec 12 12:50:33 2007 From: ramons at gmx.net (David Krings) Date: Wed, 12 Dec 2007 12:50:33 -0500 Subject: [nycphp-talk] Managing form data with PHP In-Reply-To: References: <475FF163.3060900@gmx.net> Message-ID: <47601F69.4040009@gmx.net> tedd wrote: > Ok, but wasn't the OP asking for a date thing? I must of missed the > "user name" part. Yes, indeed, I missed the date part and assumed it to be a more general question. David From jcampbell1 at gmail.com Wed Dec 12 12:51:46 2007 From: jcampbell1 at gmail.com (John Campbell) Date: Wed, 12 Dec 2007 12:51:46 -0500 Subject: [nycphp-talk] Tamperproof URLs and PHP slides posted In-Reply-To: References: <4c95589d0712111413o68f76458r76ebcb835b4d331d@mail.gmail.com> <8f0676b40712120732j4f0b492evf212387af0b60e39@mail.gmail.com> Message-ID: <8f0676b40712120951p29e39781t314e21fe048142ac@mail.gmail.com> > Yes there is, John, but you may need to seriously consider whether > implementation is worth it. > > You can use a public/private key pair to perform asymmetric > encryption. That means that a value encrypted using one key can only > be decrypted using the other. This is the encryption scheme used for > SSL, where your browser uses the server's public key (aka Certificate) > to encrypt the request. > > So you would use the game's public key to encrypt hash-of-score:random > on the client side. And then on the server, you would use the game's > private key to decrypt the value and check the hash. > > Your tasks, should you choose to go this route, are to find an RSA > implementation in ActionScript to perform the encryption, and to use > PHP's OpenSSL support to perform the decryption. I'm pretty sure the > first task is going to be tougher than the second unless Adobe > provides an api in the Flash player. > I don't follow how this is any better than what I have now? The public key is still stored in the swf, and there is nothing that prevents the key from being extracted from the swf and the request can still be forged. This seems to just be better obfuscation. From rmarscher at beaffinitive.com Wed Dec 12 12:53:17 2007 From: rmarscher at beaffinitive.com (Rob Marscher) Date: Wed, 12 Dec 2007 12:53:17 -0500 Subject: [nycphp-talk] Do you use Pretty URLs In-Reply-To: References: Message-ID: <0C7DF5E1-CE90-4759-8CAD-9D9C68571ECC@beaffinitive.com> On Dec 11, 2007, at 5:31 PM, Cliff Hirsch wrote: >>> So...how many of you use ?pretty urls?? If you do, how do you do it? > LEGACY APPLICATION. I recently was able to implement a front controller (http://www.phppatterns.com/docs/design/the_front_controller_and_php ) that used include() to call old html/php files from a legacy application. There are numerous ways to get all your requests (other than those for images, css, js files, and other static resources) through my front controller. Hans Zaunere recommends using AliasMatch apache directive if you have access to httpd.conf because it's faster than mod_rewrite: > On Aug 5, 2007, at 2:42 PM, Hans Zaunere wrote: >> AliasMatch /(.*) "/var/www/www.something.com/index.php" > > http://httpd.apache.org/docs/2.0/mod/mod_alias.html#aliasmatch Anyway... once the urls are going to the front controller, it then parsed the query string to figure out the mapping between the current url and the legacy version. The request vars were extracted and populated $_REQUEST, $_GET, etc accordingly. Then I just included the file that the url would have gone to and called "exit;" afterwards (just in case). In writing it seems like that would obviously work... but I was still surprised that it actually did work. I found using a big switch statement in my front controller and working in php rather than a lot of mod_rewrite rules was a bit easier and kept more code in the php app rather than spread out between php and apache config files. You should also put 301 header redirects for all of the old urls. The next big task is making sure that all of the url links are rewritten properly and that. That can be fairly difficult if your links aren't very centralized. -------------- next part -------------- An HTML attachment was scrubbed... URL: From nickg at modp.com Wed Dec 12 13:09:47 2007 From: nickg at modp.com (Nick Galbreath) Date: Wed, 12 Dec 2007 13:09:47 -0500 Subject: [nycphp-talk] Tamperproof URLs and PHP slides posted In-Reply-To: References: <4c95589d0712111413o68f76458r76ebcb835b4d331d@mail.gmail.com> <8f0676b40712120732j4f0b492evf212387af0b60e39@mail.gmail.com> Message-ID: <4c95589d0712121009w61cf273esc1bbd54205676279@mail.gmail.com> Hi yah, re: Chris and public/private key pairs. In your solution/example, anyone with the public key can talk to the server. Since anyone with the public key can then forge messages somehow you have to "hide" the public key. This isn't any different from use plain old secret keys as he did originally. Even if you flipped it around somehow and that the server minted key-pairs for each client downloaded (good luck), there it's the same problem of hiding the private key on client. This does make communicating back to the server 'secure' in that people can't see what is being transmitted but it doesn't prevent forgeries which what I think the original issue was about. The SSL example is solving a different problem of how two parties with out a shared secret can communicate security without snoopers. cheers, -nickg On 12/12/07, csnyder wrote: > > On Dec 12, 2007 10:32 AM, John Campbell wrote: > > > Initially the scores were send as a simple post request, e.g. > > name=john&score=1000. This is a problem because it is trivial to > > forge the request. So my solution was to create the post request as > > follows: > > > > name=john&score=1000&checksum= . md5(md5("My secret") . name . score) > > > > on the server side, I can verify the checksum. > > > > This works well enough, but an enterprising hacker can download my swf > > file and run `strings game.swf` to extract "My secret", and then they > > can forge the request. Is there any cryptography method that > > guarantees the request is coming from my code? > > > > Yes there is, John, but you may need to seriously consider whether > implementation is worth it. > > You can use a public/private key pair to perform asymmetric > encryption. That means that a value encrypted using one key can only > be decrypted using the other. This is the encryption scheme used for > SSL, where your browser uses the server's public key (aka Certificate) > to encrypt the request. > > So you would use the game's public key to encrypt hash-of-score:random > on the client side. And then on the server, you would use the game's > private key to decrypt the value and check the hash. > > Your tasks, should you choose to go this route, are to find an RSA > implementation in ActionScript to perform the encryption, and to use > PHP's OpenSSL support to perform the decryption. I'm pretty sure the > first task is going to be tougher than the second unless Adobe > provides an api in the Flash player. > > -- > Chris Snyder > http://chxo.com/ > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dcech at phpwerx.net Wed Dec 12 13:16:03 2007 From: dcech at phpwerx.net (Dan Cech) Date: Wed, 12 Dec 2007 13:16:03 -0500 Subject: [nycphp-talk] Tamperproof URLs and PHP slides posted In-Reply-To: References: <4c95589d0712111413o68f76458r76ebcb835b4d331d@mail.gmail.com> <8f0676b40712120732j4f0b492evf212387af0b60e39@mail.gmail.com> Message-ID: <47602563.4080109@phpwerx.net> csnyder wrote: > On Dec 12, 2007 10:32 AM, John Campbell wrote: > >> Initially the scores were send as a simple post request, e.g. >> name=john&score=1000. This is a problem because it is trivial to >> forge the request. So my solution was to create the post request as >> follows: >> >> name=john&score=1000&checksum= . md5(md5("My secret") . name . score) >> >> on the server side, I can verify the checksum. >> >> This works well enough, but an enterprising hacker can download my swf >> file and run `strings game.swf` to extract "My secret", and then they >> can forge the request. Is there any cryptography method that >> guarantees the request is coming from my code? >> > > Yes there is, John, but you may need to seriously consider whether > implementation is worth it. > > You can use a public/private key pair to perform asymmetric > encryption. That means that a value encrypted using one key can only > be decrypted using the other. This is the encryption scheme used for > SSL, where your browser uses the server's public key (aka Certificate) > to encrypt the request. > > So you would use the game's public key to encrypt hash-of-score:random > on the client side. And then on the server, you would use the game's > private key to decrypt the value and check the hash. Unfortunately this won't help. If a malicious user wished to fake a high score it would simply be a matter of extracting the public key from the game and using it to create a bogus hash. I do not know of any way to secure against a user with the capability to disassemble the .swf. Regardless of the mechanism used to create the 'secure' string for submission, the code to create that string must be present in the .swf, and therefore vulnerable. The degree of protection offered is really not dependent on the encryption/hash method you use, but rather on how difficult it is for a would-be cheater to figure out how to create the appropriate POST. Without knowing the impact of a forged high score (eg can a user win money by faking a high score?) it is difficult to make any recommendation, but combining a simple checksum (using one of the suggested methods to obfuscate the source of the secret portion) with obfuscation of the .swf itself should give enough protection to thwart casual attacks. Dan From ben at projectskyline.com Wed Dec 12 13:32:30 2007 From: ben at projectskyline.com (Ben Sgro) Date: Wed, 12 Dec 2007 13:32:30 -0500 Subject: [nycphp-talk] Callback syntax Message-ID: <4760293E.90908@projectskyline.com> Hello , I'm trying to do the following: object calling code: $callbackSet = array( " " => "return", "w" => "moveUp"); $key = $object->nonBlockOnInput( ); $object->process($key, $callbackSet); .... inside the class.... public function process($callbackSet) { reset($optionSet); while(list($index, $callbackFunction) = each($optionSet)) { switch ($key) { case $index: call_user_func($this->$callbackFunction); break; } } } It doesn't seem to work. I'm not sure of the syntax to do this. moveUp( ) is a method of the class, but I'm not sure how to tell it, call_user_func( ), since I need the syntax to be $this->functionName( ). Also, I need to be able to call return as well. Any ideas? - Ben From cliff at pinestream.com Wed Dec 12 13:32:11 2007 From: cliff at pinestream.com (Cliff Hirsch) Date: Wed, 12 Dec 2007 13:32:11 -0500 Subject: [nycphp-talk] Do you use Pretty URLs In-Reply-To: <0C7DF5E1-CE90-4759-8CAD-9D9C68571ECC@beaffinitive.com> Message-ID: > The next big task is making sure that all of the url links are rewritten properly and that. That can be fairly difficult if your links aren't very centralized. I see this as a big assumption on the part of many router/controllers. If you are working in a framework, things will probably work. But all it takes is one handwritten uri to muck things up. Most of the routers/controllers I?ve seen expect or write something like /param1/param2/param3, which assumes a certain order...and level of knowledge. It seems to me that a more robust method would be to have something like /param1/value1/param2/value2/.../paramn/valuen Wordier and exposes more about the application. But security by obscurity doesn?t get you very far anyway. Cliff -------------- next part -------------- An HTML attachment was scrubbed... URL: From bz-gmort at beezifies.com Wed Dec 12 13:38:37 2007 From: bz-gmort at beezifies.com (Gary Mort) Date: Wed, 12 Dec 2007 13:38:37 -0500 Subject: [nycphp-talk] Tamperproof URLs and PHP slides posted In-Reply-To: <8f0676b40712120732j4f0b492evf212387af0b60e39@mail.gmail.com> References: <4c95589d0712111413o68f76458r76ebcb835b4d331d@mail.gmail.com> <8f0676b40712120732j4f0b492evf212387af0b60e39@mail.gmail.com> Message-ID: <47602AAD.40702@beezifies.com> Due to the nature of Flashs, someone will always be able to revere engineer the code. So how about this(if it doesn't slow things down too much): When the game loads up, have the Flash program connect to the server and provide it with some information(how about hashing the ipaddress, username, and current score in some manner with a secret key) So now you have some session information on the user. Their username, their ipaddress, and a score. In return, the server provides the client with a new secret key. Every 2 minutes, connect to the server again and provide the ipaddress, username, and current score and a hash with the new key. When the game is over, connect to the server and post the information a final time, ipaddress, username, and current score, the hash, and the status code(completed). So now you have a sequence of records: 1.1.1.1 Gary 0 Hash: xxx newkey: abc 1.1.1.1 Gary 1000 Hash: xxx newkey: bcd 1.1.1.1 Gary 50000 Hash: xxx newkey: bcd 1.1.1.1 Gary 500000 Hash: xxx - final score So you only accept a final score that has a history behind it. To "repeat" the attack the hacker needs to run a new sequence of inputs. So at best, for a game you know takes at least 10 minutes, he can only submit 1 high score every 10 minutes. Then if someone complains of cheating, you have logs to go through and see if something jumps out, and how to change your final score acceptance algorythm to accomodate. From chsnyder at gmail.com Wed Dec 12 13:42:18 2007 From: chsnyder at gmail.com (csnyder) Date: Wed, 12 Dec 2007 13:42:18 -0500 Subject: [nycphp-talk] Tamperproof URLs and PHP slides posted In-Reply-To: <8f0676b40712120951p29e39781t314e21fe048142ac@mail.gmail.com> References: <4c95589d0712111413o68f76458r76ebcb835b4d331d@mail.gmail.com> <8f0676b40712120732j4f0b492evf212387af0b60e39@mail.gmail.com> <8f0676b40712120951p29e39781t314e21fe048142ac@mail.gmail.com> Message-ID: On Dec 12, 2007 12:51 PM, John Campbell wrote: > I don't follow how this is any better than what I have now? The > public key is still stored in the swf, and there is nothing that > prevents the key from being extracted from the swf and the request can > still be forged. This seems to just be better obfuscation. Actually worse obfuscation because more trouble. I saw the last question and ran with it. I'll just go back to coding now. -- Chris Snyder http://chxo.com/ From scott at crisscott.com Wed Dec 12 13:50:10 2007 From: scott at crisscott.com (Scott Mattocks) Date: Wed, 12 Dec 2007 13:50:10 -0500 Subject: [nycphp-talk] Callback syntax In-Reply-To: <4760293E.90908@projectskyline.com> References: <4760293E.90908@projectskyline.com> Message-ID: <47602D62.60108@crisscott.com> Ben Sgro wrote: > It doesn't seem to work. I'm not sure of the syntax to do this. moveUp( > ) is a method of the class, > but I'm not sure how to tell it, call_user_func( ), since I need the > syntax to be $this->functionName( ). If you are trying to call a method of an object or class you need to tell PHP which object or class to call. You do this by passing the object or class as the first element of the callback array. call_user_func(array($this, $callbackFunction)); or for static methods: call_user_func(array(__CLASS__, $callbackFunction)); > > Also, I need to be able to call return as well. Huh? You want to return the value of the callback? Just return the value of call_user_func(). -- Scott Mattocks Author: Pro PHP-GTK http://www.crisscott.com From jcampbell1 at gmail.com Wed Dec 12 14:11:11 2007 From: jcampbell1 at gmail.com (John Campbell) Date: Wed, 12 Dec 2007 14:11:11 -0500 Subject: [nycphp-talk] Callback syntax In-Reply-To: <4760293E.90908@projectskyline.com> References: <4760293E.90908@projectskyline.com> Message-ID: <8f0676b40712121111n6efca697oc8ee61a908e2e7ae@mail.gmail.com> > It doesn't seem to work. I'm not sure of the syntax to do this. moveUp( > ) is a method of the class, > but I'm not sure how to tell it, call_user_func( ), since I need the > syntax to be $this->functionName( ). Replace: call_user_func($this->$callbackFunction); with: $this->$callbackFunction(); see http://us.php.net/manual/en/functions.variable-functions.php for an explanation. call_user_func() treats everything as a static method and will not work. Regards, John Campbell From jcampbell1 at gmail.com Wed Dec 12 14:26:45 2007 From: jcampbell1 at gmail.com (John Campbell) Date: Wed, 12 Dec 2007 14:26:45 -0500 Subject: [nycphp-talk] Tamperproof URLs and PHP slides posted In-Reply-To: References: <4c95589d0712111413o68f76458r76ebcb835b4d331d@mail.gmail.com> <8f0676b40712120732j4f0b492evf212387af0b60e39@mail.gmail.com> <8f0676b40712120951p29e39781t314e21fe048142ac@mail.gmail.com> Message-ID: <8f0676b40712121126q6bfc4f7by6c38e5e3b3689606@mail.gmail.com> Thanks to all for the help. Since there are no cash prizes and this is part of online educational software that requires a subscription, I doubt anyone will care enough to decompile the swf. I did check the database however, and it appears there are 2 university students that are resending the requests (same score submitted multiple times in a too short of a time period). I need to protect against that. Regards, John Campbell From rmarscher at beaffinitive.com Wed Dec 12 23:40:50 2007 From: rmarscher at beaffinitive.com (Rob Marscher) Date: Wed, 12 Dec 2007 23:40:50 -0500 Subject: [nycphp-talk] Do you use Pretty URLs In-Reply-To: References: Message-ID: On Dec 12, 2007, at 1:32 PM, Cliff Hirsch wrote: > It seems to me that a more robust method would be to have something > like /param1/value1/param2/value2/.../paramn/valuen If I remember correctly, this is the default url structure for the Zend Framework. -------------- next part -------------- An HTML attachment was scrubbed... URL: From arzala at gmail.com Thu Dec 13 01:01:31 2007 From: arzala at gmail.com (Anirudh Zala) Date: Thu, 13 Dec 2007 11:31:31 +0530 Subject: [nycphp-talk] Do you use Pretty URLs In-Reply-To: References: Message-ID: <200712131131.31745.arzala@gmail.com> On Thursday 13 Dec 2007 10:10:50 Rob Marscher wrote: > On Dec 12, 2007, at 1:32 PM, Cliff Hirsch wrote: > > It seems to me that a more robust method would be to have something > > like /param1/value1/param2/value2/.../paramn/valuen > > If I remember correctly, this is the default url structure for the > Zend Framework. I prefer following pattern of URL. protocol://domain (application)/module/action?param1=value1¶m2=value2 or protocol://domain (application)/module/action/param1/value1/param2/value2 e.g. http://www.myapp.com/user/view?id=1&type=2 or http://www.myapp.com/user/view/id/1/type/2 1st one is more clear as it clearly separates "query string" portion from rest of URL scheme. Thanks Anirudh Zala From jcampbell1 at gmail.com Thu Dec 13 02:34:44 2007 From: jcampbell1 at gmail.com (John Campbell) Date: Thu, 13 Dec 2007 02:34:44 -0500 Subject: [nycphp-talk] Do you use Pretty URLs In-Reply-To: References: <0C7DF5E1-CE90-4759-8CAD-9D9C68571ECC@beaffinitive.com> Message-ID: <8f0676b40712122334r7a9b262cr9644f392cf9f8a21@mail.gmail.com> > It seems to me that a more robust method would be to have something like > /param1/value1/param2/value2/.../paramn/valuen Doesn't that defeat the purpose of pretty urls? I though the whole point was so the url looks like: /blog/MostRecent/Page1/ and /blog/john_caught_picking_his_nose/ instead of: /blog/orderby/recent/page/1/ and /blog/post_id/37/ or If you are going to do it the latter way, I don't understand the benefit vs a query string. Maybe I am missing something. Regards, John Campbell From cliff at pinestream.com Thu Dec 13 07:21:30 2007 From: cliff at pinestream.com (Cliff Hirsch) Date: Thu, 13 Dec 2007 07:21:30 -0500 Subject: [nycphp-talk] Do you use Pretty URLs In-Reply-To: <8f0676b40712122334r7a9b262cr9644f392cf9f8a21@mail.gmail.com> Message-ID: On 12/13/07 2:34 AM, "John Campbell" wrote: >> It seems to me that a more robust method would be to have something like >> /param1/value1/param2/value2/.../paramn/valuen > > Doesn't that defeat the purpose of pretty urls? I though the whole > point was so the url looks like: > > /blog/MostRecent/Page1/ and /blog/john_caught_picking_his_nose/ > > instead of: > /blog/orderby/recent/page/1/ and /blog/post_id/37/ or > > If you are going to do it the latter way, I don't understand the > benefit vs a query string. Maybe I am missing something. You bring up a good point. Perhaps the place to begin is the beginning, which is, "what is the point and benefit." Things I have heard: 1. SEO friendly because search engines do not process the query string Ok, but say you need to be logged in. What's the point? 2. Easier for humans to understand Perhaps for content/blog/news site; maybe for recognizing what a bookmark is. But how many of us do that? Depends on the application.... 3. Security. Hides the file.php and param names. Yeah, but I hope you are not solely relying on security by obscurity 4. Looks cool and Rails does it Do we have to mimic everything Rails does?! 5. Other? From bz-gmort at beezifies.com Thu Dec 13 08:19:19 2007 From: bz-gmort at beezifies.com (Gary Mort) Date: Thu, 13 Dec 2007 08:19:19 -0500 Subject: [nycphp-talk] Do you use Pretty URLs In-Reply-To: References: Message-ID: <47613157.1090706@beezifies.com> Cliff Hirsch wrote: > > The next big task is making sure that all of the url links are > rewritten properly and that. That can be fairly difficult if your > links aren't very centralized. > > I see this as a big assumption on the part of many router/controllers. > If you are working in a framework, things will probably work. But all > it takes is one handwritten uri to muck things up. Most of the > routers/controllers I?ve seen expect or write something like > /param1/param2/param3, which assumes a certain order...and level of > knowledge. > > It seems to me that a more robust method would be to have something > like /param1/value1/param2/value2/.../paramn/valuen > > Wordier and exposes more about the application. But security by > obscurity doesn?t get you very far anyway. It's also not pretty urls. Here is an example: http://test.com/index.php?option=com_adsmanager&page=show_category&catid=34&brandid=48 Now convert that in std format to: http://nowhere.com/com_adsmanager/show_category/34/48 Or your proposal http://nowhere.com/option/com_adsmanager/page/show_category/catid/34/brandid/48 Neither of these are "pretty" and their only real benefit is hiding things form search engines to make the urls look unqiue. http://nowhere.com/find/widgets/acme.html That is what I feel is a pretty url. Where find summaries the whole component & action widgets is the category acme is the brand Now someone searching on google looking for "acme widgets" will see the url http://nowhere.com/find/widgets.acme.html Oh look, that is precisely what I'm looking for. I'll go there. The thing is though, stuff like this can't be automated by some fire and forget generic routing app, it requires some intelligence. The parm./value or /value/value format is great to get you from nothing to something, and as long as you have a way to customize the function for your needs, that seems great to me. From david at davidmintz.org Thu Dec 13 12:53:00 2007 From: david at davidmintz.org (David Mintz) Date: Thu, 13 Dec 2007 12:53:00 -0500 Subject: [nycphp-talk] Managing form data with PHP In-Reply-To: References: Message-ID: <721f1cc50712130953l5a1ca5a2w285e6c21c7afc646@mail.gmail.com> Once upon a time someone said it was a security risk to echo back $_POST data unconditionally, even if you escape it, and even though you are only showing them the very thing they just submitted to you. But I forget what that risk was. Maybe I misremember. I suppose if someone were to submit a string the length of War and Peace, it would squander bandwidth if you sent it back without truncating, but is that a true security risk? -- David Mintz http://davidmintz.org/ The subtle source is clear and bright The tributary streams flow through the darkness -------------- next part -------------- An HTML attachment was scrubbed... URL: From ramons at gmx.net Thu Dec 13 13:09:50 2007 From: ramons at gmx.net (David Krings) Date: Thu, 13 Dec 2007 13:09:50 -0500 Subject: [nycphp-talk] Do you use Pretty URLs In-Reply-To: References: Message-ID: <4761756E.5030000@gmx.net> Cliff Hirsch wrote: > You bring up a good point. Perhaps the place to begin is the beginning, > which is, "what is the point and benefit." Things I have heard: > 3. Security. Hides the file.php and param names. > Yeah, but I hope you are not solely relying on security by obscurity Sin't changing the server's directive for passing on php files better? Name your file .whoknowswhat and have that get sent to the PHP interpreter...or pull everything through the interpreter and use no file extensions at all. And for the parameters, don't use GET. I agree, there are better means to achieve security and even my proposals are lame. David From brian at realm3.com Thu Dec 13 14:05:42 2007 From: brian at realm3.com (Brian D.) Date: Thu, 13 Dec 2007 14:05:42 -0500 Subject: [nycphp-talk] OOP Books & Resources In-Reply-To: References: <475F318F.7060104@projectskyline.com> Message-ID: > Once you get the basics down, I'd recommend looking at design > patterns. I happen to like "Head First Design Patterns". You either > love this series or hate it. This also includes examples in Java. > I second the recommendation for "Head First Design Patterns." I might be a little biased, though, since my background lies in Java development. - Brian -- realm3 web applications [realm3.com] freelance consulting, application development (423) 506-0349 From brian at realm3.com Thu Dec 13 14:07:43 2007 From: brian at realm3.com (Brian D.) Date: Thu, 13 Dec 2007 14:07:43 -0500 Subject: [nycphp-talk] OOP Books & Resources In-Reply-To: References: <475F318F.7060104@projectskyline.com> Message-ID: > Once you get the basics down, I'd recommend looking at design > patterns. I happen to like "Head First Design Patterns". You either > love this series or hate it. This also includes examples in Java. > I second the recommendation for "Head First Design Patterns." I might be a little biased, though, since my background lies in Java development. - Brian -- realm3 web applications [realm3.com] freelance consulting, application development (423) 506-0349 From brian at realm3.com Thu Dec 13 14:29:25 2007 From: brian at realm3.com (Brian D.) Date: Thu, 13 Dec 2007 14:29:25 -0500 Subject: [nycphp-talk] Callback syntax In-Reply-To: <8f0676b40712121111n6efca697oc8ee61a908e2e7ae@mail.gmail.com> References: <4760293E.90908@projectskyline.com> <8f0676b40712121111n6efca697oc8ee61a908e2e7ae@mail.gmail.com> Message-ID: > call_user_func() treats everything as a static method and will not work. While the variable function might work, could you clarify what you mean by 'treats everything as a static method'? I just ran this:schmoo = $var; } function getSchmoo( ) { return $this->schmoo; } function setCallbackSchmoo( $var ) { call_user_func( array( $this, 'setSchmoo' ), $var ); } } $foo= new Foobar; var_dump( $foo->getSchmoo( ) ); $foo->setCallbackSchmoo( 20 ); var_dump( $foo->getSchmoo( ) ); ?> And got this: int(9) int(20) Which is precisely what I'd expect. -- realm3 web applications [realm3.com] freelance consulting, application development (423) 506-0349 From tonyf at buffnet.net Thu Dec 13 15:42:02 2007 From: tonyf at buffnet.net (Tony Furnivall) Date: Thu, 13 Dec 2007 14:42:02 -0600 Subject: [nycphp-talk] More questions about working with forms Message-ID: Thanks to those who replied earlier. I've moved on a little, and now am wondering how to make an object 'persist' between activations of an action script, associated with a button on the form. The model I have (the common thread of most replies) is something like this (not in php, but in reasonably self-evident pseudo code): (firsttime) is determined by a test of the $_POST variables, or in some similar way if (firsttime) then showform and wait for action script {this script} to re-activate else edit form data and build error stack showform along with error stack and wait for next action end I can get this to work fine if I'm not using an object, but if I create an object on the (firsttime) path, it disappears between then and the next activation. The object includes not only the functions to build the form display, but also the editing and error-stack management functions (no multiple inheritance :-(). Is it as simple as stashing away the object in a hidden field? or maybe in some $_SESSION variable? Thanks for any help! Tony -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.503 / Virus Database: 269.17.1/1182 - Release Date: 12/12/2007 11:29 AM From ben at projectskyline.com Thu Dec 13 16:07:35 2007 From: ben at projectskyline.com (Ben Sgro) Date: Thu, 13 Dec 2007 16:07:35 -0500 Subject: [nycphp-talk] More questions about working with forms In-Reply-To: References: Message-ID: <47619F17.70806@projectskyline.com> Hello, Can you serialize the object and stick it in the $_SESSION? - Ben Tony Furnivall wrote: > Thanks to those who replied earlier. I've moved on a little, and now > am wondering how to make an object 'persist' between activations of an > action script, associated with a button on the form. > > The model I have (the common thread of most replies) is something like > this (not in php, but in reasonably self-evident pseudo code): > > (firsttime) is determined by a test of the $_POST variables, or in > some similar way > > if (firsttime) then > showform and wait for action script {this script} to re-activate > else > edit form data and build error stack > showform along with error stack and wait for next action > end > > I can get this to work fine if I'm not using an object, but if I > create an object on the (firsttime) path, it disappears between then > and the next activation. > > The object includes not only the functions to build the form display, > but also the editing and error-stack management functions (no multiple > inheritance :-(). > > Is it as simple as stashing away the object in a hidden field? or > maybe in some $_SESSION variable? > > Thanks for any help! > > Tony > > From dorgan at donaldorgan.com Thu Dec 13 16:10:07 2007 From: dorgan at donaldorgan.com (Donald J Organ IV) Date: Thu, 13 Dec 2007 16:10:07 -0500 Subject: [nycphp-talk] More questions about working with forms In-Reply-To: <47619F17.70806@projectskyline.com> References: <47619F17.70806@projectskyline.com> Message-ID: <47619FAF.6060605@donaldorgan.com> Yes, just remember to unserialize it when you want to use it. Ben Sgro wrote: > Hello, > > Can you serialize the object and stick it in the $_SESSION? > > - Ben > > Tony Furnivall wrote: >> Thanks to those who replied earlier. I've moved on a little, and now >> am wondering how to make an object 'persist' between activations of >> an action script, associated with a button on the form. >> >> The model I have (the common thread of most replies) is something >> like this (not in php, but in reasonably self-evident pseudo code): >> >> (firsttime) is determined by a test of the $_POST variables, or in >> some similar way >> >> if (firsttime) then >> showform and wait for action script {this script} to re-activate >> else >> edit form data and build error stack >> showform along with error stack and wait for next action >> end >> >> I can get this to work fine if I'm not using an object, but if I >> create an object on the (firsttime) path, it disappears between then >> and the next activation. >> >> The object includes not only the functions to build the form display, >> but also the editing and error-stack management functions (no >> multiple inheritance :-(). >> >> Is it as simple as stashing away the object in a hidden field? or >> maybe in some $_SESSION variable? >> >> Thanks for any help! >> >> Tony >> >> > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php From jcampbell1 at gmail.com Thu Dec 13 16:53:45 2007 From: jcampbell1 at gmail.com (John Campbell) Date: Thu, 13 Dec 2007 16:53:45 -0500 Subject: [nycphp-talk] More questions about working with forms In-Reply-To: References: Message-ID: <8f0676b40712131353p451466c2oa51308f2e78a5348@mail.gmail.com> > Is it as simple as stashing away the object in a hidden field? or > maybe in some $_SESSION variable? Don't use sessions. You need to embrace the atomic nature of a web request, and just reconstruct the object on each request. Each request should have all of the information required to reconstruct the object. I am not sure what you are trying to do, but maybe you need hidden form fields to retain state across requests. In my opinion, sessions should be used very sparingly. Regards, John Campbell From ioplex at gmail.com Thu Dec 13 17:15:25 2007 From: ioplex at gmail.com (Michael B Allen) Date: Thu, 13 Dec 2007 17:15:25 -0500 Subject: [nycphp-talk] OOP Books & Resources In-Reply-To: <475F0074.6080403@projectskyline.com> References: <475F0074.6080403@projectskyline.com> Message-ID: <78c6bd860712131415l183e5e28n17a30da28474f78b@mail.gmail.com> On 12/11/07, Ben Sgro wrote: > Hello, > > A while back I asked an OOP related question. Brian D suggested: > > If you're just starting out in the PHP5 OOP world, I highly recommend > Zandstra's "PHP 5 Objects, Patterns, and Practice." I promise you it's > worth the $20. > > Which I did and started reading it (twice) and it just assumes too much. > I have zero OOP experience (well that's not really true) and need more > explanation than that book provides. Hi Ben, If you just want the basics of how to write programs using OOP constructs, you might look at something like the Deitel & Deitel Java How to Program book. PHP's OOP is very close to Java's. However, more generally, I would de-emphasize the importance of "Design Patterns". The whole DP thing is overrated. Unfortunately it's pretty common to see people using various patterns without really knowing why. Most of the patterns you'll find described in those books are only useful in a few advanced high-level scenarios like UI widget libraries (e.g. Composite). Or they're so simple you really didn't need a book to explain it to you (e.g. Flyweight). It is much more common to find that you simply want to use an abstract base class so that other parts of your code can overload some methods. That sort of basic stuff is covered in an intro book like the Deitel & Deitel one. I have recently been modelling my code after Zend Framework. Some of the ZF components are a little over-designed but I think the coding standards and organization is excellent. Just looking at some good examples might be all that you need to get on the right track. Mike -- Michael B Allen PHP Active Directory SPNEGO SSO http://www.ioplex.com/ From ben at projectskyline.com Thu Dec 13 17:16:12 2007 From: ben at projectskyline.com (Ben Sgro) Date: Thu, 13 Dec 2007 17:16:12 -0500 Subject: [nycphp-talk] More questions about working with forms In-Reply-To: <8f0676b40712131353p451466c2oa51308f2e78a5348@mail.gmail.com> References: <8f0676b40712131353p451466c2oa51308f2e78a5348@mail.gmail.com> Message-ID: <4761AF2C.4040805@projectskyline.com> John, That's easy to say, but unless your building the app as RESTful or something, then the easiest way to accomplish it IS to store it in a session. I am not sure what you are trying to do, but maybe you need hidden form fields to retain state across requests. Sessions sound easier. - Ben John Campbell wrote: >> Is it as simple as stashing away the object in a hidden field? or >> maybe in some $_SESSION variable? >> > > Don't use sessions. You need to embrace the atomic nature of a web > request, and just reconstruct the object on each request. Each > request should have all of the information required to reconstruct the > object. I am not sure what you are trying to do, but maybe you need > hidden form fields to retain state across requests. > > In my opinion, sessions should be used very sparingly. > > Regards, > John Campbell > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > > From ben at projectskyline.com Thu Dec 13 17:23:28 2007 From: ben at projectskyline.com (Ben Sgro) Date: Thu, 13 Dec 2007 17:23:28 -0500 Subject: [nycphp-talk] OOP Books & Resources In-Reply-To: <78c6bd860712131415l183e5e28n17a30da28474f78b@mail.gmail.com> References: <475F0074.6080403@projectskyline.com> <78c6bd860712131415l183e5e28n17a30da28474f78b@mail.gmail.com> Message-ID: <4761B0E0.4040400@projectskyline.com> Hey Michael, Good points. As I said before, I like that book I got from work, "The object oriented thought process". I will take a look at the Java book your recommending. I do like UML though, er, well I at least like the concept of it. I'd like to have the ability to map classes out (but I have to understand them well enough) before I start coding them. Thanks. - Ben Michael B Allen wrote: > On 12/11/07, Ben Sgro wrote: > >> Hello, >> >> A while back I asked an OOP related question. Brian D suggested: >> >> If you're just starting out in the PHP5 OOP world, I highly recommend >> Zandstra's "PHP 5 Objects, Patterns, and Practice." I promise you it's >> worth the $20. >> >> Which I did and started reading it (twice) and it just assumes too much. >> I have zero OOP experience (well that's not really true) and need more >> explanation than that book provides. >> > > Hi Ben, > > If you just want the basics of how to write programs using OOP > constructs, you might look at something like the Deitel & Deitel Java > How to Program book. PHP's OOP is very close to Java's. > > However, more generally, I would de-emphasize the importance of > "Design Patterns". The whole DP thing is overrated. Unfortunately it's > pretty common to see people using various patterns without really > knowing why. Most of the patterns you'll find described in those books > are only useful in a few advanced high-level scenarios like UI widget > libraries (e.g. Composite). Or they're so simple you really didn't > need a book to explain it to you (e.g. Flyweight). It is much more > common to find that you simply want to use an abstract base class so > that other parts of your code can overload some methods. That sort of > basic stuff is covered in an intro book like the Deitel & Deitel one. > > I have recently been modelling my code after Zend Framework. Some of > the ZF components are a little over-designed but I think the coding > standards and organization is excellent. Just looking at some good > examples might be all that you need to get on the right track. > > Mike > > From ben at projectskyline.com Thu Dec 13 17:24:43 2007 From: ben at projectskyline.com (Ben Sgro) Date: Thu, 13 Dec 2007 17:24:43 -0500 Subject: [nycphp-talk] OOP Books & Resources In-Reply-To: <78c6bd860712131415l183e5e28n17a30da28474f78b@mail.gmail.com> References: <475F0074.6080403@projectskyline.com> <78c6bd860712131415l183e5e28n17a30da28474f78b@mail.gmail.com> Message-ID: <4761B12B.2040300@projectskyline.com> Michael, http://vig.prenhall.com/catalog/academic/product/0,1144,0132222205,00.html Is that it? - Ben Michael B Allen wrote: > On 12/11/07, Ben Sgro wrote: > >> Hello, >> >> A while back I asked an OOP related question. Brian D suggested: >> >> If you're just starting out in the PHP5 OOP world, I highly recommend >> Zandstra's "PHP 5 Objects, Patterns, and Practice." I promise you it's >> worth the $20. >> >> Which I did and started reading it (twice) and it just assumes too much. >> I have zero OOP experience (well that's not really true) and need more >> explanation than that book provides. >> > > Hi Ben, > > If you just want the basics of how to write programs using OOP > constructs, you might look at something like the Deitel & Deitel Java > How to Program book. PHP's OOP is very close to Java's. > > However, more generally, I would de-emphasize the importance of > "Design Patterns". The whole DP thing is overrated. Unfortunately it's > pretty common to see people using various patterns without really > knowing why. Most of the patterns you'll find described in those books > are only useful in a few advanced high-level scenarios like UI widget > libraries (e.g. Composite). Or they're so simple you really didn't > need a book to explain it to you (e.g. Flyweight). It is much more > common to find that you simply want to use an abstract base class so > that other parts of your code can overload some methods. That sort of > basic stuff is covered in an intro book like the Deitel & Deitel one. > > I have recently been modelling my code after Zend Framework. Some of > the ZF components are a little over-designed but I think the coding > standards and organization is excellent. Just looking at some good > examples might be all that you need to get on the right track. > > Mike > > From ramons at gmx.net Thu Dec 13 18:02:08 2007 From: ramons at gmx.net (David Krings) Date: Thu, 13 Dec 2007 18:02:08 -0500 Subject: [nycphp-talk] More questions about working with forms In-Reply-To: <8f0676b40712131353p451466c2oa51308f2e78a5348@mail.gmail.com> References: <8f0676b40712131353p451466c2oa51308f2e78a5348@mail.gmail.com> Message-ID: <4761B9F0.5030408@gmx.net> John Campbell wrote: > In my opinion, sessions should be used very sparingly. Can you elaborate on this? I use sessions very often and find them to be very useful. After all, they are there to be used, so why not use them when applicable? David From jcampbell1 at gmail.com Thu Dec 13 19:01:14 2007 From: jcampbell1 at gmail.com (John Campbell) Date: Thu, 13 Dec 2007 19:01:14 -0500 Subject: [nycphp-talk] More questions about working with forms In-Reply-To: <4761B9F0.5030408@gmx.net> References: <8f0676b40712131353p451466c2oa51308f2e78a5348@mail.gmail.com> <4761B9F0.5030408@gmx.net> Message-ID: <8f0676b40712131601o51be7372jafc31fb61d9b92f7@mail.gmail.com> > Can you elaborate on this? I use sessions very often and find them to be very > useful. After all, they are there to be used, so why not use them when appli cable? They do have applications, but most people find way too many applications. 1) Sessions often break a lot of things, typically bookmarks, the back button, using mutiple windows, and they expire. These are especially problems for beginners. 2) Sessions are not a good substitute for a performance cache, and people tend to use them that way. 3) Sessions make for very hard to find bugs. Think about how ridiculous it is to save an object to a session. Let's assume the object has 20 methods and 4 data points. Serializing an object and saving one copy for each user is a terrible programming habit to get into. What does it even mean to serialize an object? I find the concept nonsensical. Structs (arrays) can be serialized, objects should not be. What happens when you unserialize a database resource? or a Singleton? or anthing that references something else? The right solution is to boil down the required information to as little as possible, and then include it with the request. And then you can just do something like $myobj->restore($v1,$v2,$v3,$v4) If you want a short cut, then save the 4 data points in a session, but know your form won't work in mutiple windows at the same time. Regards, John Campbell From nynj.tech at hotmail.com Thu Dec 13 22:19:32 2007 From: nynj.tech at hotmail.com (chad qian) Date: Thu, 13 Dec 2007 22:19:32 -0500 Subject: [nycphp-talk] question:upload picture to the server Message-ID: I use "godaddy" as web hosting.I access web files through FTP and I access mysql database through phpMyAdmin(through IE). Now,I want to upload pictures to the server side. My problem is: how to define the picture path when I do php coding?I access the mysql database through phpMyAdmin(IE).Mysql is not on my local computer.I can't define "c:\...." or "d:\..." as where pictures are saved.I access MySql through phpMyadmin(IE).What's the correct path?I'm completely lost. Thanks! chad _________________________________________________________________ i?m is proud to present Cause Effect, a series about real people making a difference. http://im.live.com/Messenger/IM/MTV/?source=text_Cause_Effect -------------- next part -------------- An HTML attachment was scrubbed... URL: From nasir81 at gmail.com Thu Dec 13 22:24:32 2007 From: nasir81 at gmail.com (Nasir Zubair) Date: Thu, 13 Dec 2007 22:24:32 -0500 Subject: [nycphp-talk] question:upload picture to the server In-Reply-To: References: Message-ID: <40fcda730712131924y2cf17414n7bd7ac8736313666@mail.gmail.com> Hi, The easiest way I can think of is to upload a PHP document with the following line: Then access that file from a browser. It will tell you the actual path top the file on the server. something like "/home/user/public_html/file.php" You can work out path to your photo directory from there. On Dec 13, 2007 10:19 PM, chad qian wrote: > I use "godaddy" as web hosting.I access web files through FTP and I > access mysql database through phpMyAdmin(through IE). > Now,I want to upload pictures to the server side. > My problem is: how to define the picture path when I do php coding?I > access the mysql database through phpMyAdmin(IE).Mysql is not on my local > computer.I can't define "c:\...." or "d:\..." as where pictures are > saved.I access MySql through phpMyadmin(IE).What's the correct path?I'm > completely lost. > > Thanks! > > chad > > ------------------------------ > i'm is proud to present Cause Effect, a series about real people making a > difference. Learn more > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > -- Nasir Zubair http://www.nasir.us/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From rmarscher at beaffinitive.com Thu Dec 13 23:05:47 2007 From: rmarscher at beaffinitive.com (Rob Marscher) Date: Thu, 13 Dec 2007 23:05:47 -0500 Subject: [nycphp-talk] Tamperproof URLs and PHP slides posted In-Reply-To: <8f0676b40712121126q6bfc4f7by6c38e5e3b3689606@mail.gmail.com> References: <4c95589d0712111413o68f76458r76ebcb835b4d331d@mail.gmail.com> <8f0676b40712120732j4f0b492evf212387af0b60e39@mail.gmail.com> <8f0676b40712120951p29e39781t314e21fe048142ac@mail.gmail.com> <8f0676b40712121126q6bfc4f7by6c38e5e3b3689606@mail.gmail.com> Message-ID: <91608ABE-98B8-4091-9C1D-16018B937EB6@beaffinitive.com> I wrote a couple flash client / php server casino games. I didn't actually do the flash client part (takes me forever to produce nice looking stuff with that app) but I did come up with the api. It used a token and timestamps that were hashed with a secret key - pretty similar to the way that Amazon's api works. The only way I came up with to really prevent cheating was to keep all of the game logic on the server and use the client to send user actions and display the response. So for a blackjack game, for example, the client would say start a new game - which would give it a new token - then the server would deal the cards and tell the client which cards it was dealt, the client would tell the server if it was hitting, staying, splitting, doubling, etc. and then the server would tell the client if it won or not. Sort of a side note here... but I also had a client once ask if we could serve a video in a flash player and make it not possible for anyone to download it. I told them we would have to embed the video in the flash player timeline (which makes it not look as good), we would have to encrypt the whole thing somehow and obfuscate the key to unencrypt it (perhaps it could be timestamp based and requested from the server which would send back a current key to use and verify the client was authorized to have it). After going through all that trouble and spending a ton of money, a really good hacker could still crack it and even worse... any screen capture program could easily save the video as another file. That was my long way of saying... it can't be done. From brian at realm3.com Fri Dec 14 08:51:40 2007 From: brian at realm3.com (Brian D.) Date: Fri, 14 Dec 2007 08:51:40 -0500 Subject: [nycphp-talk] More questions about working with forms In-Reply-To: <8f0676b40712131601o51be7372jafc31fb61d9b92f7@mail.gmail.com> References: <8f0676b40712131353p451466c2oa51308f2e78a5348@mail.gmail.com> <4761B9F0.5030408@gmx.net> <8f0676b40712131601o51be7372jafc31fb61d9b92f7@mail.gmail.com> Message-ID: I'm going to agree with John on this, with a caveat. $_SESSION in and of itself is fine, I think the objection boils down to using it for "application instruction" that should normally be handled by parameters. Using $_SESSION to pass params from one page to the next *will* cause problems with users who are browsing your site with more than one tab. Serializing also is a performance hit, so it should be used, in my opinion, rather sparingly. It has issues with private & protected variables, and other oddities. I could be wrong on this one, but it seems like a mistake to be throwing objects into a $_SESSION array for the sake of convenience. Passing $_SESSION user information in the form of an array, or user preferences, or other structs, would be fine. From that information and your url params, you'll know what needs to be done. On Dec 13, 2007 7:01 PM, John Campbell wrote: > > Can you elaborate on this? I use sessions very often and find them to be very > > useful. After all, they are there to be used, so why not use them when appli > cable? > > They do have applications, but most people find way too many applications. > > 1) Sessions often break a lot of things, typically bookmarks, the back > button, using mutiple windows, and they expire. These are especially > problems for beginners. > 2) Sessions are not a good substitute for a performance cache, and > people tend to use them that way. > 3) Sessions make for very hard to find bugs. > > Think about how ridiculous it is to save an object to a session. > Let's assume the object has 20 methods and 4 data points. Serializing > an object and saving one copy for each user is a terrible programming > habit to get into. What does it even mean to serialize an object? I > find the concept nonsensical. Structs (arrays) can be serialized, > objects should not be. What happens when you unserialize a database > resource? or a Singleton? or anthing that references something else? > > The right solution is to boil down the required information to as > little as possible, and then include it with the request. And then > you can just do something like $myobj->restore($v1,$v2,$v3,$v4) > If you want a short cut, then save the 4 data points in a session, but > know your form won't work in mutiple windows at the same time. > > Regards, > John Campbell > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > -- realm3 web applications [realm3.com] freelance consulting, application development (423) 506-0349 From bz-gmort at beezifies.com Fri Dec 14 08:57:13 2007 From: bz-gmort at beezifies.com (Gary Mort) Date: Fri, 14 Dec 2007 08:57:13 -0500 Subject: [nycphp-talk] question:upload picture to the server In-Reply-To: References: Message-ID: <47628BB9.9010601@beezifies.com> Install Menalto Gallery and upload through one of their many methods. When your ready to do your own coding, you have a source on the server, working, where you can see how they do uploads. chad qian wrote: > I use "godaddy" as web hosting.I access web files through FTP and I > access mysql database through phpMyAdmin(through IE). > Now,I want to upload pictures to the server side. > My problem is: how to define the picture path when I do php coding?I > access the mysql database through phpMyAdmin(IE).Mysql is not on my > local computer.I can't define "c:\...." or "d:\..." as where pictures > are saved.I access MySql through phpMyadmin(IE).What's the correct > path?I'm completely lost. > > Thanks! > > chad > > i?m is proud to present Cause Effect, a series about real people > making a difference. Learn more > > ------------------------------------------------------------------------ > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php From tedd at sperling.com Fri Dec 14 09:41:49 2007 From: tedd at sperling.com (tedd) Date: Fri, 14 Dec 2007 09:41:49 -0500 Subject: [nycphp-talk] Managing form data with PHP In-Reply-To: <721f1cc50712130953l5a1ca5a2w285e6c21c7afc646@mail.gmail.com> References: <721f1cc50712130953l5a1ca5a2w285e6c21c7afc646@mail.gmail.com> Message-ID: At 12:53 PM -0500 12/13/07, David Mintz wrote: >Once upon a time someone said it was a security risk to echo back >$_POST data unconditionally, even if you escape it, and even though >you are only showing them the very thing they just submitted to you. >But I forget what that risk was. Maybe I misremember. > >I suppose if someone were to submit a string the length of War and >Peace, it would squander bandwidth if you sent it back without >truncating, but is that a true security risk? > >-- >David Mintz Not that I experienced it, not that I'm correct, but the idea *I* remember was that if you exceeded the length of a POST you could crash the system and have your way with it. BUT, that was a long time ago and things have changed. Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com From ken at secdat.com Fri Dec 14 09:49:04 2007 From: ken at secdat.com (Kenneth Downs) Date: Fri, 14 Dec 2007 09:49:04 -0500 Subject: [nycphp-talk] Managing form data with PHP In-Reply-To: References: <721f1cc50712130953l5a1ca5a2w285e6c21c7afc646@mail.gmail.com> Message-ID: <476297E0.1020707@secdat.com> The really important thing about a lot of this stuff you hear is that it is repeated over and over by people who do not necessarily understand *why* it is a problem. Blindly following rules of thumb is always bad, but in security it can be really bad. The principle behind not returning $_POST (or $_GET) is /never trust anything from the browser/. Assume that anything that came from the browser may have nasty stuff in it. So, when sending back to the browser escape out the HTML entities. When sending to a database escape out quotes to prevent SQL injection. And of course *never* execute it as code on the server because it could delete files, reveal passwords, or anything else your process is privileged to do. tedd wrote: > At 12:53 PM -0500 12/13/07, David Mintz wrote: >> Once upon a time someone said it was a security risk to echo back >> $_POST data unconditionally, even if you escape it, and even though >> you are only showing them the very thing they just submitted to you. >> But I forget what that risk was. Maybe I misremember. >> >> I suppose if someone were to submit a string the length of War and >> Peace, it would squander bandwidth if you sent it back without >> truncating, but is that a true security risk? >> >> -- >> David Mintz > > Not that I experienced it, not that I'm correct, but the idea *I* > remember was that if you exceeded the length of a POST you could crash > the system and have your way with it. BUT, that was a long time ago > and things have changed. > > Cheers, > > tedd -- Kenneth Downs Secure Data Software, Inc. www.secdat.com www.andromeda-project.org 631-689-7200 Fax: 631-689-0527 cell: 631-379-0010 -------------- next part -------------- An HTML attachment was scrubbed... URL: From willie at pdfsystems.com Fri Dec 14 10:21:18 2007 From: willie at pdfsystems.com (willie klein) Date: Fri, 14 Dec 2007 10:21:18 -0500 Subject: [nycphp-talk] Zend Framework confusion Message-ID: Hi All; I've just started using Zend Framework and having a hard time getting used to this new way of doing things. I'm a bit confused about how to register databases with the registry and putting things all together. I can query tables fine and put the results into my view if I use the table model, that is make the table a class and refer to it as a object through Zend_Table_class. This is fine for querys with one table but I think for joins its better to use their SQL builder interface. So if I put in my bootstrap file: // load configuration $config = new Zend_Config_Ini('./application/config.ini', 'general'); $registry = Zend_Registry::getInstance(); $registry->set('config', $config); // setup database $db = Zend_Db::factory($config->db->adapter, $config->db->config->toArray()); Zend_Db_Table::setDefaultAdapter($db); Zend_Registry::set('db', $db); ///// Can I just use in my controller : $db = Zend_Registry::get('db'); $select = $db->select(); $select->distinct() ->from( 'course') ->join(array( 'user'), 'course.teacherID = user.id') ; $data = $db->fetchAll($select); $this->view->data = $data;// This doesn't work and I'm not sure why. This works with the model: $dbuser = new User(); $this->view->dbuser = $dbuser->fetchAll(); -------------- next part -------------- An HTML attachment was scrubbed... URL: From ramons at gmx.net Fri Dec 14 10:40:04 2007 From: ramons at gmx.net (David Krings) Date: Fri, 14 Dec 2007 10:40:04 -0500 Subject: [nycphp-talk] More questions about working with forms In-Reply-To: <8f0676b40712131601o51be7372jafc31fb61d9b92f7@mail.gmail.com> References: <8f0676b40712131353p451466c2oa51308f2e78a5348@mail.gmail.com> <4761B9F0.5030408@gmx.net> <8f0676b40712131601o51be7372jafc31fb61d9b92f7@mail.gmail.com> Message-ID: <4762A3D4.40008@gmx.net> John Campbell wrote: >> Can you elaborate on this? I use sessions very often and find them to be very >> useful. After all, they are there to be used, so why not use them when appli > cable? > > They do have applications, but most people find way too many applications. > > 1) Sessions often break a lot of things, typically bookmarks, the back > button, using mutiple windows, and they expire. These are especially > problems for beginners. > 2) Sessions are not a good substitute for a performance cache, and > people tend to use them that way. > 3) Sessions make for very hard to find bugs. Thank you for those pointers. I use $_SESSION in my current project to store such things as the language of the currently logged in user, the user's access level, and the base portion of the URL to redirect the browser to pages on my server. The first two could be obtained from a table in the database, but I figured retrieving this information once and carrying it along with the $_SESSION saves hitting the database several time to retrieve the exat same piece of information. The last piece saves running the same code over and over again to get the same result. So far I haven't found any problems with doing this. In one section of my application I do store more in $_SESSION, an array and a pointer. The array includes unique IDs of records in the database and the pointer contains the current array key of the element I want to look at. That way I was able to build a simple navigation tool that allows for calling up records in the sequence specified by a search. Yes, I could do that by crafting the navigation as forms and pass along the info via $_POST, but for that I'd need to handle both the array (and serialize that) and the pointer, whereas using the session I only need to write the new pointer to the session, which is way less code and way less stuff that shows up in the XHTML. I admit I haven't tested it with multiple windows and the browser controls, but even if there are problems the worst that may happen is that the individual windows rewrite the pointer in the session and then the navigation would show on a Next click really something that is 3 Previous clicks before. In my case I deal with pictures and video files, so that there is no horrible damage, althought I admit that the app then no longer works as designed. And thinking about, sending everything via $_POST will for sure prevent that. I do have code in place that makes sure that the next or previous item indeed exists and that the pointer does not get set to keys that do not exist in the array. I found it not to be difficult to find bugs that were related to $_SESSION. In my IDE it gets displayed the same way as the $_POST variable. I also do not use objects that I'd need to pass along. My app uses an object in one place to deal with ZIP files, but that's about it. I see the benefit of objects, but so far found easy enough ways to do without them. That may change when I get the crazy idea to work on more complex stuff. I will go back and look at my code and see where I stuff more into $_SESSION and if I could do without it. In case of bookmarking, that is a side effect that can be to one's advantage. I know for sure that if someone bookmarks the pages in my app the bookmark will not work, but code is in place that captures especially the missing user level and gracefully redirects one to the login page. That is a behavior that I want. Is there anything drastically flawed with my approach? David From selyah1 at yahoo.com Fri Dec 14 10:55:48 2007 From: selyah1 at yahoo.com (selyah) Date: Fri, 14 Dec 2007 07:55:48 -0800 (PST) Subject: [nycphp-talk] validating email address Message-ID: <941114.30832.qm@web30815.mail.mud.yahoo.com> Hello all: I have created a database which is working fine and i am now validating the inputted data. I am stuck on validating the email address. I am using the validating statement below, and it is not working. when i enter the email incorrectly, it is still entered into the database, and the errror msg is not printed. can anyone see the error of my ways. thanks if(eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $_POST['email'])) { echo "Valid email address."; }else { echo "Invalid email address.";} -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben at projectskyline.com Fri Dec 14 11:05:53 2007 From: ben at projectskyline.com (Ben Sgro) Date: Fri, 14 Dec 2007 11:05:53 -0500 Subject: [nycphp-talk] validating email address In-Reply-To: <941114.30832.qm@web30815.mail.mud.yahoo.com> References: <941114.30832.qm@web30815.mail.mud.yahoo.com> Message-ID: <4762A9E1.3070901@projectskyline.com> if (!preg_match("/^( [a-zA-Z0-9] )+( [a-zA-Z0-9\._-] )*@( [a-zA-Z0-9_-] )+( [a-zA-Z0-9\._-] +)+$/" , $email)) selyah wrote: > Hello all: > I have created a database which is working fine and i am now > validating the inputted data. I am stuck on validating the email > address. I am using the validating statement below, and it is not > working. when i enter the email incorrectly, it is still entered into > the database, and the errror msg is not printed. can anyone see the > error of my ways. thanks > |if(||eregi||(||"^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$"||, $_POST['email']||||)) {| > | echo ||"Valid email address."||;| > | }| > |else {| > | echo ||"Invalid email address."||;| > |}| > *//* > > > ------------------------------------------------------------------------ > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php From selyah1 at yahoo.com Fri Dec 14 11:09:57 2007 From: selyah1 at yahoo.com (selyah) Date: Fri, 14 Dec 2007 08:09:57 -0800 (PST) Subject: [nycphp-talk] validating email address Message-ID: <605506.66441.qm@web30810.mail.mud.yahoo.com> thanks, that works ----- Original Message ---- From: Ben Sgro To: NYPHP Talk Sent: Friday, December 14, 2007 11:05:53 AM Subject: Re: [nycphp-talk] validating email address if (!preg_match("/^( [a-zA-Z0-9] )+( [a-zA-Z0-9\._-] )*@( [a-zA-Z0-9_-] )+( [a-zA-Z0-9\._-] +)+$/" , $email)) selyah wrote: > Hello all: > I have created a database which is working fine and i am now > validating the inputted data. I am stuck on validating the email > address. I am using the validating statement below, and it is not > working. when i enter the email incorrectly, it is still entered into > the database, and the errror msg is not printed. can anyone see the > error of my ways. thanks > |if(||eregi||(||"^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$"||, $_POST['email']||||)) {| > | echo ||"Valid email address."||;| > | }| > |else {| > | echo ||"Invalid email address."||;| > |}| > *//* > > > ------------------------------------------------------------------------ > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php _______________________________________________ New York PHP Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk NYPHPCon 2006 Presentations Online http://www.nyphpcon.com Show Your Participation in New York PHP http://www.nyphp.org/show_participation.php -------------- next part -------------- An HTML attachment was scrubbed... URL: From jcampbell1 at gmail.com Fri Dec 14 11:58:14 2007 From: jcampbell1 at gmail.com (John Campbell) Date: Fri, 14 Dec 2007 11:58:14 -0500 Subject: [nycphp-talk] More questions about working with forms In-Reply-To: <4762A3D4.40008@gmx.net> References: <8f0676b40712131353p451466c2oa51308f2e78a5348@mail.gmail.com> <4761B9F0.5030408@gmx.net> <8f0676b40712131601o51be7372jafc31fb61d9b92f7@mail.gmail.com> <4762A3D4.40008@gmx.net> Message-ID: <8f0676b40712140858i13c4255aj917539a3c6b061c9@mail.gmail.com> > Is there anything drastically flawed with my approach? > Since you understand the pitfalls of your approach and choose to do it that way it is not a problem. You are also using sessions to prevent repeated hits to the database for "performance reasons". Don't do that. It typically makes performance worse because session data must be serialized and written to disk on every request even if the data doesn't change. Regards, John Campbell From david at davidmintz.org Fri Dec 14 12:35:05 2007 From: david at davidmintz.org (David Mintz) Date: Fri, 14 Dec 2007 12:35:05 -0500 Subject: [nycphp-talk] Zend Framework confusion In-Reply-To: References: Message-ID: <721f1cc50712140935w1c7a04acq26498f2c05993ac6@mail.gmail.com> Try printing that Zend_Db_Select object -- it has a nice __toString(). Then copy and paste that query into your mysql command line client and see what happens. It may be that your SQL isn't what you want it to be. On Dec 14, 2007 10:21 AM, willie klein wrote: > Hi All; > > > > I've just started using Zend Framework and having a hard time getting used > to this new way of doing things. > > > > I'm a bit confused about how to register databases with the registry and > putting things all together. > > > > I can query tables fine and put the results into my view if I use the > table model, that is make the table a class and refer to it as a object > through Zend_Table_class. This is fine for querys with one table but I > think for joins its better to use their SQL builder interface. So if I put > in my bootstrap file: > > // load configuration > > $config = new Zend_Config_Ini('./application/config.ini', 'general'); > > $registry = Zend_Registry::getInstance(); > > $registry->set('config', $config); > > > > // setup database > > $db = Zend_Db::factory($config->db->adapter, > $config->db->config->toArray()); > > Zend_Db_Table::setDefaultAdapter($db); > > Zend_Registry::set('db', $db); > > ///// > > Can I just use in my controller : > > $db = Zend_Registry::get('db'); > > $select = $db->select(); > > $select->distinct() > > ->from( 'course') > > ->join(array( 'user'), 'course.teacherID = user.id') > ; > > $data = $db->fetchAll($select); > > $this->view->data = $data;// > > This doesn't work and I'm not sure why. > > > > This works with the model: > > $dbuser = new User(); > > $this->view->dbuser = $dbuser->fetchAll(); > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > -- David Mintz http://davidmintz.org/ The subtle source is clear and bright The tributary streams flow through the darkness -------------- next part -------------- An HTML attachment was scrubbed... URL: From rmarscher at beaffinitive.com Fri Dec 14 12:44:13 2007 From: rmarscher at beaffinitive.com (Rob Marscher) Date: Fri, 14 Dec 2007 12:44:13 -0500 Subject: [nycphp-talk] validating email address In-Reply-To: <941114.30832.qm@web30815.mail.mud.yahoo.com> References: <941114.30832.qm@web30815.mail.mud.yahoo.com> Message-ID: On Dec 14, 2007, at 10:55 AM, selyah wrote: > I am stuck on validating the email address. Check this out. PHP 5 now includes the filter extension by default. Saves you from having to keep your regular expression up to date -- just keep your php install up to date instead: if (filter_var($email, FILTER_VALIDATE_EMAIL) !== false) { // email passed validation } else { // email is not valid } http://php.net/filter http://php.net/filter_var -------------- next part -------------- An HTML attachment was scrubbed... URL: From ramons at gmx.net Fri Dec 14 13:41:28 2007 From: ramons at gmx.net (David Krings) Date: Fri, 14 Dec 2007 13:41:28 -0500 Subject: [nycphp-talk] More questions about working with forms In-Reply-To: <8f0676b40712140858i13c4255aj917539a3c6b061c9@mail.gmail.com> References: <8f0676b40712131353p451466c2oa51308f2e78a5348@mail.gmail.com> <4761B9F0.5030408@gmx.net> <8f0676b40712131601o51be7372jafc31fb61d9b92f7@mail.gmail.com> <4762A3D4.40008@gmx.net> <8f0676b40712140858i13c4255aj917539a3c6b061c9@mail.gmail.com> Message-ID: <4762CE58.4070802@gmx.net> John Campbell wrote: >> Is there anything drastically flawed with my approach? >> > > Since you understand the pitfalls of your approach and choose to do it > that way it is not a problem. You are also using sessions to prevent > repeated hits to the database for "performance reasons". Don't do > that. It typically makes performance worse because session data must > be serialized and written to disk on every request even if the data > doesn't change. So you are saying that a database access is faster than a file access? I find that hard to believe, but do not have any evidence of the contrary. David From ken at secdat.com Fri Dec 14 14:10:06 2007 From: ken at secdat.com (Kenneth Downs) Date: Fri, 14 Dec 2007 14:10:06 -0500 Subject: [nycphp-talk] More questions about working with forms In-Reply-To: <4762CE58.4070802@gmx.net> References: <8f0676b40712131353p451466c2oa51308f2e78a5348@mail.gmail.com> <4761B9F0.5030408@gmx.net> <8f0676b40712131601o51be7372jafc31fb61d9b92f7@mail.gmail.com> <4762A3D4.40008@gmx.net> <8f0676b40712140858i13c4255aj917539a3c6b061c9@mail.gmail.com> <4762CE58.4070802@gmx.net> Message-ID: <4762D50E.8010502@secdat.com> I have actually seen it in several cases, and it took me by surprise. I have been meaning to do some tests one of these days.... David Krings wrote: > John Campbell wrote: >>> Is there anything drastically flawed with my approach? >>> >> >> Since you understand the pitfalls of your approach and choose to do it >> that way it is not a problem. You are also using sessions to prevent >> repeated hits to the database for "performance reasons". Don't do >> that. It typically makes performance worse because session data must >> be serialized and written to disk on every request even if the data >> doesn't change. > > So you are saying that a database access is faster than a file access? > I find that hard to believe, but do not have any evidence of the > contrary. > > David > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php -- Kenneth Downs Secure Data Software, Inc. www.secdat.com www.andromeda-project.org 631-689-7200 Fax: 631-689-0527 cell: 631-379-0010 From ben at projectskyline.com Fri Dec 14 14:20:02 2007 From: ben at projectskyline.com (Ben Sgro) Date: Fri, 14 Dec 2007 14:20:02 -0500 Subject: [nycphp-talk] Method overloading Message-ID: <4762D762.30209@projectskyline.com> Hello, Reading a java book on OOP, I wanted to do this in php: class foo { public function bar($string){...} public function bar($string, $int, $array) {...} } It should provide different "signatures" and allow method overloading... Why not in php? Is that not built in? - Ben From ken at secdat.com Fri Dec 14 14:24:24 2007 From: ken at secdat.com (Kenneth Downs) Date: Fri, 14 Dec 2007 14:24:24 -0500 Subject: [nycphp-talk] Method overloading In-Reply-To: <4762D762.30209@projectskyline.com> References: <4762D762.30209@projectskyline.com> Message-ID: <4762D868.1000504@secdat.com> Ben Sgro wrote: > Hello, > > Reading a java book on OOP, I wanted to do this in php: > > class foo > { > public function bar($string){...} > public function bar($string, $int, $array) {...} > } > > > It should provide different "signatures" and allow method overloading... > Why not in php? I can't answer the "why", but you can get to the same place by providing default values: class foo { public function bar ($string,$int=0,$array=array()) { ... } } > > Is that not built in? > > - Ben > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php -- Kenneth Downs Secure Data Software, Inc. www.secdat.com www.andromeda-project.org 631-689-7200 Fax: 631-689-0527 cell: 631-379-0010 From ben at projectskyline.com Fri Dec 14 14:27:16 2007 From: ben at projectskyline.com (Ben Sgro) Date: Fri, 14 Dec 2007 14:27:16 -0500 Subject: [nycphp-talk] Method overloading In-Reply-To: <4762D868.1000504@secdat.com> References: <4762D762.30209@projectskyline.com> <4762D868.1000504@secdat.com> Message-ID: <4762D914.4080801@projectskyline.com> Yup, I figured I'd go down that path. It just adds extra logic, because in one case the 1st arg is an array, in the other its a bunch of strings. Ok, so you the answer is "no", you can't do method overloading in php? - Ben Kenneth Downs wrote: > Ben Sgro wrote: >> Hello, >> >> Reading a java book on OOP, I wanted to do this in php: >> >> class foo >> { >> public function bar($string){...} >> public function bar($string, $int, $array) {...} >> } >> >> >> It should provide different "signatures" and allow method overloading... >> Why not in php? > > I can't answer the "why", but you can get to the same place by > providing default values: > > class foo { > public function bar ($string,$int=0,$array=array()) { ... } > } > >> >> Is that not built in? >> >> - Ben >> _______________________________________________ >> New York PHP Community Talk Mailing List >> http://lists.nyphp.org/mailman/listinfo/talk >> >> NYPHPCon 2006 Presentations Online >> http://www.nyphpcon.com >> >> Show Your Participation in New York PHP >> http://www.nyphp.org/show_participation.php > > From ken at secdat.com Fri Dec 14 14:31:49 2007 From: ken at secdat.com (Kenneth Downs) Date: Fri, 14 Dec 2007 14:31:49 -0500 Subject: [nycphp-talk] Method overloading In-Reply-To: <4762D914.4080801@projectskyline.com> References: <4762D762.30209@projectskyline.com> <4762D868.1000504@secdat.com> <4762D914.4080801@projectskyline.com> Message-ID: <4762DA25.9000101@secdat.com> Ben Sgro wrote: > Yup, > > I figured I'd go down that path. It just adds extra logic, because in one > case the 1st arg is an array, in the other its a bunch of strings. Yeah, I just handle that by putting a trap in, if the argument is an array I leave it alone but if it is a string I explode it. > > Ok, so you the answer is "no", you can't do method overloading in php? AFAIK, Yes, the answer is no :) > > - Ben > > Kenneth Downs wrote: >> Ben Sgro wrote: >>> Hello, >>> >>> Reading a java book on OOP, I wanted to do this in php: >>> >>> class foo >>> { >>> public function bar($string){...} >>> public function bar($string, $int, $array) {...} >>> } >>> >>> >>> It should provide different "signatures" and allow method >>> overloading... >>> Why not in php? >> >> I can't answer the "why", but you can get to the same place by >> providing default values: >> >> class foo { >> public function bar ($string,$int=0,$array=array()) { ... } >> } >> >>> >>> Is that not built in? >>> >>> - Ben >>> _______________________________________________ >>> New York PHP Community Talk Mailing List >>> http://lists.nyphp.org/mailman/listinfo/talk >>> >>> NYPHPCon 2006 Presentations Online >>> http://www.nyphpcon.com >>> >>> Show Your Participation in New York PHP >>> http://www.nyphp.org/show_participation.php >> >> > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php -- Kenneth Downs Secure Data Software, Inc. www.secdat.com www.andromeda-project.org 631-689-7200 Fax: 631-689-0527 cell: 631-379-0010 From rmarscher at beaffinitive.com Fri Dec 14 14:51:03 2007 From: rmarscher at beaffinitive.com (Rob Marscher) Date: Fri, 14 Dec 2007 14:51:03 -0500 Subject: [nycphp-talk] More questions about working with forms In-Reply-To: <4762CE58.4070802@gmx.net> References: <8f0676b40712131353p451466c2oa51308f2e78a5348@mail.gmail.com> <4761B9F0.5030408@gmx.net> <8f0676b40712131601o51be7372jafc31fb61d9b92f7@mail.gmail.com> <4762A3D4.40008@gmx.net> <8f0676b40712140858i13c4255aj917539a3c6b061c9@mail.gmail.com> <4762CE58.4070802@gmx.net> Message-ID: <6CEC4297-C3C9-4F8C-9850-1F417DC896F0@beaffinitive.com> On Dec 14, 2007, at 1:41 PM, David Krings wrote: > John Campbell wrote: >>> Is there anything drastically flawed with my approach? >>> >> Since you understand the pitfalls of your approach and choose to do >> it >> that way it is not a problem. You are also using sessions to prevent >> repeated hits to the database for "performance reasons". Don't do >> that. It typically makes performance worse because session data must >> be serialized and written to disk on every request even if the data >> doesn't change. > > So you are saying that a database access is faster than a file > access? I find that hard to believe, but do not have any evidence of > the contrary. I would guess it depends on a number of factors -- like whether or not the session file is in the OS filesystem cache, what type of hard drive you are using, etc. I think the point John was making is that if the data doesn't change you might be able to recognize that there was no change and not write the session data at the end of the request. With php's default session handler, it's going to write to the session file at the end of every request. If you're not working on a medium to high volume traffic site, the performance difference probably isn't a big deal. From jcampbell1 at gmail.com Fri Dec 14 14:52:58 2007 From: jcampbell1 at gmail.com (John Campbell) Date: Fri, 14 Dec 2007 14:52:58 -0500 Subject: [nycphp-talk] More questions about working with forms In-Reply-To: <4762CE58.4070802@gmx.net> References: <8f0676b40712131353p451466c2oa51308f2e78a5348@mail.gmail.com> <4761B9F0.5030408@gmx.net> <8f0676b40712131601o51be7372jafc31fb61d9b92f7@mail.gmail.com> <4762A3D4.40008@gmx.net> <8f0676b40712140858i13c4255aj917539a3c6b061c9@mail.gmail.com> <4762CE58.4070802@gmx.net> Message-ID: <8f0676b40712141152i1763878fp60c6bff2ff3ed598@mail.gmail.com> > So you are saying that a database access is faster than a file access? I find > that hard to believe, but do not have any evidence of the contrary. As a general rule of thumb, databases are faster for small bits of data and the file system is faster for larger data. Both the filesystem and the database have memory caches, so reading data from a file or the database repeatedly doesn't require going to the disk. The problem with php sessions is that they force a write on every request, which requires going to the disk every request. This could be mitigated with memcached or memory tables, but that has a whole host of other problems. I think if i had a session performance problem (which I don't) I'd use a hybrid database/memcached solution that only writes if the session has actually changed. That way, you would only have to hit the disk if required and your would be able to restart mysql/memcached without destroying every session. Regards, John Campbell From ben at projectskyline.com Fri Dec 14 14:53:29 2007 From: ben at projectskyline.com (Ben Sgro) Date: Fri, 14 Dec 2007 14:53:29 -0500 Subject: [nycphp-talk] Setting a catch dynamically Message-ID: <4762DF39.7010906@projectskyline.com> Hello again! In this code sample, try { call_user_func($faSet, $this->getArguments($argSet)); } catch ( customException $e ) { throw new $exceptionToThrow; } From ben at projectskyline.com Fri Dec 14 14:59:45 2007 From: ben at projectskyline.com (Ben Sgro) Date: Fri, 14 Dec 2007 14:59:45 -0500 Subject: [nycphp-talk] Setting a catch dynamically In-Reply-To: <4762DF39.7010906@projectskyline.com> References: <4762DF39.7010906@projectskyline.com> Message-ID: <4762E0B1.1070500@projectskyline.com> haha I want to set the customException dynamically. I tried doing so by passing it in as a var ... catch ($var $e) but that didn't seem to work. Can it be done? - Ben Ben Sgro wrote: > Hello again! > > In this code sample, > > try > { > call_user_func($faSet, $this->getArguments($argSet)); > } > catch ( customException $e ) > { > throw new $exceptionToThrow; > } > > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > From rmarscher at beaffinitive.com Fri Dec 14 15:02:55 2007 From: rmarscher at beaffinitive.com (Rob Marscher) Date: Fri, 14 Dec 2007 15:02:55 -0500 Subject: [nycphp-talk] Setting a catch dynamically In-Reply-To: <4762DF39.7010906@projectskyline.com> References: <4762DF39.7010906@projectskyline.com> Message-ID: On Dec 14, 2007, at 2:53 PM, Ben Sgro wrote: > Hello again! > > In this code sample, > > try > { > call_user_func($faSet, $this->getArguments($argSet)); > } > catch ( customException $e ) > { > throw new $exceptionToThrow; > } Exceptions will bubble all the way up to the first place the code was called from... so usually you don't have to catch an exception just to throw another one. From rmarscher at beaffinitive.com Fri Dec 14 15:08:16 2007 From: rmarscher at beaffinitive.com (Rob Marscher) Date: Fri, 14 Dec 2007 15:08:16 -0500 Subject: [nycphp-talk] Setting a catch dynamically In-Reply-To: <4762E0B1.1070500@projectskyline.com> References: <4762DF39.7010906@projectskyline.com> <4762E0B1.1070500@projectskyline.com> Message-ID: > Ben Sgro wrote: >> try >> { >> call_user_func($faSet, $this->getArguments($argSet)); >> } >> catch ( customException $e ) >> { >> throw new $exceptionToThrow; >> } On Dec 14, 2007, at 2:59 PM, Ben Sgro wrote: > I want to set the customException dynamically. > I tried doing so by passing it in as a var ... catch ($var $e) > but that didn't seem to work. > Can it be done? I'm not sure... seems somewhat odd that you would need to do that... You could catch Exception which would get you everything and then use a switch on get_class: try { // something } catch (Exception $e) { switch (get_class($e)) { default: // blah break; case $customException: // handle it break; } } From bz-gmort at beezifies.com Fri Dec 14 16:06:49 2007 From: bz-gmort at beezifies.com (Gary Mort) Date: Fri, 14 Dec 2007 16:06:49 -0500 Subject: [nycphp-talk] Readini Message-ID: <4762F069.7090706@beezifies.com> I'm curious, is there a reason readini is not used for config files in general? Is it that much faster to include the config.php file as opposed to using readini? From ioplex at gmail.com Fri Dec 14 17:38:44 2007 From: ioplex at gmail.com (Michael B Allen) Date: Fri, 14 Dec 2007 17:38:44 -0500 Subject: [nycphp-talk] Method overloading In-Reply-To: <4762DA25.9000101@secdat.com> References: <4762D762.30209@projectskyline.com> <4762D868.1000504@secdat.com> <4762D914.4080801@projectskyline.com> <4762DA25.9000101@secdat.com> Message-ID: <78c6bd860712141438s502032e3x852f5d9d9d6b9346@mail.gmail.com> On 12/14/07, Kenneth Downs wrote: > Ben Sgro wrote: > > Ok, so you the answer is "no", you can't do method overloading in php? > > AFAIK, Yes, the answer is no :) Method overloading could mean overloading the method in a subclass so to say "you can't do method overloading in php" is false. PHP does support method overloading. It just doesn't support using the same method name with different signatures. But as you point out, PHP does allow optional / default values instead which achieves a very similar result (and in fact I find it to be superior in many ways). Mike -- Michael B Allen PHP Active Directory SPNEGO SSO http://www.ioplex.com/ From ioplex at gmail.com Fri Dec 14 17:46:01 2007 From: ioplex at gmail.com (Michael B Allen) Date: Fri, 14 Dec 2007 17:46:01 -0500 Subject: [nycphp-talk] Setting a catch dynamically In-Reply-To: <4762E0B1.1070500@projectskyline.com> References: <4762DF39.7010906@projectskyline.com> <4762E0B1.1070500@projectskyline.com> Message-ID: <78c6bd860712141446i5c45a051v16cd47cf470cbcf7@mail.gmail.com> On 12/14/07, Ben Sgro wrote: > I want to set the customException dynamically. > > I tried doing so by passing it in as a var ... catch ($var $e) > > but that didn't seem to work. > > Can it be done? No. But you do know that you can catch multiple different exceptions at the same time right? try { // do something } catch (MyCustomException $mce) { // handle this type of exception here } catch (SomeOtherException $soe) { // Only SomeOtherException exceptions will be caught here } catch (Exception $e) { // All other types of exceptions will be caught here } Mike -- Michael B Allen PHP Active Directory SPNEGO SSO http://www.ioplex.com/ From ken at secdat.com Fri Dec 14 17:53:49 2007 From: ken at secdat.com (Kenneth Downs) Date: Fri, 14 Dec 2007 17:53:49 -0500 Subject: [nycphp-talk] Method overloading In-Reply-To: <78c6bd860712141438s502032e3x852f5d9d9d6b9346@mail.gmail.com> References: <4762D762.30209@projectskyline.com> <4762D868.1000504@secdat.com> <4762D914.4080801@projectskyline.com> <4762DA25.9000101@secdat.com> <78c6bd860712141438s502032e3x852f5d9d9d6b9346@mail.gmail.com> Message-ID: <4763097D.4050305@secdat.com> Michael B Allen wrote: > On 12/14/07, Kenneth Downs wrote: > >> Ben Sgro wrote: >> >>> Ok, so you the answer is "no", you can't do method overloading in php? >>> >> AFAIK, Yes, the answer is no :) >> > > Method overloading could mean overloading the method in a subclass so > to say "you can't do method overloading in php" is false. That's overriding, not overloading. > PHP does > support method overloading. It just doesn't support using the same > method name with different signatures. > Overloading is by definition exactly what it does not allow, having different methods of the same name with different signatures. > But as you point out, PHP does allow optional / default values instead > which achieves a very similar result (and in fact I find it to be > superior in many ways). > Overloading is a requirement for strongly typed languages, since PHP is not strongly typed it can get by without it. I also find PHP's loose typing far more appropriate to its role as a string generator (sql, HTML), and appreciate its default values as part of its entire philosophy of flexibility. > Mike > > -- Kenneth Downs Secure Data Software, Inc. www.secdat.com www.andromeda-project.org 631-689-7200 Fax: 631-689-0527 cell: 631-379-0010 -------------- next part -------------- An HTML attachment was scrubbed... URL: From rmarscher at beaffinitive.com Fri Dec 14 23:19:31 2007 From: rmarscher at beaffinitive.com (Rob Marscher) Date: Fri, 14 Dec 2007 23:19:31 -0500 Subject: [nycphp-talk] Readini In-Reply-To: <4762F069.7090706@beezifies.com> References: <4762F069.7090706@beezifies.com> Message-ID: <8197723C-8F69-4089-AB77-760801330586@beaffinitive.com> On Dec 14, 2007, at 4:06 PM, Gary Mort wrote: > I'm curious, is there a reason readini is not used for config files > in general? > Is it that much faster to include the config.php file as opposed to > using readini? You mean parse_ini_file, right? http://php.net/parse_ini_file Ini files are more readable than php... but sometimes I think it's nice to have the flexibility of php in my config files to be able to put a little php in them... I guess what I'm thinking it more akin to the bootstrap file concept. Parse_ini_file is part of the core php code, so it's probably pretty fast. A pure PHP implementation would surely be too slow. I would guess the performance difference with parse_ini_file (if significant) isn't reason enough to not use it if you prize readability... then again... maybe it's worth taking it one step farther and installing syck and the pecl ext/syck extension so you can read/write YAML: http://www.whytheluckystiff.net/syck/ http://devzone.zend.com/article/2585-Using-YAML-With-PHP-and-PECL From ramons at gmx.net Sat Dec 15 11:30:10 2007 From: ramons at gmx.net (David Krings) Date: Sat, 15 Dec 2007 11:30:10 -0500 Subject: [nycphp-talk] gettext help Message-ID: <47640112.1050003@gmx.net> Hi! After creating a simple test project and going with xgettext at it I did successfully create the .po file, but found that concatenated strings aren't treated as one string. For example, I have this in my test script: echo _("This is a string ". "that is concatenated ". "over three rows in one statement."); xgettext reads that out as three individual strings. What I expected to happen is that a string within _() gets treated as one string and since I specified PHP as the language to deal with I further expected xgetttext to know how strings are concatenated in PHP and that any concatenated variables are to be ignored (although I haven't tested yet if it did that). I used the following command: "C:\Program Files\Poedit\bin\xgettext.exe" -pF:\gettexttest\lang -a --language=PHP F:\gettexttest\*.php I have concatenated strings all over the place after many people yelled at me that my lines in my scripts are longer than 80 chars. Any advice on how to make xgettext understand the dot? Also, how can I specify an entire directory tree to be searched for php files rather than just one directory. I did see that one can specify the locations to be read from a file, but I couldn't find conclusive instructions on how to format that file. I also tried using poedit to create the catalogs, but all I get is an error message that it couldn't find source files. The help doesn't really specify on where to set where to look for the source files. I guess with some more time I could get used to gettext, but the motto "as simple as possible, but not simpler" requires that I redefine what I understand under "simple". What makes it even worse, the several tutorials that are available all have their own, often overly complicated approach. Most create extra functions and wrap functions into new functions. I also wonder how gettext differentiates between text strings. It is possible that a string in two spots is the same for English, but different for German. Since gettext apparently keys off the english string, how can it differentiate? Does anyone know of a good tutorial that doesn't try to get fancy in step 0? While waiting for answers I will look into using ini file as string files. There are translation tools out there and ini files are simple enough to create one's own tools. Reading ini files is part of the php core...wait, wasn't there a discussion about this going on as well? The downside to that is that I'd need to create a new function and that I need to extract the strings manually, which in my case wouldn't be that horrible as there aren't that many. Thanks in advance! David From brenttech at gmail.com Sat Dec 15 16:58:52 2007 From: brenttech at gmail.com (Brent Baisley) Date: Sat, 15 Dec 2007 16:58:52 -0500 Subject: [nycphp-talk] Help in creating multiple columns and rows to display product name pice and images In-Reply-To: References: Message-ID: <29594C58-CFEE-4BD5-9B64-4A3CC73C9B26@gmail.com> I have a class I created that I have been using for years to do almost exactly what you are looking to do. Although you don't really need to use PHP5 syntax to do it. I've attached the class file and an example file that shows how it works. The example is a calendar and it generates it's own example data array, but any array will work. Just put the files in a web accessible directory and call the listMaker.example.php file. This is just an example, so there are a number of things I am not doing, like sanitizing the form input data. There are 3 essential settings to it: 1. The template for the data. In your case, it's what is in your while loop without the "tr" 2. The data, which is a multi-dimensional associative array. It's the array you get when you retrieve data from mysql the way you are. 3. The row delimiter. In your case "" When you call the makeList function, you tell it how many columns you want. It then creates however many rows are necessary based on the size of the data array. So if your data array has 9 items and you specify 3 columns, it will create 3 rows. I did not mention pagination, because you should only be retrieving enough records from the database to build the page, not all the data. You would do this by adding a "LIMIT" clause to your query. There was a pagination discussion not too long ago, you should search the archives for that discussion. Hope that helps. Brent?? On Dec 11, 2007, at 12:16 PM, anang tawiah wrote: > > I am a relative php amateur who is trying to kind of master the php > 5 syntax and I have using Larry Ulmanns php and mysql 2nd edition > book. The problem I am facing is that in the authors example he > lists all the results. > > > > What I want to do for this project is to display the following > product information in rows and columns whereby; > > > > i could specify the number of columns and rows per page (using php > 5 syntax) > And finally I also want to paginate the result set (using php 5 > syntax) > > > I know this might sound trivial to most of you ?Gurus? on this > list (which is why I finally decided to stop trying to figure it > out myself and ask for help) and I appreciate your help in advance. > > > > > > > > > // This page displays the available prints (products). > > > > // Set the page title and include the HTML header. > > $page_title = 'Browse the Prints'; > > include ('./includes/header.html'); > > > > require_once ('../mysql_connect.php'); // Connect to the database. > > > > // Are we looking at a particular artist? > > if (isset($_GET['aid'])) { > > $aid = (int) $_GET['aid']; > > if ($aid > 0) { > > $query = "SELECT artists.artist_id, > CONCAT_WS(' ', first_name, middle_name, last_name) AS name, > print_name, price, description, print_id FROM artists, prints WHERE > artists.artist_id = prints.artist_id AND prints.artist_id =$aid > ORDER BY prints.print_name"; > > } else { > > $query = "SELECT artists.artist_id, > CONCAT_WS(' ', first_name, middle_name, last_name) AS name, > print_name, price, description, print_id FROM artists, prints WHERE > artists.artist_id = prints.artist_id ORDER BY artists.last_name > ASC, prints.print_name ASC"; > > } > > } else { > > $query = "SELECT artists.artist_id, CONCAT_WS(' ', > first_name, middle_name, last_name) AS name, print_name, price, > description, print_id FROM artists, prints WHERE artists.artist_id > = prints.artist_id ORDER BY artists.last_name ASC, > prints.print_name ASC"; > > } > > > > // Create the table head. > > echo ' align="center"> > > > > > > > > > > > > '; > > > > // Display all the prints, linked to URLs. > > $result = mysqli_query ($dbc, $query); > > while ($row = mysqli_fetch_array ($result, MYSQL_ASSOC)) { > > > > // Display each record. > > echo " > > > > > > > > > > \n"; > > > > } // End of while loop. > > > > echo '
ArtistPrint NameDescriptionPrice
\"browse_prints.php?aid={$row['artist_id']}\">{$row['name']} pid={$row['print_id']}\">{$row['print_name']}{$row['description']}\${$row['price']}
'; // Close the table. > > > > mysqli_close($dbc); // Close the database connection. > > include ('./includes/footer.html'); > > > > ?> > > > > > > > > Thanks, > > > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: listMaker.class.php Type: text/php Size: 5765 bytes Desc: not available URL: -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: listMaker.example.php Type: text/php Size: 4535 bytes Desc: not available URL: -------------- next part -------------- An HTML attachment was scrubbed... URL: From jcampbell1 at gmail.com Sat Dec 15 17:58:30 2007 From: jcampbell1 at gmail.com (John Campbell) Date: Sat, 15 Dec 2007 17:58:30 -0500 Subject: [nycphp-talk] gettext help In-Reply-To: <47640112.1050003@gmx.net> References: <47640112.1050003@gmx.net> Message-ID: <8f0676b40712151458h4f9341a6hf6b89b86d81bf711@mail.gmail.com> > I have concatenated strings all over the place after many people yelled at me > that my lines in my scripts are longer than 80 chars. Any advice on how to > make xgettext understand the dot? xgettext is not a full blown php parser. Maybe making an exception to the 80 char rule is a good idea for strings that need to be translated. Does your application have good separation between presentation logic and application logic? Keep in mind that if you make your own translation method, there will be no xgettext at all. > Also, how can I specify an entire directory tree to be searched for php files > rather than just one directory. I did see that one can specify the locations > to be read from a file, but I couldn't find conclusive instructions on how to > format that file. This is trivial with a *nix shell. I am useless with the windows shell. Maybe someone on this list can explain how to emulate the behavior of "xargs" and "find" in the windows shell. My solution would be to install cygwin, but that is like killing a gnat with a sledgehammer. > I also tried using poedit to create the catalogs, but all I get is an error > message that it couldn't find source files. The help doesn't really specify on > where to set where to look for the source files. I have only used po edit to open and edit .po files. The catalogue manager is for translators who have many projects. You need to consolidate all of your po files to one master file, and just open that with PoEdit. Use msgmerge to merge po files. > I guess with some more time I could get used to gettext, but the motto "as > simple as possible, but not simpler" requires that I redefine what I > understand under "simple". What makes it even worse, the several tutorials > that are available all have their own, often overly complicated approach. Most > create extra functions and wrap functions into new functions. The expression "as simple as possible, but not simpler" is an Einstein quote about General Relativity. Gettext is not quite that bad, but it ain't simple either. > I also wonder how gettext differentiates between text strings. It is possible > that a string in two spots is the same for English, but different for German. > Since gettext apparently keys off the english string, how can it differentiate? This is a pitfall, but I have never found it to be an issue. Do you actually have this problem? In theory, it seems like it would be a problem, but in practice I have never found it to be an issue. You may be trying to translate too many one word phrases. For instance, don't do: _('Showing') ." $pos " . _("of") . " $total"; do : sprintf(_('Showing %d of %d'),$pos,$total); or if you need reordering: sprintf(_('Showing %1$d of %2$d'),$pos,$total); If it is still a problem, you could hack it with: You could hack it with: $text = _("back::as in - scratch my back, not a back button") $text = preg_replace("/::.*/,'',$text); > Does anyone know of a good tutorial that doesn't try to get fancy in step 0? No, but I think you are taking the right approach. Learn the basics, and then proceed from there. You are 60% of the way to a gettext epiphany. I didn't know you were trying to do this on a windows enviroment. Without decent command line tools, it may be tricky to make it seamless. Consider writing some .bat files to help with the merging and building of the po files. A couple of other things: Are you using a templating framework? If you are using smarty, you will need a plugin. Does your editor allow regex search and replace? It is really helpful if you have a bunch of strings. Regards, John Campbell From paulcheung at tiscali.co.uk Sat Dec 15 18:10:51 2007 From: paulcheung at tiscali.co.uk (PaulCheung) Date: Sat, 15 Dec 2007 23:10:51 -0000 Subject: [nycphp-talk] How do I return to the original point of entry to my application and hand back control? Message-ID: <009101c83f6f$bce7b280$0300a8c0@X9183> During link testing I identified the need to capture the "pre-application" HTTP_REFERER, for the want of a better way of describing it, in order to store the information so that control can be returned at the end of the session, That is if it correct way of returning control. I just cannot capture the very first one that takes me into the application. Paul From ramons at gmx.net Sat Dec 15 20:02:16 2007 From: ramons at gmx.net (David Krings) Date: Sat, 15 Dec 2007 20:02:16 -0500 Subject: [nycphp-talk] gettext help In-Reply-To: <8f0676b40712151458h4f9341a6hf6b89b86d81bf711@mail.gmail.com> References: <47640112.1050003@gmx.net> <8f0676b40712151458h4f9341a6hf6b89b86d81bf711@mail.gmail.com> Message-ID: <47647918.10906@gmx.net> Hi! First of all, thanks John for your reply. Yes, I do use the WAMPP stack, which in several tests happened to come up on top in regards to performance compared to LAMPP and IIS. I am not surprised that it performs better than IIS, but was suprised about the LAMPP. Although, performance wasn't the reason I chose it. I have a W2k Pro box with server SCSI drives that is rock solid and runs for months without problems. My record is 9 months without reboot, unheard of in the Windows world. And if there is a reboot, it is because Patch Tuesday. I did dig a bit deeper into gettext and the tools that are available on *nix are mostly ported to doze as well. I got tired of the resulting .po files to be littered with all kinds of string garbage or less than half the strings no matter what I did. Plan B was writing two simple functions, one that reads in a specified ini file into an array, and when a section was specified, returns only that section while ditching the remains. The second function accepts a key and a default string (the current english string) and has to get passed on the array with the strings. I crafted an ini file with 300 entries and strings that each are about 200 chars. In my first test I had PHP barf up the entire array, then in a second test pick out random strings. I braced for the worst, but turns out that this is really fast. My plan is to create sections for each script that generates output, read in the file, then based on the name of the script keep the required section and throw the rest away (hoping that PHP releases the memory used). Overall, the two functions are less than a dozen lines of code. That approach has two disadvantages. The code once instrumented gets more difficult to read, but using some one or two letter name for my function and a short array name will condense the calls. It is not as short as _(), well, I could name my function _, but I don't think that is a good idea. Maybe ~() or ?() isn't taken yet. The other disadvantage is the manual string extraction, but I need to rework all echos anyway and given the state of the .po files those would need some massive manual cleanup work as well. My scripts aren't as logic / display separated as they could be, but I do make a point in preparing everything first and then focus on output as much as possible, but still, it is sometimes within the same script. I go with the ini file approach and see how that works out. The tests worked much better than I expected. I then can also expand the functions to accept additional parameters if needed. David From ramons at gmx.net Sat Dec 15 22:21:17 2007 From: ramons at gmx.net (David Krings) Date: Sat, 15 Dec 2007 22:21:17 -0500 Subject: [nycphp-talk] gettext help In-Reply-To: <47647918.10906@gmx.net> References: <47640112.1050003@gmx.net> <8f0676b40712151458h4f9341a6hf6b89b86d81bf711@mail.gmail.com> <47647918.10906@gmx.net> Message-ID: <476499AD.7090408@gmx.net> David Krings wrote: > Hi! > > function and a short array name will condense the calls. It is not as > short as _(), well, I could name my function _, but I don't think that > is a good idea. Maybe ~() or ?() isn't taken yet. The other disadvantage I found that PHP doesn't like ~ as a function name, but ? is fine. After reading in the ini file or a portion of it I can now craft echos as such echo ?(123456, $l, "This is the default string."); with the integer being the numeric key (alphanumeric would work as well, but with alphas in the key spellchecking the ini string file is a pita), $l the array that contains the string for the current script, and the optional string being a default text if the requested string is not found. I may get back to it and refine the ? function to pass things like a number or a date along that then needs to be inserted into the correct position, but I will see if I need this for my app. If anyone is interested in the functions let me know and I'll post them. So long, gettext, maybe next time.... David From jcampbell1 at gmail.com Sun Dec 16 01:13:12 2007 From: jcampbell1 at gmail.com (John Campbell) Date: Sun, 16 Dec 2007 01:13:12 -0500 Subject: [nycphp-talk] gettext help In-Reply-To: <476499AD.7090408@gmx.net> References: <47640112.1050003@gmx.net> <8f0676b40712151458h4f9341a6hf6b89b86d81bf711@mail.gmail.com> <47647918.10906@gmx.net> <476499AD.7090408@gmx.net> Message-ID: <8f0676b40712152213k774d9000p8076ea477d69db8d@mail.gmail.com> > but ? is fine. I don't have one of those on my keyboard... You might want to pick something that is in 7-bit ascii to avoid character set problems. T() seems like a good name. It is unfortunate that you are giving up on gettext. I am sure your solution will work, but I think in the long run it is going to be extra effort because the function now has 3 parameters rather than one. You also don't need to bother testing performance on 200x300=60kb of data. No matter what you do, it will be fast. Once you have 1Mb of data, then there will start to be a difference because gettext will use 1Mb of memory per language, and your solution will write 1Mb to memory every request. Btw, how are you testing performance? Pure php, ab, or something else? Cheers, John Campbell From johnzabroski at yahoo.com Sun Dec 16 08:42:35 2007 From: johnzabroski at yahoo.com (John Zabroski) Date: Sun, 16 Dec 2007 05:42:35 -0800 (PST) Subject: [nycphp-talk] Method overloading In-Reply-To: <4763097D.4050305@secdat.com> Message-ID: <665648.88735.qm@web60219.mail.yahoo.com> --- Kenneth Downs wrote: > Overloading is a requirement for strongly typed > languages, since PHP is > not strongly typed it can get by without it. I also > find PHP's loose > typing far more appropriate to its role as a string > generator (sql, > HTML), and appreciate its default values as part of > its entire > philosophy of flexibility. To be quite honest, overloading is rarely ever necessary even in a language with static types. The temptation is to use overloading where default values for parameters are reasonable. Using overloading in place of default parameter values leads to Run-On Initialization bug patterns where part of the object instantiation code is apart from the constructor. This is a code smell, and the only reason it might have for existing is its legacy code and "making it right" might actually break it. If overloading is used for some other reason, then it's likely still a code smell. However, instead of Run-On Initialization, the code smells would be code duplication and exposing structure. Typically, overloading might be used because requirements changed. e.g., you thought it was a good idea to use a formatted string to determine the internal structure of an object. This often results in Broken Dispatch bug patterns. These aren't usually very obvious when performing maintenance on code, because typically any maintenance error only manifests itself in another class that was depending upon the previously exposed internal structure. Yet, for composing objects with complex graph structures, there are superior approaches that are more flexible for maintenance. One correct approach is to use a Builder pattern and inject the built structure into the constructor. Algorithms should be bound to data structures as late as possible, and that is another way to say, "program to an interface, not an implementation". These nefarious issues with overloading are not at all obvious, especially the Broken Dispatch, and therefore a good reason to stay away from overloading whenever possible. Ad-hoc polymorphism is more useful, and is sometimes mistaken for overloading. Ad-hoc polymorphism is a way to provide more specific dynamic method dispatch, helps provide late binding, and thus allows the execution path to be determined at run-time. ____________________________________________________________________________________ Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping From ramons at gmx.net Sun Dec 16 08:52:52 2007 From: ramons at gmx.net (David Krings) Date: Sun, 16 Dec 2007 08:52:52 -0500 Subject: [nycphp-talk] gettext help In-Reply-To: <8f0676b40712152213k774d9000p8076ea477d69db8d@mail.gmail.com> References: <47640112.1050003@gmx.net> <8f0676b40712151458h4f9341a6hf6b89b86d81bf711@mail.gmail.com> <47647918.10906@gmx.net> <476499AD.7090408@gmx.net> <8f0676b40712152213k774d9000p8076ea477d69db8d@mail.gmail.com> Message-ID: <47652DB4.4030807@gmx.net> John Campbell wrote: >> but ? is fine. > > I don't have one of those on my keyboard... You might want to pick > something that is in 7-bit ascii to avoid character set problems. T() > seems like a good name. Well, you need to get a better keyboard then, one that has an Alt Gr key and none of these windows buttons like my good 'ol Cheery. It is the first keyboard I ever bought (about 20 years ago). ;) I change it, it was more curiosity and a futile attempt at being kewl than rational thinking. > It is unfortunate that you are giving up on gettext. I am sure your > solution will work, but I think in the long run it is going to be > extra effort because the function now has 3 parameters rather than > one. You also don't need to bother testing performance on > 200x300=60kb of data. No matter what you do, it will be fast. Once > you have 1Mb of data, then there will start to be a difference because > gettext will use 1Mb of memory per language, and your solution will > write 1Mb to memory every request. Btw, how are you testing > performance? Pure php, ab, or something else? > Oh, the super scientific method of running it in the debugger and see what happens. I found that pulling it through the debugger makes everything extra slow compared to the production system (not that I expected it any different). I have some sections that take about a second from request to page display, but on the production side it is an unnoticeable delay. I could put in measures using microtime or such, but since I do not have a base line that becomes useless, nothing to compare it to. This was really just a subjective test. Also, the ini file approach has one big and one smaller advantage over gettext: one does not have to restart the web server in order to load the updated strings and one also does not need the gettext extension to be enabled. The three parameters are something I am not too happy about, ideally it would have been two, the key and the default string, which is optional. But I need to pass the array to the function otherwise the function doesn't know anything about that array. I could make it global, which saves four characters in the call. 1 MB of strings is a lot. I worked on professional desktop apps that had external string files and those were 400 or 500 kB max. You also got to see how much stuff gettext puts around each string (useful stuff). Using integer keys cuts down on data size to be handled right there. Although, when you say "1 Mb of data", do you mean mbit or mbyte (your notation indicates mbit)? And does that refer to file size or data size of strings only? In any case, I doubt that I will end up with that many strings for my app either way. I think gettext is a good solution per s?, but the tools wrapped around it are lacking a bit of comfort. What would be nice is to have a parser go through the PHP files and allow for manual intervention right there allowing to reject strings and combine concatenated, while after accepting a string the source code gets updated to use the correct call. When trofitting one has to touch each string anyway. Well, let's see with how many strings I end up. I think that I will first work on my CSH functions so that I can put that in as well while crawling through the code. David From bz-gmort at beezifies.com Sun Dec 16 10:14:07 2007 From: bz-gmort at beezifies.com (Gary Mort) Date: Sun, 16 Dec 2007 10:14:07 -0500 Subject: [nycphp-talk] Managing form data with PHP In-Reply-To: <721f1cc50712130953l5a1ca5a2w285e6c21c7afc646@mail.gmail.com> References: <721f1cc50712130953l5a1ca5a2w285e6c21c7afc646@mail.gmail.com> Message-ID: <476540BF.5060900@beezifies.com> David Mintz wrote: > Once upon a time someone said it was a security risk to echo back > $_POST data unconditionally, even if you escape it, and even though > you are only showing them the very thing they just submitted to you. > But I forget what that risk was. Maybe I misremember. It depends on what your doing. As an example, what if your the message text for an email someone sends to your site. It's just one field, and you put your logo and framing around it, but without much explanatory text. Now, I trick someone with an account on your site to post to that form and display the following text: "There is a problem with your account. Please contact scumsucker at 212-000-0000 and have your account name and the credit card number associated with the account to verify account ownership". Opps, not such a good idea to display that on your site! From chsnyder at gmail.com Sun Dec 16 13:33:36 2007 From: chsnyder at gmail.com (csnyder) Date: Sun, 16 Dec 2007 13:33:36 -0500 Subject: [nycphp-talk] Readini In-Reply-To: <8197723C-8F69-4089-AB77-760801330586@beaffinitive.com> References: <4762F069.7090706@beezifies.com> <8197723C-8F69-4089-AB77-760801330586@beaffinitive.com> Message-ID: On Dec 14, 2007 11:19 PM, Rob Marscher wrote: > Ini files are more readable than php... but sometimes I think it's > nice to have the flexibility of php in my config files to be able to > put a little php in them... I guess what I'm thinking it more akin to > the bootstrap file concept. Using php, you can define constants, arrays, objects, and localized strings. -- Chris Snyder http://chxo.com/ From phplists at jellyandcustard.com Mon Dec 17 13:12:35 2007 From: phplists at jellyandcustard.com (Khalid Hanif) Date: Mon, 17 Dec 2007 18:12:35 +0000 Subject: [nycphp-talk] PHP, Perl & SOAP Message-ID: Hi Guys, I'm connecting to a SOAP Server that is being run under Perl. Unfortunately, there is no WSDL for this server, and all I have to go on is legacy Perl code. When I receive back a response from the SOAP Server, the data is wrapped in gensym tags: remote_pass ***** password ***** error_string (Above has been snipped). In the Perl code, the above is handled internally, and it will create the key=>value pairs as an array. However, I can't get this to work in PHP. The perl code makes use of $result->paramsout; to do this (it appears). To make things even more difficult, the digits within the gensym tags are randomly assigned, so each request is different. Any ideas what I can do to get this to work? If I had a WSDL, would this problem be rectified? Cheers, Khalid From nynj.tech at hotmail.com Mon Dec 17 13:26:43 2007 From: nynj.tech at hotmail.com (chad qian) Date: Mon, 17 Dec 2007 13:26:43 -0500 Subject: [nycphp-talk] =?windows-1256?q?upload_image_to_the_mysql_and_then_display_imag?= =?windows-1256?q?e_on_web_page=FE?= Message-ID: I want to create upload form to upload images from people.And then select and display the image on web page.Could anyone please give me the sample code and explaination?I run php/mysql under "godaddy.com"Thanks in advancechad _________________________________________________________________ Share life as it happens with the new Windows Live. http://www.windowslive.com/share.html?ocid=TXT_TAGHM_Wave2_sharelife_122007 -------------- next part -------------- An HTML attachment was scrubbed... URL: From jmcgraw1 at gmail.com Mon Dec 17 13:31:19 2007 From: jmcgraw1 at gmail.com (Jake McGraw) Date: Mon, 17 Dec 2007 13:31:19 -0500 Subject: [nycphp-talk] upload image to the mysql and then display image on web page Message-ID: The php.net site on this is pretty good: http://us3.php.net/manual/en/features.file-upload.php I'm going to assume that was the missing piece in the puzzle for you, otherwise you'll have quite a bit to read about interfacing with a MySQL database and coming up with a schema to represent the data you have. - jake On Dec 17, 2007 1:26 PM, chad qian wrote: > I want to create upload form to upload images from people.And then select > and display the image on web page.Could anyone please give me the sample > code and explaination?I run php/mysql under "godaddy.com" > > Thanks in advance > > chad > > > ------------------------------ > Share life as it happens with the new Windows Live. Share now! > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tgales at tgaconnect.com Mon Dec 17 15:39:13 2007 From: tgales at tgaconnect.com (Tim Gales) Date: Mon, 17 Dec 2007 15:39:13 -0500 Subject: [nycphp-talk] Method overloading In-Reply-To: <665648.88735.qm@web60219.mail.yahoo.com> References: <665648.88735.qm@web60219.mail.yahoo.com> Message-ID: <4766DE71.5060009@tgaconnect.com> John Zabroski wrote: > --- Kenneth Downs wrote: > >> Overloading is a requirement for strongly typed >> languages, since PHP is >> not strongly typed it can get by without it. I also >> find PHP's loose >> typing far more appropriate to its role as a string >> generator (sql, >> HTML), and appreciate its default values as part of >> its entire >> philosophy of flexibility. > > To be quite honest, overloading is rarely ever > necessary even in a language with static types. > Overloading in C++ can be useful to 'line up' your classes so that you can use them in templates But since we're discussing PHP, I would say that you couldn't be any more right -- especially about the 'smelly code' [snip] -- T. Gales & Associates 'Helping People Connect with Technology' http://www.tgaconnect.com From tonyf at buffnet.net Mon Dec 17 18:26:35 2007 From: tonyf at buffnet.net (Tony Furnivall) Date: Mon, 17 Dec 2007 17:26:35 -0600 Subject: [nycphp-talk] Apache fails on startup after reinstalling PHP In-Reply-To: <200712171719.lBHHIxwv081990@proxy.buffnet.net> References: <200712171719.lBHHIxwv081990@proxy.buffnet.net> Message-ID: Hi! I'm trying to re-install Apache, version 2.0.59 (running with PHP 5.2.5 and MySQL 5.0.45). The problem arises when trying to restart Apache after installing PHP. Before this step, I get the Apache logo, and everything seems fine. Installation of PHP goes fine, and all the .ini and .conf files are updated, but when Apache tries to start I get a long list of missing DLLs. The list includes: LIBEAY32.dll sqlite.dll aspell-15.dll DB2CLI.dll ICLIT09B.dll intl3_svn.dll isqlt09a.dll lcrzo.dll libcs.dll libmonetra.dll libSQLDBC_C.dll OCI.dll OCIW32.dll Two of the files are identifiable in closely related (but different) names: LIBEAY32.dll 4 different versions of libeay32.dll! sqlite.dll as php_sqlite.dll Does anyone have any ideas how to track these files down? I have a note from an earlier installation (February 2006) that restarting Apache after installing PHP was 'tricky', but in my eagerness back then, I went no further towards noting just how tricky it had been (:-() I'm guessing that the references are coming from php5apache.dll, but the files weren't in the PHP distro! Thanks for any advice! Tony -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.503 / Virus Database: 269.17.4/1187 - Release Date: 12/16/2007 11:36 AM From mikesz at qualityadvantages.com Mon Dec 17 21:09:47 2007 From: mikesz at qualityadvantages.com (mikesz at qualityadvantages.com) Date: Tue, 18 Dec 2007 10:09:47 +0800 Subject: [nycphp-talk] Closing Tags or Not Closing Tags, that is my question... Message-ID: <1541699910.20071218100947@qualityadvantages.com> Hello and Greetings To All, "The closing PHP tag isn't required and actually stops people breaking things. We removed it intentionally, since some customers were adding whitespace to the end and getting blank pages / cookie errors." This was posted by a senior developer for a VERY popular PHP product. Any body care to comment on this, I am a little disturbed about where it came from having had the white space after the tag problem on more than one of the products I have had the joy to troubleshoot... but I don't think dropping the closing tag was ever a solution that I entertained. I just think its a poor and sloppy approach to problem solving. Any comments? -- Best regards, mikesz mailto:mikesz at qualityadvantages.com From chsnyder at gmail.com Mon Dec 17 21:24:38 2007 From: chsnyder at gmail.com (csnyder) Date: Mon, 17 Dec 2007 21:24:38 -0500 Subject: [nycphp-talk] Closing Tags or Not Closing Tags, that is my question... In-Reply-To: <1541699910.20071218100947@qualityadvantages.com> References: <1541699910.20071218100947@qualityadvantages.com> Message-ID: On Dec 17, 2007 9:09 PM, wrote: > I just think its a poor and sloppy approach to problem > solving. Any comments? Omitting the closing tag is often considered good form, and for some projects is mandatory style. If you want to avoid "sloppiness" you can always end your scripts with: // EOF or something similar to indicate that the script hasn't been truncated. -- Chris Snyder http://chxo.com/ From bz-gmort at beezifies.com Mon Dec 17 21:54:41 2007 From: bz-gmort at beezifies.com (Gary Mort) Date: Mon, 17 Dec 2007 21:54:41 -0500 Subject: [nycphp-talk] Closing Tags or Not Closing Tags, that is my question... In-Reply-To: <1541699910.20071218100947@qualityadvantages.com> References: <1541699910.20071218100947@qualityadvantages.com> Message-ID: <47673671.3070501@beezifies.com> mikesz at qualityadvantages.com wrote: > Hello and Greetings To All, > > "The closing PHP tag isn't required and actually stops people breaking > things. We removed it intentionally, since some customers were adding > whitespace to the end and getting blank pages / cookie errors." > > This was posted by a senior developer for a VERY popular PHP product. > > Any body care to comment on this, Just to fully clarify this, I have seen the same argument put forth for a few projects, one thing they all have in common is using ob_start and saving all content generated to the buffer, before finally releasing it at the end. Personally, I'm nor a big fan of buffering the output like that because it leads to a laggier looking display(when you don't buffer, the page loads as it is built, instead of waiting on a blank page untill the page is generated and then appearing in one block) However, I do see the attraction and even necessity for some products...like a certain CMS I like to use. :-) Personally, I'd be more concerned about the missing comments and documentation than a missing closing tag. From matteo.rinaudo at gmail.com Mon Dec 17 21:57:17 2007 From: matteo.rinaudo at gmail.com (Matteo Rinaudo) Date: Mon, 17 Dec 2007 21:57:17 -0500 Subject: [nycphp-talk] Apache fails on startup after reinstalling PHP In-Reply-To: References: <200712171719.lBHHIxwv081990@proxy.buffnet.net> Message-ID: Hi Tony, I'm not a Windows guy, but afaik you should double check your httpd.conf file: into the 'LoadModule' directive for PHP5, just make sure you are referencing to php5apache2.dll rather than php5apache.dll (if this dll still exists) since you are using apache 2.0.x; also, do make sure the 'extension_dir' directive in php.ini is referencing the right php's extensions folder in your filesystem. Also, copying some of the dlls you mentioned into the apache's bin folder might help, it happened to a friend of mine while dealing with some specific dlls for the mssql extension, and might be applicable to your case although you are not using mssql but oracle, as I can see from your post. Hope this helps! Just check the above steps out, and let us know! Matteo Rinaudo On 12/17/07, Tony Furnivall wrote: > Hi! > > I'm trying to re-install Apache, version 2.0.59 (running with PHP > 5.2.5 and MySQL 5.0.45). The problem arises when trying to restart > Apache after installing PHP. Before this step, I get the Apache logo, > and everything seems fine. > > Installation of PHP goes fine, and all the .ini and .conf files are > updated, but when Apache tries to start I get a long list of missing > DLLs. The list includes: > > LIBEAY32.dll > sqlite.dll > aspell-15.dll > DB2CLI.dll > ICLIT09B.dll > intl3_svn.dll > isqlt09a.dll > lcrzo.dll > libcs.dll > libmonetra.dll > libSQLDBC_C.dll > OCI.dll > OCIW32.dll > > Two of the files are identifiable in closely related (but different) names: > > LIBEAY32.dll 4 different versions of libeay32.dll! > sqlite.dll as php_sqlite.dll > > Does anyone have any ideas how to track these files down? I have a > note from an earlier installation (February 2006) that restarting > Apache after installing PHP was 'tricky', but in my eagerness back > then, I went no further towards noting just how tricky it had been (:-() > > I'm guessing that the references are coming from php5apache.dll, but > the files weren't in the PHP distro! > > Thanks for any advice! > > Tony > > > -- > No virus found in this outgoing message. > Checked by AVG Free Edition. > Version: 7.5.503 / Virus Database: 269.17.4/1187 - Release Date: 12/16/2007 > 11:36 AM > > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > From matteo.rinaudo at gmail.com Mon Dec 17 22:07:59 2007 From: matteo.rinaudo at gmail.com (Matteo Rinaudo) Date: Mon, 17 Dec 2007 22:07:59 -0500 Subject: [nycphp-talk] Apache fails on startup after reinstalling PHP In-Reply-To: References: <200712171719.lBHHIxwv081990@proxy.buffnet.net> Message-ID: Hi again, Forgot to mention: also make sure you are commenting out all the php extensions you don't need. Extensions like oci8 or db2 do require a client installation for these databases in the same machine running apache/php; if you do not have these db clients, you can get errors like not found dlls. You might also want to consider installing the php binaries exploding the tarball and dealing with the installation manually following the included readme files rather than using (if you did so) an installer. Let us know how it goes! Matteo Rinaudo On 12/17/07, Tony Furnivall wrote: > Hi! > > I'm trying to re-install Apache, version 2.0.59 (running with PHP > 5.2.5 and MySQL 5.0.45). The problem arises when trying to restart > Apache after installing PHP. Before this step, I get the Apache logo, > and everything seems fine. > > Installation of PHP goes fine, and all the .ini and .conf files are > updated, but when Apache tries to start I get a long list of missing > DLLs. The list includes: > > LIBEAY32.dll > sqlite.dll > aspell-15.dll > DB2CLI.dll > ICLIT09B.dll > intl3_svn.dll > isqlt09a.dll > lcrzo.dll > libcs.dll > libmonetra.dll > libSQLDBC_C.dll > OCI.dll > OCIW32.dll > > Two of the files are identifiable in closely related (but different) names: > > LIBEAY32.dll 4 different versions of libeay32.dll! > sqlite.dll as php_sqlite.dll > > Does anyone have any ideas how to track these files down? I have a > note from an earlier installation (February 2006) that restarting > Apache after installing PHP was 'tricky', but in my eagerness back > then, I went no further towards noting just how tricky it had been (:-() > > I'm guessing that the references are coming from php5apache.dll, but > the files weren't in the PHP distro! > > Thanks for any advice! > > Tony > > > -- > No virus found in this outgoing message. > Checked by AVG Free Edition. > Version: 7.5.503 / Virus Database: 269.17.4/1187 - Release Date: 12/16/2007 > 11:36 AM > > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > From ramons at gmx.net Mon Dec 17 22:19:35 2007 From: ramons at gmx.net (David Krings) Date: Mon, 17 Dec 2007 22:19:35 -0500 Subject: [nycphp-talk] Closing Tags or Not Closing Tags, that is my question... In-Reply-To: <1541699910.20071218100947@qualityadvantages.com> References: <1541699910.20071218100947@qualityadvantages.com> Message-ID: <47673C47.8060701@gmx.net> mikesz at qualityadvantages.com wrote: > Hello and Greetings To All, > > "The closing PHP tag isn't required and actually stops people breaking > things. We removed it intentionally, since some customers were adding > whitespace to the end and getting blank pages / cookie errors." > > This was posted by a senior developer for a VERY popular PHP product. > > Any body care to comment on this, I am a little disturbed about where > it came from having had the white space after the tag problem on more > than one of the products I have had the joy to troubleshoot... but I > don't think dropping the closing tag was ever a solution that I > entertained. I just think its a poor and sloppy approach to problem > solving. Any comments? > So how does the parser know where PHP ends and HTML starts? David From bz-gmort at beezifies.com Tue Dec 18 05:45:36 2007 From: bz-gmort at beezifies.com (Gary Mort) Date: Tue, 18 Dec 2007 05:45:36 -0500 Subject: [nycphp-talk] Closing Tags or Not Closing Tags, that is my question... In-Reply-To: <47673C47.8060701@gmx.net> References: <1541699910.20071218100947@qualityadvantages.com> <47673C47.8060701@gmx.net> Message-ID: <4767A4D0.3050106@beezifies.com> David Krings wrote: > > So how does the parser know where PHP ends and HTML starts? Simple, PHP starts where you have and HTML starts. IE This is html This is more html on the file means if some extra spaces/lines get added to the end of the file, they are not treated as HTML. From ramons at gmx.net Tue Dec 18 10:46:11 2007 From: ramons at gmx.net (David Krings) Date: Tue, 18 Dec 2007 10:46:11 -0500 Subject: [nycphp-talk] Closing Tags or Not Closing Tags, that is my question... In-Reply-To: <4767A4D0.3050106@beezifies.com> References: <1541699910.20071218100947@qualityadvantages.com> <47673C47.8060701@gmx.net> <4767A4D0.3050106@beezifies.com> Message-ID: <4767EB43.1010705@gmx.net> Gary Mort wrote: > And since there are some operating systems where some editors will stick > a blank space at the end of a file accidentally, not placing the closing > ?> on the file means if some extra spaces/lines get added to the end of > the file, they are not treated as HTML. Thanks for explaining, but I wonder why the tag doesn't take care of that. Once the html tag is closed anything after that ought to be ignored by a browser. That is not the case? From bz-gmort at beezifies.com Tue Dec 18 10:59:29 2007 From: bz-gmort at beezifies.com (Gary Mort) Date: Tue, 18 Dec 2007 10:59:29 -0500 Subject: [nycphp-talk] Closing Tags or Not Closing Tags, that is my question... In-Reply-To: <4767EB43.1010705@gmx.net> References: <1541699910.20071218100947@qualityadvantages.com> <47673C47.8060701@gmx.net> <4767A4D0.3050106@beezifies.com> <4767EB43.1010705@gmx.net> Message-ID: <4767EE61.6070003@beezifies.com> David Krings wrote: > Gary Mort wrote: >> And since there are some operating systems where some editors will >> stick a blank space at the end of a file accidentally, not placing >> the closing ?> on the file means if some extra spaces/lines get added >> to the end of the file, they are not treated as HTML. > > Thanks for explaining, but I wonder why the tag doesn't take > care of that. Once the html tag is closed anything after that ought to > be ignored by a browser. That is not the case? The discussing is regarding the PHP interpreter, not the browser. The problem is dealing with HTML data sent from the script to the browser. The data is, for convenience and simplicity, in 2 parts. The "header" data and the "content" - header here does not mean the HTML header section, but the actual header(where you send cookies and other information). When sending data from a server to a client, all the header information has to come /before/ the content. When your including say...12 different files into a page, sometimes script number 8 needs to send header information. So the practice is to accumulate all the content information into a variable, and send that at the end of the script. This makes it no longer possible to mix HTML and PHP code in a document(ok, it's possible, but outside the scope of this email) as the second you have a raw HTML outside the PHP execution tags, you have lost your chance of sending header data and are into the sending of body data. The problem is when at the end of a file you place ?>[space] The PHP interpreter sees that there is a charector after the ?> and sends it. So now content has begun and you can no longer send headers. Of course, that is less ugly than the ?> References: <1541699910.20071218100947@qualityadvantages.com> Message-ID: I remember reading that and it immediately seemed like a great idea. How many times have you tried a redirect or set a cookie, only to get the error "Headers already sent". That extra return after the closing ?> causes the headers to be sent, since you are delivering content. You also avoid extra characters being sent. Did you ever look at the source code of a web site and see dozens (or more) of blank lines together? Anything after the closing ?> gets sent to the client, even if it's just a bunch of extra returns. I can't think of a good reason to include the closing ?> if you don't specifically need it. Brent On Dec 17, 2007, at 9:09 PM, mikesz at qualityadvantages.com wrote: > Hello and Greetings To All, > > "The closing PHP tag isn't required and actually stops people breaking > things. We removed it intentionally, since some customers were adding > whitespace to the end and getting blank pages / cookie errors." > > This was posted by a senior developer for a VERY popular PHP product. > > Any body care to comment on this, I am a little disturbed about where > it came from having had the white space after the tag problem on more > than one of the products I have had the joy to troubleshoot... but I > don't think dropping the closing tag was ever a solution that I > entertained. I just think its a poor and sloppy approach to problem > solving. Any comments? > > > -- > Best regards, > mikesz mailto:mikesz at qualityadvantages.com > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php From jcampbell1 at gmail.com Tue Dec 18 13:12:05 2007 From: jcampbell1 at gmail.com (John Campbell) Date: Tue, 18 Dec 2007 13:12:05 -0500 Subject: [nycphp-talk] Closing Tags or Not Closing Tags, that is my question... In-Reply-To: References: <1541699910.20071218100947@qualityadvantages.com> Message-ID: <8f0676b40712181012g69aa6170tb89c7c41ee24ce91@mail.gmail.com> I was browsing the MediaWiki repository (the code behind wikipedia) one day and I saw that someone removed all of the closing tags. I immediately thought it was smart and did the same thing to my code. Excluding the closing tag at the end of the file is a *good idea*. Are there any "sed" gurus on the list that can write a 1 liner to remove the closing tags? David, This does not apply to files that mix php and html. This is for php only files, such as classes, or config files. If your application separates the presentation logic from the application logic, you will have lots of files that are pure php and this prevents those scripts from inadvertently sending output to the browser. Regards, John Campbell From ramons at gmx.net Tue Dec 18 13:53:37 2007 From: ramons at gmx.net (David Krings) Date: Tue, 18 Dec 2007 13:53:37 -0500 Subject: [nycphp-talk] Closing Tags or Not Closing Tags, that is my question... In-Reply-To: <4767EE61.6070003@beezifies.com> References: <1541699910.20071218100947@qualityadvantages.com> <47673C47.8060701@gmx.net> <4767A4D0.3050106@beezifies.com> <4767EB43.1010705@gmx.net> <4767EE61.6070003@beezifies.com> Message-ID: <47681731.4060601@gmx.net> Gary Mort wrote: > When your including say...12 different files into a page, sometimes > script number 8 needs to send header information. So the practice is to > accumulate all the content information into a variable, and send that at > the end of the script. > > This makes it no longer possible to mix HTML and PHP code in a > document(ok, it's possible, but outside the scope of this email) as the > second you have a raw HTML outside the PHP execution tags, you have lost > your chance of sending header data and are into the sending of body data. > > The problem is when at the end of a file you place ?>[space] > > The PHP interpreter sees that there is a charector after the ?> and > sends it. So now content has begun and you can no longer send headers. Ah! Now I understand and see where the problem is. I am surprised that I haven't run into this so far, but maybe I am just lucky or the IDEs I use take of this. Thanks! You should seek a carreer as instructor. :) David From ramons at gmx.net Tue Dec 18 14:00:09 2007 From: ramons at gmx.net (David Krings) Date: Tue, 18 Dec 2007 14:00:09 -0500 Subject: [nycphp-talk] Closing Tags or Not Closing Tags, that is my question... In-Reply-To: <8f0676b40712181012g69aa6170tb89c7c41ee24ce91@mail.gmail.com> References: <1541699910.20071218100947@qualityadvantages.com> <8f0676b40712181012g69aa6170tb89c7c41ee24ce91@mail.gmail.com> Message-ID: <476818B9.4050006@gmx.net> John Campbell wrote: > David, > > This does not apply to files that mix php and html. This is for php > only files, such as classes, or config files. If your application > separates the presentation logic from the application logic, you will > have lots of files that are pure php and this prevents those scripts >>from inadvertently sending output to the browser. I do use scripts that do not output anything, but I usually run a browser redirect within the code once done and before the closing tag, so I guess it wouldn't matter in my case as the bogus content would come after the redirect and it also doesn't matter once content is sent. I don't think I have any scripts so far that would cause this problem, but good to know that this issue exists. David From ken at secdat.com Tue Dec 18 15:18:58 2007 From: ken at secdat.com (Kenneth Downs) Date: Tue, 18 Dec 2007 15:18:58 -0500 Subject: [nycphp-talk] Andromeda MySQL hackathon Message-ID: <47682B32.2090805@secdat.com> Hi everybody, The Long Island PHP group is contemplating a hack-a-thon to make Andromeda build mySQL databases. I just brought this up this afternoon, so there are no firm plans, but we are talking about at least one long Saturday plus maybe Friday evening before and Sunday after. The goal is to have Andromeda provide all of its database features to MySQL databases. The plan is to talk it through ahead of time so everybody has a pretty good idea of what they'll be coding when they arrive. This is very doable if we have a few people who know MySQL pretty well and if we talk it through ahead of time. Andromeda intentionally only uses a very few back-end building blocks, so as to make things like this possible. The bulk of it will probably be very annoying translations. So for instance Postgres requires a certain syntax for IF/THEN in triggers, and I have no doubt MySQL will want the commas and semis in different places, that kind of stuff. Same kind of thing for any syntax variations in create table commands, create indexes, and so forth. Remote and on-site participation is welcome. Food and beverages will be provided, and an internet connection and a flat surface for the laptops! If you are interested, please subscribe to the Andromeda general mailing list, as I will be moving the conversation about this over to there next week. That is available on sourceforge: http://lists.sourceforge.net/mailman/listinfo/andro-general -- Kenneth Downs Secure Data Software, Inc. www.secdat.com www.andromeda-project.org 631-689-7200 Fax: 631-689-0527 cell: 631-379-0010 From alexey at webscribble.com Wed Dec 19 12:51:54 2007 From: alexey at webscribble.com (Web Scribble - Alexey Gutin) Date: Wed, 19 Dec 2007 12:51:54 -0500 Subject: [nycphp-talk] Checking if a program is installed Message-ID: <000b01c84267$d7dd5310$8797f930$@com> Hi Everyone, I am trying to check if a program is installed on the server through PHP. In particular, FFMPEG. In Linux, I can just run "ffmpeg", and the shell will throw an error if it isn't found. The same happens in Windows. Is there a way I can figure out if FFMPEG is installed on the server (Windows or Linux)? I know I can try something like shell_exec(), but it doesn't seem to work too well if the command isn't found. Thanks, Alexey -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben at projectskyline.com Wed Dec 19 12:56:06 2007 From: ben at projectskyline.com (Ben Sgro) Date: Wed, 19 Dec 2007 12:56:06 -0500 Subject: [nycphp-talk] Checking if a program is installed In-Reply-To: <000b01c84267$d7dd5310$8797f930$@com> References: <000b01c84267$d7dd5310$8797f930$@com> Message-ID: <47695B36.2030203@projectskyline.com> http://us2.php.net/manual/en/function.is-executable.php FFMPEG was a PITA to setup for me. Got it working though, converting .wmv's to .flv. Web Scribble - Alexey Gutin wrote: > > Hi Everyone, > > I am trying to check if a program is installed on the server through > PHP. In particular, FFMPEG. In Linux, I can just run ?ffmpeg?, and the > shell will throw an error if it isn?t found. The same happens in Windows. > > Is there a way I can figure out if FFMPEG is installed on the server > (Windows or Linux)? I know I can try something like shell_exec(), but > it doesn?t seem to work too well if the command isn?t found. > > Thanks, > > Alexey > > ------------------------------------------------------------------------ > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php From bz-gmort at beezifies.com Wed Dec 19 13:43:22 2007 From: bz-gmort at beezifies.com (Gary Mort) Date: Wed, 19 Dec 2007 13:43:22 -0500 Subject: [nycphp-talk] Checking if a program is installed In-Reply-To: <47695B36.2030203@projectskyline.com> References: <000b01c84267$d7dd5310$8797f930$@com> <47695B36.2030203@projectskyline.com> Message-ID: <4769664A.6040005@beezifies.com> Ben Sgro wrote: > http://us2.php.net/manual/en/function.is-executable.php > > FFMPEG was a PITA to setup for me. > > Got it working though, converting .wmv's to .flv. > There is a PHP library for accessing some functions of FFMPEG. This is helpful for the setup: http://forums.theplanet.com/index.php?showtopic=64541 Note: just wait untill you get a corrupted wmv file which plays fine on windows media player but keeps truncating when converted to FLV. When you have really weird errors, I suggest submitting the file to Google Video and Youtube and see if they convert it ok. If they don't, than you can let the submitter know their file is corrupt. If a billion dollar company can't convert it in an automated fashion, it's highly unlikely anyone can. From aw at sap8.com Wed Dec 19 13:46:51 2007 From: aw at sap8.com (Anthony Wlodarski) Date: Wed, 19 Dec 2007 13:46:51 -0500 Subject: [nycphp-talk] Web hosting. Message-ID: <006101c8426f$86050c60$920f2520$@com> Looking for a good inexpensive reseller we hosting, can anyone make any recommendations? Is anyone using www.hostgator.com? Thanks, Anthony Wlodarski 646-285-0500 x230 aw at sap8.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben at projectskyline.com Wed Dec 19 14:35:55 2007 From: ben at projectskyline.com (Ben Sgro) Date: Wed, 19 Dec 2007 14:35:55 -0500 Subject: [nycphp-talk] Web hosting. In-Reply-To: <006101c8426f$86050c60$920f2520$@com> References: <006101c8426f$86050c60$920f2520$@com> Message-ID: <4769729B.8050803@projectskyline.com> I've had bad experience w/a client who was using host gator. We needed to run php5 and I had to spend a few hours to get them to upgrade us to php5 from php4. It was a pita. I use nexcess.net, they are amazing. Amazing! Been using them for a over a year, maybe two, w/a 30 node reseller account. Excellent customer support, very smart, quick, great stability, centOS w/php5, mysql, phpmyadmin on all the panels, great domain management, etc. SSH access if you need it! ( no additional cost) SSL if you need it. They are great! No bullshit phpwebforum scripts and crap like that. - Ben Anthony Wlodarski wrote: > > Looking for a good inexpensive reseller we hosting, can anyone make > any recommendations? > > > > Is anyone using www.hostgator.com ? > > > > Thanks, > > > > /Anthony Wlodarski/ > > 646-285-0500 x230 > > aw at sap8.com > > ------------------------------------------------------------------------ > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php From mancinic at gmail.com Wed Dec 19 15:24:22 2007 From: mancinic at gmail.com (Christopher M Mancini) Date: Wed, 19 Dec 2007 15:24:22 -0500 Subject: [nycphp-talk] Web hosting. In-Reply-To: <4769729B.8050803@projectskyline.com> References: <006101c8426f$86050c60$920f2520$@com> <4769729B.8050803@projectskyline.com> Message-ID: <84caf2b90712191224va748f3bp219bb5b9113dbbeb@mail.gmail.com> I use BlueHost and love it. Inexpensive, strong support, and continual improvement of their services. If you are interested in learning more, let me know. I am registered as a affiliate, if you decide to sign up I would love to get credit for referring you. Sincerely, Christopher Mancini http://blog.itrealm.net On Dec 19, 2007 2:35 PM, Ben Sgro wrote: > I've had bad experience w/a client who was using host gator. We needed > to run php5 and I had to spend > a few hours to get them to upgrade us to php5 from php4. It was a pita. > > I use nexcess.net, they are amazing. Amazing! Been using them for a over > a year, maybe two, > w/a 30 node reseller account. Excellent customer support, very smart, > quick, great stability, > centOS w/php5, mysql, phpmyadmin on all the panels, great domain > management, etc. > > SSH access if you need it! ( no additional cost) SSL if you need it. > They are great! > > No bullshit phpwebforum scripts and crap like that. > > - Ben > > Anthony Wlodarski wrote: > > > > Looking for a good inexpensive reseller we hosting, can anyone make > > any recommendations? > > > > > > > > Is anyone using www.hostgator.com ? > > > > > > > > Thanks, > > > > > > > > /Anthony Wlodarski/ > > > > 646-285-0500 x230 > > > > aw at sap8.com > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > New York PHP Community Talk Mailing List > > http://lists.nyphp.org/mailman/listinfo/talk > > > > NYPHPCon 2006 Presentations Online > > http://www.nyphpcon.com > > > > Show Your Participation in New York PHP > > http://www.nyphp.org/show_participation.php > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > -- <------------------------- Sincerely, Christopher M Mancini mancinic at gmail.com http://www.linkedin.com/in/buffaloit http://blog.itrealm.net --------------------------> -------------- next part -------------- An HTML attachment was scrubbed... URL: From aw at sap8.com Wed Dec 19 15:30:31 2007 From: aw at sap8.com (Anthony Wlodarski) Date: Wed, 19 Dec 2007 15:30:31 -0500 Subject: [nycphp-talk] Web hosting. In-Reply-To: <4769729B.8050803@projectskyline.com> References: <006101c8426f$86050c60$920f2520$@com> <4769729B.8050803@projectskyline.com> Message-ID: <00a701c8427d$ffeb8730$ffc29590$@com> Ben, Thanks for the recommendation, unfortunately the space they offer vs. the high price didn't go by too well with the higher ups. Approximately how long ago was your PHP 4/5 conversion issue? Regards, Anthony Wlodarski 646-285-0500 x230 aw at sap8.com -----Original Message----- From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On Behalf Of Ben Sgro Sent: Wednesday, December 19, 2007 2:36 PM To: NYPHP Talk Subject: Re: [nycphp-talk] Web hosting. I've had bad experience w/a client who was using host gator. We needed to run php5 and I had to spend a few hours to get them to upgrade us to php5 from php4. It was a pita. I use nexcess.net, they are amazing. Amazing! Been using them for a over a year, maybe two, w/a 30 node reseller account. Excellent customer support, very smart, quick, great stability, centOS w/php5, mysql, phpmyadmin on all the panels, great domain management, etc. SSH access if you need it! ( no additional cost) SSL if you need it. They are great! No bullshit phpwebforum scripts and crap like that. - Ben Anthony Wlodarski wrote: > > Looking for a good inexpensive reseller we hosting, can anyone make > any recommendations? > > > > Is anyone using www.hostgator.com ? > > > > Thanks, > > > > /Anthony Wlodarski/ > > 646-285-0500 x230 > > aw at sap8.com > > ------------------------------------------------------------------------ > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php _______________________________________________ New York PHP Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk NYPHPCon 2006 Presentations Online http://www.nyphpcon.com Show Your Participation in New York PHP http://www.nyphp.org/show_participation.php From ben at projectskyline.com Wed Dec 19 15:34:17 2007 From: ben at projectskyline.com (Ben Sgro) Date: Wed, 19 Dec 2007 15:34:17 -0500 Subject: [nycphp-talk] Web hosting. In-Reply-To: <00a701c8427d$ffeb8730$ffc29590$@com> References: <006101c8426f$86050c60$920f2520$@com> <4769729B.8050803@projectskyline.com> <00a701c8427d$ffeb8730$ffc29590$@com> Message-ID: <47698049.1020708@projectskyline.com> 4 months maybe... They do custom plans yo! I think I even blogged about how pissed off I got. Space vs Cost...I'm not sure what your trying to store online? DVDs? haha Anthony Wlodarski wrote: > Ben, > > Thanks for the recommendation, unfortunately the space they offer vs. the > high price didn't go by too well with the higher ups. Approximately how > long ago was your PHP 4/5 conversion issue? > > Regards, > > Anthony Wlodarski > 646-285-0500 x230 > aw at sap8.com > > -----Original Message----- > From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On > Behalf Of Ben Sgro > Sent: Wednesday, December 19, 2007 2:36 PM > To: NYPHP Talk > Subject: Re: [nycphp-talk] Web hosting. > > I've had bad experience w/a client who was using host gator. We needed > to run php5 and I had to spend > a few hours to get them to upgrade us to php5 from php4. It was a pita. > > I use nexcess.net, they are amazing. Amazing! Been using them for a over > a year, maybe two, > w/a 30 node reseller account. Excellent customer support, very smart, > quick, great stability, > centOS w/php5, mysql, phpmyadmin on all the panels, great domain > management, etc. > > SSH access if you need it! ( no additional cost) SSL if you need it. > They are great! > > No bullshit phpwebforum scripts and crap like that. > > - Ben > > Anthony Wlodarski wrote: > >> Looking for a good inexpensive reseller we hosting, can anyone make >> any recommendations? >> >> >> >> Is anyone using www.hostgator.com ? >> >> >> >> Thanks, >> >> >> >> /Anthony Wlodarski/ >> >> 646-285-0500 x230 >> >> aw at sap8.com >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> New York PHP Community Talk Mailing List >> http://lists.nyphp.org/mailman/listinfo/talk >> >> NYPHPCon 2006 Presentations Online >> http://www.nyphpcon.com >> >> Show Your Participation in New York PHP >> http://www.nyphp.org/show_participation.php >> > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > > > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > > From sequethin at gmail.com Wed Dec 19 15:54:27 2007 From: sequethin at gmail.com (Michael Hernandez) Date: Wed, 19 Dec 2007 15:54:27 -0500 Subject: [nycphp-talk] Web hosting. In-Reply-To: <00a701c8427d$ffeb8730$ffc29590$@com> References: <006101c8426f$86050c60$920f2520$@com> <4769729B.8050803@projectskyline.com> <00a701c8427d$ffeb8730$ffc29590$@com> Message-ID: On Dec 19, 2007, at 3:30 PM, Anthony Wlodarski wrote: > Ben, > > Thanks for the recommendation, unfortunately the space they offer > vs. the > high price didn't go by too well with the higher ups. Approximately > how > long ago was your PHP 4/5 conversion issue? > > Regards, you can also check dreamhost (who's affiliate program I am a member of), they have a nice way of setting up users and managing bandwidth and space for accounts which is great for reselling. you can also choose between php 4 and 5, and there are other niceties. Caveat - there are some issues though (check http://www.dreamhoststatus.com). for the price I find it's worth it, and I basically post this same email every time someone asks for hosting options ;) good luck in your choice, --Mike H From aw at sap8.com Wed Dec 19 16:07:27 2007 From: aw at sap8.com (Anthony Wlodarski) Date: Wed, 19 Dec 2007 16:07:27 -0500 Subject: [nycphp-talk] Web hosting. In-Reply-To: <47698049.1020708@projectskyline.com> References: <006101c8426f$86050c60$920f2520$@com> <4769729B.8050803@projectskyline.com> <00a701c8427d$ffeb8730$ffc29590$@com> <47698049.1020708@projectskyline.com> Message-ID: <00ab01c84283$29180c50$7b4824f0$@com> We have about 27000 files that might need to be migrated. Couple of big SQL databases (1gb max) and then personal office storage lockers. Online DVD... I would but then there are all those laws I would be breaking... Anthony Wlodarski 646-285-0500 x230 aw at sap8.com -----Original Message----- From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On Behalf Of Ben Sgro Sent: Wednesday, December 19, 2007 3:34 PM To: NYPHP Talk Subject: Re: [nycphp-talk] Web hosting. 4 months maybe... They do custom plans yo! I think I even blogged about how pissed off I got. Space vs Cost...I'm not sure what your trying to store online? DVDs? haha Anthony Wlodarski wrote: > Ben, > > Thanks for the recommendation, unfortunately the space they offer vs. the > high price didn't go by too well with the higher ups. Approximately how > long ago was your PHP 4/5 conversion issue? > > Regards, > > Anthony Wlodarski > 646-285-0500 x230 > aw at sap8.com > > -----Original Message----- > From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On > Behalf Of Ben Sgro > Sent: Wednesday, December 19, 2007 2:36 PM > To: NYPHP Talk > Subject: Re: [nycphp-talk] Web hosting. > > I've had bad experience w/a client who was using host gator. We needed > to run php5 and I had to spend > a few hours to get them to upgrade us to php5 from php4. It was a pita. > > I use nexcess.net, they are amazing. Amazing! Been using them for a over > a year, maybe two, > w/a 30 node reseller account. Excellent customer support, very smart, > quick, great stability, > centOS w/php5, mysql, phpmyadmin on all the panels, great domain > management, etc. > > SSH access if you need it! ( no additional cost) SSL if you need it. > They are great! > > No bullshit phpwebforum scripts and crap like that. > > - Ben > > Anthony Wlodarski wrote: > >> Looking for a good inexpensive reseller we hosting, can anyone make >> any recommendations? >> >> >> >> Is anyone using www.hostgator.com ? >> >> >> >> Thanks, >> >> >> >> /Anthony Wlodarski/ >> >> 646-285-0500 x230 >> >> aw at sap8.com >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> New York PHP Community Talk Mailing List >> http://lists.nyphp.org/mailman/listinfo/talk >> >> NYPHPCon 2006 Presentations Online >> http://www.nyphpcon.com >> >> Show Your Participation in New York PHP >> http://www.nyphp.org/show_participation.php >> > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > > > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > > _______________________________________________ New York PHP Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk NYPHPCon 2006 Presentations Online http://www.nyphpcon.com Show Your Participation in New York PHP http://www.nyphp.org/show_participation.php From ken at secdat.com Wed Dec 19 16:08:41 2007 From: ken at secdat.com (Kenneth Downs) Date: Wed, 19 Dec 2007 16:08:41 -0500 Subject: [nycphp-talk] Web hosting. In-Reply-To: <00a701c8427d$ffeb8730$ffc29590$@com> References: <006101c8426f$86050c60$920f2520$@com> <4769729B.8050803@projectskyline.com> <00a701c8427d$ffeb8730$ffc29590$@com> Message-ID: <47698859.5040508@secdat.com> I'm very happy with sevenl.net. Lots of personal attention and going-rate pricing. Anthony Wlodarski wrote: > Ben, > > Thanks for the recommendation, unfortunately the space they offer vs. the > high price didn't go by too well with the higher ups. Approximately how > long ago was your PHP 4/5 conversion issue? > > Regards, > > Anthony Wlodarski > 646-285-0500 x230 > aw at sap8.com > > -----Original Message----- > From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On > Behalf Of Ben Sgro > Sent: Wednesday, December 19, 2007 2:36 PM > To: NYPHP Talk > Subject: Re: [nycphp-talk] Web hosting. > > I've had bad experience w/a client who was using host gator. We needed > to run php5 and I had to spend > a few hours to get them to upgrade us to php5 from php4. It was a pita. > > I use nexcess.net, they are amazing. Amazing! Been using them for a over > a year, maybe two, > w/a 30 node reseller account. Excellent customer support, very smart, > quick, great stability, > centOS w/php5, mysql, phpmyadmin on all the panels, great domain > management, etc. > > SSH access if you need it! ( no additional cost) SSL if you need it. > They are great! > > No bullshit phpwebforum scripts and crap like that. > > - Ben > > Anthony Wlodarski wrote: > >> Looking for a good inexpensive reseller we hosting, can anyone make >> any recommendations? >> >> >> >> Is anyone using www.hostgator.com ? >> >> >> >> Thanks, >> >> >> >> /Anthony Wlodarski/ >> >> 646-285-0500 x230 >> >> aw at sap8.com >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> New York PHP Community Talk Mailing List >> http://lists.nyphp.org/mailman/listinfo/talk >> >> NYPHPCon 2006 Presentations Online >> http://www.nyphpcon.com >> >> Show Your Participation in New York PHP >> http://www.nyphp.org/show_participation.php >> > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > > > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > -- Kenneth Downs Secure Data Software, Inc. www.secdat.com www.andromeda-project.org 631-689-7200 Fax: 631-689-0527 cell: 631-379-0010 -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben at projectskyline.com Wed Dec 19 16:10:17 2007 From: ben at projectskyline.com (Ben Sgro) Date: Wed, 19 Dec 2007 16:10:17 -0500 Subject: [nycphp-talk] Web hosting. In-Reply-To: <00ab01c84283$29180c50$7b4824f0$@com> References: <006101c8426f$86050c60$920f2520$@com> <4769729B.8050803@projectskyline.com> <00a701c8427d$ffeb8730$ffc29590$@com> <47698049.1020708@projectskyline.com> <00ab01c84283$29180c50$7b4824f0$@com> Message-ID: <476988B9.6080108@projectskyline.com> heh, Yeah, I don't store lots of stuff on these servers (email me for the secret stash, hehe) so I haven't run into those limitations. I know nexcess will create custom plans, so please email support if you really know what you want. Good luck! - Ben Anthony Wlodarski wrote: > We have about 27000 files that might need to be migrated. Couple of big SQL > databases (1gb max) and then personal office storage lockers. > > Online DVD... I would but then there are all those laws I would be > breaking... > > Anthony Wlodarski > 646-285-0500 x230 > aw at sap8.com > > > -----Original Message----- > From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On > Behalf Of Ben Sgro > Sent: Wednesday, December 19, 2007 3:34 PM > To: NYPHP Talk > Subject: Re: [nycphp-talk] Web hosting. > > 4 months maybe... > > They do custom plans yo! I think I even blogged about how pissed off I got. > > Space vs Cost...I'm not sure what your trying to store online? DVDs? > > haha > > Anthony Wlodarski wrote: > >> Ben, >> >> Thanks for the recommendation, unfortunately the space they offer vs. the >> high price didn't go by too well with the higher ups. Approximately how >> long ago was your PHP 4/5 conversion issue? >> >> Regards, >> >> Anthony Wlodarski >> 646-285-0500 x230 >> aw at sap8.com >> >> -----Original Message----- >> From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] >> > On > >> Behalf Of Ben Sgro >> Sent: Wednesday, December 19, 2007 2:36 PM >> To: NYPHP Talk >> Subject: Re: [nycphp-talk] Web hosting. >> >> I've had bad experience w/a client who was using host gator. We needed >> to run php5 and I had to spend >> a few hours to get them to upgrade us to php5 from php4. It was a pita. >> >> I use nexcess.net, they are amazing. Amazing! Been using them for a over >> a year, maybe two, >> w/a 30 node reseller account. Excellent customer support, very smart, >> quick, great stability, >> centOS w/php5, mysql, phpmyadmin on all the panels, great domain >> management, etc. >> >> SSH access if you need it! ( no additional cost) SSL if you need it. >> They are great! >> >> No bullshit phpwebforum scripts and crap like that. >> >> - Ben >> >> Anthony Wlodarski wrote: >> >> >>> Looking for a good inexpensive reseller we hosting, can anyone make >>> any recommendations? >>> >>> >>> >>> Is anyone using www.hostgator.com ? >>> >>> >>> >>> Thanks, >>> >>> >>> >>> /Anthony Wlodarski/ >>> >>> 646-285-0500 x230 >>> >>> aw at sap8.com >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> New York PHP Community Talk Mailing List >>> http://lists.nyphp.org/mailman/listinfo/talk >>> >>> NYPHPCon 2006 Presentations Online >>> http://www.nyphpcon.com >>> >>> Show Your Participation in New York PHP >>> http://www.nyphp.org/show_participation.php >>> >>> >> _______________________________________________ >> New York PHP Community Talk Mailing List >> http://lists.nyphp.org/mailman/listinfo/talk >> >> NYPHPCon 2006 Presentations Online >> http://www.nyphpcon.com >> >> Show Your Participation in New York PHP >> http://www.nyphp.org/show_participation.php >> >> >> >> _______________________________________________ >> New York PHP Community Talk Mailing List >> http://lists.nyphp.org/mailman/listinfo/talk >> >> NYPHPCon 2006 Presentations Online >> http://www.nyphpcon.com >> >> Show Your Participation in New York PHP >> http://www.nyphp.org/show_participation.php >> >> >> > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > > From ben at projectskyline.com Wed Dec 19 16:14:32 2007 From: ben at projectskyline.com (Ben Sgro) Date: Wed, 19 Dec 2007 16:14:32 -0500 Subject: [nycphp-talk] Web hosting. In-Reply-To: <47698859.5040508@secdat.com> References: <006101c8426f$86050c60$920f2520$@com> <4769729B.8050803@projectskyline.com> <00a701c8427d$ffeb8730$ffc29590$@com> <47698859.5040508@secdat.com> Message-ID: <476989B8.7000405@projectskyline.com> Kind of a side note but, some might find this interesting: I was hosting a 1U at my house, public facing for about 6 months. I didn't notice the electricity. When I moved from an apartment to a house, I realized I was paying +-$100.00/month for this thing. Crazy. - Ben Kenneth Downs wrote: > I'm very happy with sevenl.net. Lots of personal attention and > going-rate pricing. > > Anthony Wlodarski wrote: >> Ben, >> >> Thanks for the recommendation, unfortunately the space they offer vs. the >> high price didn't go by too well with the higher ups. Approximately how >> long ago was your PHP 4/5 conversion issue? >> >> Regards, >> >> Anthony Wlodarski >> 646-285-0500 x230 >> aw at sap8.com >> >> -----Original Message----- >> From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On >> Behalf Of Ben Sgro >> Sent: Wednesday, December 19, 2007 2:36 PM >> To: NYPHP Talk >> Subject: Re: [nycphp-talk] Web hosting. >> >> I've had bad experience w/a client who was using host gator. We needed >> to run php5 and I had to spend >> a few hours to get them to upgrade us to php5 from php4. It was a pita. >> >> I use nexcess.net, they are amazing. Amazing! Been using them for a over >> a year, maybe two, >> w/a 30 node reseller account. Excellent customer support, very smart, >> quick, great stability, >> centOS w/php5, mysql, phpmyadmin on all the panels, great domain >> management, etc. >> >> SSH access if you need it! ( no additional cost) SSL if you need it. >> They are great! >> >> No bullshit phpwebforum scripts and crap like that. >> >> - Ben >> >> Anthony Wlodarski wrote: >> >>> Looking for a good inexpensive reseller we hosting, can anyone make >>> any recommendations? >>> >>> >>> >>> Is anyone using www.hostgator.com ? >>> >>> >>> >>> Thanks, >>> >>> >>> >>> /Anthony Wlodarski/ >>> >>> 646-285-0500 x230 >>> >>> aw at sap8.com >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> New York PHP Community Talk Mailing List >>> http://lists.nyphp.org/mailman/listinfo/talk >>> >>> NYPHPCon 2006 Presentations Online >>> http://www.nyphpcon.com >>> >>> Show Your Participation in New York PHP >>> http://www.nyphp.org/show_participation.php >>> >> _______________________________________________ >> New York PHP Community Talk Mailing List >> http://lists.nyphp.org/mailman/listinfo/talk >> >> NYPHPCon 2006 Presentations Online >> http://www.nyphpcon.com >> >> Show Your Participation in New York PHP >> http://www.nyphp.org/show_participation.php >> >> >> >> _______________________________________________ >> New York PHP Community Talk Mailing List >> http://lists.nyphp.org/mailman/listinfo/talk >> >> NYPHPCon 2006 Presentations Online >> http://www.nyphpcon.com >> >> Show Your Participation in New York PHP >> http://www.nyphp.org/show_participation.php >> > > > -- > Kenneth Downs > Secure Data Software, Inc. > www.secdat.com www.andromeda-project.org > 631-689-7200 Fax: 631-689-0527 > cell: 631-379-0010 > > ------------------------------------------------------------------------ > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php From aw at sap8.com Wed Dec 19 16:26:33 2007 From: aw at sap8.com (Anthony Wlodarski) Date: Wed, 19 Dec 2007 16:26:33 -0500 Subject: [nycphp-talk] Web hosting. In-Reply-To: <476989B8.7000405@projectskyline.com> References: <006101c8426f$86050c60$920f2520$@com> <4769729B.8050803@projectskyline.com> <00a701c8427d$ffeb8730$ffc29590$@com> <47698859.5040508@secdat.com> <476989B8.7000405@projectskyline.com> Message-ID: <00b201c84285$d4419310$7cc4b930$@com> Data centers FTW. Big electricity bill FTL... Anthony Wlodarski Senior Technical Recruiter Shulman Fleming & Partners 646-285-0500 x230 aw at sap8.com -----Original Message----- From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On Behalf Of Ben Sgro Sent: Wednesday, December 19, 2007 4:15 PM To: NYPHP Talk Subject: Re: [nycphp-talk] Web hosting. Kind of a side note but, some might find this interesting: I was hosting a 1U at my house, public facing for about 6 months. I didn't notice the electricity. When I moved from an apartment to a house, I realized I was paying +-$100.00/month for this thing. Crazy. - Ben Kenneth Downs wrote: > I'm very happy with sevenl.net. Lots of personal attention and > going-rate pricing. > > Anthony Wlodarski wrote: >> Ben, >> >> Thanks for the recommendation, unfortunately the space they offer vs. the >> high price didn't go by too well with the higher ups. Approximately how >> long ago was your PHP 4/5 conversion issue? >> >> Regards, >> >> Anthony Wlodarski >> 646-285-0500 x230 >> aw at sap8.com >> >> -----Original Message----- >> From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On >> Behalf Of Ben Sgro >> Sent: Wednesday, December 19, 2007 2:36 PM >> To: NYPHP Talk >> Subject: Re: [nycphp-talk] Web hosting. >> >> I've had bad experience w/a client who was using host gator. We needed >> to run php5 and I had to spend >> a few hours to get them to upgrade us to php5 from php4. It was a pita. >> >> I use nexcess.net, they are amazing. Amazing! Been using them for a over >> a year, maybe two, >> w/a 30 node reseller account. Excellent customer support, very smart, >> quick, great stability, >> centOS w/php5, mysql, phpmyadmin on all the panels, great domain >> management, etc. >> >> SSH access if you need it! ( no additional cost) SSL if you need it. >> They are great! >> >> No bullshit phpwebforum scripts and crap like that. >> >> - Ben >> >> Anthony Wlodarski wrote: >> >>> Looking for a good inexpensive reseller we hosting, can anyone make >>> any recommendations? >>> >>> >>> >>> Is anyone using www.hostgator.com ? >>> >>> >>> >>> Thanks, >>> >>> >>> >>> /Anthony Wlodarski/ >>> >>> 646-285-0500 x230 >>> >>> aw at sap8.com >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> New York PHP Community Talk Mailing List >>> http://lists.nyphp.org/mailman/listinfo/talk >>> >>> NYPHPCon 2006 Presentations Online >>> http://www.nyphpcon.com >>> >>> Show Your Participation in New York PHP >>> http://www.nyphp.org/show_participation.php >>> >> _______________________________________________ >> New York PHP Community Talk Mailing List >> http://lists.nyphp.org/mailman/listinfo/talk >> >> NYPHPCon 2006 Presentations Online >> http://www.nyphpcon.com >> >> Show Your Participation in New York PHP >> http://www.nyphp.org/show_participation.php >> >> >> >> _______________________________________________ >> New York PHP Community Talk Mailing List >> http://lists.nyphp.org/mailman/listinfo/talk >> >> NYPHPCon 2006 Presentations Online >> http://www.nyphpcon.com >> >> Show Your Participation in New York PHP >> http://www.nyphp.org/show_participation.php >> > > > -- > Kenneth Downs > Secure Data Software, Inc. > www.secdat.com www.andromeda-project.org > 631-689-7200 Fax: 631-689-0527 > cell: 631-379-0010 > > ------------------------------------------------------------------------ > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php _______________________________________________ New York PHP Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk NYPHPCon 2006 Presentations Online http://www.nyphpcon.com Show Your Participation in New York PHP http://www.nyphp.org/show_participation.php From tonyf at buffnet.net Wed Dec 19 17:04:08 2007 From: tonyf at buffnet.net (Tony Furnivall) Date: Wed, 19 Dec 2007 16:04:08 -0600 Subject: [nycphp-talk] Apache failing after update.. a follow-up Message-ID: What a difference a day makes! Turns out that I had missed a little "2" on a directory name - not content with having to remove all the "5"s from PHP5 for this install, I had to add "2"s to the Apache stuff, and one got lost in httpd.conf Many thanks to Matteo Rinaudo for the suggestion. Now onwards to see if it fixed the problem I was having with the interpreter! You guys are great! Tony -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.503 / Virus Database: 269.17.4/1189 - Release Date: 12/18/2007 9:40 PM From matteo.rinaudo at gmail.com Wed Dec 19 17:36:27 2007 From: matteo.rinaudo at gmail.com (Matteo Rinaudo) Date: Wed, 19 Dec 2007 17:36:27 -0500 Subject: [nycphp-talk] Apache failing after update.. a follow-up In-Reply-To: References: Message-ID: I am happy it did work out great! Matteo On Dec 19, 2007 5:04 PM, Tony Furnivall wrote: > What a difference a day makes! > > Turns out that I had missed a little "2" on a directory name - not > content with having to remove all the "5"s from PHP5 for this > install, I had to add "2"s to the Apache stuff, and one got lost in httpd.conf > > Many thanks to Matteo Rinaudo for the suggestion. Now onwards to see > if it fixed the problem I was having with the interpreter! > > You guys are great! > > Tony > > > -- > No virus found in this outgoing message. > Checked by AVG Free Edition. > Version: 7.5.503 / Virus Database: 269.17.4/1189 - Release Date: 12/18/2007 9:40 PM > > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > From mancinic at gmail.com Wed Dec 19 20:34:25 2007 From: mancinic at gmail.com (Christopher M Mancini) Date: Wed, 19 Dec 2007 20:34:25 -0500 Subject: [nycphp-talk] Web hosting. In-Reply-To: <00b201c84285$d4419310$7cc4b930$@com> References: <006101c8426f$86050c60$920f2520$@com> <4769729B.8050803@projectskyline.com> <00a701c8427d$ffeb8730$ffc29590$@com> <47698859.5040508@secdat.com> <476989B8.7000405@projectskyline.com> <00b201c84285$d4419310$7cc4b930$@com> Message-ID: <84caf2b90712191734t1b5f9ca3t9d772531943a6688@mail.gmail.com> Which makes sense why it is not worth it to try and host your own public servers :D Chris > Sent: Wednesday, December 19, 2007 4:15 PM > To: NYPHP Talk > Subject: Re: [nycphp-talk] Web hosting. > > Kind of a side note but, some might find this interesting: > > I was hosting a 1U at my house, public facing for about 6 months. > > I didn't notice the electricity. > > When I moved from an apartment to a house, I realized I was paying > +-$100.00/month > for this thing. > > Crazy. > > - Ben > > Kenneth Downs wrote: > > I'm very happy with sevenl.net. Lots of personal attention and > > going-rate pricing. > > > > Anthony Wlodarski wrote: > >> Ben, > >> > >> Thanks for the recommendation, unfortunately the space they offer vs. > the > >> high price didn't go by too well with the higher ups. Approximately > how > >> long ago was your PHP 4/5 conversion issue? > >> > >> Regards, > >> > >> Anthony Wlodarski > >> 646-285-0500 x230 > >> aw at sap8.com > >> > >> -----Original Message----- > >> From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org > ] > On > >> Behalf Of Ben Sgro > >> Sent: Wednesday, December 19, 2007 2:36 PM > >> To: NYPHP Talk > >> Subject: Re: [nycphp-talk] Web hosting. > >> > >> I've had bad experience w/a client who was using host gator. We needed > >> to run php5 and I had to spend > >> a few hours to get them to upgrade us to php5 from php4. It was a pita. > >> > >> I use nexcess.net, they are amazing. Amazing! Been using them for a > over > >> a year, maybe two, > >> w/a 30 node reseller account. Excellent customer support, very smart, > >> quick, great stability, > >> centOS w/php5, mysql, phpmyadmin on all the panels, great domain > >> management, etc. > >> > >> SSH access if you need it! ( no additional cost) SSL if you need it. > >> They are great! > >> > >> No bullshit phpwebforum scripts and crap like that. > >> > >> - Ben > >> > >> Anthony Wlodarski wrote: > >> > >>> Looking for a good inexpensive reseller we hosting, can anyone make > >>> any recommendations? > >>> > >>> > >>> > >>> Is anyone using www.hostgator.com ? > >>> > >>> > >>> > >>> Thanks, > >>> > >>> > >>> > >>> /Anthony Wlodarski/ > >>> > >>> 646-285-0500 x230 > >>> > >>> aw at sap8.com > >>> > >>> > ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> New York PHP Community Talk Mailing List > >>> http://lists.nyphp.org/mailman/listinfo/talk > >>> > >>> NYPHPCon 2006 Presentations Online > >>> http://www.nyphpcon.com > >>> > >>> Show Your Participation in New York PHP > >>> http://www.nyphp.org/show_participation.php > >>> > >> _______________________________________________ > >> New York PHP Community Talk Mailing List > >> http://lists.nyphp.org/mailman/listinfo/talk > >> > >> NYPHPCon 2006 Presentations Online > >> http://www.nyphpcon.com > >> > >> Show Your Participation in New York PHP > >> http://www.nyphp.org/show_participation.php > >> > >> > >> > >> _______________________________________________ > >> New York PHP Community Talk Mailing List > >> http://lists.nyphp.org/mailman/listinfo/talk > >> > >> NYPHPCon 2006 Presentations Online > >> http://www.nyphpcon.com > >> > >> Show Your Participation in New York PHP > >> http://www.nyphp.org/show_participation.php > >> > > > > > > -- > > Kenneth Downs > > Secure Data Software, Inc. > > www.secdat.com www.andromeda-project.org > > 631-689-7200 Fax: 631-689-0527 > > cell: 631-379-0010 > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > New York PHP Community Talk Mailing List > > http://lists.nyphp.org/mailman/listinfo/talk > > > > NYPHPCon 2006 Presentations Online > > http://www.nyphpcon.com > > > > Show Your Participation in New York PHP > > http://www.nyphp.org/show_participation.php > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > > > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > -- <------------------------- Sincerely, Christopher M Mancini mancinic at gmail.com http://www.linkedin.com/in/buffaloit http://blog.itrealm.net --------------------------> -------------- next part -------------- An HTML attachment was scrubbed... URL: From mikesz at qualityadvantages.com Wed Dec 19 21:56:04 2007 From: mikesz at qualityadvantages.com (mikesz at qualityadvantages.com) Date: Thu, 20 Dec 2007 10:56:04 +0800 Subject: [nycphp-talk] Web hosting. In-Reply-To: <006101c8426f$86050c60$920f2520$@com> References: <006101c8426f$86050c60$920f2520$@com> Message-ID: <194836609.20071220105604@qualityadvantages.com> An HTML attachment was scrubbed... URL: From ioplex at gmail.com Wed Dec 19 22:13:24 2007 From: ioplex at gmail.com (Michael B Allen) Date: Wed, 19 Dec 2007 22:13:24 -0500 Subject: [nycphp-talk] static variable variable? Message-ID: <78c6bd860712191913r1fe2df96j64b9a4c90ec5e7e6@mail.gmail.com> I have a bunch of subclasses that define a static varible that I need to access in the parent class. So I'm trying something like: $_staticvarname = get_class($this) . '::$_staticvar'; print_r($$_staticvarname); But this doesn't work. I just get: Undefined variable: Sublcass::$_staticvar If I do: print_r(Subclass::$_staticvar) it works so I know it's just an evaluation issue. I can't use const because the variable is an array. I don't want to hardcode the subclass name in the parent class and I want to use a static variable reasoning that it uses less memory. Is there any way to do this? Mike -- Michael B Allen PHP Active Directory SPNEGO SSO http://www.ioplex.com/ From jcampbell1 at gmail.com Thu Dec 20 00:40:25 2007 From: jcampbell1 at gmail.com (John Campbell) Date: Thu, 20 Dec 2007 00:40:25 -0500 Subject: [nycphp-talk] static variable variable? In-Reply-To: <78c6bd860712191913r1fe2df96j64b9a4c90ec5e7e6@mail.gmail.com> References: <78c6bd860712191913r1fe2df96j64b9a4c90ec5e7e6@mail.gmail.com> Message-ID: <8f0676b40712192140p67768ffck9593eab078f55a0e@mail.gmail.com> Humm... The only thing I can think of is to do something like: $v = get_class_vars(get_class($this)); print_r($v['_staticvar']); Kind of a shitty hack, and it reminds me of one thing that pisses me off about php. Why can't we do: print_r(get_class_vars(get_class($this))['_staticvar']); Regards, John Campbell From kenrbnsn at rbnsn.com Thu Dec 20 07:26:35 2007 From: kenrbnsn at rbnsn.com (Ken Robinson) Date: Thu, 20 Dec 2007 07:26:35 -0500 Subject: [nycphp-talk] static variable variable? In-Reply-To: <78c6bd860712191913r1fe2df96j64b9a4c90ec5e7e6@mail.gmail.co m> References: <78c6bd860712191913r1fe2df96j64b9a4c90ec5e7e6@mail.gmail.com> Message-ID: At 10:13 PM 12/19/2007, Michael B Allen wrote: >I have a bunch of subclasses that define a static varible that I need >to access in the parent class. So I'm trying something like: > >$_staticvarname = get_class($this) . '::$_staticvar'; Try using double quotes instead of single quotes: $_staticvarname = get_class($this) . "::$_staticvar"; Variables are not evaluated when surrounded by single quotes Ken From ioplex at gmail.com Thu Dec 20 11:00:32 2007 From: ioplex at gmail.com (Michael B Allen) Date: Thu, 20 Dec 2007 11:00:32 -0500 Subject: [nycphp-talk] static variable variable? In-Reply-To: <8f0676b40712192140p67768ffck9593eab078f55a0e@mail.gmail.com> References: <78c6bd860712191913r1fe2df96j64b9a4c90ec5e7e6@mail.gmail.com> <8f0676b40712192140p67768ffck9593eab078f55a0e@mail.gmail.com> Message-ID: <78c6bd860712200800g6949c4d7p1686b9df72dad10b@mail.gmail.com> On 12/20/07, John Campbell wrote: > Humm... > > The only thing I can think of is to do something like: > $v = get_class_vars(get_class($this)); > print_r($v['_staticvar']); This does work in my case. But, I the code could get invoked quite a bit which makes me wonder if the overhead of calling those functions and building the vars array would offset the benefit of storage savings from using a static array. I have opted for the KISS approach and just used a non-static array instead. That is a neat trick though. I'll have to remember this one. Thanks, Mike -- Michael B Allen PHP Active Directory SPNEGO SSO http://www.ioplex.com/ From nickg at modp.com Thu Dec 20 12:45:30 2007 From: nickg at modp.com (Nick Galbreath) Date: Thu, 20 Dec 2007 12:45:30 -0500 Subject: [nycphp-talk] static variable variable? In-Reply-To: <78c6bd860712191913r1fe2df96j64b9a4c90ec5e7e6@mail.gmail.com> References: <78c6bd860712191913r1fe2df96j64b9a4c90ec5e7e6@mail.gmail.com> Message-ID: <4c95589d0712200945w5d6f09cbn9c82a4a8162ff85a@mail.gmail.com> Hi, if I understood your issue correctly, then in C++, Java, and PHP5 you'd do something like this: abstract class Foo { public function doit() { echo $this->gettext(); } abstract protected function gettext(); } class Bar extends Foo { static $msg = "this is some text\n"; public function gettext() { return self::$msg; } } $tmp = $Bar; $tmp->doit(); Or you can get rid of the 'abstract' part and just define Foo::gettext() to do "nothing" if that make sense. Yeah the method to wrap the variable is a bit annoying, but you can think of it this way... the parent class doesn't care if it's static or not. It just wants the variable. The fact the children wanted to use a static is their choice. hope this made sense... looks like you found a another nifty way of doing it. enjoy! --nickg On 12/19/07, Michael B Allen wrote: > > I have a bunch of subclasses that define a static varible that I need > to access in the parent class. So I'm trying something like: > > $_staticvarname = get_class($this) . '::$_staticvar'; > print_r($$_staticvarname); > > But this doesn't work. I just get: > > Undefined variable: Sublcass::$_staticvar > > If I do: > > print_r(Subclass::$_staticvar) > > it works so I know it's just an evaluation issue. > > I can't use const because the variable is an array. I don't want to > hardcode the subclass name in the parent class and I want to use a > static variable reasoning that it uses less memory. > > Is there any way to do this? > > Mike > > -- > Michael B Allen > PHP Active Directory SPNEGO SSO > http://www.ioplex.com/ > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ioplex at gmail.com Thu Dec 20 17:25:17 2007 From: ioplex at gmail.com (Michael B Allen) Date: Thu, 20 Dec 2007 17:25:17 -0500 Subject: [nycphp-talk] static variable variable? In-Reply-To: <4c95589d0712200945w5d6f09cbn9c82a4a8162ff85a@mail.gmail.com> References: <78c6bd860712191913r1fe2df96j64b9a4c90ec5e7e6@mail.gmail.com> <4c95589d0712200945w5d6f09cbn9c82a4a8162ff85a@mail.gmail.com> Message-ID: <78c6bd860712201425x3b209210l14e1bf34247c42e6@mail.gmail.com> Actually this lead me to a solution that didn't use the static array at all. I really just wanted the child class to be able to map some strings. So I just some if return blocks in the overridden method: protected function mapName($name) { if ($name === 'foo') return 'bar'; if ($name === 'zig') return 'zag'; return $name; } The parent version just returns $name unchanged. No need for the static array at all. Thanks, Mike On 12/20/07, Nick Galbreath wrote: > Hi, > > if I understood your issue correctly, then in C++, Java, and PHP5 you'd do > something like this: > > > abstract class Foo { > > public function doit() > { > echo $this->gettext(); > } > > abstract protected function gettext(); > } > > class Bar extends Foo { > static $msg = "this is some text\n"; > public function gettext() { > return self::$msg; > } > } > > $tmp = $Bar; > $tmp->doit(); > > > > Or you can get rid of the 'abstract' part and just define Foo::gettext() to > do "nothing" if that make sense. > > > Yeah the method to wrap the variable is a bit annoying, but you can think of > it this way... the parent class doesn't care if it's static or not. It just > wants the variable. The fact the children wanted to use a static is their > choice. > > hope this made sense... looks like you found a another nifty way of doing > it. > > enjoy! > > > --nickg > > > > > > On 12/19/07, Michael B Allen wrote: > > > > I have a bunch of subclasses that define a static varible that I need > > to access in the parent class. So I'm trying something like: > > > > $_staticvarname = get_class($this) . '::$_staticvar'; > > print_r($$_staticvarname); > > > > But this doesn't work. I just get: > > > > Undefined variable: Sublcass::$_staticvar > > > > If I do: > > > > print_r(Subclass::$_staticvar) > > > > it works so I know it's just an evaluation issue. > > > > I can't use const because the variable is an array. I don't want to > > hardcode the subclass name in the parent class and I want to use a > > static variable reasoning that it uses less memory. > > > > Is there any way to do this? > > > > Mike > > > > -- > > Michael B Allen > > PHP Active Directory SPNEGO SSO > > http://www.ioplex.com/ > > _______________________________________________ > > New York PHP Community Talk Mailing List > > http://lists.nyphp.org/mailman/listinfo/talk > > > > NYPHPCon 2006 Presentations Online > > http://www.nyphpcon.com > > > > Show Your Participation in New York PHP > > http://www.nyphp.org/show_participation.php > > > > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > -- Michael B Allen PHP Active Directory SPNEGO SSO http://www.ioplex.com/ From lists at zaunere.com Fri Dec 21 18:48:48 2007 From: lists at zaunere.com (Hans Zaunere) Date: Fri, 21 Dec 2007 18:48:48 -0500 Subject: [nycphp-talk] Tamperproof URLs and PHP slides posted In-Reply-To: <4c95589d0712111413o68f76458r76ebcb835b4d331d@mail.gmail.com> References: <4c95589d0712111413o68f76458r76ebcb835b4d331d@mail.gmail.com> Message-ID: <000701c8442c$0843a5c0$640aa8c0@MobileZ> Hi Nick, thanks for this. I've added it to our presentation archive: http://www.nyphp.org/content/presentations/ Quick reminder for the Jan meeting: you'll need to RSVP *AFTER* Christmas Day - I'll send out a reminder. To all NYPHPers, have a healthy and a happy. 2008 is going to be another exciting year at NYPHP, and we'll be kicking off with a redesign/restructure of the site and new features. Best, --- Hans Zaunere / President / New York PHP www.nyphp.org / www.nyphp.com Nick Galbreath wrote on Tuesday, December 11, 2007 5:14 PM: > Hello, > > First thanks everyone for coming out the NYPHP on 27-nov-2007 for my > talk on "Tamperproof URLs and PHP" > > Based on your feedback, comments, and uhhh, a few blank stares, I > completely revamped the slides. > > Right now, I've dumped the slides, the source code and the unit test > here: > > http://modp.com/slides/securestring/ > > However I hope to move all of it to svn at code.google.com once they > let me use more resources. If you have any comments, questions on > the slides, or corrections what not, please post a comment on my > blog: > > http://blog.modp.com/2007/12/tamperproof-urls-and-php.html > > thanks again, > > --nickg > Nick Galbreath From ramons at gmx.net Sat Dec 22 16:43:24 2007 From: ramons at gmx.net (David Krings) Date: Sat, 22 Dec 2007 16:43:24 -0500 Subject: [nycphp-talk] Need some JS / HTML help Message-ID: <476D84FC.7030904@gmx.net> Hi! I have this hyperlink ? that I use to access context sensitive webhelp. The link works fine and the help shows. That is the good part, the bad part is that all my tries to make it show up in a new window so far didn't even do something. I am basically at this point: echo "?"; Obviously, something is majorly wrong with that. I did check the O'Reilly HTML&XHTML Definitie Guide to make sure that the a link has the onClick event. After getting this to work I also want to attach it to a button, which should be the same call. Anyone has a good idea on how to craft this? I'm just at the end of my very limited HTML latin. Thanks in advance! David From rotsen at gmail.com Sat Dec 22 17:47:22 2007 From: rotsen at gmail.com (=?ISO-8859-1?Q?N=E9stor?=) Date: Sat, 22 Dec 2007 14:47:22 -0800 Subject: [nycphp-talk] Need some JS / HTML help In-Reply-To: <476D84FC.7030904@gmx.net> References: <476D84FC.7030904@gmx.net> Message-ID: Here is an ezample on how to do it with a popup but I think that you can also do it if you put a link and set the target to blank "target=blank" The Target Attribute With the target attribute, you can define * where* the linked document will be opened. The line below will open the document in a new browser window: Visit W3Schools! ------------------------------------------ POPUP: JavaScript Popup Window How-To Example 1: Basic Popup Window

JavaScript Popup Windows How-To

Example 1: Basic Popup Window

This popup window is a completely separate HTML file that was opened using JavaScript. This file can contain whatever you want.

The JavaScript command to close a window is to refer to the window by name, or by self-reference, and use the close method. The link below looks like:

    <a href="javascript:self.close()">close window</a>

Close this Window

----------------------- Santa N?stor On Dec 22, 2007 1:43 PM, David Krings wrote: > Hi! > > I have this hyperlink > href=" > http://localhost:8080/file:/F:/piviviewer/include/help/en_us/Default_CSH.htm#100 > ">? > that I use to access context sensitive webhelp. The link works fine and > the > help shows. That is the good part, the bad part is that all my tries to > make > it show up in a new window so far didn't even do something. I am basically > at > this point: > echo " onClick=\"javascript:window.open > ('".$href."','HelpWindow',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes');\">?"; > > Obviously, something is majorly wrong with that. I did check the O'Reilly > HTML&XHTML Definitie Guide to make sure that the a link has the onClick > event. > After getting this to work I also want to attach it to a button, which > should > be the same call. > > Anyone has a good idea on how to craft this? I'm just at the end of my > very > limited HTML latin. > > Thanks in advance! > > David > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ramons at gmx.net Sat Dec 22 21:06:15 2007 From: ramons at gmx.net (David Krings) Date: Sat, 22 Dec 2007 21:06:15 -0500 Subject: [nycphp-talk] Need some JS / HTML help In-Reply-To: References: <476D84FC.7030904@gmx.net> Message-ID: <476DC297.4070207@gmx.net> Hi! Thanks Nestor, your examples helped at least to point me to the right direction although you didn't copy the popup code, but the stuff that is in the popup window. But I found the source page and could figure it out, although their approach didn't work for me, but see below. N?stor wrote: > Here is an ezample on how to do it with a popup but I think that you can > also do it > if you put a link and set the target to blank "target=blank" > OK, I got the target in the regular hyperlink all set and that works at least for those cases where JavaScript isn't an option. I still can't get anything from JavaScript. What I did see in the Defintive Guide that one can write the JS code into the fref attribute. That causes the browser to render the link, which it didn't do before, and it opens the desired window, but it also navigates away from the source page and in Firefox at least shows a blank page with the text [object window]. It is halfways there, but as bad as before somehow. But while I was writing this I got another idea that led to another idea and some more googling and now I got it. I don't really know why it works, but it does work: ? What I'm surprised about is that in order to get a link rendered the href attribute needs to be present, but when no URL is specified the click on the link doesn't do anything, but the onClick event fires and executes the code. But then I tried a subsequent link / button and as it turns out the popup is behind the main window. So I needed to find a way to give it focus and after some more googling I got this: And I got the CSH portion also down and with my little function I can customize the button caption or only show a ? or have a text link with custom text. I then tried the code without JavaScript enabled to see if the

Here's the latest picture



Please upload a new picture and title

Please choose an image to upload:
Please enter the title of that picture:
then:

By Graham Ellis - graham at wellho.net _________________________________________________________________ Get the power of Windows + Web with the new Windows Live. http://www.windowslive.com?ocid=TXT_TAGHM_Wave2_powerofwindows_122007 -------------- next part -------------- An HTML attachment was scrubbed... URL: From ramons at gmx.net Tue Dec 25 22:29:47 2007 From: ramons at gmx.net (David Krings) Date: Tue, 25 Dec 2007 22:29:47 -0500 Subject: [nycphp-talk] Thanks in advance In-Reply-To: References: Message-ID: <4771CAAB.2000501@gmx.net> chad qian wrote: > I get the following source code from internet.It can upload the > image but it can't display the image on the web page.There is always "x" > sign .Any idea?Thanks a lot! Check the source code of the resulting page and see if the value for the tag points to a location from where the image can be retrieved. When you see the X the browser cannot download the image as the file is not found in the specified location. David From tsinagra at gmail.com Wed Dec 26 07:25:23 2007 From: tsinagra at gmail.com (Todd Sinagra) Date: Wed, 26 Dec 2007 07:25:23 -0500 Subject: [nycphp-talk] Error Fetching http headers In-Reply-To: <117286890712241520g689305dekfaa4a0c963aad884@mail.gmail.com> References: <8c3fe96a0712240244h4bbe235ciaa93018388c81b03@mail.gmail.com> <117286890712241520g689305dekfaa4a0c963aad884@mail.gmail.com> Message-ID: <8c3fe96a0712260425o492bcd3ex1753a0cfda89cf48@mail.gmail.com> There a three methods that are giving me that error. They are CreateReceivablesInvoice, CreateSalesOrder, and CreatePayablesInvoice. At one point in time, those three methods did work on the version of PHP I am currently running, which is 5.2.1. I have not tried PHP 5.1 yet. The web service is a commercial package it is M/S Dynamics GP (Great Plains). Here is the request that is getting sent over for CreatePayablesInvoice. 0000006DOCUMENT 06USD250.0022007-12-26USD250.002USD02InvoiceUSD2502PAYABLES BATCH2007-12-26007380-1en-USTransactionalf39624cb-97f1-4d5a-a67f-9b66e95d8930Create Payables Invoice PolicyPayables Document What should be returned is a CreatePayablesInvoiceResponse. Which is pretty much nothing. I pretty much and at a loss at this point. Any help is greatly appreciated. - Todd On Dec 24, 2007 6:20 PM, Tom Melendez wrote: > Hi Todd, > > Could you tell us which methods are experiencing the problem? > Could you show us the data you are sending and what you expect to receive? > Judging by the naming of the directory in the error below, it seems > that you are using a package (commercial or open source) of some > sorts? Which package is it? > Did this ever work for you? Perhaps in 5.1x? > > Thanks, > > Tom > http://www.liphp.org > > > > On Dec 24, 2007 5:44 AM, Todd Sinagra wrote: > > Whenever calling certain SOAP methods I get the following error. > > > > SoapFault exception: [HTTP] Error Fetching http headers in > > /home/enc/www/bancard/gp/sample_files/create_receivables_invoice.php:54 > > Stack trace: #0 [internal function]: SoapClient->__doRequest(' > version="...', 'http://nabacct0...', 'http://schemas....', 2, 0) #1 > > [internal function]: SoapClient->__call('CreateReceivabl...', Array) > > #2 /home/enc/www/bancard/gp/sample_files/create_receivables_invoice.php(54): > > SoapClient->CreateReceivablesInvoice(Array) #3 {main} > > > > However, other SOAP methods work just fine without any problems. > > > > I've tried different PHP versions (5.2.1, 5.2.3) and different > > solutions on the web with no luck. > > > > Any suggestions? > > _______________________________________________ > > New York PHP Community Talk Mailing List > > http://lists.nyphp.org/mailman/listinfo/talk > > > > NYPHPCon 2006 Presentations Online > > http://www.nyphpcon.com > > > > Show Your Participation in New York PHP > > http://www.nyphp.org/show_participation.php > > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > From dorgan at donaldorgan.com Wed Dec 26 08:59:42 2007 From: dorgan at donaldorgan.com (Donald J Organ IV) Date: Wed, 26 Dec 2007 08:59:42 -0500 Subject: [nycphp-talk] LIPHP mailing list In-Reply-To: <665648.88735.qm@web60219.mail.yahoo.com> References: <665648.88735.qm@web60219.mail.yahoo.com> Message-ID: <47725E4E.8030902@donaldorgan.com> I think we had an issue with the maling list yesterday, when you get a chance can you try and send something to the list. From edwardpotter at gmail.com Wed Dec 26 10:02:29 2007 From: edwardpotter at gmail.com (Edward Potter) Date: Wed, 26 Dec 2007 10:02:29 -0500 Subject: [nycphp-talk] Web hosting. In-Reply-To: <22182-63353@sneakemail.com> References: <006101c8426f$86050c60$920f2520$@com> <4769729B.8050803@projectskyline.com> <00a701c8427d$ffeb8730$ffc29590$@com> <22182-63353@sneakemail.com> Message-ID: Go with the no-brainers, devote no more then 10 seconds to think about hosting, it's not 1999. pair.com, dreamhost, for 99% of your needs they probably can do it all. Yes, in 1999 we paid $25,000 per MONTH for hosting, today a rock bottom account on dreamhost is probably 100X better. Once you make your fist 100G, and you actually have health and dental insurance for everyone - THEN think about managing your own servers, but not before. Don't waste any time on hosting issues, work on your SITE (IMHO) :-) PS, in 2008 I am no longer a "Consultant", I'm now an "Adviser" :-) On Dec 25, 2007 5:31 PM, inforequest <1j0lkq002 at sneakemail.com> wrote: > Michael Hernandez sequethin-at-gmail.com |nyphp dev/internal group use| > wrote: > > > you can also check dreamhost (who's affiliate program I am a member > > of), they have a nice way of setting up users and managing bandwidth > > and space for accounts which is great for reselling. you can also > > choose between php 4 and 5, and there are other niceties. Caveat - > > there are some issues though (check http://www.dreamhoststatus.com). > > > > for the price I find it's worth it, and I basically post this same > > email every time someone asks for hosting options ;) > > > > good luck in your choice, > > > > --Mike H > > > Something to understand about Dreamhost... they are Extremely efficient > at their operations. That's Extremely with a capital "E". They will do > just about anything to gain efficiencies... and you will notice that > alot. The trick is to work with it to your advantage. > > Got low traffic? They will give you low bandwidth. Got big traffic? Ask > for it and they give you appropriate servers/services. Forget to ask (or > if they don't notice themselves) and your site will not serve its users > very well. If you have a stable site, Dreamhost can be a dream. If you > have a fluctuating site, you are likely to be very frustrated *unless* > you communicate with them about your performance and expectations, in > which case it can still be very good and extremely good when factoring > in the cost. > > Lots more can be said, but probably OT for this forum. > > -=john > > > > > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > -- IM/iChat: ejpusa Links: http://del.icio.us/ejpusa Blog: http://www.utopiaparkway.com Follow me: http://www.twitter.com/ejpusa Karma: http://www.coderswithconscience.com Projects: http://flickr.com/photos/86842405 at N00/ Store: http://astore.amazon.com/httpwwwutopic-20 From tgales at tgaconnect.com Wed Dec 26 10:11:32 2007 From: tgales at tgaconnect.com (Tim Gales) Date: Wed, 26 Dec 2007 10:11:32 -0500 Subject: [nycphp-talk] LIPHP mailing list In-Reply-To: <47725E4E.8030902@donaldorgan.com> References: <665648.88735.qm@web60219.mail.yahoo.com> <47725E4E.8030902@donaldorgan.com> Message-ID: <47726F24.3000106@tgaconnect.com> Donald J Organ IV wrote: > I think we had an issue with the maling list yesterday, when you get a > chance can you try and send something to the list. Seems to work now -- T. Gales & Associates 'Helping People Connect with Technology' http://www.tgaconnect.com From dorgan at donaldorgan.com Wed Dec 26 10:18:00 2007 From: dorgan at donaldorgan.com (Donald J Organ IV) Date: Wed, 26 Dec 2007 10:18:00 -0500 Subject: [nycphp-talk] LIPHP mailing list In-Reply-To: <47726F24.3000106@tgaconnect.com> References: <665648.88735.qm@web60219.mail.yahoo.com> <47725E4E.8030902@donaldorgan.com> <47726F24.3000106@tgaconnect.com> Message-ID: <477270A8.4070402@donaldorgan.com> Hmm ok that wasnt meant to go to you...lol...guess getting up and not adding rewetting drops to your contacts before you send an email can be bad. Tim Gales wrote: > Donald J Organ IV wrote: >> I think we had an issue with the maling list yesterday, when you get >> a chance can you try and send something to the list. > > Seems to work now > From tim_lists at o2group.com Wed Dec 26 21:24:55 2007 From: tim_lists at o2group.com (Tim Lieberman) Date: Wed, 26 Dec 2007 19:24:55 -0700 Subject: [nycphp-talk] Thanks in advance In-Reply-To: <4771CAAB.2000501@gmx.net> References: <4771CAAB.2000501@gmx.net> Message-ID: <47730CF7.3090502@o2group.com> David Krings wrote: > chad qian wrote: >> I get the following source code from internet.It can upload the image >> but it can't display the image on the web page.There is always "x" >> sign .Any idea?Thanks a lot! > > Check the source code of the resulting page and see if the value for > the tag points to a location from where the image can be > retrieved. When you see the X the browser cannot download the image as > the file is not found in the specified location. More likely in this case, something is causing the image data that gets sent to the browser to be corrupted. Note that he's storing the image in the database, and this very same script (with $_GET['gim'] set) is outputting those data. It's a perennial debate, but I'll go there: Storing image data in the database is a bad idea. You already have a very robust database for managing files: the filesystem. So before you bother debugging this code more, you might want to consider changing your implementation. Simply write a uniquely named file somewhere on disk, and store the filename in the database. Then you can construct the relevant src attributes on image tags, etc, or if you must, run the image data through PHP using fpassthru() or similar. Here are some things I'd look at, if I was debugging your code: 1) When calling the script with "gim" in the URL (telling it to send the image), does any extra data get sent? Are there spaces before your opening References: Message-ID: <477329B3.3060708@omnistep.com> chad qian wrote: > I get the following source code from internet.It can upload the > image but it can't display the image on the web page.There is always > "x" sign .Any idea?Thanks a lot! > > Here is the source code: > > ..... >

Here's the latest picture

> >

>
>
> fix the image tag ~Rolan From rmarscher at beaffinitive.com Thu Dec 27 10:33:21 2007 From: rmarscher at beaffinitive.com (Rob Marscher) Date: Thu, 27 Dec 2007 10:33:21 -0500 Subject: [nycphp-talk] Checking if a program is installed In-Reply-To: <000b01c84267$d7dd5310$8797f930$@com> References: <000b01c84267$d7dd5310$8797f930$@com> Message-ID: <85D548F0-85EC-46CB-AE4E-7AC242763FEC@beaffinitive.com> On Dec 19, 2007, at 12:51 PM, Web Scribble - Alexey Gutin wrote: > I am trying to check if a program is installed on the server through > PHP. In particular, FFMPEG. In Linux, I can just run ?ffmpeg?, and > the shell will throw an error if it isn?t found. The same happens in > Windows. Sorry for replying to a relatively old thread. I've been on vacation. But I see know one exactly answered this - the is_executable only works if you know the exact absolute path that the program would be installed at. The following should work on a unix based machine. There's got to be something similar for Windows, but I don't want to reboot my Mac to try to figure it out :) From anangtt at hotmail.com Thu Dec 27 14:39:55 2007 From: anangtt at hotmail.com (Anan Tawia) Date: Thu, 27 Dec 2007 14:39:55 -0500 Subject: [nycphp-talk] RE: talk Digest, Vol 14, Issue 52 In-Reply-To: References: Message-ID: Need Freelance Help: I am trying to use Larry Ullman's chapter 14 ecommerce example for an ecommerce project I am currently working on and need some freelance help; - First of I need help in integrating the cart with PayPal's Payflow pro (someone with past experience with Payflow pro is preferred) - Secondly I need some one to help me get the products to display in a thumbnail format i.e. product image, prod price, prod name This is a low budget project, so I would prefer someone who can provide a flat bid (or I will be willing to pay 35hr max depending on how many hours you think it would take) and execute upon that. This project needs to be live by Friday. If you are interested please email me with your contact information and samples of similar work you've done. Links: http://www.dmcinsights.com/phpmysql2/scripts.php Contact Info: Anangtt at hotmail.com From tommyo at gmail.com Mon Dec 31 15:24:44 2007 From: tommyo at gmail.com (Thomas O'Neill) Date: Mon, 31 Dec 2007 14:24:44 -0600 Subject: [nycphp-talk] OT: MidwestSource?? Message-ID: First off I want to apologize for the blatant solicitation. I have been actively following this list for about 4 years and have found the discussion on all things web development related an outstanding resource. The group has great participation and members that often provide excellent advice to the PHP development community. I hope that I am not out of line seeking some business advice. I work for a growing web development company in Minneapolis, MN (4+ years 45+ employees) and we are looking to expand our customer base to the east coast. Does anyone have any suggestions for a company rooted in the Midwest to get in on the action out east? Does anyone need a partner to supplement their workload? We are an agile development shop with ~30 programmers that bills ~1000 hours/week. Thomas O'Neill Director of Software Development Sierra Bravo Corporation http://www.sierra-bravo.com Email: toneill at sierra-bravo.com Cell: (612) 327-0574 Direct: (952) 567-6316 Main Office: (952) 948-1211 -------------- next part -------------- An HTML attachment was scrubbed... URL: