Re: [PHP] Image Verification - Problems in Safari, Mac OS X
On Mon, May 23, 2005 8:46 am, Rahul S. Johari said: If I had misunderstood your method and you think your method is better then what I'm using now, I'd still really appreciate if you can clarify and explain. Your method is fine. In fact, it penalizes IE for some stupidity in its caching, which is Good because maybe they'll fix it if their cache becomes increasingly useless as everybody does this to avoid their stupid bugs. In theory, the ?$random_string should have forced the browser to load a new/different image each time... It's hard to imagine even Microsoft could screw that up, but you never know with Microsoft on this issue... One possible improvement, however, is this: The random part of the URL that you need to use to make Microsoft *NOT* cache an image doesn't have to be tied to the actual algorithm that creates the image. Consider this example: index.html --- ?php $fool_microsoft = mt_rand(1, 200); ? img src=random.php/?php echo $fool_microsoft?/example.png --- random.php --- ?php $heads = mt_rand(0, 1) ? 'heads' : 'tails'; $image = imagecreatetruecolor(100, 100); $white = imagecolorallocate($image, 255, 255, 255); $black = imagecolorallocate($image, 0, 0, 0); imagefilledrectangle($image, 0, 0, 100, 100, $white); imagestring($image, $heads, 10, 60, $black); header(Content-type: image/png); imagepng($image); ? The HUGE random number in the URL that forces MS to never cache my coin-flipping image has nothing to do with the heads/tails outcome. I don't know if this will help you have less clutter in your images or not, but it might be useful some day. -- 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 nightmares
On Mon, May 23, 2005 8:43 am, W Luke said: I really struggle with regex, and would appreciate some guidance. Basically, I have a whole load of files (HTML) which are updated every few minutes. I need to go through each line, looking for the word CONFIRMED: (which is always in capitals, and always superseded by a colon). The line looks like this: 22.5 J.Smith at Thropton, CONFIRMED: more text here, including commas and info on the appointment etc Is that always on ONE line? If so, you sure don't need anything as fancy as RegEx to do that. $file = file(/full/path/to/your/file.html) or die(Could not load HTML); while (list(, $line) = each($file)){ if (strstr($line, 'CONFIRMED:')){ $parts = explode('CONFIRMED:', $line); list($before, $after) = $parts; echo A CONFIRMED appointment!br /\n; echo p$before/p\n; echo p$after/p\n; echo hr /\n; } } You may need RegEx some other day to pick out the other bits and pieces from the line... Or not. I've done a lot of scraping of data like this with just explode and strstr and substr. RegEx is great when you need it; But when you don't it's a lot of overhead and a bit of a headache. [Course, when you *DO* need RegEx it's *more* than a bit of a headache. More like a migraine :-)] -- 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] Re: Re: Re: __get() not reentrant?
On Mon, May 23, 2005 8:43 am, Christopher J. Bottaro said: You took my suggestions as flames, and responded in kind. They were not intended as such. I'm happy to assume that you're the best programmer on the planet, okay? Let's cut the flames out. case. Its insulting to our intelligence as programmers. PHP was initially designed for very much non-programmers. It's kind of gotten away from that with all the OO stuff, especially in PHP 5, but there is still a considerable faction that doesn't *WANT* the complexity of a full-blown kitchen-sink language. It's not because we think you're stupid; And it's certainly not that we think we're stupid. It's that we believe that simple tasks are best served by simple tools. I was making a point. I don't see why recursion is allowed in every other function except for __get(). I think your argument is weak about protecting people from typos. If PHP wanted to protect people from typos, it should force you to declare your variables. Or maybe it should warn you when you use an undeclared variable. Oh wait, it *DOES* that! Rather like Lisp, actually. But that feature is turned off by default installation. I was bringing the to the table a discussion of the current behavior of __get(). I proposed that I might be broken or maybe should be changed, and you start insulting my abilities as a programmer and suggest that we shouldn't consider moving forward and just deal with what we have? I don't know why you took insult. None was intended. You may want to take this discussion to PHP-Dev, however, where people who actually made the decision you don't like, and who will be the ones to decide what to do about your suggestion discuss these kinds of decisions. You obviously don't accept my musings on possible reasons. [shrug] What is wrong with that? Why should PHP disallow that recursive __get() call? It is perfectly valid recursive code. It terminates for all cases. You clearly don't like the answer I gave. Maybe there's a better answer. Berating me sure won't find it. Try PHP-Dev. What happens if you do: class example { function __get($x){ return $this-recursive_get($x); } function recursive_get($x){ /* paste your current __get function body here */ } } I suspect it will work just fine at the expense of one (1) extra function call, which is not significant in recursion. I suspect it doesn't. If __get() is anywhere in the call stack, then $this-x won't invoke a 2nd __get() call. You misunderstood my suggestion. I was suggesting that you compartmentalize the __get() from the recursion, such that there was NO $this-xyz in the function body of recursive_get(). A recursive __get() has some serious implications to performance and design decisions that painted you into this corner. Well, it doesn't have any implication on the performance of my app, considering the code path is executed like 5% (or less) of the time. Painted myself into this corner? Why? Because I think its easier to write $this-myvar than it is to write $this-attrs['myvar']? Its PHP's job to make my life easier and more convenient. The code you posted was doing quite a bit more than getting rid of an array reference... If that's all you want, you can do it without recursion. Obviously, it's entirely possible that your Design is the most elegant beautiful disciplined bit of code since John von Nueman... But it's more likely, without knowing anything about you, that you've come up with this as a result of some bad Design decisions. Review your Design. :-) Wow, how pompous of you. Bad design, huh? Since when is it bad design to calculate attribute values on the fly? Many cookbook style books have idioms for doing this. In my case, one of the calculated values depends on other values accessible via __get(). So why shouldn't I use __get()? The syntax is cleaner. Btw, when I say use __get(), I mean implicitly call __get() via $this-attribute syntax. This whole problem does not exist if you call __get() explicitly, but then whats the point. You're not going to like my answer. Oh well. It seems to me that you've decided to make your property references be just as powerful, complex, and flexible as methods. At which point, I have to wonder why they should be properties at all. Why not just make it be a method? $example-get($x); There's not a lot of point to HAVING properties distinct from methods if the properties are going to be so complex that they require all the power of methods. That's just *MY* opinion, based on a lot of different OO languages. I expect you disagree with it, and that's fine. But the point is there: If you are going to put that much complexity into your property, it's not a property any more; it's a method. Speaking of good design, Python's __getattr__() behaves how I expect. Okay. [shrug] Perhaps you'd be happier coding your application in Python? Nobody is forcing
Re: [PHP] Can I prevent Server variables from being spoofed ?
On Mon, May 23, 2005 5:40 am, Jochem Maas said: your site would make you look less like monopolistic idiots (why is it that the organisations with the most freaking money are the least capable of providing a _proper_ site...?) Because their expert friend company (the one with the most money) told them it wasn't safe unless they only used their products. [That was a Microsoft-bash for anybody who didn't follow it.] -- 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] Re: Re: Re: __get() not reentrant?
Christopher J. Bottaro wrote: Richard Lynch wrote: On Sun, May 22, 2005 3:24 pm, Christopher J. Bottaro said: And what would make it any different from a normal recursive function? The fact that *ANY* attempt to access a mis-typed property would kick in a __get() call, and that's too frickin' easy to happen in code that's too easy to fly by QA in large-scale applications springs to mind... don't forget the noob factor - a noob could spend days trying to figure out WTF is going on in such a situation. we might even lose him to ASP in that time :-/ Not saying you're wrong or they're right just that it's not quite as simple as a normal recursive function or loop iteration. I completely disagree. I don't mean any offense to anyone here, but I find it kind of ridiculous for a language to restrict itself that like in this case. Its insulting to our intelligence as programmers. er whatever, interesting to see how easily you are insulted - I mean its a programming language with a certain kind of implementation, which may not be perfect, but I don't think they we're thinking of you when they wrote it. Every recursive function runs the risk of going into infinite loop if the programmer doesn't understand the basic concept (or makes a silly mistake). Just saying it's an easier silly mistake to mis-type: $whatever-fooo instead of $whatever-foo and have that escape QA somehow. Loops run the risk of going on indefinitely as well. Maybe PHP should disable all forms of loops/recursion to protect the programmers from themselves. That does seem a bit excessive... I was making a point. I don't see why recursion is allowed in every other function except for __get(). I think your argument is weak about protecting people from typos. If PHP wanted to protect people from typos, it should force you to declare your variables. you think its a weak argument, maybe you are missing the point - ask yourself what the average level of php programmers is? part of the php philosophy is about making/keeping php accessible. I think you will find that if you we're forced to declare you [class] variables that your __get() implementation would stop working they way it does now... Maybe __get() should allow recursion and let the developer worry about infinite recursion. Is that the 11th commandment? But, today, it doesn't, so deal with it and move on. ditto. I was bringing the to the table a discussion of the current behavior of __get(). I proposed that I might be broken or maybe should be changed, and maybe you are broken, hard to tell from here. you start insulting my abilities as a programmer and suggest that we shouldn't consider moving forward and just deal with what we have? I think Richard is a fairly intelligent person, if he had been insulting you I'm quite sure that he would have done a much better job ;-) What is wrong with that? Why should PHP disallow that recursive __get() call? It is perfectly valid recursive code. It terminates for all cases. if it bugs you that much, write a patch for the engine and submit it at [EMAIL PROTECTED] What happens if you do: class example { function __get($x){ return $this-recursive_get($x); } function recursive_get($x){ /* paste your current __get function body here */ } } I suspect it will work just fine at the expense of one (1) extra function call, which is not significant in recursion. I suspect it doesn't. If __get() is anywhere in the call stack, then you didn't bother to test? $this-x won't invoke a 2nd __get() call. A recursive __get() has some serious implications to performance and design decisions that painted you into this corner. ditto. Well, it doesn't have any implication on the performance of my app, considering the code path is executed like 5% (or less) of the time. Painted myself into this corner? Why? Because I think its easier to write $this-myvar than it is to write $this-attrs['myvar']? Its PHP's job to given the number of chars in the email you wrote you could have written the extra attrs[''] (9 chars) god knows how many times, besides if you admit you can solve all your issues by writing the 'long' form then your argument [below] that you need to call __get() from inside __get() in order to retrieve 1 or more calculated values to calculate the originally requested attribute sounds bogus. and yes this are of your implementation does seem flawed - btw we all have flawed code running... sometimes you have to hack around a problem because time/money is what it is, sometimes you write something that is suboptimal because you didn't, at the time, know all there is to know about that part of php php isn't perfect, neither are you - find a balance, get over it. make my life easier and more convenient. I didn't realise php had a job, I thought it was me who had the job and php was what I used to accomplish it Obviously, it's entirely possible that
Re: [PHP] Can I prevent Server variables from being spoofed ?
Richard Lynch wrote: On Mon, May 23, 2005 5:40 am, Jochem Maas said: your site would make you look less like monopolistic idiots (why is it that the organisations with the most freaking money are the least capable of providing a _proper_ site...?) Because their expert friend company (the one with the most money) told them it wasn't safe unless they only used their products. its a pity that the manager at my local branch [of 'the bank'] isn't such a gullible . (give me a bigger morgage,... its safer ;-) [That was a Microsoft-bash for anybody who didn't follow it.] made me laugh :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Free penetration test
Chris Shiflett wrote: Andy Pieters wrote: I am looking at where I can get my system tested for penetration. [ snip ] You might want to check out the links Christophe mentioned, as these provide free advice, which seems to be more along the lines of what you want. I recently stumbled onto Open Web Application Security Project [ www.owasp.org ]. Although not PHP-specific, they have some good stuff wrt securing web applications. They also have some php functions for sanitizing data, but the real good stuff is in their guides. Might be worth a click. Oh and Chris -- I loved your PHP Security writeup that you had posted on your website a while back. Keep up the good work. Regards, Burhan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[Fwd: Re: Re: [PHP] Re: Re: Re: __get() not reentrant?]
if someone with access to the webserver hosting jnsolutions.co.uk could do a quick rm -rf /home/jnsoluti/.autorespond that would be great :-) Original Message Return-Path: [EMAIL PROTECTED] X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - earth.svr7-speedyservers.com X-AntiAbuse: Original Domain - iamjochem.com X-AntiAbuse: Originator/Caller UID/GID - [32298 32003] / [47 12] X-AntiAbuse: Sender Address Domain - earth.svr7-speedyservers.com X-Source: /usr/local/cpanel/bin/autorespond X-Source-Args: /usr/local/cpanel/bin/autorespond [EMAIL PROTECTED] /home/jnsoluti/.autorespond X-Source-Dir: / We are currently away on holiday, until 16th June. I will respond with your email on my return. Thanks James Nunnerley -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [Fwd: Re: Re: [PHP] Re: Re: Re: __get() not reentrant?]
Jochem Maas a écrit : if someone with access to the webserver hosting jnsolutions.co.uk could do a quick rm -rf /home/jnsoluti/.autorespond that would be great :-) To that someone, here's the admin URL (cPanel 9) if you forgot it :) http://jnsolutions.co.uk:2082/ Ch. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [Fwd: Re: Re: [PHP] Re: Re: Re: __get() not reentrant?]
Christophe Chisogne wrote: Jochem Maas a écrit : if someone with access to the webserver hosting jnsolutions.co.uk could do a quick rm -rf /home/jnsoluti/.autorespond that would be great :-) To that someone, here's the admin URL (cPanel 9) if you forgot it :) http://jnsolutions.co.uk:2082/ Ch. I would prefer https://jnsolutions.co.uk:2083/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Re: Re: __get() not reentrant?
Christopher J. Bottaro wrote: Richard Lynch wrote: On Sun, May 22, 2005 3:24 pm, Christopher J. Bottaro said: And what would make it any different from a normal recursive function? The fact that *ANY* attempt to access a mis-typed property would kick in a __get() call, and that's too frickin' easy to happen in code that's too easy to fly by QA in large-scale applications springs to mind... Not saying you're wrong or they're right just that it's not quite as simple as a normal recursive function or loop iteration. I completely disagree. I don't mean any offense to anyone here, but I find it kind of ridiculous for a language to restrict itself that like in this case. Its insulting to our intelligence as programmers. and another thing, take this rather contrived/simple example of making set (as opposed to non-existent) [non-public] properties available via the property access syntax: public function __get($varName) { return isset($this-$varName) ? $this-$varName: null; } which would be impossible to do as is if __get() was 'reentrant' (whatever that means exactly, we both/all at least know that we mean that you can call it recursively...) actually if __get() worked in such a recursive way then it would be impossible to actually access any properties of the object. also note that __get() only comes into play if the property requested is not public or is not set. the internals mailing list has stuff in the archives about __get() which probably explains it a whole load better (including the reasoning behind the decisions etc etc) which may be of interest to you. these are not the droids your looking for, move along. :-) -- C -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Learning PHP ... online courses?
A few months back I signed up for the O'Reilly Safari Bookshelf. For about $20 a month you can check out up to 10 books to read online (put them on your bookshelf). Too many times I've bought a book and found only one or two chapters helpful. Or bought a book for a specific chapter. Now I can just read the chapters I need online. If I find the whole book helpful, I'll buy it. O'Reilly provides discounts on books for bookshelf subscribers. Something to look into if you plan on learning on a lot, especially on different subjects. That said, I learned PHP by reading PHP and MySQL Web Development from SAMS. I don't know if it's been updated for PHP5. Someone else mentioned php architect magazine. I think that's and excellent resource. You can just subscribe to the PDF version if you want to save some money. On May 23, 2005, at 3:45 PM, Bill McEachran wrote: I'm just learning PHP. If anyone knows of any affordable quality on-line based PHP courses please pass on the details. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Brent Baisley Systems Architect Landover Associates, Inc. Search Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Why this doesn't work ?
Hi, Hi have this bit of code: - echo script language=\JavaScript\ window.location=\valid_cv_insert.php?email=$email\ /script; - but when passing to file valid_cv_insert.php, $email value doesn't go along. The page that has this code knows tha value of $email variable. How can i turn this around ? Thanking you in advance. Warm regards, Mário Gamito -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why this doesn't work ?
Mário Gamito wrote: Hi, Hi have this bit of code: - echo script language=\JavaScript\ window.location=\valid_cv_insert.php?email=$email\ /script; - but when passing to file valid_cv_insert.php, $email value doesn't go along. The page that has this code knows tha value of $email variable. Echo out $email to see if what you think is there actually is. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why this doesn't work ?
Ave, I tried: forminput type=text name=emailINPUT type=submit value=SUbmit name=Submit/form ?php if($Submit) { echo script language=\JavaScript\ window.location=\delete.php?email=$email\ /script; } ? In a simple page. It worked absolutely fine... The value of $email was passed along to delete.php I don't think there's something wrong with your code below.. There might be some other reason affecting the transfer of the $email variable value. Rahul S. Johari Coordinator, Internet Administration Informed Marketing Services Inc. 251 River Street Troy, NY 12180 Tel: (518) 266-0909 x154 Fax: (518) 266-0909 Email: [EMAIL PROTECTED] http://www.informed-sources.com On 5/24/05 8:24 AM, Mário Gamito [EMAIL PROTECTED] wrote: Hi, Hi have this bit of code: - echo script language=\JavaScript\ window.location=\valid_cv_insert.php?email=$email\ /script; - but when passing to file valid_cv_insert.php, $email value doesn't go along. The page that has this code knows tha value of $email variable. How can i turn this around ? Thanking you in advance. Warm regards, Mário Gamito -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] strtotime('yesterday')
Ave, I¹m trying to delete all files in a folder based on a string match with the following code: ? $dir = '/Library/WebServer/Documents/something.com/subfolder/'; $dp = opendir($dir) or die ('Fatal Error: '.mysql_error()); while ($file = readdir($dp)) { if ((eregi('.png',$file)) (filemtime($dir.$file)) (strtotime('yesterday'))) { unlink($dir.$file); } } closedir($dp); $yesterday = mktime( 0, 0, 0, date(m) , date(d)-1, date(Y) ); $date = date( m-d-y, D, $yesterday ); echo BErase Successful!/BbrAll images up to $date, have been permanently erased from the Server.; ? I need the code to delete all images created till yesterday, and leave images created today. Somehow strtotime(yesterday¹) doesn¹t work. If I put strtotime(-2 days¹) or strtotime(-7 days¹) or even strtotime(8:00am¹)... They all work accordingly. How come (yesterday¹) isn¹t working? It doesn¹t delete anything. Any tips? Rahul S. Johari Coordinator, Internet Administration Informed Marketing Services Inc. 251 River Street Troy, NY 12180 Tel: (518) 266-0909 x154 Fax: (518) 266-0909 Email: [EMAIL PROTECTED] http://www.informed-sources.com
Re: [PHP] Why this doesn't work ?
Mário Gamito wrote: Hi, hi, the subject line of your post is not so good - make the subject relevant to your question, asking 'why doesn't this work' is like asking 'why are we here'. its liable to get you either: a, no answers. b, answers like this one. c, really useful answer like '42' ok on with the show Hi have this bit of code: - echo script language=\JavaScript\ window.location=\valid_cv_insert.php?email=$email\ /script; - but when passing to file valid_cv_insert.php, $email value doesn't go along. inside valid_cv_insert.php $email will only be set by the GET query if the ini setting register_globals is on. try doing this inside valid_cv_insert.php: ? var_dump( $_GET, $GET['email'] ); ? (depending on your version of php $_GET may or not exist in any case check this out (read it carefully!): http://php.net/en/language.variables.predefined as a sidenote, make sure you're doing some dumb like: ? $email = 'x'; echo $emial; ? ... its the kind fo thing I have wasted literally days on in the past. The page that has this code knows tha value of $email variable. how does it know it? possibly because you do something like?: ? $email = [EMAIL PROTECTED]; ? How can i turn this around ? you won't find much useful info on the back of your monitor ;-) it wasn't too clear exactly what you were looking for but the gist seems to be that you need to read up a bit on what register_globals is, the fact that the default has gone from 'On' to 'Off' somewhere in the not so distance past and what the consequences are for your code. still stuck? go read the manual a bit... then come back and ask some more. :-) good luck. Thanking you in advance. Warm regards, Mário Gamito -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Re: Re: Re: __get() not reentrant?
posted mailed Jochem Maas wrote: On Sun, May 22, 2005 3:24 pm, Christopher J. Bottaro said: And what would make it any different from a normal recursive function? The fact that *ANY* attempt to access a mis-typed property would kick in a __get() call, and that's too frickin' easy to happen in code that's too easy to fly by QA in large-scale applications springs to mind... don't forget the noob factor - a noob could spend days trying to figure out WTF is going on in such a situation. we might even lose him to ASP in that time :-/ I didn't realize that PHP had such an emphasis on the noob factor. Not saying you're wrong or they're right just that it's not quite as simple as a normal recursive function or loop iteration. I completely disagree. I don't mean any offense to anyone here, but I find it kind of ridiculous for a language to restrict itself that like in this case. Its insulting to our intelligence as programmers. er whatever, interesting to see how easily you are insulted - I mean its a programming language with a certain kind of implementation, which may not be perfect, but I don't think they we're thinking of you when they wrote it. I just don't like being talked down to, who does? You can be immature and poke fun at my choice of words if you want. All I meant to say is that I find it weird that PHP assumes that I don't understand how recursion works. Every recursive function runs the risk of going into infinite loop if the programmer doesn't understand the basic concept (or makes a silly mistake). Just saying it's an easier silly mistake to mis-type: $whatever-fooo instead of $whatever-foo and have that escape QA somehow. Loops run the risk of going on indefinitely as well. Maybe PHP should disable all forms of loops/recursion to protect the programmers from themselves. That does seem a bit excessive... I was making a point. I don't see why recursion is allowed in every other function except for __get(). I think your argument is weak about protecting people from typos. If PHP wanted to protect people from typos, it should force you to declare your variables. you think its a weak argument, maybe you are missing the point - ask yourself what the average level of php programmers is? part of the php philosophy is about making/keeping php accessible. Again, I didn't realize was so geared towards noobs. I think you will find that if you we're forced to declare you [class] variables that your __get() implementation would stop working they way it does now... No, I use __get() to provide property like access to calculated values. There is no corresponding class var for these values. If I wanted access to class vars, I'd just declare them and then __get() wouldn't be used. Maybe __get() should allow recursion and let the developer worry about infinite recursion. Is that the 11th commandment? I have no idea what you are talking about. I meant to say, Maybe __get()'s implicit invocation should work like normal functions. But, today, it doesn't, so deal with it and move on. ditto. Do yall really think I have halted my work because of this? I just want to discuss it. I was bringing the to the table a discussion of the current behavior of __get(). I proposed that I might be broken or maybe should be changed, and maybe you are broken, hard to tell from here. Way to make me look stupid because I made a typo. you start insulting my abilities as a programmer and suggest that we shouldn't consider moving forward and just deal with what we have? I think Richard is a fairly intelligent person, if he had been insulting you I'm quite sure that he would have done a much better job ;-) Thats great, I'm sure he's the reigning cut down contest champ on this list. I don't care. Like I said, I don't like being talked down to. I found it very unnecessarily presumptuous of him to say stuff like without knowing anything about you, I assume you have made bad design decisions, painted yourself in a corner, etc. What the hell does any of that have to do with the discussion? Painted myself into this corner? Why? Because I think its easier to write $this-myvar than it is to write $this-attrs['myvar']? Its PHP's job to given the number of chars in the email you wrote you could have written the extra attrs[''] (9 chars) god knows how many times, Yeah, I've written more in these threads than the entire class that spawned them. ?...?...? besides if you admit you can solve all your issues by writing the 'long' form then your argument [below] that you need to call __get() from inside __get() in order to [retrieve 1 or more calculated values to calculate the originally requested attribute sounds bogus. Err, not following ya. The point is that I don't want to use the long form. __get() is recursive when using the long form. Its the implicit invocation that isn't. php isn't perfect, neither are you - find a
[PHP] Recursive function and formatting string for javascript tree
Hi all. I can't seem to figure this one out. I am trying to output a string for a javascript that builds a DHTML tree. The sample string looks like this: [ ['Executive Director', null, null, ['Executive Assistant ', null, null], ['Operations Director', null, null, ['Information Technology Director', null, null, ['Information Technology Analyst', null, null] ] ], ['Finance Director', null, null], ['Human Resources Director', null, null], ['Program Services Director', null, null] ] ] My class contains these two functions to make this happen: function generateOrg() { $this-getDepts(0,1); $str = [. $this-str.]; return ($str); } function getDepts ( $parent, $level ) { $sql = 'SELECT BudgetedOrganization.* '; $sql .= 'FROM BudgetedOrganization '; $sql .= 'WHERE BudgetedOrganization.boSuperiorOrgID = ' . $parent; $rs = $this-retrieveData($sql); $totalRows = mysql_num_rows($rs); if ($totalRows 0) { while($row = mysql_fetch_array($rs)){ $currRow = 0; $this-str .= [' . $row['boOrgName'] . ',null,null; ($totalRows == $currRow) ? $delim = , : $delim = ],; $this-str .= $delim; $this-getDepts($row['boOrgID'],$level+1); $currRow++; } } return($this-str); } Here is the output I am getting from my database, and the format is not right. I have played with it for hours and still can't figure out how to get the brackets and commas formatted properly to represent the data tree properly. ['Organization XYZ',null,null], ['Operations',null,null], ['Finance',null,null], ['Information Technology',null,null], ['Program Services',null,null], ['Program Support',null,null], ['Provider Resources',null,null], ['MOST',null,null], ['Family Resources',null,null], ['Family Resources - Chatham Site',null,null], ['Team 13',null,null], ['Team 14',null,null], ['Enhanced Programs',null,null], ['Teen Parent Program',null,null], ['External Relations',null,null], ] AND here is is when it is nested the way I want it (I did this by hand): [ ['Organization XYZ',null,null, ['Operations',null,null, ['Finance',null,null], ['Information Technology',null,null] ], ['Program Services',null,null, ['Program Support',null,null] ['Provider Resources',null,null, ['MOST',null,null] ], ['Family Resources',null,null, ['Family Resources - Chatham Site',null,null, ['Team 13',null,null], ['Team 14',null,null] ], ['Enhanced Programs',null,null, ['Teen Parent Program',null,null] ] ], ], ['External Relations',null,null] ] ] Any help would be great. I am stuck. Thanks, Charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Re: Re: Re: __get() not reentrant?
Hello Christopher, Tuesday, May 24, 2005, 4:25:08 PM, you wrote: CJB Again, I don't see whats wrong with trying to get fixed what I CJB think is wrong. PHP is full of things I'm sure lots of us would like to see work differently (personally I'd love to see Java style overloading and to do away with __get entirely, as it can encourage poor OO design practises), but functionality isn't voted for via mailing list arguments. To begin a change request of this magnitude it needs to be addressed to the right people in the right place, so it may be worthwhile taking it through the correct channels. Although it's a cop-out response, you do actually have the full source to PHP - if this is such a major issue and an immediate resolve is required, that's your only real option beyond live with it - sad but true. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Regex nightmares
[Course, when you *DO* need RegEx it's *more* than a bit of a headache. More like a migraine :-)] One of these days I will truly master regular expressions. After that, enlightenment should be easy. Regards, Murray -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Very long delay posting to php-general (might be OT)
Hi all I was wondering if it is normal that when posting to the php-general list there is always a very long delay before messages are shown. It's not like with snail mail. Sending mail messages is instant so where is the delay? With kind regards Andy -- Registered Linux User Number 379093 -- --BEGIN GEEK CODE BLOCK- Version: 3.1 GAT/O/E$ d-(---)+ s:(+): a--(-)? C$(+++) UL$ P-(+)++ L+++$ E---(-)@ W++$ !N@ o? !K? W--(---) !O !M- V-- PS++(+++) PE--(-) Y+ PGP++(+++) t+(++) 5-- X++ R*(+)@ !tv b-() DI(+) D+(+++) G(+) e$@ h++(*) r--++ y--() -- ---END GEEK CODE BLOCK-- -- Check out these few php utilities that I released under the GPL2 and that are meant for use with a php cli binary: http://www.vlaamse-kern.com/sas/ -- -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] db aware text editor? (slightly OT?)
Hi All, I'm wondering if anyone knows of a 'db aware' text editor? By 'db aware', I mean one that can pull a recordset back from a local MySQL server and edit the content of fields much like a standard text editor does with files. I could probably build myself a simple one in Java, but before I undertake that task I thought I'd ask if any of the better known editors are capable of doing this, as I'd rather be able to use a feature-rich editor (ie one that has features such as regex search and replace, macro recording etc) than a hand-built alternative. Much warmth, Murray -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mysql connect problem
Hi: I have recently upgraded from a Mac G4 running OS 10.3.9 to a G5 running OS 10.4. I ported a working PHP app and upgraded from PHP 4.3.4 to 4.3.10 and MySQL 4.0.17 to 4.1.11. I am having a problem connecting to MySQL from PHP. I can connect to the database using either phpMyADMIN or directly from terminal mode using MySQL commands. However, when I try to enter the database from php, using $result = mysql_pconnect(localhost, api_user, 97533); I get $result = FALSE. This command works on the old system as does the MySQL command: mysql -u api_user -p I am using the identical php.ini on the new and old machines. Any help in getting over this hurdle would be appreciated. Jim -- Jim Feldman 14 Linda Lane Newton, MA 02461 617-527-0509 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Very long delay posting to php-general (might be OT)
Andy Pieters wrote: Hi all I was wondering if it is normal that when posting to the php-general list there is always a very long delay before messages are shown. It's not like with snail mail. Sending mail messages is instant so where is the delay? I think John Nichel took over the job of filtering the list of spam :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql connect problem
On Tue, May 24, 2005 2:14 pm, Jim Sara Feldman said: $result = mysql_pconnect(localhost, api_user, 97533); if (!$result) die(mysql_error()); Try it without the 'p' in pconnect, which you probably aren't using in the other connections in your testing. -- 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] Very long delay posting to php-general (might be OT)
On Tue, May 24, 2005 3:32 pm, Marek Kilimajer said: Andy Pieters wrote: Hi all I was wondering if it is normal that when posting to the php-general list there is always a very long delay before messages are shown. It's not like with snail mail. Sending mail messages is instant so where is the delay? I think John Nichel took over the job of filtering the list of spam :) I don't think that happened (at least not yet...) But things to consider: There must be some kind of automated spam-filtering going on. Or we'd be awash in spam. PHP's servers are donated, and the load must be enormous. It's not *THAT* bad a lag -- It's a mailing list, for Pete's sake. Posts are gatewayed to/from the newsgroup. That might introduce some inherent lag as duplicates are culled or something... I don't know WHY posts take hours to get through, but I'm not honestly seeing it as a problem personally. -- 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
[PHP] further detail on mysql connect problem
Hi: Adding a detail to my previous note on the mysql connect problem: At the point where I attempted to connect, I added a printout of the error generated when the instruction ran. The two lines now read: $result = mysql_pconnect(localhost, api_user, x97533); echo Tried to connect. Problem: .mysql_error(). br; What came back was: Tried to connect. Problem: Client does not support authentication protocol requested by server; consider upgrading MySQL client Thanks for your help. Jim -- Jim Feldman 14 Linda Lane Newton, MA 02461 617-527-0509
Re: [PHP] db aware text editor? (slightly OT?)
On Tue, May 24, 2005 2:08 pm, Murray @ PlanetThoughtful said: I'm wondering if anyone knows of a 'db aware' text editor? By 'db aware', I mean one that can pull a recordset back from a local MySQL server and edit the content of fields much like a standard text editor does with files. You've probably used phpMyAdmin, which has some of the features you ask for, though it's web-based and not text based... You *MIGHT* be able to built a new UI on top of phpMyAdmin easier than, say, a plug-in for vi or emacs to do what you want... Maybe not. Just an idea to ponder. -- 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] Re: Re: Re: Re: __get() not reentrant?
On Tue, May 24, 2005 8:25 am, Christopher J. Bottaro said: I think Richard is a fairly intelligent person, if he had been insulting you I'm quite sure that he would have done a much better job ;-) Oh yeah. :-) Thats great, I'm sure he's the reigning cut down contest champ on this list. I don't care. Like I said, I don't like being talked down to. I found it very unnecessarily presumptuous of him to say stuff like without knowing anything about you, I assume you have made bad design decisions, painted yourself in a corner, etc. What the hell does any of that have to do with the discussion? That may be what you read. It's certainly not what I typed. I saw two possibilities: 1. You had written something really elegant where you needed __get() to be recursive for a really good reason. 2. You, well, didn't... I don't know you from Adam. I said that it was MORE LIKELY that #2 applied, not knowing anything about you. Now, however, you have declared that you *DO* know what you are doing, so I will cheerfully retract #2. Happy? php isn't perfect, neither are you - find a balance, get over it. Sigh. PHP's motto: Get over it, we oppose change. (According to you and Richard). Another gross mis-representation of our theses... I believe I shall simply cease responding to Mr. Bottaro. You're right, all those cookbooks are stupid. Actually, a lot of those cookbooks are kinda stupid... They show you how to do nifty things, but they don't really explain when they should be applied, or more importantly, when not to apply them... And a lot of software developers, NOT INCLUDING Mr. Battaro, who use those cookbooks never really figure they out -- They apply the latest cool cookbook technique they have mastered whether it's a better fit to the problem than something from CS 101 or not. Speaking of good design, Python's __getattr__() behaves how I expect. use it then? I would if I could, but I can't. Besides, PHP is pretty fun/easy to program with, I'd say its my 2nd favorite language right now. Again, I don't see whats wrong with trying to get fixed what I think is wrong. Nothing wrong with that ; As noted, your post isn't going to the right list, nor had the right tone/content to achieve that goal. If you wanna re-write PHP, go to PHP-Dev. OK, all the subtle stabs at each other (and yes, they are subtle) aside, you brought up some good points about __get()'s behavior if it's implicit invocation allowed for recursion. Thats all I really wanted, thanks for that. You may be giving us more credit for subtlety than we deserve :-) Sometimes a cigar is just a cigar. -- 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] strtotime('yesterday')
On Tue, May 24, 2005 7:24 am, Rahul S. Johari said: I¹m trying to delete all files in a folder based on a string match with the following code: ? $dir = '/Library/WebServer/Documents/something.com/subfolder/'; $dp = opendir($dir) or die ('Fatal Error: '.mysql_error()); while ($file = readdir($dp)) { if ((eregi('.png',$file)) (filemtime($dir.$file)) (strtotime('yesterday'))) { unlink($dir.$file); } } closedir($dp); $yesterday = mktime( 0, 0, 0, date(m) , date(d)-1, date(Y) ); $date = date( m-d-y, D, $yesterday ); echo BErase Successful!/BbrAll images up to $date, have been permanently erased from the Server.; ? I need the code to delete all images created till yesterday, and leave images created today. Somehow strtotime(yesterday¹) doesn¹t work. If I put strtotime(-2 days¹) or strtotime(-7 days¹) or even strtotime(8:00am¹)... They all work accordingly. How come (yesterday¹) isn¹t working? It doesn¹t delete anything. Maybe strtotime('-1 day') would work. [shrug] You could also use http://php.net/mktime mktime(date('m'), -1); //This should be 24 hours before 'now', I think... Or maybe mktime(date('m'), date('d) -1); Whichever it is, PHP's mktime does the right thing even if you use, like: mktime(6, 0); //This is really May 31st, not June 0. PHP knows. -- 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
[PHP] cybercash as a shared object
I need to install the cybercash module on a Debian Sarge system. I really want to keep Debian's PHP packages, and just build this as a shared module. At least one post in the archives indicates that this is possible, as does one changelog entry. However, no specifics were offered. Here's what I've tried: I can build the module fine statically. I can build the shared module cybercash.so by modifying the ext/cybercash/config.m4 and Makefile files, modeling them after the mcrypt.so entries. While modules/cybercash.so does get built, I get this error when trying to load it: PHP Warning: Unknown(): Invalid library (maybe not a PHP library) 'cybercash.so' in Unknown on line 0 I'm building with PHP 4.3.10, and the latest cybercash from PECL. I've also tried the cybercash module from 4.2.3, as suggested in one of the online manual comments. Any guidance would be greatly appreciated! Regards, Bill Shupp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php