Re: [PHP] Re: iconv is messing up a spreadsheet generated by the Spreadsheet Excel Writer
Hi there, I'm not sure if this is the same problem but after I struggled with strange characters in Spreadsheet Excel Writer for some time I wrote an article from my lessons learned: http://research.elabs.govt.nz/generating-excel-spreadsheets-with-maori-macrons-in-php/ It contains some example code, hope it helps. Ewen 2009/1/14 > > > The charset: latin1 and the collation: latin1_swedish_ci. > > Trivia quiz at a MySQL presentation at my Chicago PHP User Group a few year > ago comes in handy! > > The defaults for MySQL are actually latin1_swedish as that is the native > language of the original developer, (?Monty Widenus?) > > This charset differs in only one character (or two chars switched?) from > English. > > It seems unlikely to produce drastic problems in iconv, but I have no idea > what I'm actually talking about. > > We now return you to your regularly scheduled program! > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
Re: [PHP] Zend Framework...where to start? -- don't.
I think Daevid has some valid points although I think frameworks still have a lot of value, I've recently learned to use the CakePHP framework and have been happy with the development time improvements. But more then that I've found it has made my applications more extensible and flexible. As to the point about training new employees to the framework - in my experience I would have much prefered previous colleagues to have used a framework which would at least provide a reference for me to use rather than seeing several development styles throughout the code and inconsistent documentation. No, frameworks are not silver bullets but still a useful programming tool in the right situations/applications. Cheers, Ewen 2009/1/15 Phpster > Core files are what my plans include too. > > Bastien > > Sent from my iPod > > On Jan 14, 2009, at 9:26 PM, "Kyle Terry" wrote: > > On Wed, Jan 14, 2009 at 6:17 PM, Paul M Foster > >wrote: >> >> On Wed, Jan 14, 2009 at 01:39:02PM -0800, Daevid Vincent wrote: >>> >>> Not to start a Holy War (as these "to framework" or "not to framework" debates often turn into), but I personally had a horrible experience >>> with >>> using frameworks. I was forced to use Symfony at my last job and it >>> was so >>> cumbersome and slow to do even the simplest things. The whole MVC >>> thing >>> can be overkill. Plus the learning curve can be quite steep. Then if >>> you >>> want to hire other developers to work with you, you have to train them >>> and >>> let them ramp up on not only the framework but also your core project >>> too! >>> More wasted time. The pages are significantly slower than straight PHP by orders of magnitude: [1]http://paul-m-jones.com/?p=315 >>> >>> What a great link! I've never seen this kind of comparison before. HTML >>> is 70% faster than straight PHP, and the frameworks (even codeigniter) >>> deliver less than 20% of the performance of straight PHP. >>> >>> The basic problem with frameworks is they try to be one thing for all people. This carries a lot of baggage with it. There's a lot of crap >>> you >>> end up pulling in that you don't want/need. Plus if you want to >>> deviate at >>> all, you either have to roll your own, or sometimes you simply just >>> can't. >>> They seem attractive with all their plugins and stuff, but honestly, rarely do the plugins do EXACTLY what you want, the way you want. It >>> might >>> be as simple as trying to change the look/feel of a button or >>> something >>> and you'll find out that you can't -- so now you have this website >>> that >>> has this section that doesn't look like the rest of your site. And if >>> you >>> find a bug, you have to try to either fix it yourself and then keep >>> those >>> changes migrated into new updates, or submit it to the developer and >>> hope >>> they implement them (and trust me, you can submit to them and have >>> them >>> rejected for all sorts of lame reasons -- even though the work has >>> been >>> done and you're using it!) I advise against it. Just follow good practices and use thin wrappers >>> and >>> functions. Don't get all OO googlie eyed and try to over-engineer and over-OO the code. OO is great for some things (like a User class) but don't start making some OO page renderer or form builder. Don't fall >>> into >>> the DB Abstraction trap either -- just use a wrapper around your DB >>> calls >>> (see attached), so you can swap out that wrapper if (and you almost >>> never >>> do) you change the DB. Don't be suckered by something like QuickForms >>> -- >>> you WILL run into limitations that you can't get around and are at >>> their >>> mercy. Don't buy the hype that DIV's are the magic bullet and TABLEs >>> are >>> "poor design" -- Tables are still the best and most ubiquitous way to align things in a browser agnostic way (including mobile phones, etc.) >>> and >>> to layout forms. >>> >>> I agree and disagree. I agree there's waaay too much herd mentality in >>> the programming field. (Fortunately, Linus Torvalds didn't listen to the >>> academics who insisted that microkernels where THE WAY, or we wouldn't >>> have Linux today.) OO is nifty for some things, but it's certainly not >>> the "fountain of reusability" it was originally promoted to be. And I >>> also agree about tables versus CSS. I can render a page very precisely >>> with tables that would take me hours to get right with CSS. And I really >>> don't give a crap about what "experts" say about anything. I find >>> "experts" to be wrong much of the time. >>> >>> OTOH, I just finished writing about 80K lines of PHP/HTML, all by hand, >>> no OO, no classes, no nothing. E
Re: [PHP] Zend Framework...where to start? -- don't.
On Wed, 2009-01-14 at 14:28 -0800, Kyle Terry wrote: > On Wed, Jan 14, 2009 at 2:18 PM, Eric Butera wrote: > > > On Wed, Jan 14, 2009 at 5:03 PM, Robert Cummings > > wrote: > > > On Wed, 2009-01-14 at 17:01 -0500, Robert Cummings wrote: > > >> On Wed, 2009-01-14 at 16:50 -0500, Eric Butera wrote: > > >> > On Wed, Jan 14, 2009 at 4:39 PM, Daevid Vincent > > wrote: > > >> > > http://daevid.com > > >> > > > >> > "It appears your browser does not support some of the advanced > > >> > features this site requires." > > >> > > > >> > That is pretty enteprisey! ;D > > >> > > >> I got the same message... 2001 called-- they'd like they're web > > >> technology back. > > > > > > Hmmm.. so I opened it up in Firefox and there's this little window just > > > like one I programmed for IE/Firefox/Opera 4 years ago. Not sure why > > > Opera isn't supported, or any other browser with JavaScript and CSS. > > > Reall, if the browser doesn't support the window thingy, it should just > > > degrade to a normal content box. > > > > > > Cheers, > > > Rob. > > > -- > > > http://www.interjinn.com > > > Application and Templating Framework for PHP > > > > > > > > > > I'm using Safari. :D > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > His website made firefox crash! >=[! Well that would be a Firefox bug :) Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Zend Framework...where to start? -- don't.
On Wed, 2009-01-14 at 15:47 -0800, Daevid Vincent wrote: > On Wed, 2009-01-14 at 14:28 -0800, Kyle Terry wrote: > > > On Wed, Jan 14, 2009 at 2:18 PM, Eric Butera wrote: > > > > > On Wed, Jan 14, 2009 at 5:03 PM, Robert Cummings > > > wrote: > > > > On Wed, 2009-01-14 at 17:01 -0500, Robert Cummings wrote: > > > >> On Wed, 2009-01-14 at 16:50 -0500, Eric Butera wrote: > > > >> > On Wed, Jan 14, 2009 at 4:39 PM, Daevid Vincent > > > wrote: > > > >> > > http://daevid.com > > > >> > > > > >> > "It appears your browser does not support some of the advanced > > > >> > features this site requires." > > > >> > > > > >> > That is pretty enteprisey! ;D > > > >> > > > >> I got the same message... 2001 called-- they'd like they're web > > > >> technology back. > > > > > > > > Hmmm.. so I opened it up in Firefox and there's this little window just > > > > like one I programmed for IE/Firefox/Opera 4 years ago. Not sure why > > > > Opera isn't supported, or any other browser with JavaScript and CSS. > > > > Reall, if the browser doesn't support the window thingy, it should just > > > > degrade to a normal content box. > > > > > > > > Cheers, > > > > Rob. > > > > -- > > > > http://www.interjinn.com > > > > Application and Templating Framework for PHP > > > > > > > > > > > > > > I'm using Safari. :D > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > His website made firefox crash! >=[! > > > > > Um. I am using FF on Ubuntu right now at work, and it works just fine. I > develop at home on XP and IE6 and IE7 and it also works. I guarantee you > that crash was not related to my site. > > All of you are spending way too much time on something that is besides > the point. My personal site has NOTHING to do with > Symfony/Zend/Cake/etc. frameworks per se. The reason you can't load it > in safari is a Javascript check and not PHP -- again off topic from this > conversation. It doesn't degrade nicely b/c I never bothered to > implement the other part of the Winlike "kit" which will degrade (as you > can see on their site http://www.winlike.net as I honestly don't really > care about Safari users (like 7% of the market) to be honest. I'm not using Safari, I'm using Opera. That brings it up to about 9% *heheh*. Cheers, Rob. > It's my > own personal site and if a Mac person can't use FF to view it, it's not > sweat off either of our backs.) > http://www.macobserver.com/article/2008/07/01.9.shtml > > Can we please get back on topic? If you really want to see my > credentials, then go here: http://resume.daevid.com or go to my personal > site in Firefox or IE. A resume is a polished document specifically meant to extoll your virtues. Your personal website appears to be an example of your work ethic without attempting to extoll your virtues. You are the sum of your parts, each contributes to the body of knowledge about you. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Zend (or other) Framework...where to start?
Well, Symcell Corporation is *my* company, so I give you all right to use it :) I just dragged and dropped that file as an example. I'm a firm believer in FOSS and sharring code. That notice is basically some copy paste C.Y.A. and part of a standard header all my files have. If you prefer, then use it as a reference to see how I do things and re-write your own ;-) d > -Original Message- > From: Paul M Foster [mailto:pa...@quillandmouse.com] > Sent: Wednesday, January 14, 2009 7:01 PM > To: php-general@lists.php.net > Subject: Re: [PHP] Zend (or other) Framework...where to start? > > Um, your base.class.php belongs to your company and says at > the top not to copy or distribute. Oops. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to display new icon for news posted within 2 days?
is it possible to do it like SELECT *, UNIX_TIMESTAMP(post_date)-172,800 as is_new FROM tbl $post = mysqli_fetch_object($sql); if($post->is_new) echo ''; On 1/14/09, Phpster wrote: > Make it easy and store the date as a unix timestamp. Then it's a > simple testto do > > If ((current timestamp - db timestamp) < 172,800 ){ > echo ''; > } > > Conversely, you can use strtotime() to convert the date. > > Bastien > > Sent from my iPod > > On Jan 14, 2009, at 10:36 PM, paragasu wrote: > >> i do have a mysql table with one date field. >> what i want is to display and tiny icon (red new icon) so user will >> notice it is a new post. >> i am looking for the simplest solutions here. >> >> i believe we can calculate whether the date is within two days of user >> current time. >> then we display an icon based on it. >> >> can anyone help? >> >> thanks >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Zend Framework...where to start? -- don't.
On Wed, 2009-01-14 at 21:17 -0500, Paul M Foster wrote: > On Wed, Jan 14, 2009 at 01:39:02PM -0800, Daevid Vincent wrote: > > >Not to start a Holy War (as these "to framework" or "not to framework" > >debates often turn into), but I personally had a horrible experience with > >using frameworks. I was forced to use Symfony at my last job and it was > > so > >cumbersome and slow to do even the simplest things. The whole MVC thing > >can be overkill. Plus the learning curve can be quite steep. Then if you > >want to hire other developers to work with you, you have to train them > > and > >let them ramp up on not only the framework but also your core project > > too! > >More wasted time. > > > >The pages are significantly slower than straight PHP by orders of > >magnitude: [1]http://paul-m-jones.com/?p=315 > > What a great link! I've never seen this kind of comparison before. HTML > is 70% faster than straight PHP, and the frameworks (even codeigniter) > deliver less than 20% of the performance of straight PHP. It's not a fair comparison. It's like saying here's a bucket of water. I want you to take it across the road using one of the following methods: a) Walking b) Driving a truck c) Flying an airplane Well of course a) wins in this contrived example because the truck requires you to open the door, put the key in the ignition, and start the truck (you may even have to walk to the gas station half a kilometre away first). Similarly for the airplane. However, very few web applications are a walk across the road. Some are... anything complex is not. Now, if I change the problem to something a little more realistic and instead ask that you bring a parcel to John Doe who just happens to live in Slumber Acres 5km outside of town... at the other side of town-- then tell me which is now the best option? Now, moving along... what if the parcel is to go to John Doe's grandmother who lives 4000km away in another country? You see, the study you read is contrived. By the time you are doing anything complex, you are VERY likely to incurr a similar startup cost as many a framework. So... the question is not whether frameworks are a good idea or not, it's what do they offer and how well were they built. Obviously some frameworks have terrible start up conditions and general run-time efficiency. However, they may be more modular in general, allowing you to quickly piece together an alternate mode of transportation rather than inventing your own airplane or car. Others will be quite quick but may not handle everything you throw at them or will require more low level programming to accomplish more complex tasks. And then there's the town fool... the person who wastes everyone's time declaring the sky is falling... or the world is coming to an end... or that frameworks are pointless and everyone should code from cratch in rote PHP. Pick the tool for the job... there are times a quick PHP script is the answer, and there are times when it is not. PHP is itself a framework over C. C is a framework over assembly. Assembly is a framework over machine language. Each of these incurrs a cost, but nobody is suggesting you write a website in assembly. Please DO develop your critical thinking before reading such sites and jumping to conclusions. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Zend Framework...where to start? -- don't.
On Wed, 2009-01-14 at 21:17 -0500, Paul M Foster wrote: > > Incidentally, I would differ from the reviewer in the link above only in > this respect: He maintains that every line of code adds time. While this > is true, I believe it's the number of files which have to be opened > which drags down framework numbers the most. When I wrote C code, the > CPU would blaze through the actual code, but file opens and reads > consumed far more time than in-memory code execution. Moot point if you're using an accelerator like eAccelerator or APC since these cache the data in memory. Similarly, most operating systems cache file reads also, so it's probably not as expensive without an accelerator as you think either. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Zend (or other) Framework...where to start?
On Thu, 2009-01-15 at 09:57 +0300, Usamah M. Ali wrote: > On Thu, Jan 15, 2009 at 1:59 AM, Paul M Foster > wrote: > > > If you're going to go with a prebuilt framework, I'd recommend > > CodeIgniter for your first time out. If the docs look good to you (and > > they are pretty good), you'll probably do fine with it. It's about the > > lightest weight platform out there. It doesn't get in your way too much, > > but gives you the benefits of using a framework. > > > > I downloaded CI because of recommendations from this list as well, but > was totally shocked when I discovered that its codebase is written in > PHP4! I looked up for an alpha version that is written in PHP5 to no > avail. I just can't understand why would they still be in PHP4 while > Symfony, a framework born after CI, requires PHP5 since version one > and takes full advantage of PHP5's advanced OO features! Does it work within a PHP5 environment? If so... why rewrite it? Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Zend Framework...where to start? -- do
'Twas brillig, and Daevid Vincent at 14/01/09 21:39 did gyre and gimble: The pages are significantly slower than straight PHP by orders of magnitude: http://paul-m-jones.com/?p=315 Shock News: Frameworks that allow you to write an application in less code do stuff in the background for you. I don't mean to state the very obvious but of course frameworks will be slower than a simpler and less flexible/powerful/maintainable solution. That's like buying an F1 car for your daily commute to work then complaining about the MPGs you get! Frameworks are not about running faster, they are about implementing faster and more efficiently, using a standard technique that allows other developers to take over from you later with minimal hand over, it's about being able to take on new staff without having to train them in all your specific code etc. One of the things these speed tests totally fail to take into consideration is that any sensibly written application will have a caching structure at it's core and will utilise it *heavily*. When an application is written with a good caching policy/infrastructure, the performance as a whole goes up by orders of magnitude. Some performance shootouts don't even employ opcode caches which is just insane in any kind of sensible hosting environment. In short, don't believe the hype and use a little bit of logic and common sense to make comparisons as to which approach is "better" (remember "better" != "raw performance") for you. Col PS FWIW, I have adopted Zend_Framework and while some of the paradigms don't fully suit me I have extended and adapted them to make it work very well for me. -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mandriva Linux Contributor [http://www.mandriva.com/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Zend Framework...where to start? -- do
Colin Guthrie schrieb: 'Twas brillig, and Daevid Vincent at 14/01/09 21:39 did gyre and gimble: The pages are significantly slower than straight PHP by orders of magnitude: http://paul-m-jones.com/?p=315 Shock News: Frameworks that allow you to write an application in less code do stuff in the background for you. I don't mean to state the very obvious but of course frameworks will be slower than a simpler and less flexible/powerful/maintainable solution. That's like buying an F1 car for your daily commute to work then complaining about the MPGs you get! Frameworks are not about running faster, they are about implementing faster and more efficiently, using a standard technique that allows other developers to take over from you later with minimal hand over, it's about being able to take on new staff without having to train them in all your specific code etc. One of the things these speed tests totally fail to take into consideration is that any sensibly written application will have a caching structure at it's core and will utilise it *heavily*. When an application is written with a good caching policy/infrastructure, the performance as a whole goes up by orders of magnitude. Some performance shootouts don't even employ opcode caches which is just insane in any kind of sensible hosting environment. In short, don't believe the hype and use a little bit of logic and common sense to make comparisons as to which approach is "better" (remember "better" != "raw performance") for you. Col PS FWIW, I have adopted Zend_Framework and while some of the paradigms don't fully suit me I have extended and adapted them to make it work very well for me. Hi Colin, i agree that. Carlos Medina -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Zend (or other) Framework...where to start?
The question is interesting. I do another question: Will PHP5 support PHP4 backward compatibility forever? Ok I'm rediculous, forever not, but, until 5.3 or 6? I really don't know how CI thinks about evolution, but I'm very curious why don't use the new features that provide good evolution? "It's Works" don't seem to me one good reason to not do evolution. Mainly when some concepts are deprecated. I'm don't talking that CI is not good or enough, just, I offer IMHO some interesting questions. On Thu, Jan 15, 2009 at 7:21 AM, Robert Cummings wrote: > On Thu, 2009-01-15 at 09:57 +0300, Usamah M. Ali wrote: >> On Thu, Jan 15, 2009 at 1:59 AM, Paul M Foster >> wrote: >> >> > If you're going to go with a prebuilt framework, I'd recommend >> > CodeIgniter for your first time out. If the docs look good to you (and >> > they are pretty good), you'll probably do fine with it. It's about the >> > lightest weight platform out there. It doesn't get in your way too much, >> > but gives you the benefits of using a framework. >> > >> >> I downloaded CI because of recommendations from this list as well, but >> was totally shocked when I discovered that its codebase is written in >> PHP4! I looked up for an alpha version that is written in PHP5 to no >> avail. I just can't understand why would they still be in PHP4 while >> Symfony, a framework born after CI, requires PHP5 since version one >> and takes full advantage of PHP5's advanced OO features! > > Does it work within a PHP5 environment? If so... why rewrite it? > > Cheers, > Rob. > -- > http://www.interjinn.com > Application and Templating Framework for PHP > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Abraços Edgar Ferreira da Silva Engenheiro de Software Campinas - SP (19) 8110-0733 http://edgarfs.com.br - Aprenda PHP, cole códigos, saiba das vagas de empregos: http://www.manjaphp.com.br -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Finger
Hi, My problem is that how I can know that a valid e-mail address is exists on the mail server? Is there some PHP function, or protocol, or something? Thanks, SanTa
RES: [PHP] Finger
U can find sometinhg on http://www.phpclasses.org/, http://www.phpclasses.org/browse/package/1519.html, there's a lot of sugestions there zechim -Mensagem original- De: Sándor Tamás (HostWare Kft.) [mailto:sandorta...@hostware.hu] Enviada em: quinta-feira, 15 de janeiro de 2009 09:30 Para: php-general@lists.php.net Assunto: [PHP] Finger Hi, My problem is that how I can know that a valid e-mail address is exists on the mail server? Is there some PHP function, or protocol, or something? Thanks, SanTa -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Finger
> My problem is that how I can know that a valid e-mail address is exists on > the mail server? > Is there some PHP function, or protocol, or something? The only way is to send email to it with an ID that the user has to give back to you (Eg. have them go to a particular URL). That way you can be more or less sure that a person has read the email. -- Richard Heyes HTML5 Graphing for Firefox, Chrome, Opera and Safari: http://www.rgraph.org (Updated January 4th) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Zend (or other) Framework...where to start?
On Thu, 2009-01-15 at 09:03 -0200, Edgar da Silva (Fly2k) wrote: > The question is interesting. > > I do another question: Will PHP5 support PHP4 backward compatibility > forever? Ok I'm rediculous, forever not, but, until 5.3 or 6? I think once PHP6 comes out we'll find that some PHP4 idiosyncracies currently tolerated by PHP5 will become fatal errors. At which point projects like CodeIgniter will probably cease PHP4 support and instead span their support across PHP5 and 6. > I really don't know how CI thinks about evolution, but I'm very > curious why don't use the new features that provide good evolution? I think that's partly a question of what one considers a good feature. Just because a feature exists doesn't mean it should necessarily be used. > "It's Works" don't seem to me one good reason to not do evolution. > Mainly when some concepts are deprecated. > > I'm don't talking that CI is not good or enough, just, I offer IMHO > some interesting questions. I don't know how CI works, just that I also maintain backward compatibility for my framework to PHP4. However, I'm finding now that there's not much point since almost all of my client applications are now running on PHP5. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Zend (or other) Framework...where to start?
On Thu, Jan 15, 2009 at 9:48 AM, Robert Cummings wrote: > On Thu, 2009-01-15 at 09:03 -0200, Edgar da Silva (Fly2k) wrote: >> The question is interesting. >> >> I do another question: Will PHP5 support PHP4 backward compatibility >> forever? Ok I'm rediculous, forever not, but, until 5.3 or 6? > > I think once PHP6 comes out we'll find that some PHP4 idiosyncracies > currently tolerated by PHP5 will become fatal errors. At which point > projects like CodeIgniter will probably cease PHP4 support and instead > span their support across PHP5 and 6. > >> I really don't know how CI thinks about evolution, but I'm very >> curious why don't use the new features that provide good evolution? > > I think that's partly a question of what one considers a good feature. > Just because a feature exists doesn't mean it should necessarily be > used. I agree in parts. Things "doesn't mean its should necessarlly" is very very relative. If we think in this way, like PHP is a simple language (but very powerfull) we doesn't have to use OOP to build one application, for example. We need to think carefully about the life time of the application. Mainly when we are talking about frameworks. Watch the evolution walking aside is very important. Another point, talking about frameworks, extending some feature in some times is necessary. Doing in PHP4 using OOP to do this is extend a real class that works like astract class, but there is no interface class, its would be hard to provide reliability. What can do in PHP5. Altough, I agree with you we don't need to implement all new features, but, we need to be carefull with what features evolved. Again, "It's works" isn't a good reason. Mainly in this case. >> "It's Works" don't seem to me one good reason to not do evolution. >> Mainly when some concepts are deprecated. >> >> I'm don't talking that CI is not good or enough, just, I offer IMHO >> some interesting questions. > > I don't know how CI works, just that I also maintain backward > compatibility for my framework to PHP4. However, I'm finding now that > there's not much point since almost all of my client applications are > now running on PHP5. > > Cheers, > Rob. > -- > http://www.interjinn.com > Application and Templating Framework for PHP > > -- Abraços Edgar Ferreira da Silva Engenheiro de Software Campinas - SP (19) 8110-0733 http://edgarfs.com.br - Aprenda PHP, cole códigos, saiba das vagas de empregos: http://www.manjaphp.com.br -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to display new icon for news posted within 2 days?
That should work as well Bastien Sent from my iPod On Jan 15, 2009, at 4:14 AM, paragasu wrote: is it possible to do it like SELECT *, UNIX_TIMESTAMP(post_date)-172,800 as is_new FROM tbl $post = mysqli_fetch_object($sql); if($post->is_new) echo ''; On 1/14/09, Phpster wrote: Make it easy and store the date as a unix timestamp. Then it's a simple testto do If ((current timestamp - db timestamp) < 172,800 ){ echo ''; } Conversely, you can use strtotime() to convert the date. Bastien Sent from my iPod On Jan 14, 2009, at 10:36 PM, paragasu wrote: i do have a mysql table with one date field. what i want is to display and tiny icon (red new icon) so user will notice it is a new post. i am looking for the simplest solutions here. i believe we can calculate whether the date is within two days of user current time. then we display an icon based on it. can anyone help? thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] unpack bug?
Hi, I have some code developed on a linux system with PHP 5.1.6, its using the PEAR Net_DNS class to send dns updates, part of this requires unpacking a binary string, an example is below. This works on PHP 5.1.6 but fails on 5.2.8, it appears that it may be in relation to the following change in 5.2.4 "Added missing format validator to unpack()". A test case of the code is as follows: $data = base64_decode("A86pgAABCHJuZGMta2V5AAD6AP8AADoIaG1hYy1tZDUHc2lnLWFsZwNyZWcDaW50SW8kgAEsABBd7hm4xnUjl5kWLXfbZKaBA84A"); $offset=58; $d = unpack('\...@$offset/nth/Ntl/nfudge/nmac_size', $data); print_r($d); Expected output: Array ( [th] => 974 [tl] => -1451229184 [fudge] => 0 [mac_size] => 0 ) Actual output: Warning: unpack(): Invalid format type \ Removing the "\" before that @ does make the error go away but causes a different result: Array ( [th] => 52905 [tl] => -2147483648 [fudge] => 0 [mac_size] => 0 ) Is this being caused by the format validator and if so should it be allowing this, or is there another way I can unpack this correctly. Regards James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Zend (or other) Framework...where to start?
On Thu, Jan 15, 2009 at 1:57 AM, Usamah M. Ali wrote: > On Thu, Jan 15, 2009 at 1:59 AM, Paul M Foster > wrote: > >> If you're going to go with a prebuilt framework, I'd recommend >> CodeIgniter for your first time out. If the docs look good to you (and >> they are pretty good), you'll probably do fine with it. It's about the >> lightest weight platform out there. It doesn't get in your way too much, >> but gives you the benefits of using a framework. >> > > I downloaded CI because of recommendations from this list as well, but > was totally shocked when I discovered that its codebase is written in > PHP4! I looked up for an alpha version that is written in PHP5 to no > avail. I just can't understand why would they still be in PHP4 while > Symfony, a framework born after CI, requires PHP5 since version one > and takes full advantage of PHP5's advanced OO features! > > Regards, > Usamah > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > Yes, I ran into this problem too when I downloaded it and looked. Same thing with cakephp too. There's a php5 based framework at http://kohanaphp.com/ that says it is based off CI. I started looking at it but all the FW classes are top level with no namespace prefix which made me really sad. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: iconv is messing up a spreadsheet generated by the Spreadsheet Excel Writer
On Wed, 14 Jan 2009 13:19:31 +0200, Thodoris wrote: Variable_name Value character_set_clientutf8 character_set_connectionutf8 character_set_database latin1 character_set_filesystembinary character_set_results utf8 character_set_serverlatin1 character_set_systemutf8 What's the character set of the column you get the data from? The charset: latin1 and the collation: latin1_swedish_ci. I'm not sure exactly how these affect the data returned to PHP. The 'connection' and 'results' variables would suggest utf8. In any case, it must be one of 'latin1' or 'utf8'. What happens if you do: $worksheet->setInputEncoding('latin1'); /* or 'ISO-8859-1' */ It would still be helpful to see a hexdump. /Nisse Since the data are in greek I can't see anything but despite that the xls still breaks. In addition to that MS-Excel doesn't even open the file because it thinks it is corrupted. OOffice still opens it as before but it breaks in a certain line. BTW As you have already guessed I am using: $worksheet->setInputEncoding('UTF-8'); I think that it is the pear extension's problem and has something to do with the encoding. I hex dumped the data and no curious characters seem to be there. Moreover the line in the xls that the script breaks the data written changes if I change the encoding. -- Thodoris
Re: [PHP] Zend (or other) Framework...where to start?
On Thu, Jan 15, 2009 at 09:57:42AM +0300, Usamah M. Ali wrote: > On Thu, Jan 15, 2009 at 1:59 AM, Paul M Foster > wrote: > > > If you're going to go with a prebuilt framework, I'd recommend > > CodeIgniter for your first time out. If the docs look good to you (and > > they are pretty good), you'll probably do fine with it. It's about the > > lightest weight platform out there. It doesn't get in your way too much, > > but gives you the benefits of using a framework. > > > > I downloaded CI because of recommendations from this list as well, but > was totally shocked when I discovered that its codebase is written in > PHP4! I looked up for an alpha version that is written in PHP5 to no > avail. I just can't understand why would they still be in PHP4 while > Symfony, a framework born after CI, requires PHP5 since version one > and takes full advantage of PHP5's advanced OO features! > It's designed to work with a broad range of PHP installations. If you're running PHP5, it takes advantage of features in PHP5. Look at the code tree, and you'll see two files which alternatively switch in, depending on whether you're working in PHP4 or PHP5. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Basic Authentication
> -Original Message- > From: tedd [mailto:tedd.sperl...@gmail.com] > Sent: Wednesday, January 14, 2009 5:18 PM > To: Shawn McKenzie; php-general@lists.php.net > Subject: Re: [PHP] Basic Authentication > > At 2:19 PM -0600 1/14/09, Shawn McKenzie wrote: > > > > > >As others have said, use crypt(). > >http://php.net/manual/function.crypt.php has Example #2 Using crypt() > >with htpasswd. > > > Thanks, but that doesn't really solve my problem. > > You see, I know the password and I know the encoded result -- what I > don't know is what algorithm was used to generate the encoding. > > Here are all the algorithms I know of (this includes the above link > you provided). > > http://webbytedd.com//md5/index.php > > However, none of them match what have. tedd, It would appear your Standard DES and MD5 labels are actually both MD5. Also--there is more than just Standard DES. Once DES was determined to be relatively IN-secure, more algorithms like Triple DES, G-DES, DES-X, LOKI89, and ICE were created. You might be looking at a Triple DES hash. HTH, // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to display new icon for news posted within 2 days?
2 things. In that query, you can't have a comma in your 172,800. It's going to fail b/c 800 isn't a column name. Unless it actually is, then you're good to go. =D Secondly, to be more user friendly, if the user has viewed that news item, then mark it as read (take away the new.gif). There are a couple of ways to achieve this. One, you can use cookies to keep track of what they've read. The other is to keep track in the database (sorta like user preferences). Good luck. ~Philip PS... Sorry to top post. It was the trend of the email and I didn't want to break it. On Jan 15, 2009, at 7:50 AM, Phpster wrote: That should work as well Bastien Sent from my iPod On Jan 15, 2009, at 4:14 AM, paragasu wrote: is it possible to do it like SELECT *, UNIX_TIMESTAMP(post_date)-172,800 as is_new FROM tbl $post = mysqli_fetch_object($sql); if($post->is_new) echo ''; On 1/14/09, Phpster wrote: Make it easy and store the date as a unix timestamp. Then it's a simple testto do If ((current timestamp - db timestamp) < 172,800 ){ echo ''; } Conversely, you can use strtotime() to convert the date. Bastien Sent from my iPod On Jan 14, 2009, at 10:36 PM, paragasu wrote: i do have a mysql table with one date field. what i want is to display and tiny icon (red new icon) so user will notice it is a new post. i am looking for the simplest solutions here. i believe we can calculate whether the date is within two days of user current time. then we display an icon based on it. can anyone help? thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Zend Framework...where to start? -- don't.
> -Original Message- > From: Paul M Foster [mailto:pa...@quillandmouse.com] > Sent: Wednesday, January 14, 2009 8:18 PM > To: php-general@lists.php.net > Subject: Re: [PHP] Zend Framework...where to start? -- don't. > ---8<--- > I agree and disagree. I agree there's waaay too much herd mentality in > the programming field. (Fortunately, Linus Torvalds didn't listen to > the > academics who insisted that microkernels where THE WAY, or we wouldn't > have Linux today.) OO is nifty for some things, but it's certainly not > the "fountain of reusability" it was originally promoted to be. And I > also agree about tables versus CSS. I can render a page very precisely > with tables that would take me hours to get right with CSS. And I > really > don't give a crap about what "experts" say about anything. I find > "experts" to be wrong much of the time. > > OTOH, I just finished writing about 80K lines of PHP/HTML, all by hand, > no OO, no classes, no nothing. Each page in one file, except for a few > helper functions in a couple of common files. I wouldn't want to go > through that again. I've opted for a framework on rewriting this code, > just to cut down on the number of lines of code I have to manually > write. But I built my own framework, which doesn't call in 20 files for > each page load. Very compact. Probably not suitable for every kind of > project, but it works for this. > > Incidentally, I would differ from the reviewer in the link above only > in > this respect: He maintains that every line of code adds time. While > this > is true, I believe it's the number of files which have to be opened > which drags down framework numbers the most. When I wrote C code, the > CPU would blaze through the actual code, but file opens and reads > consumed far more time than in-memory code execution. http://www.giveupandusetables.com 'nuff said. // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Zend Framework...where to start? -- don't.
On Jan 15, 2009, at 10:19 AM, "Boyd, Todd M." wrote: -Original Message- From: Paul M Foster [mailto:pa...@quillandmouse.com] Sent: Wednesday, January 14, 2009 8:18 PM To: php-general@lists.php.net Subject: Re: [PHP] Zend Framework...where to start? -- don't. ---8<--- I agree and disagree. I agree there's waaay too much herd mentality in the programming field. (Fortunately, Linus Torvalds didn't listen to the academics who insisted that microkernels where THE WAY, or we wouldn't have Linux today.) OO is nifty for some things, but it's certainly not the "fountain of reusability" it was originally promoted to be. And I also agree about tables versus CSS. I can render a page very precisely with tables that would take me hours to get right with CSS. And I really don't give a crap about what "experts" say about anything. I find "experts" to be wrong much of the time. OTOH, I just finished writing about 80K lines of PHP/HTML, all by hand, no OO, no classes, no nothing. Each page in one file, except for a few helper functions in a couple of common files. I wouldn't want to go through that again. I've opted for a framework on rewriting this code, just to cut down on the number of lines of code I have to manually write. But I built my own framework, which doesn't call in 20 files for each page load. Very compact. Probably not suitable for every kind of project, but it works for this. Incidentally, I would differ from the reviewer in the link above only in this respect: He maintains that every line of code adds time. While this is true, I believe it's the number of files which have to be opened which drags down framework numbers the most. When I wrote C code, the CPU would blaze through the actual code, but file opens and reads consumed far more time than in-memory code execution. http://www.giveupandusetables.com 'nuff said. // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Awesome :-) Bastien -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Zend Framework...where to start? -- don't.
On Wednesday 14 January 2009 23:39:02 Daevid Vincent wrote: > Not to start a Holy War (as these "to framework" or "not to framework" > debates often turn into), but I personally had a horrible experience > with using frameworks. I was forced to use Symfony at my last job and it > was so cumbersome and slow to do even the simplest things. The whole MVC > thing can be overkill. Plus the learning curve can be quite steep. Then > if you want to hire other developers to work with you, you have to train > them and let them ramp up on not only the framework but also your core > project too! More wasted time. > > The pages are significantly slower than straight PHP by orders of > magnitude: http://paul-m-jones.com/?p=315 > > The basic problem with frameworks is they try to be one thing for all > people. This carries a lot of baggage with it. There's a lot of crap you > end up pulling in that you don't want/need. Plus if you want to deviate > at all, you either have to roll your own, or sometimes you simply just > can't. They seem attractive with all their plugins and stuff, but > honestly, rarely do the plugins do EXACTLY what you want, the way you > want. It might be as simple as trying to change the look/feel of a > button or something and you'll find out that you can't -- so now you > have this website that has this section that doesn't look like the rest > of your site. And if you find a bug, you have to try to either fix it > yourself and then keep those changes migrated into new updates, or > submit it to the developer and hope they implement them (and trust me, > you can submit to them and have them rejected for all sorts of lame > reasons -- even though the work has been done and you're using it!) > > I advise against it. Just follow good practices and use thin wrappers > and functions. Don't get all OO googlie eyed and try to over-engineer > and over-OO the code. OO is great for some things (like a User class) > but don't start making some OO page renderer or form builder. Don't fall > into the DB Abstraction trap either -- just use a wrapper around your DB > calls (see attached), so you can swap out that wrapper if (and you > almost never do) you change the DB. Don't be suckered by something like > QuickForms -- you WILL run into limitations that you can't get around > and are at their mercy. Don't buy the hype that DIV's are the magic > bullet and TABLEs are "poor design" -- Tables are still the best and > most ubiquitous way to align things in a browser agnostic way (including > mobile phones, etc.) and to layout forms. > > I've not used Zend myself, so I can't say for certain, but the above > tenements I think would still hold true. I guess I would trust the Zend > one the most given they actually make PHP, but at this point in time, I > would never choose to use a bloated framework. Then again, I write > enterprise level and very custom applications (Saas) so maybe this > doesn't apply if all you're trying to do is make yet another Blog or > Photo-album or personal/corporate website or something generic/basic. > I've been coding nearly 20 years and founded several $MM companies. > That's my take (or rant depending on how you look at it). > > Daevid. > http://daevid.com > Hell, yes, signed to from start to end. After RoR, PHP guys (including Zend) goes nuts. Every one eat his brains to develop RoR like Framework. I wish to see fixed function parameter names, option orders, easy and strong input validation in PHP 6. And they give full effort to generate Zend Framework. Then what? It still harder than Ror... Hell yes, Compete own community. teh best way to spend your resources... Sancar Saran
[PHP] Re: unpack bug?
Nathan Rixham wrote: it's the pack offset that's wrong; remove all together and you'll get the correct results: $d = unpack('nth/Ntl/nfudge/nmac_size', $data); Thanks, thought I had already tried that but obviously not. Cheers James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Zend Framework...where to start? -- don't.
On Thu, 2009-01-15 at 17:34 +0200, Sancar Saran wrote: > On Wednesday 14 January 2009 23:39:02 Daevid Vincent wrote: > > Not to start a Holy War (as these "to framework" or "not to framework" > > debates often turn into), but I personally had a horrible experience > > with using frameworks. I was forced to use Symfony at my last job and it > > was so cumbersome and slow to do even the simplest things. The whole MVC > > thing can be overkill. Plus the learning curve can be quite steep. Then > > if you want to hire other developers to work with you, you have to train > > them and let them ramp up on not only the framework but also your core > > project too! More wasted time. > > > > The pages are significantly slower than straight PHP by orders of > > magnitude: http://paul-m-jones.com/?p=315 > > > > The basic problem with frameworks is they try to be one thing for all > > people. This carries a lot of baggage with it. There's a lot of crap you > > end up pulling in that you don't want/need. Plus if you want to deviate > > at all, you either have to roll your own, or sometimes you simply just > > can't. They seem attractive with all their plugins and stuff, but > > honestly, rarely do the plugins do EXACTLY what you want, the way you > > want. It might be as simple as trying to change the look/feel of a > > button or something and you'll find out that you can't -- so now you > > have this website that has this section that doesn't look like the rest > > of your site. And if you find a bug, you have to try to either fix it > > yourself and then keep those changes migrated into new updates, or > > submit it to the developer and hope they implement them (and trust me, > > you can submit to them and have them rejected for all sorts of lame > > reasons -- even though the work has been done and you're using it!) > > > > I advise against it. Just follow good practices and use thin wrappers > > and functions. Don't get all OO googlie eyed and try to over-engineer > > and over-OO the code. OO is great for some things (like a User class) > > but don't start making some OO page renderer or form builder. Don't fall > > into the DB Abstraction trap either -- just use a wrapper around your DB > > calls (see attached), so you can swap out that wrapper if (and you > > almost never do) you change the DB. Don't be suckered by something like > > QuickForms -- you WILL run into limitations that you can't get around > > and are at their mercy. Don't buy the hype that DIV's are the magic > > bullet and TABLEs are "poor design" -- Tables are still the best and > > most ubiquitous way to align things in a browser agnostic way (including > > mobile phones, etc.) and to layout forms. > > > > I've not used Zend myself, so I can't say for certain, but the above > > tenements I think would still hold true. I guess I would trust the Zend > > one the most given they actually make PHP, but at this point in time, I > > would never choose to use a bloated framework. Then again, I write > > enterprise level and very custom applications (Saas) so maybe this > > doesn't apply if all you're trying to do is make yet another Blog or > > Photo-album or personal/corporate website or something generic/basic. > > I've been coding nearly 20 years and founded several $MM companies. > > That's my take (or rant depending on how you look at it). > > > > Daevid. > > http://daevid.com > > > > Hell, yes, signed to from start to end. > > After RoR, PHP guys (including Zend) goes nuts. > Every one eat his brains to develop RoR like Framework. What are you smoking? I like my framework the way it is. I'm sure others like theirs the way it is. In no way do I try to be like RoR and probably for good reason since I hear mostly bad things about RoR. > I wish to see fixed function parameter names Good luck with that... it's been shot down several times on the PHP internals list. > , option orders, easy and strong input validation in PHP 6. Isn't the filters stuff available in PHP5 already for doing stronger validation. It's not like input validation is difficult. > And they give full effort to generate Zend Framework. Huh? > Then what? It still harder than Ror... What is? PHP? What are you talking about? > Hell yes, Compete own community. teh best way to spend your resources... Internal competition only makes something better. If all you have are yes men, then the only answer you'll get is "yes". Having those who dissent in opinion provides a basis for different views and approaches to problem solving. May survival of the fittest benefit all both from the perspective of getting a better final product and from the perspective of learning from mistakes along the way. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Basic Authentication
At 11:43 PM + 1/14/09, Ashley Sheridan wrote: > Surely that's a good thing then? Security through obscurity and all that... Ash Ash: Certainly it's a good thing -- until the client asks for another password. At this point, I have four logon and password combinations to use. I can tell the client if they use one of those, then they can login. However if they want their own, then I have no idea of what the algorithm was/is and thus no way of generating a new combination for them. You see, the problem here is not that I can't set up an authorization scheme -- I can do that easily enough. The problem is that I don't know how the one currently in place on my client's server works in generating passwords. If I knew that, then I could generate the password myself. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Zend Framework...where to start? -- don't.
On Thursday 15 January 2009 17:45:35 Robert Cummings wrote: > > > > Hell, yes, signed to from start to end. > > > > After RoR, PHP guys (including Zend) goes nuts. > > Every one eat his brains to develop RoR like Framework. > > What are you smoking? I like my framework the way it is. I'm sure others > like theirs the way it is. In no way do I try to be like RoR and > probably for good reason since I hear mostly bad things about RoR. > Naah, I left somoking more than 3 years ago and having problems discussing in English (still no former education). And I'm sorry, My English better than your Turkish. So please be polute about my grammar errors. :) Everyone likes own dog-meat. And, last week I meet a tiny php shop to fix their code against remote file inclusion. Their code was uber mess and one thing make me sad. Their old coder (which he doesn't know anything about current php development trends) do the job wint under 20k phtml code. (most of k was spend for html tables). maybe 5 functions and so. I'm very sure to updating his code with current trends plus some improvement under (excluding the templates) in 20k I can give the answer for 80% of web demands. And if we look someting more TYPO3 / Joomla / Drupal can do the job. For Ruby, Perl, Python, you have have a web focused frame work to get job done in faster. And that php already web focused language. we need faster, more organized, better language, not uber bloated framwork from ZEND. > > I wish to see fixed function parameter names > > Good luck with that... it's been shot down several times on the PHP > internals list. > > > , option orders, easy and strong input validation in PHP 6. > > Isn't the filters stuff available in PHP5 already for doing stronger > validation. It's not like input validation is difficult. > > > And they give full effort to generate Zend Framework. > > Huh? > > > Then what? It still harder than Ror... > > What is? PHP? What are you talking about? I mean, ZEND Framework still harder to handle than RoR. > > > Hell yes, Compete own community. teh best way to spend your resources... > > Internal competition only makes something better. If all you have are > yes men, then the only answer you'll get is "yes". Having those who > dissent in opinion provides a basis for different views and approaches > to problem solving. May survival of the fittest benefit all both from > the perspective of getting a better final product and from the > perspective of learning from mistakes along the way. Yes of course and that Zend was not M$, they not swim in to dollar filled pools. And wIth zend framework, Zend begin rivalling against CI, Symphony, Solar and other popular framework communuties. (including yours and mine). > Cheers, > Rob. > -- > http://www.interjinn.com > Application and Templating Framework for PHP Regards Sancar
Re: [PHP] Basic Authentication
On Jan 15, 2009, at 12:32 PM, tedd wrote: At 11:43 PM + 1/14/09, Ashley Sheridan wrote: > Surely that's a good thing then? Security through obscurity and all that... Ash Ash: Certainly it's a good thing -- until the client asks for another password. At this point, I have four logon and password combinations to use. I can tell the client if they use one of those, then they can login. However if they want their own, then I have no idea of what the algorithm was/is and thus no way of generating a new combination for them. You see, the problem here is not that I can't set up an authorization scheme -- I can do that easily enough. The problem is that I don't know how the one currently in place on my client's server works in generating passwords. If I knew that, then I could generate the password myself. Hey tedd, One thing I just thought of that I'm sure you checked but just in case... With the current system do they have any way of adding new users to it? If so... there would be info in a file that had the algorithm info you need... Other then that nothing to add except rewrite the whole thing with properly commented code so future people can view/edit the code :) -- Jason Pruim japr...@raoset.com 616.399.2355
Re: [PHP] Basic Authentication
At 12:42 AM +0100 1/15/09, Edmund Hertle wrote: I think I do not really understand your problem... searching for standard crypt algorithms? google, wikipedia and such should help. I solved the problem myself, which basically meant there was no way to determine what the algorithm was except for a no-salt MD5. For example: Here's the password: froggy123 Here's the encoded string: a2667f2ace21c54ed03a35cf946e347a If you checked the the two, you could discover that the algorithm was MD5 without a salt. If the encoding was something else, then a different algorithm was used and most likely you could not tell what algorithm was used unless you knew the salt value. For example, if the salt was "hello" and the encoding was heWf00Lr.jHb6 , then the algorithm could be Crypt, Standard DES or MD5. Understand now? In any event, thanks for trying. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com
[PHP] To check for existing user in database
Hi, I know this is very basic question, this is so because I am a basic programmer struggling to make things work. Where in this code should I be trying to check if the user already exists and throw an error saying "The user already exists ding ding ding". The check has to be done with the emailAddress: Thanks in advance, Chris -- View this message in context: http://www.nabble.com/To-check-for-existing-user-in-database-tp21483013p21483013.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Basic Authentication
At 7:56 PM -0500 1/14/09, Andrew Ballard wrote: I didn't get that from your original post at all. You asked how to "create an encoded password string that would work in a .htaccess file using basic authentication." Yes, but that was before I knew that generating a password from the command line in Unix did not mean that a specific algorithm was going to be used. It appears that any of an assortment of them might be employed from the command line -- if that makes sense. In any event, I see that the problem is not solvable. Thanks for your help. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Finger
On Thu, Jan 15, 2009 at 06:30, Sándor Tamás (HostWare Kft. ) wrote: > Hi, > > My problem is that how I can know that a valid e-mail address is exists on > the mail server? > Is there some PHP function, or protocol, or something? The quick and simple answer is no. Imagine if it was that easy; you think you have a lot of SPAM now? The full answer is that yes, there is a way, but no, there's no native PHP function. -- daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Unadvertised dedicated server deals, too low to print - email me to find out! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Zend Framework...where to start? -- don't.
On Thu, 2009-01-15 at 19:37 +0200, Sancar Saran wrote: > On Thursday 15 January 2009 17:45:35 Robert Cummings wrote: > > > > > > > Hell, yes, signed to from start to end. > > > > > > After RoR, PHP guys (including Zend) goes nuts. > > > Every one eat his brains to develop RoR like Framework. > > > > What are you smoking? I like my framework the way it is. I'm sure others > > like theirs the way it is. In no way do I try to be like RoR and > > probably for good reason since I hear mostly bad things about RoR. > > > Naah, I left somoking more than 3 years ago and having problems discussing in > English (still no former education). > > And I'm sorry, My English better than your Turkish. > So please be polute about my grammar errors. :) > > Everyone likes own dog-meat. > And, last week I meet a tiny php shop to fix their code against remote file > inclusion. Their code was uber mess and one thing make me sad. > > Their old coder (which he doesn't know anything about current php development > trends) do the job wint under 20k phtml code. (most of k was spend for html > tables). maybe 5 functions and so. > > I'm very sure to updating his code with current trends plus some improvement > under (excluding the templates) in 20k I can give the answer for 80% of web > demands. > > And if we look someting more TYPO3 / Joomla / Drupal can do the job. > > For Ruby, Perl, Python, you have have a web focused frame work to get job > done > in faster. > > And that php already web focused language. > > we need faster, more organized, better language, not uber bloated framwork > from ZEND. > > > > I wish to see fixed function parameter names > > > > Good luck with that... it's been shot down several times on the PHP > > internals list. > > > > > , option orders, easy and strong input validation in PHP 6. > > > > Isn't the filters stuff available in PHP5 already for doing stronger > > validation. It's not like input validation is difficult. > > > > > And they give full effort to generate Zend Framework. > > > > Huh? > > > > > Then what? It still harder than Ror... > > > > What is? PHP? What are you talking about? > > I mean, ZEND Framework still harder to handle than RoR. > > > > > > Hell yes, Compete own community. teh best way to spend your resources... > > > > Internal competition only makes something better. If all you have are > > yes men, then the only answer you'll get is "yes". Having those who > > dissent in opinion provides a basis for different views and approaches > > to problem solving. May survival of the fittest benefit all both from > > the perspective of getting a better final product and from the > > perspective of learning from mistakes along the way. > > Yes of course and that Zend was not M$, they not swim in to dollar filled > pools. > > And wIth zend framework, Zend begin rivalling against CI, Symphony, Solar and > other popular framework communuties. (including yours and mine). Ah, I see what your saying... I thought you were railing on PHP (punny eh?) when you were actually railing on Zend in particular. Thanks for the clarification. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Basic Authentication
At 9:11 AM -0600 1/15/09, Boyd, Todd M. wrote: tedd, It would appear your Standard DES and MD5 labels are actually both MD5. Also--there is more than just Standard DES. Once DES was determined to be relatively IN-secure, more algorithms like Triple DES, G-DES, DES-X, LOKI89, and ICE were created. You might be looking at a Triple DES hash. HTH, // Todd Todd: Yes, I saw that as well. The code is directly from the crypt link, namely: http://php.net/manual/function.crypt.php Example #3. However, I may have made a mistake -- I'll look into it. Thanks, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: iconv is messing up a spreadsheet generated by the Spreadsheet Excel Writer
Hi there, I'm not sure if this is the same problem but after I struggled with strange characters in Spreadsheet Excel Writer for some time I wrote an article from my lessons learned: http://research.elabs.govt.nz/generating-excel-spreadsheets-with-maori-macrons-in-php/ It contains some example code, hope it helps. Ewen 2009/1/14 The charset: latin1 and the collation: latin1_swedish_ci. Trivia quiz at a MySQL presentation at my Chicago PHP User Group a few year ago comes in handy! The defaults for MySQL are actually latin1_swedish as that is the native language of the original developer, (?Monty Widenus?) This charset differs in only one character (or two chars switched?) from English. It seems unlikely to produce drastic problems in iconv, but I have no idea what I'm actually talking about. We now return you to your regularly scheduled program! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Thanks man that did it :-) . What exactly was the problem you've noticed (I am seeing a diff between the two files bu t I am not sure I fully understand)? -- Thodoris
Re: [PHP] Basic Authentication
At 12:46 PM -0500 1/15/09, Jason Pruim wrote: Hey tedd, One thing I just thought of that I'm sure you checked but just in case... With the current system do they have any way of adding new users to it? If so... there would be info in a file that had the algorithm info you need... Other then that nothing to add except rewrite the whole thing with properly commented code so future people can view/edit the code :) Jason: It would have been nice if the previous programmer had documented ANYTHING. But unfortunately, for the last year, I've had to discover everything myself. On the good side, it's been a learning experience. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Looking for an app...
Hi List! I know this is somewhat basic.. and I am searching google as I type! I'm looking for a client/server app that allows me to have a quick/dirty client that can upload/download a file to a server app, with the server app copying the file to a given dir... Code samples, or pointers to a site where I can download this would be great!! I don't want a straight FTP, as I want to do more things with the server piece... And yes, a php/apache kind of app would be cool.. thanks!! -g -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Javascript header
Hello there, Kind of newbie to PHP and javascript... I have this problem: I want to pass a javascript variable to a PHP code. I am inside a javascript function that is creating HTML elements dynamically. After creating a tag, I want to populate it with a list of variable names from $_SESSION['subgroupcolumn'] . Here is part of the code: . . . location.href="subgroup.php?m=" + m; var linner= "for ($c=1; $c < $_SESSION['rows']; $c++){ echo( '' . $_SESSION['subgroupcolumn'][$c][0] . '\n' ); }" ; document.getElementById(selectedSubsetText + hitcounter).innerHTML = linner ; . . . Since we cannot pass a javascript var to PHP directly, I am redirecting to subgroup.php and sending the variable ("m") and getting it there using a $_GET. Now the question: In subgroup.php, after I get the variable m, I create the $_SESSION['subgroupcolumn'] array then I redirect to the initial page. Obviously it's not working because the code after location.href="subgroup.php?m=" + m; is not executing after coming back to the initial page How do I make it to continue executing the javascript code? I hope it's clear... Thanks for your help. -- View this message in context: http://www.nabble.com/PHP-Javascript-header-tp21483721p21483721.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Quotes in querys
It is over head, but it caches the execution plan for multiple runs of the script. So different users with different data will use the same cached query on the database. Saving processing time. It also prevents SQL injection on the fly because you are indicating what data type each place holder will need to accept. No, it's per session. http://dev.mysql.com/doc/refman/5.0/en/sql-syntax-prepared-statements.html The scope of a prepared statement is the client session within which it is created. Other clients cannot see it. Well he probably meant that the mysql server will cache the query and that is true. But I think that mysql uses the cache only if the query is the exact same... So it does no good in this case. -- Thodoris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Zend Framework...where to start? -- don't.
Daevid Vincent wrote: > > The pages are significantly slower than straight PHP by orders of > magnitude: http://paul-m-jones.com/?p=315 > http://www.codinghorror.com/blog/archives/001198.html I know this blog isn't specifically about PHP but he makes a good general point that can be applied to this conversation very well. For those who don't want to read the article it's about the cost of time spent programming vs hardware. Even if a framework will run slower than raw HTML or a simple PHP page on it's own, if that framework saves you a significant amount of time developing, and the server your running the application on isn't as responsive as you like, maybe it would be cheaper just to add another server and load balance the two. A lot of frameworks include stuff exactly for load balancing making your whole application a lot more flexible and able to withstand a lot more growth without you having to write any extra code.
Re: [PHP] Security question
"VamVan" wrote in message news:12eb8b030901141421u6741b943q396bc784136b7...@mail.gmail.com... > On Wed, Jan 14, 2009 at 2:22 PM, Frank Stanovcak > wrote: > >> This is mostly to make sure I understand how sessions are handled >> correctly. >> As far as sessions are concerned the variable data is stored on the >> server >> (be it in memory or temp files), and never transmitted accross the net >> unless output to the page? So this means I should be able to store the >> username and password for a program in session vars for quick >> validations, >> and if I force rentry of the password for sensitive areas (every time) >> even >> if someone mannages to spoof the sesid all they will have access to is >> non >> sensitive areas? This also assumes I, at least, quick validate at the >> start >> of every page immideately after starting the session. >> >> >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> > Password should never be stored anywhere in clear text. You can store md5 > version in session or database. As long as password is encrypted ure fine > and safe. > > Thanks, > V > Thanks V So if I store the hash in the db, and in the session var then I should be resonably safe provided I salt the hash prior to storing it? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Javascript header
Applejus wrote: > Hello there, > > Kind of newbie to PHP and javascript... I have this problem: > > I want to pass a javascript variable to a PHP code. > I am inside a javascript function that is creating HTML elements > dynamically. After creating a tag, I want to populate it with a > list of variable names from $_SESSION['subgroupcolumn'] . > Here is part of the code: > > . > . > . > location.href="subgroup.php?m=" + m; > var linner= "for ($c=1; $c < $_SESSION['rows']; $c++){ echo( ' value=' . $c . '>' . $_SESSION['subgroupcolumn'][$c][0] . '\n' ); > }" ; > document.getElementById(selectedSubsetText + hitcounter).innerHTML = linner > ; > . > . > . > Since we cannot pass a javascript var to PHP directly, I am redirecting to > subgroup.php and sending the variable ("m") and getting it there using a > $_GET. Now the question: > In subgroup.php, after I get the variable m, I create the > $_SESSION['subgroupcolumn'] array then I redirect to the initial page. > Obviously it's not working because the code after > location.href="subgroup.php?m=" + m; is not executing after coming back to > the initial page > > How do I make it to continue executing the javascript code? > > I hope it's clear... > > Thanks for your help. > > The problem is that you are changing the location of the page and then chaning the location back. Really you need an AJAX call using XMLHttpRequest. There are probably easier examples, but here is one: http://www.w3schools.com/PHP/php_ajax_suggest.asp -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] To check for existing user in database
Welcome to the list, Chris. Your code is going to require some rewriting to save you a lot of headaches and serious security issues down the road. So here we go: On Thu, Jan 15, 2009 at 12:46, Chris Carter wrote: */ if($_POST['submit']) { // Check to see if the user already exists. $sql = "SELECT emailAddress AS email FROM owners "; $sql .= "WHERE emailAddress='".mysql_real_escape_string($_POST['emailAddress'])."' "; $sql .= "LIMIT 0,1"; /* Several things are happening here: 1.) We're spanning the variable by using $sql = "" followed by $sql .= "" to append. 2.) We're using MySQL's `AS` aliasing syntax to shorten the column name on output (not in the DB) 3.) We're checking to see if $_POST['emailAddress'] is already registered. 4.) We're SANITIZING INPUT() with mysql_real_escape_string(). VERY IMPORTANT 5.) We're telling MySQL that we only need the first result returned, because that will still be a positive result. */ $result = mysql_query($sql); // Get the resource ID of this query connection as $result. if(($row = mysql_fetch_assoc($result)) == True) { // Allows error suppression and validation in one shot /* This record already exists in the database, and it's accessible in $row['email'] So now you can do as you please. For example: */ echo "The user already exists ding ding ding.\n"; } else { // If there was no matching record // Insert new entry in the database if entry submitted $emailAddress = $_POST['emailAddress']; $confEmail = $_POST['confEmail']; $password = $_POST['password']; $confPassword = $_POST['confPassword']; $body = "Some email text"; // insert new entry into database --- REMEMBER TO SANITIZE USER INPUT HERE! $sql = "insert into `owners` (emailAddress, confEmail, password,confPassword) VALUES ("; $sql .= "'".mysql_real_escape_string($emailAddress)."',"; $sql .= "'".mysql_real_escape_string($confEmail)."',"; $sql .= "'".mysql_real_escape_string($password)."',"; $sql .= "'".mysql_real_escape_string($confPassword)."')"; if(mysql_query($sql)) { mail($emailAddress, "Thank you for registering!", $body, "From: some...@someone.com"); header("Location: thankYou.php"); } else { /* If there's an error, don't show this to the user - log it with a simple log mechanism instead. */ $err = mysql_error(); $logfile = dirname(dirname(__FILE__)).'/php_includes/sqlerror.log'; // Store the log out of the web directory. // The following line writes the current file, line, SQL query, and error message received. $message = "SQL Error in ".__FILE__." near line #".__LINE__.": \"".$sql."\" (".$err.")\n"; file_put_contents($logfile,$message,FILE_APPEND); // Append the entry to the log; if the file doesn't exist, create it. // Output an error message to the user. echo "We're sorry. We're experiencing temporary issues with our database. We are working to repair this problem.\n"; } } // And thus ends the if($_POST['submit']) block ?> There are a bunch of different styles, methods, and options, which would take days to discuss but this should get you going on the right path. From here on, RTFM and STFW, and feel free to ask any questions here that you could find answers to on the web. Good luck! -- daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Unadvertised dedicated server deals, too low to print - email me to find out! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Looking for an app...
bruce wrote: > Hi List! > > > I know this is somewhat basic.. and I am searching google as I type! I'm > looking for a client/server app that allows me to have a quick/dirty client > that can upload/download a file to a server app, with the server app copying > the file to a given dir... > > Code samples, or pointers to a site where I can download this would be > great!! I don't want a straight FTP, as I want to do more things with the > server piece... > > And yes, a php/apache kind of app would be cool.. > > thanks!! > > -g > I remember opendocman, owl and philer, though I've never used them. Depending upon the features you need you can easily write your own. HTML form with an input type=file PHP file to acept and move the file PHP file to view files in certain directory http://us3.php.net/manual/en/features.file-upload.post-method.php -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] What's the best way to rotate, resize, and thumbnail?
I have a site (done in CodeIgniter) where users can upload pictures. When they upload a picture, I want to rotate it (rotating is optional, depending on how much cpu/ram I end up needing), resize it, and create a thumbnail. Right now I'm doing it all in that order using GD, but I'm not sure if it's as efficient as it could be. What's the best way to make this process faster? -- View this message in context: http://www.nabble.com/What%27s-the-best-way-to-rotate%2C-resize%2C-and-thumbnail--tp21485027p21485027.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Zend Framework...where to start? -- don't.
On Thu, 2009-01-15 at 13:52 -0500, Sam Stelfox wrote: > Daevid Vincent wrote: > > > > > The pages are significantly slower than straight PHP by orders of > > magnitude: http://paul-m-jones.com/?p=315 > > > > http://www.codinghorror.com/blog/archives/001198.html > > I know this blog isn't specifically about PHP but he makes a good > general point that can be applied to this conversation very well. > > For those who don't want to read the article it's about the cost of > time spent programming vs hardware. Even if a framework will run > slower than raw HTML or a simple PHP page on it's own, if that > framework saves you a significant amount of time developing, and the > server your running the application on isn't as responsive as you > like, maybe it would be cheaper just to add another server and load > balance the two. A lot of frameworks include stuff exactly for load > balancing making your whole application a lot more flexible and able > to withstand a lot more growth without you having to write any extra > code. That sounds great in theory, but the reality is harsh and disappointing. That was my biggest problem with Symfony -- not raw speed of page serving (although it is slow and you can see/feel it. and we did have 5 servers: load balancer/web1/web2/masterDB/slaveDB) -- but the overhead of creating a page. Learning the framework took significant time. Learning it well enough to be productive in it took even more. There is a difference from reading a book and understanding the concepts vs. sitting down and creating something that you don't have an example for. That takes a lot of research, document reading (and symfony's documentation SUCKED -- maybe I'm just spoiled by php.net), asking questions on the email list, waiting for replies, running into limitations *in* the framework or WORSE yet, BUGS *in* the framework. Then just to do the simplest of things you have to extract it into this MVC architecture and ORM and do you use a partial or some other mechanism. Then you have to pass arrays of parameters and objects around. Then there are NEW "reserved" words that the framework has. Pages that I could have written (and written very well, clean, maintainable and scalable) in an hour were now taking hours or more because of all the routing, models, views, controllers, yaml, schema, scripts to rebuild/generate, etc that needed to be setup. I don't disagree with the concept of a framework. I think it has an intrinsic value and would love to see them evolve and improve. My problem is with the current state of affairs. The bulk. The bloat. The bugs. The limitations. Ignoring Joe Blow and his blog or photo album or some other stupid "who gives a $hit about it" website -- the way I see it, there are those that want a framework to save them time to get a site up quickly... a prototype lets say. So great, they're wonderful for that. Symfony does some magic to create the "CRUD" for admin backend pages automatically even. But now you have a site up and you want to start building upon it -- you're stuck with this cruft and bloated framework "forever" now. OR you have to re-build it from scratch all over again. The other kinds of people are those who are writing a serious SaaS or other enterprise/significant-money-and-time-involved site. They are going to want all kinds of control and customization and optimization of the code and database. Once you start getting into 100k or 1M+ rows and joins, ORM fails miserably, so then you have to "optimize" by doing raw SQL -- and once you've done that, you loose the (perceived) benefits of the ORM -- so why bother with that layer in the first place. Just use a hybrid base class (as I posted) and get an Object with all the benefits of SQL too. Ignoring that, so you want some feature. Great! You go hunt and find a plug-in to save you weeks of work -- guess what? It is NEVER going to do EVERYTHING you want it to do. So now what? Do you modify the plugin (and forever merge those changes back with new updates)? Do you try to extend it somehow if even possible? Or do you just write your own? Probably you will write your own -- so again, what did the framework save you? At my last company, we wanted comment sections, blogs, photo albums, voting, ranking and all sorts of other "common" features. Well, if you didn't have your database in the way they needed it, or your layout the way they had it, or whatever other idiosyncrasy required, it was barely usable and often unusable. Finally once you start using a framework for everything, it seems people forget how to do anything outside of it. At my last company, they had no concept of straight SQL which improved a news section with 100k rows to parse from minutes to seconds. They didn't know about include() which we used to automate the menu system for sub-sections and was impossible to do (the way we wanted to do it) with the framework due to scoping issues. The worst example was this script that had to update various t
Re: [PHP] To check for existing user in database
You might want to (seriously) look at the PEAR Auth class. It can save you a TON of time...all the stuff you're trying to do with this code (that you were just told you're going to have to rewrite) is already done for you. It's very handy for registering/tracking users of your sites. John Corry On Thu, Jan 15, 2009 at 1:43 PM, Daniel Brown wrote: >Welcome to the list, Chris. > >Your code is going to require some rewriting to save you a lot of > headaches and serious security issues down the road. So here we go: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to display new icon for news posted within 2 days?
paragasu wrote: > is it possible to do it like SELECT *, UNIX_TIMESTAMP(post_date)-172,800 as is_new FROM tbl > $post = mysqli_fetch_object($sql); if($post->is_new) echo ''; >From what I can tell, you'll just have a timestamp 2 days earlier than the actual post date in the is_new var. So unless the post date is 172800 or earlier it will eval to true. How about: SELECT *, UNIX_TIMESTAMP(post_date) as ts FROM tbl if($post->ts > (time()-172800)) { echo ''; } -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: [PHP] Zend Framework...where to start? -- don't.
I think I'm going to stick with objects generated by POG, PEAR classes where they can save me time and Smarty templates for display. Glad we had this little fireside chat before I started on my next project with an ambition to use some fancy new framework. You guys saved me what sounds like a LOT of time. Thanks, John Corry
Re: [PHP] What's the best way to rotate, resize, and thumbnail?
Umm I don't think there is any benchmark tests that will suit your case, it really depends on what you are going to do to the image. I suggest you to benchmark and measure these things, I also know codeigniter has a built-in image editing class, and as far as I remember you can choose in your config files whether to use imagemagick or GD. HTH, Nitsan On Thu, Jan 15, 2009 at 9:27 PM, port23user wrote: > > I have a site (done in CodeIgniter) where users can upload pictures. When > they upload a picture, I want to rotate it (rotating is optional, depending > on how much cpu/ram I end up needing), resize it, and create a thumbnail. > Right now I'm doing it all in that order using GD, but I'm not sure if it's > as efficient as it could be. What's the best way to make this process > faster? > -- > View this message in context: > http://www.nabble.com/What%27s-the-best-way-to-rotate%2C-resize%2C-and-thumbnail--tp21485027p21485027.html > Sent from the PHP - General mailing list archive at Nabble.com. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
Re: [PHP] how to display new icon for news posted within 2 days?
Shawn McKenzie wrote: > paragasu wrote: >> is it possible to do it like > SELECT *, UNIX_TIMESTAMP(post_date)-172,800 as is_new FROM tbl > $post = mysqli_fetch_object($sql); > if($post->is_new) > echo ''; > > From what I can tell, you'll just have a timestamp 2 days earlier than > the actual post date in the is_new var. So unless the post date is > 172800 or earlier it will eval to true. How about: > > SELECT *, UNIX_TIMESTAMP(post_date) as ts FROM tbl > > if($post->ts > (time()-172800)) { > echo ''; > } > > In MySQL 5+ something like this may work with your code: SELECT *, IF(UNIX_TIMESTAMP(CURRENT_TIMESTAMP) - UNIX_TIMESTAMP(post_date) < 172800, 1, 0) AS is_new FROM tbl -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: iconv is messing up a spreadsheet generated by the Spreadsheet Excel Writer
Thanks man that did it :-) . What exactly was the problem you've noticed (I am seeing a diff between the two files bu t I am not sure I fully understand)? -- Thodoris Yes I have previously worked on loads of Greek sites. Some how strange enough I had problems whenever I used UTF-8 to store content and even display on the web page. So I had to use default latin swedish ci in the db and also use Charset 1253 in the html meta tag to get everything displayed properly. Thanks, V
[PHP] I can't get help from the binary administrator
Hi, folks. I own an old Pentium I machine, and I pay phone connection with Internet by the minute, so I want to recieve a digest from the list. In the first communication from this list I was said: "For help and a description of available commands, send a message to: " Does anyone know address subject text for getting a digest instead of the individual mails? Thanks. Eduardo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] I can't get help from the binary administrator
On Thu, Jan 15, 2009 at 1:35 PM, Eduardo Varela wrote: > Hi, folks. I own an old Pentium I machine, and I pay phone connection > with Internet by the minute, so I want to recieve a digest from the > list. > > In the first communication from this list I was said: > > "For help and a description of available commands, send a message to: > " > > Does anyone know > address > subject > text > for getting a digest instead of the individual mails? > > Thanks. > Eduardo > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > Go here for the archives http://www.php.net/mailing-lists.php You will find most of the lists have archives. -- Kyle Terry | www.kyleterry.com
Re: [PHP] Security question
Frank Stanovcak wrote: > "VamVan" wrote in message > news:12eb8b030901141421u6741b943q396bc784136b7...@mail.gmail.com... > >> On Wed, Jan 14, 2009 at 2:22 PM, Frank Stanovcak >> wrote: >> >> >>> This is mostly to make sure I understand how sessions are handled >>> correctly. >>> As far as sessions are concerned the variable data is stored on the >>> server >>> (be it in memory or temp files), and never transmitted accross the net >>> unless output to the page? So this means I should be able to store the >>> username and password for a program in session vars for quick >>> validations, >>> and if I force rentry of the password for sensitive areas (every time) >>> even >>> if someone mannages to spoof the sesid all they will have access to is >>> non >>> sensitive areas? This also assumes I, at least, quick validate at the >>> start >>> of every page immideately after starting the session. >>> >>> >>> >>> -- >>> PHP General Mailing List (http://www.php.net/) >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> >>> >>> >> Password should never be stored anywhere in clear text. You can store md5 >> version in session or database. As long as password is encrypted ure fine >> and safe. >> >> Thanks, >> V >> >> > > Thanks V > So if I store the hash in the db, and in the session var then I should be > resonably safe provided I salt the hash prior to storing it? > > > > Yes, but don't use md5. There are lookups available to help someone crack it. Try sha1: http://us3.php.net/sha1 Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] I can't get help from the binary administrator
Eduardo Varela wrote: Hi, folks. I own an old Pentium I machine, and I pay phone connection with Internet by the minute, so I want to recieve a digest from the list. In the first communication from this list I was said: "For help and a description of available commands, send a message to: " Does anyone know address subject text for getting a digest instead of the individual mails? Probably easiest to unsubscribe fully then re-subscribe to just the digest. Not sure if there is a command to change you to a digest-only email. -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Parsing HTML href-Attribute
Hey, I want to "parse" a href-attribute in a given String to check if there is a relative link and then adding an absolute path. Example: $string = ''; I tried using regular expressions but my knowledge of RegEx is very limited. Things to consider: - $string could be quite long but my concern are only those href attributes (so working with explode() would be not very handy) - Should also work if href= is not using quotes or using single quotes - link could already be an absolute path, so just searching for href= and then inserting absolute path could mess up the link Any ideas? Or can someone create a RegEx to use? Thanks
Re: [PHP] I can't get help from the binary administrator
On Thu, Jan 15, 2009 at 16:35, Eduardo Varela wrote: > > Does anyone know > address > subject > text > for getting a digest instead of the individual mails? You will have to first unsubscribe from the list, then subscribe to digest format at http://php.net/mailinglists If you have any problem in the process, let me know and I will be happy to help get your subscription switched over. Thanks, Eduardo. -- daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Unadvertised dedicated server deals, too low to print - email me to find out! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] To check for existing user in database
At 9:46 AM -0800 1/15/09, Chris Carter wrote: Chris: That's not the way I would do it. After establishing a connection with the database, I would use the query: $query "SELECT email FROM owners WHERE email = '$emailAddress' ": $result = mysql_query($query) or die(mysql_error()); if(mysql_affected_rows()) { // then report a duplicate email/record. } else { // else insert a new record in the dB. } HTH's tedd --- Hi, I know this is very basic question, this is so because I am a basic programmer struggling to make things work. Where in this code should I be trying to check if the user already exists and throw an error saying "The user already exists ding ding ding". The check has to be done with the emailAddress: // database information $host = 'xxx'; $user = 'xxx'; $password = 'xxx'; $dbName = 'xxx'; if ($_POST['submit']) { // connect and select the database $conn = mysql_connect($host, $user, $password) or die(mysql_error()); $db = mysql_select_db($dbName, $conn) or die(mysql_error()); // insert new entry in the database if entry submitted $emailAddress = $_POST['emailAddress']; $confEmail = $_POST['confEmail']; $password = $_POST['password']; $confPassword = $_POST['confPassword']; $body = "Some email text"; // insert new entry into database $sql = "insert into `owners` (emailAddress, confEmail, password, confPassword) VALUES ('$emailAddress', '$confEmail', '$password', '$confPassword')"; if(mysql_query($sql)) { mail($emailAddress, "Thank you for registering!", $body, "From: some...@someone.com"); header("Location: thankYou.php"); } else { die("Error! Could not insert values".mysql_error()); } } ?> Thanks in advance, Chris -- View this message in context: http://www.nabble.com/To-check-for-existing-user-in-database-tp21483013p21483013.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] To check for existing user in database
2009/1/15 tedd > At 9:46 AM -0800 1/15/09, Chris Carter wrote: > > Chris: > > That's not the way I would do it. After establishing a connection with the > database, I would use the query: > > $query "SELECT email FROM owners WHERE email = '$emailAddress' ": > $result = mysql_query($query) or die(mysql_error()); > > if(mysql_affected_rows()) > { > // then report a duplicate email/record. > } > else > { > // else insert a new record in the dB. > } > > HTH's > > tedd You should not forget to use mysql_real_escape_string() just as Daniel Brown explained... -eddy
[PHP] Mirroring/caching PHP webpages.
For some time I have had feedback pages on several of my websites based on the example given by David Powers in chapter 6 of "PHP for Dreamweaver 8". These worked fine for some years, but some months ago someone started stuffing pornographic advertisements into them. A few weeks ago I got fed up with these messages, and devised a very simple filter to reject them (I won't explain how this works, because if I did the perpetrators could immediately change their technique to defeat it). If the content was acceptable I handled the message in the normal way, but otherwise I deleted the contents, and forwarded the message to a different address with the title "rubbish from XXX website". This worked well, but then I decided I didn't need to know anything about this stuff at all, so I modified the logic so that if the message is unacceptable it is simply dumped, but the sender is still shown the normal "Thank you for your feedback" message. This way the sender cannot tell whether or not his message has actually been sent, and so he cannot experiment to try to break the filter. Now if I try to send myself bad messages they simply disappear without trace, as expected, but I am still getting one or two messages a day sent with the version 1 (censored) logic. I have changed the messages in my new version, and verified that the old messages do not appear anywhere on my hard disk, and that there is only the new version of the feedback procedure on my server. The only explanation I can see is that someone has somehow managed to cache or mirror the version 1 logic, and is still dutifully stuffing pornography into it. As it is my understanding that the PHP code which handles the processing is inaccessible to the user, I cannot understand how this could have been done. Does anyone have any suggestions? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mirroring/caching PHP webpages.
On Thu, Jan 15, 2009 at 4:57 PM, Clancy wrote: > For some time I have had feedback pages on several of my websites based on > the example > given by David Powers in chapter 6 of "PHP for Dreamweaver 8". These worked > fine for some > years, but some months ago someone started stuffing pornographic > advertisements into them. > > A few weeks ago I got fed up with these messages, and devised a very simple > filter to > reject them (I won't explain how this works, because if I did the > perpetrators could > immediately change their technique to defeat it). If the content was > acceptable I > handled the message in the normal way, but otherwise I deleted the > contents, and forwarded > the message to a different address with the title "rubbish from XXX > website". This worked > well, but then I decided I didn't need to know anything about this stuff at > all, so I > modified the logic so that if the message is unacceptable it is simply > dumped, but the > sender is still shown the normal "Thank you for your feedback" message. > This way the > sender cannot tell whether or not his message has actually been sent, and > so he cannot > experiment to try to break the filter. > > Now if I try to send myself bad messages they simply disappear without > trace, as expected, > but I am still getting one or two messages a day sent with the version 1 > (censored) > logic. I have changed the messages in my new version, and verified that > the old messages > do not appear anywhere on my hard disk, and that there is only the new > version of the > feedback procedure on my server. > > The only explanation I can see is that someone has somehow managed to cache > or mirror the > version 1 logic, and is still dutifully stuffing pornography into it. As it > is my > understanding that the PHP code which handles the processing is > inaccessible to the user, > I cannot understand how this could have been done. Does anyone have any > suggestions? I don't think that can happen either. Mirroring Server level Caching happens on ur server not on theirs... My explanation would be your filter is not working as expected. you may not filter everything .. Its depends on ur script logic. Thanks, V
[PHP] print a to z
i have this cute little problem. i want to print a to z for site navigation my first attempt work fine for($i = '65'; $i < '91'; ++$i) echo chr($i); but someone point me a more interesting solutions for($i = 'a'; $i < 'z'; ++$i) echo $i the only problem with the 2nd solutions is it only print up to Y without z. so how to print up to z with the 2nd solutions? because it turn out that you cant to something like for($i = 'a'; $i <= 'z'; ++$i).. thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] print a to z
paragasu wrote: i have this cute little problem. i want to print a to z for site navigation my first attempt work fine for($i = '65'; $i < '91'; ++$i) echo chr($i); but someone point me a more interesting solutions $letters = range('a', 'z'); foreach ($letters as $letter) { echo $letter; } -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] print a to z
> $letters = range('a', 'z'); > foreach ($letters as $letter) { > echo $letter; > } wow.. that is a very nice solutions you give me chris. thanks On 1/15/09, Chris wrote: > paragasu wrote: >> i have this cute little problem. i want to print a to z for site >> navigation >> my first attempt work fine >> >> for($i = '65'; $i < '91'; ++$i) >> echo chr($i); >> >> but someone point me a more interesting solutions > > $letters = range('a', 'z'); > foreach ($letters as $letter) { >echo $letter; > } > > -- > Postgresql & php tutorials > http://www.designmagick.com/ > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Zend Framework...where to start? -- don't.
On Thu, Jan 15, 2009 at 04:20:16AM -0500, Robert Cummings wrote: > On Wed, 2009-01-14 at 21:17 -0500, Paul M Foster wrote: > > > > Incidentally, I would differ from the reviewer in the link above only in > > this respect: He maintains that every line of code adds time. While this > > is true, I believe it's the number of files which have to be opened > > which drags down framework numbers the most. When I wrote C code, the > > CPU would blaze through the actual code, but file opens and reads > > consumed far more time than in-memory code execution. > > Moot point if you're using an accelerator like eAccelerator or APC since > these cache the data in memory. Similarly, most operating systems cache > file reads also, so it's probably not as expensive without an > accelerator as you think either. Perhaps, but since much of the C code I've written is on Linux servers like those used by most of the hosting companies, and since I can't control whether they do or don't cache pages, my personal experience (and simple logic) guides me to believe file manipulation is far more time consuming than simple manipulation of strings, number and arrays. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing HTML href-Attribute
Hi Edmund, You want a regex that looks something like this: $result = preg_replace('%(href=)("|\')(?!c:/)(.+?)("|\')%', '\1\2c:/my_absolute_path\3\4', $subject); This example assumes that your absolute path begins with "c:/". You would change this to whatever suits. You would also change "c:/my_absolute_path" to be whatever appropriate value indicates the absolute path element that you want to prepend. Note: this will NOT accound for hrefs that are not encapsulated in either ' or ". The problem being that while you can probably predictably how the substring starts, it would be more difficult to determine how it ends, unless you can provide a white list of file extensions for the regex (ie, if you know you only ever link to, for example, files with .php and or .html extensions). In that case, you probably could alter the regex to test for these instead of a ' or ". M is for Murray On Fri, Jan 16, 2009 at 8:13 AM, Edmund Hertle < edmund.her...@student.kit.edu> wrote: > Hey, > I want to "parse" a href-attribute in a given String to check if there is a > relative link and then adding an absolute path. > Example: > $string = ' href="/foo/bar.php" >'; > > I tried using regular expressions but my knowledge of RegEx is very > limited. > Things to consider: > - $string could be quite long but my concern are only those href attributes > (so working with explode() would be not very handy) > - Should also work if href= is not using quotes or using single quotes > - link could already be an absolute path, so just searching for href= and > then inserting absolute path could mess up the link > > Any ideas? Or can someone create a RegEx to use? > > Thanks >
Re: [PHP] Zend Framework...where to start? -- don't.
On Thu, Jan 15, 2009 at 04:17:51AM -0500, Robert Cummings wrote: > On Wed, 2009-01-14 at 21:17 -0500, Paul M Foster wrote: > > On Wed, Jan 14, 2009 at 01:39:02PM -0800, Daevid Vincent wrote: > > > > > > > >The pages are significantly slower than straight PHP by orders of > > >magnitude: [1]http://paul-m-jones.com/?p=315 > > > > What a great link! I've never seen this kind of comparison before. HTML > > is 70% faster than straight PHP, and the frameworks (even codeigniter) > > deliver less than 20% of the performance of straight PHP. > > It's not a fair comparison. It's like saying here's a bucket of water. I > want you to take it across the road using one of the following methods: I wouldn't consider it a truly scientific comparison. The testing method seems a little odd to me. Nonetheless, the point is makes is clear: PHP is 70% (more or less) efficient in rendering pages than straight HTML, and the "best" frameworks are only about 20% as efficient as straight PHP. We can argue about the exact numbers, but the results make clear that for speed HTML > PHP > frameworks. (And really, can you logically argue that point?) From this, you don't draw the conclusion to not use frameworks or PHP. From this, you now know one of the trade-offs in using PHP and frameworks. And you get some idea of the magnitude of its impact. (These guys didn't even bother to test HTML with a bunch of Javascript or complex CSS in it. Might PHP have been faster?) Is *coding* faster and more efficient with frameworks? Sure. Does the code execute as fast? No. If execution speed is your priority, then you either scrap the framework, resort to a caching solution (which some of the frameworks already have in place, but which the testers didn't test), or figure something else out (like C?). If execution speed isn't your priority, then you might look instead at a framework. Anyway, the survey is just a tool which lets you know about one of the trade-offs in web design. I doubt any other method of testing would skew the results all that much. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mirroring/caching PHP webpages.
On Fri, Jan 16, 2009 at 11:57:24AM +1100, Clancy wrote: > For some time I have had feedback pages on several of my websites based > on the example > given by David Powers in chapter 6 of "PHP for Dreamweaver 8". These worked > fine for some > years, but some months ago someone started stuffing pornographic > advertisements into them. > > A few weeks ago I got fed up with these messages, and devised a very simple > filter to > reject them (I won't explain how this works, because if I did the > perpetrators could > immediately change their technique to defeat it). If the content was > acceptable I > handled the message in the normal way, but otherwise I deleted the contents, > and forwarded > the message to a different address with the title "rubbish from XXX website". > This worked > well, but then I decided I didn't need to know anything about this stuff > at all, so I > modified the logic so that if the message is unacceptable it is simply > dumped, but the > sender is still shown the normal "Thank you for your feedback" message. This > way the > sender cannot tell whether or not his message has actually been sent, > and so he cannot > experiment to try to break the filter. > > Now if I try to send myself bad messages they simply disappear without > trace, as expected, > but I am still getting one or two messages a day sent with the version 1 > (censored) > logic. I have changed the messages in my new version, and verified that > the old messages > do not appear anywhere on my hard disk, and that there is only the new > version of the > feedback procedure on my server. > > The only explanation I can see is that someone has somehow managed to > cache or mirror the > version 1 logic, and is still dutifully stuffing pornography into it. As > it is my > understanding that the PHP code which handles the processing is inaccessible > to the user, > I cannot understand how this could have been done. Does anyone have > any suggestions? > If Google can spider and read your site, why can't someone else? I've had similar things happen. Any program that uses the HTTP protocol to fetch your site will only get the page as rendered by the server-- sans PHP. But I can imagine someone else programming something to snag the page a different way-- *with* PHP. But actually, they don't even have to be that sophisticated. All they have to do is submit a message to your form the first time, note the variables and their characteristics, and then resubmit that same type of content later using the same variable names and characteristics. Here's something you might do: 1) Rename the page in question. That way their submission won't piggyback on your existing PHP code. 2) Change all the variable names in the file. Chances are, they're just submitting an HTTP request with the proper POST/GET variables so your page processes it as though it were being accessed "live". But if they try to submit this same content to a form that goes nowhere, Apache will just give them a 404 error. Alternatively, if you change your variable names and they submit to your existing form, your PHP can simply ignore it. Also, you might try CAPTCHA (look it up). It tries to weed out human from non-human surfers. You've probably got a 'bot submitting to you, so this might help. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] print a to z
On Thu, Jan 15, 2009 at 08:32:14PM -0800, paragasu wrote: > i have this cute little problem. i want to print a to z for site navigation > my first attempt work fine > > for($i = '65'; $i < '91'; ++$i) > echo chr($i); > > but someone point me a more interesting solutions > > for($i = 'a'; $i < 'z'; ++$i) > echo $i > > the only problem with the 2nd solutions is it only print up to Y without z. > so how to print up to z with the 2nd solutions? because it turn out > that you cant to something > like for($i = 'a'; $i <= 'z'; ++$i).. for ($i = 'a'; $i <= 'z'; $i++) echo $i; Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Zend Framework...where to start? -- don't.
Hi Daevid, Your included db.inc.php file contains what appears to be a very strict injunction against people on this list making use of it. In particular, these lines: #--- # # Confidential - Property of Symcell Corporation # Do not copy or distribute. # Copyright 2005-2008 Symcell Corporation. All rights reserved. # #--- Any chance you can resend this file without that warning included, if you have the authority to remove it? All the best, M is for Murray On Thu, Jan 15, 2009 at 7:39 AM, Daevid Vincent wrote: > Not to start a Holy War (as these "to framework" or "not to framework" > debates often turn into), but I personally had a horrible experience with > using frameworks. I was forced to use Symfony at my last job and it was so > cumbersome and slow to do even the simplest things. The whole MVC thing can > be overkill. Plus the learning curve can be quite steep. Then if you want to > hire other developers to work with you, you have to train them and let them > ramp up on not only the framework but also your core project too! More > wasted time. > > The pages are significantly slower than straight PHP by orders of > magnitude: http://paul-m-jones.com/?p=315 > > The basic problem with frameworks is they try to be one thing for all > people. This carries a lot of baggage with it. There's a lot of crap you end > up pulling in that you don't want/need. Plus if you want to deviate at all, > you either have to roll your own, or sometimes you simply just can't. They > seem attractive with all their plugins and stuff, but honestly, rarely do > the plugins do EXACTLY what you want, the way you want. It might be as > simple as trying to change the look/feel of a button or something and you'll > find out that you can't -- so now you have this website that has this > section that doesn't look like the rest of your site. And if you find a bug, > you have to try to either fix it yourself and then keep those changes > migrated into new updates, or submit it to the developer and hope they > implement them (and trust me, you can submit to them and have them rejected > for all sorts of lame reasons -- even though the work has been done and > you're using it!) > > I advise against it. Just follow good practices and use thin wrappers and > functions. Don't get all OO googlie eyed and try to over-engineer and > over-OO the code. OO is great for some things (like a User class) but don't > start making some OO page renderer or form builder. Don't fall into the DB > Abstraction trap either -- just use a wrapper around your DB calls (see > attached), so you can swap out that wrapper if (and you almost never do) you > change the DB. Don't be suckered by something like QuickForms -- you WILL > run into limitations that you can't get around and are at their mercy. Don't > buy the hype that DIV's are the magic bullet and TABLEs are "poor design" -- > Tables are still the best and most ubiquitous way to align things in a > browser agnostic way (including mobile phones, etc.) and to layout forms. > > I've not used Zend myself, so I can't say for certain, but the above > tenements I think would still hold true. I guess I would trust the Zend one > the most given they actually make PHP, but at this point in time, I would > never choose to use a bloated framework. Then again, I write enterprise > level and very custom applications (Saas) so maybe this doesn't apply if all > you're trying to do is make yet another Blog or Photo-album or > personal/corporate website or something generic/basic. I've been coding > nearly 20 years and founded several $MM companies. That's my take (or rant > depending on how you look at it). > > Daevid. > http://daevid.com > > > On Wed, 2009-01-14 at 20:36 +, jco...@gmail.com wrote: > > I've been reading about these great new 'frameworks' for PHP development. > > The most similar experience I have so far is using PEAR/Smarty in > application development. > > I am becoming very interested in adding one (or more) of these frameworks > to my work existence. > > I'm leaning toward the Zend Framework for the following reasons: > 1. Zend's commitment to PHP in the enterprise environment > 2. I'm studying for Zend PHP certification...so remaining within the same > family sort of makes sense. > 3. It's widely heralded as a very good 'framework' > 4. Integration with my IDE, Zend Studio > 5. Great support/userbase/forums/docs > > I'm getting ready to start a new project that is going to be somewhat of a > stretch for me. It'll be probably the most complex project I've done where > I'm the only designer/developer and have to do everything myself: from func > spec to mockups to wireframes to database design to documentation to code > to maintenance...all of it is me. > > What do you think, should I kill 2 birds with one stone and use the ZF to > build this new project? Or would i
RE: [PHP] print a to z
I used that notation before, and it did not work 100%. Adapt as follows: for ($i = 'a'; $i <= 'z'; $i++) if ($i == "aa") break; else echo $i; -Original Message- From: Paul M Foster [mailto:pa...@quillandmouse.com] Sent: 16 January 2009 07:55 AM To: php-general@lists.php.net Subject: Re: [PHP] print a to z On Thu, Jan 15, 2009 at 08:32:14PM -0800, paragasu wrote: > i have this cute little problem. i want to print a to z for site navigation > my first attempt work fine > > for($i = '65'; $i < '91'; ++$i) > echo chr($i); > > but someone point me a more interesting solutions > > for($i = 'a'; $i < 'z'; ++$i) > echo $i > > the only problem with the 2nd solutions is it only print up to Y without z. > so how to print up to z with the 2nd solutions? because it turn out > that you cant to something > like for($i = 'a'; $i <= 'z'; ++$i).. for ($i = 'a'; $i <= 'z'; $i++) echo $i; Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Zend (or other) Framework...where to start?
WRT Frameworks.. before I rant, I should declare myself as an ex-consultant to Zend. I have used most of the more popular frameworks, and in my current employment am using Zend Framework. All of the frameworks I have used, have had some good features, and some poorly implemented ones. This, I beleive comes from people trying to make the application all things to all people to fit all applications. This will never happen, at some time, you need to code for yourself, which is why many developers develop their own frameworks from the ground up, myself included. Symphony I did not like at all, but it has a nice modular api, which CodeIgnitor I spent nearly a year on a project and eventually came to be familiar with its nuances. The good documentation of CI and examples I found refreshing. Symphony, Cake, CI etc all have a single commong feature, they are not Zend. Not that the Zend Framework is a total peice of crap ... mostly, but seems to be the product of a tortured development process where comprimises have been made by a committee. Although not strictly part of the framework, Zend Form would have to be the biggest waste of time I have come across. Abstracted to the point of un-usability. Much simpler/easier to write a HTML form. A framework is not so much a tool to make your development faster, although this will be the case, it is a tool to make your development constant. This means you can easily, and rapidly deploy applications as you are familiar with the tool. The speed of development comes as you become more familiar with the environment you are developing in. Try any of the frameworks, or write you own, just avoid Zend. Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] print a to z
2009/1/15 Leon du Plessis : > I used that notation before, and it did not work 100%. > Adapt as follows: > > for ($i = 'a'; $i <= 'z'; $i++) >if ($i == "aa") break; else echo $i; It's weird, but true--the simple '<=' breaks the loop. However, in the above example, you don't need the 'else'; the 'break' ensures that the 'echo $i'; will not execute. You can step around the the problem more elegantly: for ($i = 'a'; $i !== 'aa'; $i++) { echo $i; } Regards, Torben > -Original Message- > From: Paul M Foster [mailto:pa...@quillandmouse.com] > Sent: 16 January 2009 07:55 AM > To: php-general@lists.php.net > Subject: Re: [PHP] print a to z > > On Thu, Jan 15, 2009 at 08:32:14PM -0800, paragasu wrote: > >> i have this cute little problem. i want to print a to z for site > navigation >> my first attempt work fine >> >> for($i = '65'; $i < '91'; ++$i) >> echo chr($i); >> >> but someone point me a more interesting solutions >> >> for($i = 'a'; $i < 'z'; ++$i) >> echo $i >> >> the only problem with the 2nd solutions is it only print up to Y without > z. >> so how to print up to z with the 2nd solutions? because it turn out >> that you cant to something >> like for($i = 'a'; $i <= 'z'; ++$i).. > > for ($i = 'a'; $i <= 'z'; $i++) >echo $i; > > Paul > > -- > Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] To check for existing user in database
2009/1/15 tedd : > At 9:46 AM -0800 1/15/09, Chris Carter wrote: > > Chris: > > That's not the way I would do it. After establishing a connection with the > database, I would use the query: > > $query "SELECT email FROM owners WHERE email = '$emailAddress' ": > $result = mysql_query($query) or die(mysql_error()); > > if(mysql_affected_rows()) > { > // then report a duplicate email/record. > } > else > { > // else insert a new record in the dB. > } > > HTH's > > tedd You want to use mysql_num_rows() there instead of mysql_affected_rows(). (Just a typo in this case, I suspect, but for the benefit of the less experienced it's worth pointing out.) For the newer PHP users, mysql_num_rows() tells you the number of rows you found with a SELECT query, while mysql_affected_rows() tells you how many rows you affected with an INSERT, UPDATE, REPLACE INTO, or DELETE query. Regards, Torben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] print a to z
This one time, at band camp, "Leon du Plessis" wrote: > I used that notation before, and it did not work 100%. > Adapt as follows: > > for ($i = 'a'; $i <= 'z'; $i++) > if ($i == "aa") break; else echo $i; > foreach(range('a', 'z') as $letter ) { echo $letter; } Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php