Re: [PHP] Retrieve Content from URL
Chris you rule !!! That great from here I'll be abble to go on. Thanks. Rodrigo
Re: [PHP] Retrieve Content from URL
Ministério Público wrote: Here it goes: in a certain page there is a dinamicaly generated Option ( one of those boxes from wich you can select a certain thing in a list) I want to retrieve the content of these options and the values assigned to each of them. So if you have: Test 1 Test 2 You want: $test1 = "Test 1"; $test2 = "Test 2"; ?? preg_match_all('%value=["\']*([^"\'>]+?)["\']*\s*>(.*)%isU', $text, $matches); That will give you an array that looks like this: Array ( [0] => Array ( [0] => Test 1 [1] => Test 2 ) [1] => Array ( [0] => test1 [1] => test2 ) [2] => Array ( [0] => Test 1 [1] => Test 2 ) ) From there you should be able to work out what to do.. -- 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] Problem with a script
I showed where the problem is and after var_dump all I get is NULL. I just sent the code cause I thought it would be easier to see it in context, not to make somebody trawl trough it. If its not an array how to find out what it is? What can I do about it? Thanks. Rodrigo
Re: [PHP] Retrieve Content from URL
Here it goes: in a certain page there is a dinamicaly generated Option ( one of those boxes from wich you can select a certain thing in a list) I want to retrieve the content of these options and the values assigned to each of them. Thanx. Rodrigo
Re: [PHP] Problem with a script
Ministério Público wrote: After using the var_dump the only thing I get is NULL, therefore I'll try something else that I think is more complete for the fellow programmers. Nobody's going to trawl through all of your code. Narrow down where the problem is. -- 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] Retrieve Content from URL
Ministério Público wrote: What I need to know is that if when I fopen() or the other function you gave me I get the variables that are assigned on the html, such as the option for example, if its name is "test", could I access it retrieving the value $test ??? No. Those functions will retrieve the webpage exactly the same as your browser does. What would "test" be? Provide an example of what you see and what you are trying to end up with. -- 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] Retrieve Content from URL
What I need to know is that if when I fopen() or the other function you gave me I get the variables that are assigned on the html, such as the option for example, if its name is "test", could I access it retrieving the value $test ??? cause I really need to do it and I cant seem to know where to begin. Thanks in advance, Rodrigo
Re: [PHP] Problem with a script
Ministério Público wrote: Hi guys I'm getting the following error and I cant seem to understand what Im doing wrong, if someone could help me I'd apreciate it. Here is the error message I get in some fileds of the output on the browser: *Warning*: Invalid argument supplied for foreach() in * c:\apache\htdocs\pobs\pobs.php* on line *180* .. *foreach($JSFileExtArray* as *$Key* *=>* *$Value) JSFileExtArray isn't an array, it's something else. Use var_dump to see what it is and go from there. -- 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] Problem with a script
Hi guys I'm getting the following error and I cant seem to understand what Im doing wrong, if someone could help me I'd apreciate it. Here is the error message I get in some fileds of the output on the browser: *Warning*: Invalid argument supplied for foreach() in * c:\apache\htdocs\pobs\pobs.php* on line *180* ** *And here goes the lines I've put a few before and a few after just in case. * ** ** ** *178 JavaScript (Functions & Variables) * *179* * *$Value) * *181* echo *''.$Value.','; * *182* ?>
RE: [PHP] PHP/Mysql: Making binary field available for download - extra browser window ?
Hi, In this case I usually creating Iframe with zero with and zero height and using your "header" code in the iframe sorce file. DS -Original Message- From: Matthew Pegg [mailto:[EMAIL PROTECTED] Sent: Friday, June 02, 2006 7:59 AM To: php-general@lists.php.net Subject: [PHP] PHP/Mysql: Making binary field available for download - extra browser window ? Hi all, Working on a PHP script at the moment where I want to be able to extract a file (PDF file) from a mysql database and force the popup of the File Download dialog, to allow the user to either save or open the document (ie. and bypass loading the file using the browser's plugin) I've found solutions on the net for doing this with a file using readfile() but if I can get away with it, I don't want to create temporary files... Here's what I've got so far (truncated...): This almost works but the problem is that this code still spawns a new empty browser window, and I don't know how to prevent this Can anyone help ? regards, Matt. -- ___ Matt Pegg IT Specialist Abacus Business Machines Ballarat, Australia. ___ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP/Mysql: Making binary field available for download - extra browser window ?
Hi all, Working on a PHP script at the moment where I want to be able to extract a file (PDF file) from a mysql database and force the popup of the File Download dialog, to allow the user to either save or open the document (ie. and bypass loading the file using the browser's plugin) I've found solutions on the net for doing this with a file using readfile() but if I can get away with it, I don't want to create temporary files... Here's what I've got so far (truncated...): This almost works but the problem is that this code still spawns a new empty browser window, and I don't know how to prevent this Can anyone help ? regards, Matt. -- ___ Matt Pegg IT Specialist Abacus Business Machines Ballarat, Australia. ___
Re: [PHP] OO purism sucks - this is a rant for anyone who is allergic to that kind of thing...
Robert Cummings wrote: On Thu, 2006-06-01 at 19:14, Jochem Maas wrote: Robert Cummings wrote: Ahh yes, I do like the elegance of prototypes too. They're a different kind of beast, but a very flexible one. the more I get in it the pretty it gets - javascript doesn't just give you a revolver to shoot yourself with it gives you a Doom3 chainsaw and it's shiny :-) Oh yeah... *rubs the gash in his foot*. I do firmly believe though, that if you have an iota of intelligence, then shooting yourself in the foot will lead to a strong lesson learned :) Protecting idiots from themselves just creates a problem of lots of idiots needing protection from themselves -- that should be a human resources issue, not a language issue IMHO :) Cheers, Rob. What was that joke that I heard. While regular programming gives you enough rope to hang yourself, OO lets you design the tree object. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OO purism sucks - this is a rant for anyone who is allergic to that kind of thing...
Robert Cummings wrote: Well there "was" a segfault, but that's fixed now, now the warning is thrown because of some purist attitude that says it's incorrect to pass a literal to a reference expecting parameter... I can see how that's an issue in C with pointers, or in a strongly type language like Java, but part of PHP's popularity is that while it shares a lot of functions with C, it is neither C nor Java, but rather a much simpler system that generally for all the novices out there "works well". Stuff like this is a bug in your code. It has nothing to do with purism: function inc_arg(&$arg) { $arg++; } inc_arg(3); You have specifically defined your function to modify the argument yet you pass it something that has no storage and thus there is no way to use that modification. For the most part I agree that we need to keep the language as flexible and forgiving as possible, but where we are able to detect code that obviously doesn't do what the programmer intended, it is tremendously helpful to get a descriptive error. As far as functions returning references, you are right that returning a literal there sometimes makes sense, but this can also hide a bug which is why this only throws a notice. You could argue that we could try to look ahead and see what is actually done with the passed argument to see if it is modified, or that we could try to figure out whether the returned reference is actually used as such, but that is technically extremely difficult given the way things work internally. So given the choice between ignoring extremely suspicious code like this and throwing an error/warning, I'd rather be told about it and in the edge cases where I really do want the equivalent of a NOP in my code, it isn't that hard to force it by adding a dummy storage variable along with a comment explaining why you need to do that. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with enter key in Forms
Awesome, thank you so much! It works! On 6/1/06, Chris <[EMAIL PROTECTED]> wrote: George Babichev wrote: > Ok, I sent it to everyone and you. Now can you answer my question please? > I type in > 1 > > > > 2 > into my form in the program that i made, then when I view it, it shows > 1 2 > BUT if I check it in PHP My Admin it displays > 1 > > > > 2 The answer is to change this: http://www.designmagick.com/
Re: [PHP] Help with enter key in Forms
Chris wrote: George Babichev wrote: Hello everyone, I am programming a blog, and most of it is done, except I have one issue. When I am typing in the form (before I click submit) and I click the neter key to make a space, the MySQL database does not recognize that space. How do I make it recognize it? Unless you're stripping it out, it will recognise it. View HTML Source and you'll see the newline is actually in there. A "\n" is not a html newline so you need to convert it. What you want is http://php.net/nl2br Uhhh did you try this -- nl2br? -- * Chuck Anderson • Boulder, CO http://www.CycleTourist.com * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with enter key in Forms
George Babichev wrote: Ok, I sent it to everyone and you. Now can you answer my question please? I type in 1 2 into my form in the program that i made, then when I view it, it shows 1 2 BUT if I check it in PHP My Admin it displays 1 2 The answer is to change this: http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with enter key in Forms
Ok, I sent it to everyone and you. Now can you answer my question please? I type in 1 2 into my form in the program that i made, then when I view it, it shows 1 2 BUT if I check it in PHP My Admin it displays 1 2 So why is my program not showing those spaces? On 6/1/06, Chris <[EMAIL PROTECTED]> wrote: George Babichev wrote: > I can't exactly reply all, because It is only sending it to you. Ok, so > wait, the data with the spaces (enter keys), but why does my program not > show it? Look. This is what I mean In your email program hit "Reply ALL" instead of "Reply". Until you work out how to do that, I'm going to ignore your emails. -- Postgresql & php tutorials http://www.designmagick.com/
Re: [PHP] Help with enter key in Forms
George Babichev wrote: Ok. well I looked more deeply into the issue, and I noticed that PHP My Admin does recognize that there are spaces. So if I click edit on PMA, it displays everything exactly liked I typed it. So why does my program not display it? This is the code I use Then you're not saving the spaces - so of course they can't be displayed. Always CC the list, you will get much better responses. -- 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] Help with enter key in Forms
George Babichev wrote: Hello everyone, I am programming a blog, and most of it is done, except I have one issue. When I am typing in the form (before I click submit) and I click the neter key to make a space, the MySQL database does not recognize that space. How do I make it recognize it? Unless you're stripping it out, it will recognise it. View HTML Source and you'll see the newline is actually in there. A "\n" is not a html newline so you need to convert it. What you want is http://php.net/nl2br -- 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] Retrieve Content from URL
Ministério Público wrote: Hi guys I'm in a predictament, this is why: How can I retrieve the content of some of the html code in an url. Its something like this, there is a URL that have an OPTION that shows a "x" number of options and it has a name "y", how can I access this html output retrieve the options and name of the same options, something like a complete retrieve. Cause what I want to do is to retrieve all the content of the main page and then scan the html for the content of the options "y" and then go to the url that the option send and retrieve each and everyone of these html too. I thank you all in advance. Rodrigo Retrieving the page is easy - see http://www.php.net/curl or http://www.php.net/fopen. You'll have to write a regular expression to get this bits and pieces you need from the html code. -- 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] mail function in 4.2.2
Aaron Todd wrote: Thanks for the reply. I'll ask the ISP about throtteling next time I talk with them. I would also like to mention that I am also getting intermitent results when just sending a single email. One if the web pages I am testing is a support request form. When the form is submitted it sends an email to me so I can test that it is working. But sometimes it never makes it. In this case I wouldn't thing that throttleing would be the cause. Sometimes when I start working on it at 8 in the morning and do a test run it never makes it. In that case nothing has been sent through PHP for at least 8 hours. Save the contact form messages (use error_log or an equivalent) and see if there's anything consistent in the emails that make it through or the emails that don't make it (can you specify your own subject for example).. -- 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] Help with enter key in Forms
Hello everyone, I am programming a blog, and most of it is done, except I have one issue. When I am typing in the form (before I click submit) and I click the neter key to make a space, the MySQL database does not recognize that space. How do I make it recognize it?
Re: [PHP] Extended Ascii Characters
At 9:46 AM +1000 6/2/06, Richard Luckhurst wrote: >Hi All > >I am in the process of cleaning up an application that was left half finished. >I >am fairly new to PHP so I am seeking the wisdom of the community to help with a >little problem. > >In many cases I need to build command strings to be sent to a backend system. >The strings have to contain a couple of non ascii characters. > >I have no problem with the following in a script > >$RM="\xFF"; > >Then using the variable works fine within that chunk of php code. > >What I would like to do is place all of the extended ascii characters in one of >the inc files and just use these in various scripts throughout the application. > >When I try what I get is a test representation rather than the actual ascii >code. Ie I get \xFF instead of the ascii character ÿ > >Is there any way to actually do this in php? > > > >Regards, >Richard Luckhurst >Product Development Yes, I think there is -- we discussed this a few months ago on this list and someone wrote a routine to do basically want you want, or so I think -- so check the archives. 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] Extended Ascii Characters
Hi All I am in the process of cleaning up an application that was left half finished. I am fairly new to PHP so I am seeking the wisdom of the community to help with a little problem. In many cases I need to build command strings to be sent to a backend system. The strings have to contain a couple of non ascii characters. I have no problem with the following in a script $RM="\xFF"; Then using the variable works fine within that chunk of php code. What I would like to do is place all of the extended ascii characters in one of the inc files and just use these in various scripts throughout the application. When I try what I get is a test representation rather than the actual ascii code. Ie I get \xFF instead of the ascii character ÿ Is there any way to actually do this in php? Regards, Richard Luckhurst Product Development Exodus Systems - Sydney, Australia. [EMAIL PROTECTED] Tel: (+612) 4751-9633 Fax: (+612) 4751-9644 Web: www.resmaster.com = Exodus Systems - Smarter Systems, Better Business = -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OO purism sucks - this is a rant for anyone who is allergic to that kind of thing...
On Thu, 2006-06-01 at 19:14, Jochem Maas wrote: > Robert Cummings wrote: > > > Ahh yes, I do like the elegance of prototypes too. They're a different > > kind of beast, but a very flexible one. > > the more I get in it the pretty it gets - javascript doesn't just give you a > revolver to shoot yourself with it gives you a Doom3 chainsaw and it's shiny > :-) Oh yeah... *rubs the gash in his foot*. I do firmly believe though, that if you have an iota of intelligence, then shooting yourself in the foot will lead to a strong lesson learned :) Protecting idiots from themselves just creates a problem of lots of idiots needing protection from themselves -- that should be a human resources issue, not a language issue IMHO :) Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OO purism sucks - this is a rant for anyone who is allergic to that kind of thing...
Robert Cummings wrote: On Thu, 2006-06-01 at 17:43, Jochem Maas wrote: ... Other than basic inheritance and the namespace features provided by classes, I don't see much else that is critically useful. There's was a strange push for all kinds of advanced OO features in PHP5 and somehow that got some kind of ball rolling to make things more and more complicated. Other than the pass objects by reference by default feature of PHP5 and better constructor/destructor support... the rest is just tooth decaying candy... and Jochem seems to be getting cavities it seems -- time to floss and brush the crud away ;) like you Rob I have a big OO codebase, only mine is php5 only and not in a state were I'm comfortable publishing it (one needs to know too much about the codebase concepts and firebird DB to make it relevant without documentation that I will probably never have time to write :-/) none the less is stable, robust, powerful and flexible - it cost me about 2 years of near fulltime development and I run a number of well paid projects on it - brushing it away is not an option at this stage in the life of the code, not that I consider it cruddy enough either. *hehehe* Sorry, the crud wasn't referring to your code, but rather to I did get that (well I assumed assumed thats what you meant - I took the opportunity to highlight the practicalities of being stuck in a situation due to commercial constraints for those who might be interested in learning from my 'mistakes'.) ... now I understand the annoyance Rob refers to but I can live that that one because I have read enough to understand that there is a segfault issue and although in theory it should be the engine that just 'deals' with it it can't without a lot of developer headache and/or BC breakage and/or performance issues playing up - so its the lesser of 2 evils. Well there "was" a segfault, but that's fixed now, now the warning is thrown because of some purist attitude that says it's incorrect to pass a literal to a reference expecting parameter... I can see how that's an issue in C with pointers, or in a strongly type language like Java, but part of PHP's popularity is that while it shares a lot of functions with C, it is neither C nor Java, but rather a much simpler system that generally for all the novices out there "works well". ah IC - although I do recall Rasmus talking about performance issues if this problem would have been solved the right way - I may be mistaken - either way the purists one that battle. ... (yes I know javascript is prototypal iso class-based but that is not the point :-) Ahh yes, I do like the elegance of prototypes too. They're a different kind of beast, but a very flexible one. the more I get in it the pretty it gets - javascript doesn't just give you a revolver to shoot yourself with it gives you a Doom3 chainsaw and it's shiny :-) not that procedural code is completely safe from the purists that are out 'to protect the developer' - remember how flexible array_merge() used to be??? well try stuffing anything other than an array into it these days and you get a big fat E_WARNING. and I am pretty damn sure *that* had nothing to do with fixing a segfault. *hehehe* Yeah. Cheers, Rob. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OO purism sucks - this is a rant for anyone who is allergic to that kind of thing...
On Thu, 2006-06-01 at 17:43, Jochem Maas wrote: > Robert Cummings wrote: > > On Thu, 2006-06-01 at 15:01, John Meyer wrote: > > > >>John Nichel wrote: > >> > >> > >>>Do what I do, and don't do OO. ;) > > there an 'oo baby' joke in there somewhere :-) > > >>> > >> > >>In other words, do what works, realizing that 99 percent of the time > >>that you're doing indivdual sites, and ignore dogma? Hmm, what a concept! > > hmm I didn't grok that comment. > > > > > > > Other than basic inheritance and the namespace features provided by > > classes, I don't see much else that is critically useful. There's was a > > strange push for all kinds of advanced OO features in PHP5 and somehow > > that got some kind of ball rolling to make things more and more > > complicated. Other than the pass objects by reference by default feature > > of PHP5 and better constructor/destructor support... the rest is just > > tooth decaying candy... and Jochem seems to be getting cavities it seems > > -- time to floss and brush the crud away ;) > > like you Rob I have a big OO codebase, only mine is php5 only and not in a > state were I'm comfortable publishing it (one needs to know too much about > the codebase concepts and firebird DB to make it relevant without > documentation > that I will probably never have time to write :-/) none the less is stable, > robust, powerful and flexible - it cost me about 2 years of near fulltime > development and I run a number of well paid projects on it - brushing it > away is not an option at this stage in the life of the code, not that I > consider it cruddy enough either. *hehehe* Sorry, the crud wasn't referring to your code, but rather to the "extras" that are causing you grief. There are critical aspects of any OO language that are absolutely necessary in OOD, but then there are also sugary parts that are just "nice to have" :) IMHO, it's wise to wait until new features completely stabilize before jumping on them. For instance my framework for all intents and purposes requires replacement services to adhere to a specific set of methods when overriding the default server object... in this way an interface is virtual, and never explicit. Some thing I find amusing in retrospect, is that when PHP4 came out I couldn't migrate to it fast enough, PHP3 just couldn't cut it in comparison to PHP4. But looking at PHP5 I feel (and I think others feel similarly) that I can easily wait till PHP6 comes out. Recently I've been rewarded with my patience... PHP5 now accepts the var statement again to declare class properties without generating a warning... if I had gone and updated my code to use public/private I'd have wasted my time :) > at every BC breaking turn in the php5 road (since beta3) I have managed to > refactor my codebase without actually changing too much or having break the > functionality the codebase offer[s|ed] - such refactoring does cost time > though in terms of having to think carefully about how to proceed and the > testing involved in making sure things still work as intended ... > > > > > One of my biggest peeves about stuff changed that worked but wasn't > > necessarily purist... not letting values be passed to functions > > expecting a reference parameter. I mean really, PHP knows it's a > > literal, so why can't it just make it safe. Ugh. Nope, now we gotta add > > an extra line of userspace code to first assign the value to a variable > > to do exactly what PHP could so much faster do for us. Similarly > > functions returning references. Used to be you could return a null or > > false value on encountering a problem... but noo, now you have to > > spank youself and write $retValue = null; return $retValue. *pt*. > > now I understand the annoyance Rob refers to but I can live that that one > because I have read enough to understand that there is a segfault issue and > although in theory it should be the engine that just 'deals' with it it can't > without a lot of developer headache and/or BC breakage and/or performance > issues playing up - so its the lesser of 2 evils. Well there "was" a segfault, but that's fixed now, now the warning is thrown because of some purist attitude that says it's incorrect to pass a literal to a reference expecting parameter... I can see how that's an issue in C with pointers, or in a strongly type language like Java, but part of PHP's popularity is that while it shares a lot of functions with C, it is neither C nor Java, but rather a much simpler system that generally for all the novices out there "works well". > besides I often end up doing > something like (a few more chars but no extra lines ;-): > > return ($r = false); > > my gripe is about the abomination that is 'strictness for the sake of it' > which > is most evident in the OO code - and not only is it strictness per se but the > continual movement of the goals posts (and incremental increase) regarding the > rigidity of what is allowed (read 'what is correct
[PHP] Retrieve Content from URL
Hi guys I'm in a predictament, this is why: How can I retrieve the content of some of the html code in an url. Its something like this, there is a URL that have an OPTION that shows a "x" number of options and it has a name "y", how can I access this html output retrieve the options and name of the same options, something like a complete retrieve. Cause what I want to do is to retrieve all the content of the main page and then scan the html for the content of the options "y" and then go to the url that the option send and retrieve each and everyone of these html too. I thank you all in advance. Rodrigo
Re: [PHP] Am I supposed to be using SPL?
Richard Lynch wrote: On Thu, June 1, 2006 3:52 am, Kevin Waterson wrote: This one time, at band camp, "D. Dante Lorenso" <[EMAIL PROTECTED]> wrote: Is SPL meant to be used? If so, is it experimental? Is it documented? Should I stay away from SPL for production code? What's the official word? Officially SPL is part of PHP. It provides a standard interface for iterating over aggregate objects, eg: array, directory listing, xml, etc... try{ foreach ( new DirectoryIterator('./') as $Item ) { echo $Item.''; } } catch(Exception $e){ echo 'No files Found!'; } So, of all the things that COULD go wrong, we just assume it's "No files Found"??? I don't think I'll ever learn to like SPL or try/catch... 12 months ago you wouldn't be seen dead near an install of php5 ;-) on a more serious note Kevins uber simple try/catch block is not indicative of the crapness of exceptions per se - besides it's already better handling than most noobs have in there code (not to say that Kevin is a noob because I can't judge that based on just this - besides we were all noobs once) to give a pseudo example: try { // do stuff with DirectoryIterator } catch (SomeKindOfDirectoryIteratorRelatedException $e) { // empty dir? } catch (SomeOtherKindOfDirectoryIteratorRelatedException $e) { // file system permissions failure? } catch (YetAnotherKindOfDirectoryIteratorRelatedException $e) { // dir doesn't exist } catch (Exception $e) { // failsafe/fallback catch for when we don't have a clue what went wrong } so you could 'try' to like it, it will probably 'catch' on regardless better the devil you know. :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OO purism sucks - this is a rant for anyone who is allergic to thatkind of thing...
Jay Blanchard wrote: [snip] RANT [/snip] ROFLMMFAO! You have never programmed in C++ have you? er no - I have this C++ book on my shelf that I keep avoiding though :-P -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OO purism sucks - this is a rant for anyone who is allergic to that kind of thing...
Robert Cummings wrote: On Thu, 2006-06-01 at 15:01, John Meyer wrote: John Nichel wrote: Do what I do, and don't do OO. ;) there an 'oo baby' joke in there somewhere :-) In other words, do what works, realizing that 99 percent of the time that you're doing indivdual sites, and ignore dogma? Hmm, what a concept! hmm I didn't grok that comment. Other than basic inheritance and the namespace features provided by classes, I don't see much else that is critically useful. There's was a strange push for all kinds of advanced OO features in PHP5 and somehow that got some kind of ball rolling to make things more and more complicated. Other than the pass objects by reference by default feature of PHP5 and better constructor/destructor support... the rest is just tooth decaying candy... and Jochem seems to be getting cavities it seems -- time to floss and brush the crud away ;) like you Rob I have a big OO codebase, only mine is php5 only and not in a state were I'm comfortable publishing it (one needs to know too much about the codebase concepts and firebird DB to make it relevant without documentation that I will probably never have time to write :-/) none the less is stable, robust, powerful and flexible - it cost me about 2 years of near fulltime development and I run a number of well paid projects on it - brushing it away is not an option at this stage in the life of the code, not that I consider it cruddy enough either. at every BC breaking turn in the php5 road (since beta3) I have managed to refactor my codebase without actually changing too much or having break the functionality the codebase offer[s|ed] - such refactoring does cost time though in terms of having to think carefully about how to proceed and the testing involved in making sure things still work as intended ... One of my biggest peeves about stuff changed that worked but wasn't necessarily purist... not letting values be passed to functions expecting a reference parameter. I mean really, PHP knows it's a literal, so why can't it just make it safe. Ugh. Nope, now we gotta add an extra line of userspace code to first assign the value to a variable to do exactly what PHP could so much faster do for us. Similarly functions returning references. Used to be you could return a null or false value on encountering a problem... but noo, now you have to spank youself and write $retValue = null; return $retValue. *pt*. now I understand the annoyance Rob refers to but I can live that that one because I have read enough to understand that there is a segfault issue and although in theory it should be the engine that just 'deals' with it it can't without a lot of developer headache and/or BC breakage and/or performance issues playing up - so its the lesser of 2 evils. besides I often end up doing something like (a few more chars but no extra lines ;-): return ($r = false); my gripe is about the abomination that is 'strictness for the sake of it' which is most evident in the OO code - and not only is it strictness per se but the continual movement of the goals posts (and incremental increase) regarding the rigidity of what is allowed (read 'what is correct') - it's not like some very strict OO stuff was introduced in the beginning, no, in the beginning [of php5] things were more relaxed and even now after 2 years php5 is still treated as a beta product with regard to the way functionality is changed according to the whim of whoever has commit rights (or there abouts). and I understand Johns sentiment about not using OO - but there are complex things you can structure and design (from my personal point of view) which cannot so easily/ transparently be done with purely procedural code. that said I have plenty of reusable function library and pure procedural sites running - I use both depending on suitability. generally I like thinking in OO terms - and it often matches with stuff I do in javascript on the client side in terms of working with objects (yes I know javascript is prototypal iso class-based but that is not the point :-) not that procedural code is completely safe from the purists that are out 'to protect the developer' - remember how flexible array_merge() used to be??? well try stuffing anything other than an array into it these days and you get a big fat E_WARNING. and I am pretty damn sure *that* had nothing to do with fixing a segfault. BTW, I still love PHP :) heh me too :-) Cheers, Rob. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Fatal error: Unable to write base address in Unknown on line 0 ?
Open up a DOS shell and try to start Apache by hand. On Thu, June 1, 2006 7:42 am, Ilja Polivanovas wrote: > Hello, > > maybe someone know what can be the problem and how to solve it. It > appears > on startup of Apache, WinXP. > Apache doesn't start. > > -- > Using Opera's revolutionary e-mail client: http://www.opera.com/m2/ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What would cause this?
On Thu, June 1, 2006 1:18 am, tedd wrote: > However, the app isn't reference or linked anywhere on the site, but > it still occasionally runs all by itself. > > My question is -- what's triggering it? Bad Guys are probably trying to poke at your site, finding URLs at random, regardless of links, trying to hack your site. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Am I supposed to be using SPL?
On Thu, June 1, 2006 3:52 am, Kevin Waterson wrote: > This one time, at band camp, "D. Dante Lorenso" <[EMAIL PROTECTED]> > wrote: > >> Is SPL meant to be used? If so, is it experimental? Is it >> documented? >> Should I stay away from SPL for production code? What's the >> official word? > > Officially SPL is part of PHP. It provides a standard interface for > iterating over > aggregate objects, eg: array, directory listing, xml, etc... > > try{ > foreach ( new DirectoryIterator('./') as $Item ) > { > echo $Item.''; > } > } > > catch(Exception $e){ > echo 'No files Found!'; > } So, of all the things that COULD go wrong, we just assume it's "No files Found"??? I don't think I'll ever learn to like SPL or try/catch... :-) -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex problem
On Thu, June 1, 2006 4:56 am, Merlin wrote: >>> ^(.*)_a[0-9](.*).htm$ Don't know what it will help, but you need \\.htm in PHP to get \.htm in PCRE to escape the . in the extension. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Checkbox & Hidden Field to Delete Row - SOLVED
Ray, Interestingly, I don't' allow special characters in File Names for files being uploaded to the File Manager. So that problem won't occur. Thanks. On 6/1/06 4:23 PM, "Ray Hauge" <[EMAIL PROTECTED]> wrote: > On Thursday 01 June 2006 13:15, Rahul S. Johari wrote: > > Tad different, but that will definitely work as well. It's a long shot, but > just make sure that filenames don't have a "#" in them. Rahul S. Johari Coordinator, Internet & Administration Informed Marketing Services Inc. 500 Federal Street, Suite 201 Troy NY 12180 Tel: (518) 687-6700 x154 Fax: (518) 687-6799 Email: [EMAIL PROTECTED] http://www.informed-sources.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML form
If you have already visited the page, and chosen another option, Firefox "remembers" your choice for you. Quit Firefox and start over, and it should "work" On Thu, June 1, 2006 1:53 pm, Martin Marques wrote: > Sorry for the OT, but this is PHP output anyway :-) > > I have a bunch of code to input and modify data through an HTML form. > When > I modify the options, some are in text, others > in textarea, and some are in select options. Now wat I did is make the > current value be the selected one, but my browser > doesn't seem to get it right. Here is the HTML output: > > > Profesor titular > Profesor asociado > Profesor adjunto > Jefe de trabajos pracáá½ticos > Ayudante de cat½edra > Ayudante alumno > Pasante > Colaborador externo > > > But the browser doesn't show the option "Ayudante de catedra" selected > by > default. > > Am I so blind that I can't see the problem or those my firefox have a > problem? > > -- > 21:50:04 up 2 days, 9:07, 0 users, load average: 0.92, 0.37, 0.18 > - > Lic. Martín Marqués | SELECT 'mmarques' || > Centro de Telemática| '@' || 'unl.edu.ar'; > Universidad Nacional| DBA, Programador, > del Litoral | Administrador > - > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Checkbox & Hidden Field to Delete Row - SOLVED
On Thursday 01 June 2006 13:15, Rahul S. Johari wrote: > Ave, > > I spent 3 hours trying to find or develop a solution for this problem... > And believe it or not, within 3 minutes of sending the problem to the > mailing list, I actually generated a solution!! Ray, you’re spot on with > what’s actually happening, but this is what I did to resolve it... > > Here’s my code to generate the Dynamic Row with Checkboxes: > value=\"$myrow[ID]#imsafm/$showfilesuser/$myrow[filename]\"> type=hidden name=login value=$login> value=$showfilesuser> > > I completely eliminated the Hidden field... Instead, added the value of > both the Row ID & the Filename to the checkbox, with a seperator “#”. > > Here’s my code to delete the Row & Corresponding File: > > foreach($thisID AS $value) { > $pieces = explode("#", $value); > $sql = "DELETE FROM file WHERE ID='$pieces[0]'"; > $result = mysql_query($sql) or die("Fatal Error: ".mysql_error()); > $thefile = "$pieces[1]"; > unlink($thefile); > } > > As you can see, I basically explode the Array on the “#” seperator, and > delete the Row & File. Is working like a charm!! > Tad different, but that will definitely work as well. It's a long shot, but just make sure that filenames don't have a "#" in them. -- Ray Hauge Programmer/Systems Administrator American Student Loan Services www.americanstudentloan.com 1.800.575.1099 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Checkbox & Hidden Field to Delete Row - SOLVED
Ave, I spent 3 hours trying to find or develop a solution for this problem... And believe it or not, within 3 minutes of sending the problem to the mailing list, I actually generated a solution!! Ray, you’re spot on with what’s actually happening, but this is what I did to resolve it... Here’s my code to generate the Dynamic Row with Checkboxes: I completely eliminated the Hidden field... Instead, added the value of both the Row ID & the Filename to the checkbox, with a seperator “#”. Here’s my code to delete the Row & Corresponding File: foreach($thisID AS $value) { $pieces = explode("#", $value); $sql = "DELETE FROM file WHERE ID='$pieces[0]'"; $result = mysql_query($sql) or die("Fatal Error: ".mysql_error()); $thefile = "$pieces[1]"; unlink($thefile); } As you can see, I basically explode the Array on the “#” seperator, and delete the Row & File. Is working like a charm!! On 6/1/06 4:07 PM, "Ray Hauge" <[EMAIL PROTECTED]> wrote: > On Thursday 01 June 2006 12:58, Rahul S. Johari wrote: >> Ave, >> >> I¹m stuck on a problem here. >> I have a file manager kind of application and I¹m trying to add the >> functionality to delete multiple files. >> >> Basically, there¹s a bunch of rows generated dynamically. Each row has a >> checkbox for ³Delete² option, and a hidden field which contains the name of >> the File associated with the record. If a user checks a checkbox to delete >> certain rows, it should be able to delete those rows from mySQL as well as >> delete the files associated with that record. >> >> I created both the checkboxes & the hidden fields to be Arrays. I run a >> loop to delete all rows (based on ID¹s) where the checkbox was Checked. It >> does that part fine... The problem is linking the Filename array to the >> Checkbox Array. It deletes the first two files uploaded no matter what rows >> are checked. Basically, the Filename array is not associating with the >> Checkbox array. So if a person checks the 3rd and 5th checkbox... The 3rd >> & 5th row is deleted from mySQL, but the 1st and 2nd file is deleted, not >> the 3rd & 5th. >> >> Rahul S. Johari > > The problem is coming from how checkboxes submit their information to the > form. Only the checked checkboxes will actually send data. The unchecked > ones will not send anything. Hidden fields differ, in that they ALWAYS send > their data. This is probably causing a mis-match between the two arrays. > You could verify that by doing a var_dump on the arrays before you delete > anything. > > I would suggest that since you keep a record of the file in the database, > include the file location in that database record. Then before you delete > it, get the file name, delete the file, then delete the record. I think that > would save you a bunch of headaches. Rahul S. Johari Coordinator, Internet & Administration Informed Marketing Services Inc. 500 Federal Street, Suite 201 Troy NY 12180 Tel: (518) 687-6700 x154 Fax: (518) 687-6799 Email: [EMAIL PROTECTED] http://www.informed-sources.com
Re: [PHP] Checkbox & Hidden Field to Delete Row
On Thursday 01 June 2006 12:58, Rahul S. Johari wrote: > Ave, > > I¹m stuck on a problem here. > I have a file manager kind of application and I¹m trying to add the > functionality to delete multiple files. > > Basically, there¹s a bunch of rows generated dynamically. Each row has a > checkbox for ³Delete² option, and a hidden field which contains the name of > the File associated with the record. If a user checks a checkbox to delete > certain rows, it should be able to delete those rows from mySQL as well as > delete the files associated with that record. > > I created both the checkboxes & the hidden fields to be Arrays. I run a > loop to delete all rows (based on ID¹s) where the checkbox was Checked. It > does that part fine... The problem is linking the Filename array to the > Checkbox Array. It deletes the first two files uploaded no matter what rows > are checked. Basically, the Filename array is not associating with the > Checkbox array. So if a person checks the 3rd and 5th checkbox... The 3rd > & 5th row is deleted from mySQL, but the 1st and 2nd file is deleted, not > the 3rd & 5th. > > Rahul S. Johari The problem is coming from how checkboxes submit their information to the form. Only the checked checkboxes will actually send data. The unchecked ones will not send anything. Hidden fields differ, in that they ALWAYS send their data. This is probably causing a mis-match between the two arrays. You could verify that by doing a var_dump on the arrays before you delete anything. I would suggest that since you keep a record of the file in the database, include the file location in that database record. Then before you delete it, get the file name, delete the file, then delete the record. I think that would save you a bunch of headaches. -- Ray Hauge Programmer/Systems Administrator American Student Loan Services www.americanstudentloan.com 1.800.575.1099 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Checkbox & Hidden Field to Delete Row
Ave, I¹m stuck on a problem here. I have a file manager kind of application and I¹m trying to add the functionality to delete multiple files. Basically, there¹s a bunch of rows generated dynamically. Each row has a checkbox for ³Delete² option, and a hidden field which contains the name of the File associated with the record. If a user checks a checkbox to delete certain rows, it should be able to delete those rows from mySQL as well as delete the files associated with that record. I created both the checkboxes & the hidden fields to be Arrays. I run a loop to delete all rows (based on ID¹s) where the checkbox was Checked. It does that part fine... The problem is linking the Filename array to the Checkbox Array. It deletes the first two files uploaded no matter what rows are checked. Basically, the Filename array is not associating with the Checkbox array. So if a person checks the 3rd and 5th checkbox... The 3rd & 5th row is deleted from mySQL, but the 1st and 2nd file is deleted, not the 3rd & 5th. Following is my code to generate the checkboxes & hidden fields... Following is the code to delete the checked rows/files... for($I=0;$Ihttp://www.informed-sources.com
[PHP] Solved (Re: [PHP] HTML form)
On Thu, 01 Jun 2006 13:06:24 -0600, John Meyer <[EMAIL PROTECTED]> wrote: > Martin Marques wrote: >> doesn't seem to get it right. Here is the HTML output: >> >> >> Profesor titular >> Profesor asociado >> Profesor adjunto >> Jefe de trabajos pracáá½ticos >> Ayudante de cat½edra >> Ayudante alumno >> Pasante >> Colaborador externo >> > > Works fine on my firefox, by the way. What version of Firefox are you > using? Just found out what the problem was talking to a fellow ex-coworker. Aparently putting the values (value="4") surrounded by doble quotes (as the specs say) solved the problem. -- - Lic. Martín Marqués | SELECT 'mmarques' || Centro de Telemática| '@' || 'unl.edu.ar'; Universidad Nacional| DBA, Programador, del Litoral | Administrador - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OO purism sucks - this is a rant for anyone who is allergic to that kind of thing...
On Thu, 2006-06-01 at 15:01, John Meyer wrote: > John Nichel wrote: > > > > > Do what I do, and don't do OO. ;) > > > > In other words, do what works, realizing that 99 percent of the time > that you're doing indivdual sites, and ignore dogma? Hmm, what a concept! Other than basic inheritance and the namespace features provided by classes, I don't see much else that is critically useful. There's was a strange push for all kinds of advanced OO features in PHP5 and somehow that got some kind of ball rolling to make things more and more complicated. Other than the pass objects by reference by default feature of PHP5 and better constructor/destructor support... the rest is just tooth decaying candy... and Jochem seems to be getting cavities it seems -- time to floss and brush the crud away ;) One of my biggest peeves about stuff changed that worked but wasn't necessarily purist... not letting values be passed to functions expecting a reference parameter. I mean really, PHP knows it's a literal, so why can't it just make it safe. Ugh. Nope, now we gotta add an extra line of userspace code to first assign the value to a variable to do exactly what PHP could so much faster do for us. Similarly functions returning references. Used to be you could return a null or false value on encountering a problem... but noo, now you have to spank youself and write $retValue = null; return $retValue. *pt*. BTW, I still love PHP :) Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OO purism sucks - this is a rant for anyone who is allergic to that kind of thing...
John Meyer wrote: John Nichel wrote: Do what I do, and don't do OO. ;) In other words, do what works, realizing that 99 percent of the time that you're doing indivdual sites, and ignore dogma? Hmm, what a concept! Actually, the company I work for operates multiple sites which all share code. From copying and pasting between sites, to the 'global include' directory I have set up with functions shared by all the sites. No OO. If it ain't broke, don't fix it. (sorry about the direct mail) -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML form
On 01/06/06, John Meyer <[EMAIL PROTECTED]> wrote: Martin Marques wrote: > Sorry for the OT, but this is PHP output anyway :-) > > I have a bunch of code to input and modify data through an HTML form. > When I modify the options, some are in text, others > in textarea, and some are in select options. Now wat I did is make the > current value be the selected one, but my browser > doesn't seem to get it right. Here is the HTML output: > > > Profesor titular > Profesor asociado > Profesor adjunto > Jefe de trabajos pracáá½ticos > Ayudante de cat½edra > Ayudante alumno > Pasante > Colaborador externo > > > But the browser doesn't show the option "Ayudante de catedra" selected > by default. > > Am I so blind that I can't see the problem or those my firefox have a > problem? Correct xhtml is .. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- http://www.web-buddha.co.uk dynamic web programming from Reigate, Surrey UK (php, mysql, xhtml, css) look out for project karma, our new venture, coming soon!
Re: [PHP] HTML form
Martin Marques wrote: Sorry for the OT, but this is PHP output anyway :-) I have a bunch of code to input and modify data through an HTML form. When I modify the options, some are in text, others in textarea, and some are in select options. Now wat I did is make the current value be the selected one, but my browser doesn't seem to get it right. Here is the HTML output: Profesor titular Profesor asociado Profesor adjunto Jefe de trabajos pracáá½ticos Ayudante de cat½edra Ayudante alumno Pasante Colaborador externo But the browser doesn't show the option "Ayudante de catedra" selected by default. Am I so blind that I can't see the problem or those my firefox have a problem? Works fine on my firefox, by the way. What version of Firefox are you using? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OO purism sucks - this is a rant for anyone who is allergic to that kind of thing...
John Nichel wrote: Do what I do, and don't do OO. ;) In other words, do what works, realizing that 99 percent of the time that you're doing indivdual sites, and ignore dogma? Hmm, what a concept! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] HTML form
Sorry for the OT, but this is PHP output anyway :-) I have a bunch of code to input and modify data through an HTML form. When I modify the options, some are in text, others in textarea, and some are in select options. Now wat I did is make the current value be the selected one, but my browser doesn't seem to get it right. Here is the HTML output: Profesor titular Profesor asociado Profesor adjunto Jefe de trabajos pracáá½ticos Ayudante de cat½edra Ayudante alumno Pasante Colaborador externo But the browser doesn't show the option "Ayudante de catedra" selected by default. Am I so blind that I can't see the problem or those my firefox have a problem? -- 21:50:04 up 2 days, 9:07, 0 users, load average: 0.92, 0.37, 0.18 - Lic. Martín Marqués | SELECT 'mmarques' || Centro de Telemática| '@' || 'unl.edu.ar'; Universidad Nacional| DBA, Programador, del Litoral | Administrador - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OO purism sucks - this is a rant for anyone who is allergic to that kind of thing...
Jochem Maas wrote: I get this sometimes, it often means I have overlooked something: Fatal error: Access to undeclared static property: AreaAgendaItem::$extraFields EVERYWHERE in php an unset var causes an E_NOTICE, but if you dare to use OO then all of a sudden the OO nuthouse runs out to put a straight jacket on you, and it's getting worse and worse. (not that this example is new) why don't the purists get that we don't need to be told at every step what is correct and what is not?? but merely to be stopped from doing things that are dangerous (as in liable to cause a segfault). eight months ago (roughly) I was told repeatedly that static interface methods were WRONG and so I wouldn't be allowed to user static interface methods anymore (fix my code was the gruff reply) - a few weeks ago static interface methods were included in php5.2(?) as a work around for some other OO deficiency (I can't remember the details but it was Derick Rethans that was suffering from whatever straight jaket had just been introduced). PHP embracing "The One and Only OO Paradigm"(tm) [a schizoid paradigm liable to change at the drop of a hat] [RANT OFF - flame away boys and girls] Do what I do, and don't do OO. ;) -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex problem
Merlin wrote: Hi there, I do work on following regex: ^(.*)_a[0-9](.*).htm$ This should be valid for "test_a9393.htm", but not for "9393.htm" as ther is no leading _a infront of the number. Unfortunatelly this also works for the 9393.htm file. Can somebody give me a hint why the regex also is true for text that does not start with _a infront of the number? Thank you for any help, Merlin Escape the period before htm. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] OO purism sucks - this is a rant for anyone who is allergic to thatkind of thing...
[snip] RANT [/snip] ROFLMMFAO! You have never programmed in C++ have you? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OO purism sucks - this is a rant for anyone who is allergic to that kind of thing...
At 4:01 PM +0200 6/1/06, Jochem Maas wrote: >I get this sometimes, it often means I have overlooked something: > > Fatal error: Access to undeclared static property: > AreaAgendaItem::$extraFields > >EVERYWHERE in php an unset var causes an E_NOTICE, but if you dare to use OO >then >all of a sudden the OO nuthouse runs out to put a straight jacket on you, and >it's >getting worse and worse. (not that this example is new) > >why don't the purists get that we don't need to be told at every step what is >correct >and what is not?? but merely to be stopped from doing things that are dangerous >(as in liable to cause a segfault). > >eight months ago (roughly) I was told repeatedly that static interface methods >were >WRONG and so I wouldn't be allowed to user static interface methods anymore >(fix my code >was the gruff reply) - a few weeks ago static interface methods were included >in php5.2(?) >as a work around for some other OO deficiency (I can't remember the details >but it was Derick >Rethans that was suffering from whatever straight jaket had just been >introduced). > >PHP embracing "The One and Only OO Paradigm"(tm) >[a schizoid paradigm liable to change at the drop of a hat] > >[RANT OFF - flame away boys and girls] Not a flame, but just my take -- dummy-up, you'll sleep better and produce more code. :-) 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] mail function in 4.2.2
Thanks for the reply. I'll ask the ISP about throtteling next time I talk with them. I would also like to mention that I am also getting intermitent results when just sending a single email. One if the web pages I am testing is a support request form. When the form is submitted it sends an email to me so I can test that it is working. But sometimes it never makes it. In this case I wouldn't thing that throttleing would be the cause. Sometimes when I start working on it at 8 in the morning and do a test run it never makes it. In that case nothing has been sent through PHP for at least 8 hours. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] OO purism sucks - this is a rant for anyone who is allergic to that kind of thing...
I get this sometimes, it often means I have overlooked something: Fatal error: Access to undeclared static property: AreaAgendaItem::$extraFields EVERYWHERE in php an unset var causes an E_NOTICE, but if you dare to use OO then all of a sudden the OO nuthouse runs out to put a straight jacket on you, and it's getting worse and worse. (not that this example is new) why don't the purists get that we don't need to be told at every step what is correct and what is not?? but merely to be stopped from doing things that are dangerous (as in liable to cause a segfault). eight months ago (roughly) I was told repeatedly that static interface methods were WRONG and so I wouldn't be allowed to user static interface methods anymore (fix my code was the gruff reply) - a few weeks ago static interface methods were included in php5.2(?) as a work around for some other OO deficiency (I can't remember the details but it was Derick Rethans that was suffering from whatever straight jaket had just been introduced). PHP embracing "The One and Only OO Paradigm"(tm) [a schizoid paradigm liable to change at the drop of a hat] [RANT OFF - flame away boys and girls] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail function in 4.2.2
On 6/1/06, Aaron Todd <[EMAIL PROTECTED]> wrote: I am working with a server that has version 4.2.2 on it. I know...I know...its old. Its my ISPs server so I don't have too much control over it. Anyway, I am seeing a problem where when I use the mail function to send out an email only some of the messages get to the destination. I wrote a simple test script that runs through a loop and is supposed to send out five emails. Usually only one or two of the emails make it. And on top of that its not always the first two that get sent. Here is my test script. I also have tried using the sleep command to give it 5 seconds between each email thinking maybe it was a time thing. for($i=0;$i<5;$i++){ echo $i.""; mail("[EMAIL PROTECTED]","test_".$i, "test_".$i); sleep(5); } Is there something with this version of PHP that could be effecting the mail function. I checked the change log and there has been some improvements to the mail function, but not much detail on why the changes were necessary. Just wondering if I have come across an old bug or something. I've already asked my ISP to upgrade this server so if that's the solution its on its way to being fixed. Is there anything else that could be wrong? Ask the isp if they have mail throttling set up - apart from that you'll need to work with them to get this fixed. They can access the mail logs.. -- 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] mail function in 4.2.2
I am working with a server that has version 4.2.2 on it. I know...I know...its old. Its my ISPs server so I don't have too much control over it. Anyway, I am seeing a problem where when I use the mail function to send out an email only some of the messages get to the destination. I wrote a simple test script that runs through a loop and is supposed to send out five emails. Usually only one or two of the emails make it. And on top of that its not always the first two that get sent. Here is my test script. I also have tried using the sleep command to give it 5 seconds between each email thinking maybe it was a time thing. for($i=0;$i<5;$i++){ echo $i.""; mail("[EMAIL PROTECTED]","test_".$i, "test_".$i); sleep(5); } Is there something with this version of PHP that could be effecting the mail function. I checked the change log and there has been some improvements to the mail function, but not much detail on why the changes were necessary. Just wondering if I have come across an old bug or something. I've already asked my ISP to upgrade this server so if that's the solution its on its way to being fixed. Is there anything else that could be wrong? Thanks Aaron -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What would cause this?
At 12:55 PM +0100 6/1/06, André Medeiros wrote: >When sending it, do this > >$server_array = print_r($_SERVER, true); > >and use the $server_array variable to obtain some info regarding the >client that's causing the requests. Thank you -- that was a most excellent idea. 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] PHP Fatal error: Unable to write base address in Unknown on line 0 ?
Ilja Polivanovas wrote: Hello, maybe someone know what can be the problem and how to solve it. It appears on startup of Apache, WinXP. Apache doesn't start. fron a quick google I would hazard a guess that your install is f***ed due to an earlier apache/php installation. either that or certain log files are not writable. try removing all installed stuff (apache, etc) and reinstalling from scratch. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Fatal error: Unable to write base address in Unknown on line 0 ?
Hello, maybe someone know what can be the problem and how to solve it. It appears on startup of Apache, WinXP. Apache doesn't start. -- Using Opera's revolutionary e-mail client: http://www.opera.com/m2/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What would cause this?
At 4:56 PM +1000 6/1/06, Chris wrote: >If you can, check your apache access logs and that will tell you the ip of the >person who accessed that page.. will give you a starting point anyway. Thanks -- have done, see below. At 8:59 AM +0200 6/1/06, nicolas figaro wrote: >>However, the app isn't reference or linked anywhere on the site, but it still >>occasionally runs all by itself. >> >It runs automagically ? Yep, automagically. At 9:21 AM +0200 6/1/06, Jochem Maas wrote: >let us know what your logs say. I asked them, and this is what they said: 72.29.85.194 - - [01/Jun/2006:00:01:06 -0400] "GET /email_me.php . -snip- First, I have removed the automagical email_me.php from my root and put it elsewhere. Second, I have seen the enemy and it is me! That's MY shared IP and it's MY own cron experiment running MY script at the start of each month as I instructed it to do -- apparently it remembers, and I don't. This is embarrassing -- but, it has taught me to look at the logs and confirms that my cron works. :-) Many thanks for your help. 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] What would cause this?
Here's what you can do: Have a timestamp of the last e-mail stored on a file. If time() - that timestamp < 600 (10 minutes) then don't send the e-mail. When sending it, do this $server_array = print_r($_SERVER, true); and use the $server_array variable to obtain some info regarding the client that's causing the requests. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex problem
Robin Vickery schrieb: On 01/06/06, Merlin <[EMAIL PROTECTED]> wrote: Hi there, I do work on following regex: ^(.*)_a[0-9](.*).htm$ This should be valid for "test_a9393.htm", but not for "9393.htm" as ther is no leading _a infront of the number. Unfortunatelly this also works for the 9393.htm file. Can somebody give me a hint why the regex also is true for text that does not start with _a infront of the number? It won't match something without an _a in it. So there's something you're not mentioning. 'test_a9393.htm' matches. 'a9393.htm' does not match. -robin Thank you robin! That saved my ass :-) Actually my regex was quit fine, the problem was that there was a search function searching for is_numeric that was redirecting to another page *lol* Best regards, Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex problem
On 01/06/06, Merlin <[EMAIL PROTECTED]> wrote: Hi there, I do work on following regex: ^(.*)_a[0-9](.*).htm$ This should be valid for "test_a9393.htm", but not for "9393.htm" as ther is no leading _a infront of the number. Unfortunatelly this also works for the 9393.htm file. Can somebody give me a hint why the regex also is true for text that does not start with _a infront of the number? It won't match something without an _a in it. So there's something you're not mentioning. 'test_a9393.htm' matches. 'a9393.htm' does not match. -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] regex problem
[snip] Hi there, I do work on following regex: ^(.*)_a[0-9](.*).htm$ This should be valid for "test_a9393.htm", but not for "9393.htm" as ther is no leading _a infront of the number. Unfortunatelly this also works for the 9393.htm file. Can somebody give me a hint why the regex also is true for text that does not start with _a infront of the number? Thank you for any help, Merlin [/snip] How about this: (\w)+(_a){1}(\w)+\.htm$ Worked for me :) HTH Dan -- Dan Parry Senior Developer Virtua Webtech Ltd http://www.virtuawebtech.co.uk -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.394 / Virus Database: 268.8.0/352 - Release Date: 30/05/2006 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex problem
Dave Goodchild schrieb: On 01/06/06, Merlin <[EMAIL PROTECTED]> wrote: Hi there, I do work on following regex: ^(.*)_a[0-9](.*).htm$ This should be valid for "test_a9393.htm", but not for "9393.htm" as ther is no leading _a infront of the number. Unfortunatelly this also works for the 9393.htm file. Can somebody give me a hint why the regex also is true for text that does not start with _a infront of the number? Thank you for any help, Merlin Try this: ^(.*)(_a{1})(\d+).htm$ in your regex you are looking for any instance of _, a OR a sequence of numbers. I think this will search for zero or more characters, one instance of _a, then one or more numbers, then .htm. Hi, unfortunatelly it does not work. But you are right my regex: ^(.*)_a[0-9](.*).htm$ seems to make an OR with _a OR numbers , but I would like to have an AND. Any other ideas? Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex problem
On 01/06/06, Merlin <[EMAIL PROTECTED]> wrote: Hi there, I do work on following regex: ^(.*)_a[0-9](.*).htm$ This should be valid for "test_a9393.htm", but not for "9393.htm" as ther is no leading _a infront of the number. Unfortunatelly this also works for the 9393.htm file. Can somebody give me a hint why the regex also is true for text that does not start with _a infront of the number? Thank you for any help, Merlin Try this: ^(.*)(_a{1})(\d+).htm$ in your regex you are looking for any instance of _, a OR a sequence of numbers. I think this will search for zero or more characters, one instance of _a, then one or more numbers, then .htm. -- http://www.web-buddha.co.uk dynamic web programming from Reigate, Surrey UK (php, mysql, xhtml, css) look out for project karma, our new venture, coming soon!
[PHP] regex problem
Hi there, I do work on following regex: ^(.*)_a[0-9](.*).htm$ This should be valid for "test_a9393.htm", but not for "9393.htm" as ther is no leading _a infront of the number. Unfortunatelly this also works for the 9393.htm file. Can somebody give me a hint why the regex also is true for text that does not start with _a infront of the number? Thank you for any help, Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Am I supposed to be using SPL?
This one time, at band camp, "D. Dante Lorenso" <[EMAIL PROTECTED]> wrote: > Is SPL meant to be used? If so, is it experimental? Is it documented? > Should I stay away from SPL for production code? What's the official word? Officially SPL is part of PHP. It provides a standard interface for iterating over aggregate objects, eg: array, directory listing, xml, etc... try{ foreach ( new DirectoryIterator('./') as $Item ) { echo $Item.''; } } catch(Exception $e){ echo 'No files Found!'; } Kevin -- "Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What would cause this?
nicolas figaro wrote: tedd a écrit : tedd, let us know what your logs say. but it's not a very good idea to let the script run without any control. you can be quickly flooded by mail from this script if it's called very often during the week-end. dude, what's a week-end? wait let me guess it's the bit between 1am on Sunday and 7am om Monday right? I agree 6 hours is plenty of time to flood someone with mail :-) N F -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What would cause this?
tedd a écrit : Hi gang: Hi I have a question regarding php and security. My apologies beforehand if this is common knowledge to everyone except me. I have a php application sitting at root level on one of my servers who's sole function is to send me an email whenever it's run. So, whenever I reference this app, it sends me an email -- very simple. However, the app isn't reference or linked anywhere on the site, but it still occasionally runs all by itself. It runs automagically ? My question is -- what's triggering it? did you check your http server log files for this url ? Is the cause a bot of some type? I was told that spiders/bots could only travel links outward from your front page (i.e., index) to all other referenced pages, but could not access things that are not linked -- unless of course they know the name of the app. Some tools try to check from a basic url for several directories or files (/images, /private, etc). So, why does this php app occasionally run? Are there critters that navigate my root without my knowledge? if you wish to limit the access to your script, you can control the IP of the client using $_SERVER["REMOTE_ADDR"]. Thanks. tedd but it's not a very good idea to let the script run without any control. you can be quickly flooded by mail from this script if it's called very often during the week-end. N F -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php