Re: [PHP] Problems installing php with pdflib
On 4/25/07, Richard Lynch [EMAIL PROTECTED] wrote: On Tue, April 24, 2007 7:39 am, Tijnema ! wrote: On 4/17/07, Richard Lynch [EMAIL PROTECTED] wrote: On Sat, April 14, 2007 3:55 am, Merlin wrote: I am moving to a new box and want to install php with pdflib again. After configure I get an error saying: pdflib.h not found! Check the path passed to --with-pdflib The path is just fine: '--with-pdflib=/usr/local/lib' configure needs to find TWO things: #1 the lib file which is libpdf.so in /usr/local/lib #2 the header file which is libpdf.h in /usr/local/include If you tell configure to look inside of /usr/local/lib, it can't *find* the libpdf.h file, because it's not inside that directory, it's inside a directory parallel to that. If you tell configure to look in /usr/local, it knows to check in /usr/local/lib for the .so file, and in /usr/local/include for the .h file, and it finds everything it needs. It won't, because his headers are in /usr/local/lib, and not in /usr/include/header If his headers are in /usr/local/lib, I'll be very very very surprised... They shouldn't be there. Move them. He hasn't replied yet, and i was also confused, but in his first post he said this: ls /usr/local/lib/pdflib.* /usr/local/lib/pdflib.h Of course, moving them is the best way, however, sometimes it gives problems with other things, so i guess creating a symlink here would be better Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with shared object file
On 4/26/07, Marten Lehmann [EMAIL PROTECTED] wrote: Hello, I'm trying to include a shared object file with the function dl(). But I always get: Warning: dl() [function.dl]: Unable to load dynamic library '/homepages/xyz/util.so' - /homepages/xyz/util.so: cannot open shared object file: No such file or directory in /homepages/xyz/test.php on line 5 But it is definetely there and readable (also executable)! I tried to include('/homepages/xyz/util.so') which gives same parsing errors since this is not php-code, but including works, so it's actually readable. What is the real error behind it? How can I find out why dynamic loading fails? Is it possibly due to different glibc versions? Regards Marten Yes, a different glibc version could be the problem. try ldd /homepages/xyz/util.so Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: posting variables to parent frame
On 4/26/07, Richard Lynch [EMAIL PROTECTED] wrote: On Wed, April 25, 2007 3:29 pm, Zoltán Németh wrote: 2007. 04. 25, szerda keltezÃ(c)ssel 14.35-kor Al ezt Ãrta: Very clever use of iFrame. So clever it doesn't show in your html source code. Looks more like you are using DIV tags, with simple POST values, just like I'd have done it. Incidentally, br/ is an error for html. can you tell me why br/ is an error I think you NEED a space before the / but I wouldn't get my knickers in a twist over this one... NO, a space is optional, a br/ withouth a space is XHTML-1.0 Strict valid. However, like said before, it could confuse really old browsers. It's pretty much the last thing to be fixed, if everything else works and you want that green check mark. :-) Which I often do, actually, but that's just because after all the hard work of getting rid of the REAL errors, getting the last little bit fixed up is about 5 minutes of work. Yeah, fix PHP errors first, and finish your site, then validate it with the w3c validator (validator.w3c.org). Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] TrueType font changes size when rotated?
On 4/26/07, Richard Lynch [EMAIL PROTECTED] wrote: On Wed, April 25, 2007 3:33 pm, Seth Price wrote: I downloaded your image, enlarged it, and measured it out in photoshop. The distance from the center to the left side is 131px, and center to right side is 129px. Diameter to top is 129px, and to bottom is 130px. While it may not be an obvious ellipse, it's enough to throw off my calculations. Enlarged it how? I guess he meant to zoom, so that he could actually count the pixels :) As soon as you scale an image, rounding errors are introduced... Take his source, maybe with a font 10 X bigger, and then using imagecolorat to examine each pixel in the original, and see if it's off... And, really, if drawing text with a 1-pixel error margin throws you off, you're in trouble anyway... It just shouldn't be like that :) Though the super dark 90-degree text versus the others with much larger variations in length is disconcerting, in your image, if those length calculations are correct... Still, it has probably nothing to do with PHP, as PHP is just using the GD library Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: everything printed suddenly has blue text, as if were a link
On 4/26/07, Al [EMAIL PROTECTED] wrote: font.. is depreciated and shouldn't be used anyhow. Use styles instead. I use combination of both :) style type=text/css font.grey { color: grey; } /style font class=grey My Grey Text :) /font Tijnema Dave Goodchild wrote: View the source, you have this: font color=blue which is not closed, therefore everything after it will be blue. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: everything printed suddenly has blue text, as if were a link
On 4/26/07, Stut [EMAIL PROTECTED] wrote: Tijnema ! wrote: On 4/26/07, Al [EMAIL PROTECTED] wrote: font.. is depreciated and shouldn't be used anyhow. Use styles instead. I use combination of both :) style type=text/css font.grey { color: grey; } /style font class=grey My Grey Text :) /font If you don't mind me saying so, that's daft. You should be using span tags here, not the deprecated font tags. -Stut Both work fine, should i really care? Tijnema Dave Goodchild wrote: View the source, you have this: font color=blue which is not closed, therefore everything after it will be blue. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: everything printed suddenly has blue text, as if were a link
On 4/26/07, Stut [EMAIL PROTECTED] wrote: Tijnema ! wrote: On 4/26/07, Stut [EMAIL PROTECTED] wrote: Tijnema ! wrote: On 4/26/07, Al [EMAIL PROTECTED] wrote: font.. is depreciated and shouldn't be used anyhow. Use styles instead. I use combination of both :) style type=text/css font.grey { color: grey; } /style font class=grey My Grey Text :) /font If you don't mind me saying so, that's daft. You should be using span tags here, not the deprecated font tags. -Stut Both work fine, should i really care? Using a screwdriver to hammer in a nail will usually work fine, but that doesn't mean you should be doing it. -Stut Hmm, maybe i'll use it in my upcoming scripts, but i'm not gonna change all my 500 made scripts :P Tijnema Dave Goodchild wrote: View the source, you have this: font color=blue which is not closed, therefore everything after it will be blue. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: posting variables to parent frame
On 4/26/07, tedd [EMAIL PROTECTED] wrote: At 5:05 PM -0400 4/25/07, Lori Lay wrote: Zoltán Németh wrote: Incidentally, br/ is an error for html. can you tell me why br/ is an error greets Zoltán Németh br/ is xhtml. It's not an error in xhtml, but might confuse older browsers. I tried it, even with a strict HTML 4.01 doctype and didn't get any errors, but who knows. I have read that br/ might confuse older browsers, so it is usually written br / to avoid problems. The basic HTML version is br. Lori Lori: To me, as error is something that is reported to me as an error by the w3c. If they accept it, then I accept it. That's the compliance thing -- I don't make the rules, I just try to live by them. Also, which older browsers have problems with it? I've been using br/ in sites for many years and never had any problem with it whatsoever. Also, every browser that BrowserCam provides has not demonstrated any problems with using br -- or at least none that I've seen. Cheers, tedd I believe it was IE4 and with some Netscape browsers. Tijnema -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: posting variables to parent frame
On 4/26/07, tedd [EMAIL PROTECTED] wrote: At 5:37 PM -0400 4/25/07, Al wrote: Ted: FF 2.0.0.3 is what I used to examine your html code. It looks the same with IE7. It's tedd not Tedd I don't know for sure, but I don't think IE 7 has the option to View Generated Source -- however, FF does, so try it after you click Speak Key. http://sperling.com/examples/captcha/ The point of View Generated Source is to view the generated source. The source used to generate the sound is not generated until you click the Speak Key. The nifty FF add-on TotalValidator is what I used to validate your html code. Try using the Validate HTML under Tools in FF, which it passes. Or use the w3c validator: http://validator.w3.org/check?uri=http://sperling.com/examples/captcha/ -- which it also passes. What's the point here? This is getting boring. Cheers, tedd It's not XHTML 1.0 Strict valid .. :P You're page is HTML 4.01 valid, i think you should make it XHTML 1.0 Strict. Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: posting variables to parent frame
On 4/26/07, tedd [EMAIL PROTECTED] wrote: At 4:54 PM +0200 4/26/07, Tijnema ! wrote: On 4/26/07, tedd [EMAIL PROTECTED] wrote: Also, which older browsers have problems with it? I've been using br/ in sites for many years and never had any problem with it whatsoever. Also, every browser that BrowserCam provides has not demonstrated any problems with using br -- or at least none that I've seen. I believe it was IE4 and with some Netscape browsers. IE what? Even IE 5 has less than a 2 percent usage and that figure is dropping by a half a percent per month -- as it is, it won't see 2008. http://www.w3schools.com/browsers/browsers_stats.asp This is like the which is faster echo or print debate -- it's not worth the effort. Cheers, tedd Yes, it is just like that debate. It turns out, if you need to choose between br/ and br / choose the latter. But if you already have a code with br/ just leave it like that :) I was talking about really old browsers :) Even IE5 is not very old for me. I don't use it, but i believe that one handles br/ already correctly. So for IE4, there are maybe 100 people on the world? That would be some Good old Stuff collectors :) Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: posting variables to parent frame
On 4/26/07, tedd [EMAIL PROTECTED] wrote: At 5:06 PM +0200 4/26/07, Tijnema ! wrote: It's not XHTML 1.0 Strict valid .. :P You're page is HTML 4.01 valid, i think you should make it XHTML 1.0 Strict. Ar. Then I would have to add all those / to my in all my code in all my sites. Literally millions of new / would have to be added. That act could possibly crash the net. So, until someone points out a good reason for me to change (I'm open for redirection), I'll continue to use what works for me. Besides, it's still compliant, isn't it? Cheers, tedd HTML 4.01 will become deprecated earlier then XHTML 1.0 :) That's all i know :P Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: everything printed suddenly has blue text, as if were a link
On 4/26/07, tedd [EMAIL PROTECTED] wrote: At 3:33 PM +0200 4/26/07, Tijnema ! wrote: On 4/26/07, Stut [EMAIL PROTECTED] wrote: Tijnema ! wrote: On 4/26/07, Al [EMAIL PROTECTED] wrote: font.. is depreciated and shouldn't be used anyhow. Use styles instead. I use combination of both :) style type=text/css font.grey { color: grey; } /style font class=grey My Grey Text :) /font If you don't mind me saying so, that's daft. You should be using span tags here, not the deprecated font tags. -Stut Both work fine, should i really care? Tijnema And you're the one who told me to switch my DOCTYPE to XHTML??? You go through all the trouble of using css and then you don't really use it. Try this: .grey { color: grey; } -- external, not embedded. p class=grey My Grey Text :) /p That's much simperer and it validates. Cheers, tedd I meant to say that every new page you write should be XHTML 1.0 Strict, not the pages you already have... Just like i'm doing this now :) Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: posting variables to parent frame
On 4/26/07, tedd [EMAIL PROTECTED] wrote: At 5:26 PM +0200 4/26/07, Tijnema ! wrote: On 4/26/07, tedd [EMAIL PROTECTED] wrote: At 5:06 PM +0200 4/26/07, Tijnema ! wrote: It's not XHTML 1.0 Strict valid .. :P You're page is HTML 4.01 valid, i think you should make it XHTML 1.0 Strict. Ar. Then I would have to add all those / to my in all my code in all my sites. Literally millions of new / would have to be added. That act could possibly crash the net. So, until someone points out a good reason for me to change (I'm open for redirection), I'll continue to use what works for me. Besides, it's still compliant, isn't it? Cheers, tedd HTML 4.01 will become deprecated earlier then XHTML 1.0 :) That's all i know :P Tijnema And tedd will become deprecated earlier than teddd -- I can wait. Besides, when HTML 4.01 finally does, someone will make a parser that will fix everything. Cheers, tedd Hmm, if that is gonna work completly, i want to see :P Look how many things are deprecated/removed in XHTML 1.0 Strict v HTML 4.01 A lot things have been replaced with styles in XHTML 1.0 Strict. I see microsoft as the first one that will ignore HTML 4.01, in IE8 maybe? Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: posting variables to parent frame
On 4/26/07, Robert Cummings [EMAIL PROTECTED] wrote: On Thu, 2007-04-26 at 19:17 +0200, Tijnema ! wrote: On 4/26/07, tedd [EMAIL PROTECTED] wrote: At 5:26 PM +0200 4/26/07, Tijnema ! wrote: On 4/26/07, tedd [EMAIL PROTECTED] wrote: At 5:06 PM +0200 4/26/07, Tijnema ! wrote: It's not XHTML 1.0 Strict valid .. :P You're page is HTML 4.01 valid, i think you should make it XHTML 1.0 Strict. Ar. Then I would have to add all those / to my in all my code in all my sites. Literally millions of new / would have to be added. That act could possibly crash the net. So, until someone points out a good reason for me to change (I'm open for redirection), I'll continue to use what works for me. Besides, it's still compliant, isn't it? Cheers, tedd HTML 4.01 will become deprecated earlier then XHTML 1.0 :) That's all i know :P Tijnema And tedd will become deprecated earlier than teddd -- I can wait. Besides, when HTML 4.01 finally does, someone will make a parser that will fix everything. Cheers, tedd Hmm, if that is gonna work completly, i want to see :P Look how many things are deprecated/removed in XHTML 1.0 Strict v HTML 4.01 A lot things have been replaced with styles in XHTML 1.0 Strict. I see microsoft as the first one that will ignore HTML 4.01, in IE8 maybe? So we're talking around 2012? Hell, I'll be retired by then!!! ;) Cheers, Rob. You maybe, but not everyone (like me :P) I would love to, but well, i guess i can't stop when i'm 20 years old :) Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP Text Messaging
On 4/26/07, Daniel Brown [EMAIL PROTECTED] wrote: Sounds like a good plan. Maybe I'll start recording all of my phone calls. I'll just answer the phone, Hello, this call is being reported for quality assurance and training purposes, this is Dan, wazzzup?!? Hmm, i see nobody would ever lie to you again :) On 4/26/07, Justin Frim [EMAIL PROTECTED] wrote: Richard Lynch wrote: [snip] Relying on Sprint, however, to honor any kind of oral agreement, is a big fat *NOT* I'm sorry, but we just don't have any reocrd of that conversation. You're now 2 weeks overdue, because that extension you claim we gave you doesn't exist. It was like a parody of the White House Watergate tapes -- Anything they didn't feel like honoring was just not there; Something that had been said that they LIKED, they had a perfect record of that though. [snip] A good old O.T. thread. :-) A few months back I was trying to weed some information out of Rogers and Fido, but several times I was told conflicting information each time I called. Finally I made an audio patch cable to connect my MP3 player/recorder to the phone and then proceeded to call Rogers again. The conversation went something like this: -Voice mail system: Thank you for calling Rogers Wireless. Please stay on the line and our next available agent will help you. Note that your call may be monitored and recorded for quality assurance and training purposes... music-on-hold... -Customer support: Thank you for calling Rogers, my name is Bob, may I have your phone number starting with the area code? -Me: I'm just letting you know that this call will be monitored and recorded for quality assurance purposes *click* MP3 recorder starts recording -Customer support: Umm okay The patch cable was designed so I could also play back audio into the phone, just in case they tried pulling a we never said that denial. Fortunately, in that conversation where I announced it was being recorded, the customer service guy never lied to me even once. Funny how that works out. You could better not tell them you are recording, and when they are saying we never said that then you just play it back :) Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP Text Messaging
On 4/26/07, Daniel Brown [EMAIL PROTECTED] wrote: Yeah, but unfortunately, in the United States, you have to alert someone when you're recording a telephone conversation. I hate laws, and i don't live in the US. :) I don't know how the laws are here in the netherlands, but i guess it is the same... :( Tijnema On 4/26/07, Tijnema ! [EMAIL PROTECTED] wrote: On 4/26/07, Daniel Brown [EMAIL PROTECTED] wrote: Sounds like a good plan. Maybe I'll start recording all of my phone calls. I'll just answer the phone, Hello, this call is being reported for quality assurance and training purposes, this is Dan, wazzzup?!? Hmm, i see nobody would ever lie to you again :) On 4/26/07, Justin Frim [EMAIL PROTECTED] wrote: Richard Lynch wrote: [snip] Relying on Sprint, however, to honor any kind of oral agreement, is a big fat *NOT* I'm sorry, but we just don't have any reocrd of that conversation. You're now 2 weeks overdue, because that extension you claim we gave you doesn't exist. It was like a parody of the White House Watergate tapes -- Anything they didn't feel like honoring was just not there; Something that had been said that they LIKED, they had a perfect record of that though. [snip] A good old O.T. thread. :-) A few months back I was trying to weed some information out of Rogers and Fido, but several times I was told conflicting information each time I called. Finally I made an audio patch cable to connect my MP3 player/recorder to the phone and then proceeded to call Rogers again. The conversation went something like this: -Voice mail system: Thank you for calling Rogers Wireless. Please stay on the line and our next available agent will help you. Note that your call may be monitored and recorded for quality assurance and training purposes... music-on-hold... -Customer support: Thank you for calling Rogers, my name is Bob, may I have your phone number starting with the area code? -Me: I'm just letting you know that this call will be monitored and recorded for quality assurance purposes *click* MP3 recorder starts recording -Customer support: Umm okay The patch cable was designed so I could also play back audio into the phone, just in case they tried pulling a we never said that denial. Fortunately, in that conversation where I announced it was being recorded, the customer service guy never lied to me even once. Funny how that works out. You could better not tell them you are recording, and when they are saying we never said that then you just play it back :) Tijnema -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: posting variables to parent frame
On 4/26/07, Justin Frim [EMAIL PROTECTED] wrote: tedd wrote: At 5:06 PM +0200 4/26/07, Tijnema ! wrote: It's not XHTML 1.0 Strict valid .. :P You're page is HTML 4.01 valid, i think you should make it XHTML 1.0 Strict. Ar. Then I would have to add all those / to my in all my code in all my sites. Literally millions of new / would have to be added. That act could possibly crash the net. So, until someone points out a good reason for me to change (I'm open for redirection), I'll continue to use what works for me. Besides, it's still compliant, isn't it? Call me crazy, but I use HTML 4.01 Transitional. It's messy as ever, but it works. And I've never had a browser bark over my br or br/ or br / I'll also admit I don't have enough CSS knowledge yet to make page layouts with completely dynamic positioning that actually look good, regardless of the browser window size and aspect ratio. You know, tables do a fantastic job of controlling layout. :-) (I'm expecting several hate-mail replies now.) Yes like this one :P It's actually quite simple, all you have to do is set positon to absolute, and use % for the left, right, top and bottom, or it won't resize. I used tables also when i started, once you know how tables work, you'll find them easy, but they aren't advanced enough once you want more. I've faced this problem when i wanted to create 1 single page that i won't ever leave (AJAX). I'm currently working on such page, but with a lot more stuff, and then i'm facing stupid browser limits. IE6 is not capable of changing CSS layouts from javascript. Also, IE6 is giving a lot of trouble with its cache. I need to clear all files from the options menu before i can test my site again. A simple refresh isn't enough, while a refresh works fine in FF. Didn't test it yet at IE7, it seems that it works better there... The current problem is that i'm no GFX master, and that i can only create layouts with colors, and no images, and they are guaranteed to look bad :P Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: posting variables to parent frame OT
On 4/26/07, Daniel Brown [EMAIL PROTECTED] wrote: You're 15 years old Tij? Wow, you were good at math right? Tijnema On 4/26/07, tedd [EMAIL PROTECTED] wrote: At 8:00 PM +0200 4/26/07, Tijnema ! wrote: On 4/26/07, Robert Cummings [EMAIL PROTECTED] wrote: So we're talking around 2012? Hell, I'll be retired by then!!! ;) Cheers, Rob. You maybe, but not everyone (like me :P) I would love to, but well, i guess i can't stop when i'm 20 years old :) Tijnema I got underwear older than that. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: everything printed suddenly has blue text, as if were a link
On 4/26/07, tedd [EMAIL PROTECTED] wrote: At 2:01 PM -0400 4/26/07, Robert Cummings wrote: On Thu, 2007-04-26 at 13:19 -0400, tedd wrote: .grey { color: grey; } -- external, not embedded. Oh dear, that's terrible, everyone knows you should use dropped vertically aligned braces in CSS: .grey { color: grey; } p class=grey My Grey Text :) /p That's disgusting... now what happens if you want to change the text to blue? You either have a class called grey that makes the text blue, or you have to change all the HTML where you used class=grey which puts you squarely back into the realm of why the font tag was deprecated. Negatory there grasshopper. You use the color rule for any tag that exhibits color AND have as many colors as you want -- it's a simperer way.. http://www.wordreference.com/definition/simperer -- Yeah... SIMPERER *giggle* Plus, you didn't do the braces right. They should be: .grey { color: grey; } In seriousness, I /do/ use colors that way -- and it works for me. Cheers, tedd For such things, i think you could better do this: p style=color:greyMy Grey Text :) /p Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: posting variables to parent frame OT
On 4/26/07, Daniel Brown [EMAIL PROTECTED] wrote: Well, smartass, I was going to pay you a compliment and say that you're well-versed and have a good handle on programming for someone your age but now, forget it! ;-P What does one person more or less matter if there are already 100s of people giving you compliments? Tijnema On 4/26/07, Tijnema ! [EMAIL PROTECTED] wrote: On 4/26/07, Daniel Brown [EMAIL PROTECTED] wrote: You're 15 years old Tij? Wow, you were good at math right? Tijnema On 4/26/07, tedd [EMAIL PROTECTED] wrote: At 8:00 PM +0200 4/26/07, Tijnema ! wrote: On 4/26/07, Robert Cummings [EMAIL PROTECTED] wrote: So we're talking around 2012? Hell, I'll be retired by then!!! ;) Cheers, Rob. You maybe, but not everyone (like me :P) I would love to, but well, i guess i can't stop when i'm 20 years old :) Tijnema I got underwear older than that. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List ( http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP Text Messaging [Straying Way OT]
On 4/26/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: If your really interested in this subject try; http://www.rcfp.org/taping/ Does there exists such page for world-wide phone calls? Tijnema Quoting Daniel Brown [EMAIL PROTECTED]: Interesting and being in Pennsylvania, I'm in the all-consent group but being originally from New Jersey, where I still thought it was law, I'm confused isn't there a Federal mandate about this as well? On 4/26/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: In the US you can record your own phone calls, ingoing and outgoing? Usually!! Most states are one-party-consent law states. If you live in one of these, you can always record your own in-state calls either openly or surreptitiously, since only one participant's consent is needed. Likewise, you can get someone else to record them for you. In interstate calls, it's important to check this state-by-state summary, because in interstate calls, both states' laws apply, and you need to apply the most stringent applicable law. For example, if you live in California or are even just speaking to someone in California (an all-party-consent law state), you must get the other party's permission to record the call, or risk having to pony up $5000 in statutory damages (or three times the actual damages, whichever is greater). In general, announcing your intent to record and letting the other party hang up if they don't like it is sufficient in all states: continued participation implies consent. The all-party-consent law states are: California, Connecticut, Florida, Illinois, Maryland, Massachusetts, Michigan, Montana, Nevada, New Hampshire, Pennsylvania, Washington. In Delaware, Indiana, Iowa, Missisippi, and New Mexico as well, a participant may record but a non-participant may not, even with consent. In Vermont the law is unsettled. I am not a lawyer; this is not legal advice; laws change; errors happen. John Quoting Daniel Brown [EMAIL PROTECTED]: Yeah, but unfortunately, in the United States, you have to alert someone when you're recording a telephone conversation. On 4/26/07, Tijnema ! [EMAIL PROTECTED] wrote: On 4/26/07, Daniel Brown [EMAIL PROTECTED] wrote: Sounds like a good plan. Maybe I'll start recording all of my phone calls. I'll just answer the phone, Hello, this call is being reported for quality assurance and training purposes, this is Dan, wazzzup?!? Hmm, i see nobody would ever lie to you again :) On 4/26/07, Justin Frim [EMAIL PROTECTED] wrote: Richard Lynch wrote: [snip] Relying on Sprint, however, to honor any kind of oral agreement, is a big fat *NOT* I'm sorry, but we just don't have any reocrd of that conversation. You're now 2 weeks overdue, because that extension you claim we gave you doesn't exist. It was like a parody of the White House Watergate tapes -- Anything they didn't feel like honoring was just not there; Something that had been said that they LIKED, they had a perfect record of that though. [snip] A good old O.T. thread. :-) A few months back I was trying to weed some information out of Rogers and Fido, but several times I was told conflicting information each time I called. Finally I made an audio patch cable to connect my MP3 player/recorder to the phone and then proceeded to call Rogers again. The conversation went something like this: -Voice mail system: Thank you for calling Rogers Wireless. Please stay on the line and our next available agent will help you. Note that your call may be monitored and recorded for quality assurance and training purposes... music-on-hold... -Customer support: Thank you for calling Rogers, my name is Bob, may I have your phone number starting with the area code? -Me: I'm just letting you know that this call will be monitored and recorded for quality assurance purposes *click* MP3 recorder starts recording -Customer support: Umm okay The patch cable was designed so I could also play back audio into the phone, just in case they tried pulling a we never said that denial. Fortunately, in that conversation where I announced it was being recorded, the customer service guy never lied to me even once. Funny how that works out. You could better not tell them you are recording, and when they are saying we never said that then you just play it back :) Tijnema -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- Daniel P. Brown [office] (570-) 587-7080 Ext
Re: [PHP] Re: posting variables to parent frame OT
On 4/26/07, Daniel Brown [EMAIL PROTECTED] wrote: Tedd, If you still have those old underwear, we should stick 'em up Tijnema's nose! :-D Hmm, if you come over to the netherlands to do that :) Just tell me when you arrive at Schiphol (Or Groningen Airport Eelde, lil bit closer), and i'll make sure you get in Frisian :) ( = Somewhere in the north of the netherlands) Tijnema On 4/26/07, Tijnema ! [EMAIL PROTECTED] wrote: On 4/26/07, Daniel Brown [EMAIL PROTECTED] wrote: Well, smartass, I was going to pay you a compliment and say that you're well-versed and have a good handle on programming for someone your age but now, forget it! ;-P What does one person more or less matter if there are already 100s of people giving you compliments? Tijnema On 4/26/07, Tijnema ! [EMAIL PROTECTED] wrote: On 4/26/07, Daniel Brown [EMAIL PROTECTED] wrote: You're 15 years old Tij? Wow, you were good at math right? Tijnema On 4/26/07, tedd [EMAIL PROTECTED] wrote: At 8:00 PM +0200 4/26/07, Tijnema ! wrote: On 4/26/07, Robert Cummings [EMAIL PROTECTED] wrote: So we're talking around 2012? Hell, I'll be retired by then!!! ;) Cheers, Rob. You maybe, but not everyone (like me :P) I would love to, but well, i guess i can't stop when i'm 20 years old :) Tijnema I got underwear older than that. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List ( http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IE and cookie issues in PHP app
On 4/26/07, Dave Goodchild [EMAIL PROTECTED] wrote: Hi all. I have built an online events directory in php ( http://dontjustsitthere.co.uk) where people can find local events and also post their events. The app is composed of a single page, index.php, that generates different content depending on the parameters passed to it and uses sessions for persistence. I have had nothing but pain with IE6 with this, I don't use any third-party cookies and one issue was resolved by using this line at the top of the page: ini_set('session.name', 'couchy'); session_start(); Why do you have cookies in your title, and you're using sessions? These are different things... To post an event, the first form processes the category and postcode of the event plus a captcha field. The fields are validated and cleaned and then passed into $_SESSION. On the next stage I perform a cookie check, and if there are issues warn the user. This has been happening to every IE6 user, they can't get past the first page - so that means that $_SESSION['category'] and $_SESSION['postcode'] are not being populated. Maybe some code could help us determine the real problem, with this text description, there could be 100+ different codes that could fit, and maybe some work with IE6, and some don't. I thought I had this nailed but it's rearing it's butt-ugly head again. Anyone aware of the probable cause of this? IE6 is full of sh*t, I had a lot of trouble with it lately too, seems that it doesn't handle all RFC/W3C standards But as i said before, we can't do anything without your code :) Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: posting variables to parent frame OT
On 4/26/07, Robert Cummings [EMAIL PROTECTED] wrote: On Thu, 2007-04-26 at 20:49 +0200, Tijnema ! wrote: On 4/26/07, Daniel Brown [EMAIL PROTECTED] wrote: Tedd, If you still have those old underwear, we should stick 'em up Tijnema's nose! :-D Hmm, if you come over to the netherlands to do that :) Just tell me when you arrive at Schiphol (Or Groningen Airport Eelde, lil bit closer), and i'll make sure you get in Frisian :) ( = Somewhere in the north of the netherlands) Careful guys, I think Tij might be a sexual predator :/ he's trying to lure you away... to his place!! ;) Cheers, Rob. Hmm, predator... LOL, sexual NO, the rest... YES, sure, who doesn't want to live in the netherlands?? Much better then the US :) No extreme idiots who kill half of a school Laws, there are laws of course, but ignoring some laws doesn't mean you get caught by the cops :) Cops are too stupid in the netherlands, they are running on the street, and not watching the web Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: posting variables to parent frame OT
On 4/26/07, Daniel Brown [EMAIL PROTECTED] wrote: Yeah, I heard the Netherlands was really loose with their laws on this kind of thing ;-P Yeah, the cops are walking on the street :) not surfing on the web,... Tijnema On 4/26/07, Robert Cummings [EMAIL PROTECTED] wrote: On Thu, 2007-04-26 at 20:49 +0200, Tijnema ! wrote: On 4/26/07, Daniel Brown [EMAIL PROTECTED] wrote: Tedd, If you still have those old underwear, we should stick 'em up Tijnema's nose! :-D Hmm, if you come over to the netherlands to do that :) Just tell me when you arrive at Schiphol (Or Groningen Airport Eelde, lil bit closer), and i'll make sure you get in Frisian :) ( = Somewhere in the north of the netherlands) Careful guys, I think Tij might be a sexual predator :/ he's trying to lure you away... to his place!! ;) 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. | `' -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: posting variables to parent frame OT
On 4/26/07, Robert Cummings [EMAIL PROTECTED] wrote: On Thu, 2007-04-26 at 21:02 +0200, Tijnema ! wrote: On 4/26/07, Robert Cummings [EMAIL PROTECTED] wrote: On Thu, 2007-04-26 at 20:49 +0200, Tijnema ! wrote: On 4/26/07, Daniel Brown [EMAIL PROTECTED] wrote: Tedd, If you still have those old underwear, we should stick 'em up Tijnema's nose! :-D Hmm, if you come over to the netherlands to do that :) Just tell me when you arrive at Schiphol (Or Groningen Airport Eelde, lil bit closer), and i'll make sure you get in Frisian :) ( = Somewhere in the north of the netherlands) Careful guys, I think Tij might be a sexual predator :/ he's trying to lure you away... to his place!! ;) Cheers, Rob. Hmm, predator... LOL, sexual NO, the rest... YES, sure, who doesn't want to live in the netherlands?? Much better then the US :) I'm in Canada... everyone knows Canada is the best country in the world :) Unless those conservatives do something dumb like make our copyright/patent laws look like the ridiculous U.S. laws. I guess we can discuss for hours what the best country is, i just can't agree that Canada is the best country :P No extreme idiots who kill half of a school There's extremists in every country. The Netherlands has a tiny population in comparison to the U.S. Unfortunately, this kind of thing, fear, I is just the tip of a 21st century iceberg :( Might be, but just because US is so important it is also a target for terrorists, what i called as example has of course nothing to do with US itself, but 9-11 has :P It guess that Bush is the biggest problem, look at the Iraq war for example. Laws, there are laws of course, but ignoring some laws doesn't mean you get caught by the cops :) It also doesn't mean you don't get caught ;) I can't really make a comment about it on this list, but you probably know what i wanted to say. If not, contact me off list :P Cops are too stupid in the netherlands, Are you going to be a cop when you grow up? *grin* While some cops may be stupid, your over generalization does no justice to your intelligence. they are running on the street, and not watching the web Well at least they'll stay in shape... hard to eat doughnuts while running :D Cheers, Rob. That's true, but that also means that hackers can do a lot of stuff without getting caught Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploaded file
On 4/26/07, PHP [EMAIL PROTECTED] wrote: Hi, How do I pass an uploaded file, from a form, to a class? I have a file type on the form called file. The variable $file is fine in my php code, can be used normally. But, I want to pass it to a class then manipulate the file, but it does not work. $cMyClass-fnManipulateFile($file); the function fnManipulateFile gets $file only as the path the file was temporarily uploaded to (tmp/98rsof398) but the other variables are blank, such as $file_name. is it possible to do this? or do I have to pass each one, like $file_name, $file_size, etc.? Thanks, Chris You should move your uploaded file first with the move_uploaded_file function, and then perform actions on it :) Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Server-Side Speech --- New Project Discussion (PHP/C++ Developers?)
On 4/26/07, Daniel Brown [EMAIL PROTECTED] wrote: As a result of an ongoing thread, I am launching a project that should allow users on shared hosting accounts and other restricted Unix-like hosting systems to utilize text-to-speech synthesis, primarily the Festival TTS engine. The goal of the project will be to create a miniature, portable TTS system that a user can upload to their hosting account and use right away, without the need to compile the system or have access to privileged-only libraries. The ultimate aim here is for a user to be able to do the following, from start to finish: 1.) Determine a need for text-to-speech synthesis on the web. 2.) Locate this project. 3.) Download the compiled binaries and PHP source code. 4.) Upload the binaries and code to their existing hosting account. 5.) Set permissions on directories and configure the system as necessary. 6.) Integrate the system into their existing architecture and design. 7.) Use the system. I may set up a small mailing list for the project, as well as a forum to use with development, bugtracking, et cetera. I'm not entirely sure whether I will be hosting the entire project on one of my servers, or if I will use SourceForge for some or all of the hosting. Anyone who's interested in jumping on, let me know. We may not create a PHP-based TTS system, but we can do the next best thing. Besides, everything has to start somewhere! -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 I'm not sure what it is exactly, i know which thread you are referring to so i guess i will need to read that one, but i don't have time for that, but it looks very interesting this. Just count me as in :) I have server running here at my lan, and i use that for development, so i have root access to it :) It's running apache + PHP + MySQL, all compiled from source, i know how to compile apps etc in linux. I have experience in programming in various languages, which include the required PHP C++. You may think that i'm too young (15) for this project, but please, don't under estimate me. Also, because i'm so young, i can learn things very quick. I understand new things very quickly. I'd like to write the hardest part of the code because i learn most from that :) Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] slow performance
On 4/25/07, clive [EMAIL PROTECTED] wrote: Do you know any resource, describing how php works (like the thing about compiling opcode, and stuff)? How does php handle simultaneous requests? Are there multiple threads spawned? PHP doesn't do threading, apache does however every request it receives spawns a new thread ( there is however a thread limit in apache if Im not mistaken), but a single php cant unless you simulate it with arrays and loops. clive No threading?? :O Threads are a must have for Compilers (also JIT), no? PHP is fast already, but it should make PHP even faster i think. Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] script timeout
On 4/25/07, Henning Eiben [EMAIL PROTECTED] wrote: Hi, I have a small sample-application, that uses smarty for the presentation layer. Unfortunately I might encounter script-timeouts (not necessarily from smarty, could also be the DB-connection or something). In this case I would like to return an appropriate HTTP status-code (might be 500 or something). Right now I just receive a blank page, as well as a HTTP status-code of 200, which would indicate that everything is OK! So what do I need to do? I don't think this is possible in PHP. But i guess you need to do something in Apache, to return some special error message. A thing to keep in mind: PHP max_execution_time set in php.ini or set with set_time_limit does not affect system calls, such as database operations. So, you'd be better off setting the time limit in Apache, and do some stuff with Apache configuration files to return something. Of course, every Apache could be replaced by IIS in above text :) Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: how to detect type of image
On 4/25/07, Satyam [EMAIL PROTECTED] wrote: Sorry I'm late to this thread, I don't know if it has been mentioned, but most files have a 'magic number' at the begining of the file, which usually reads as a couple of letters or more. I think EXE files start with MZ, gifs with GIFxx where xx is the last two digits of the year of the standard. Just open files of the types you are concerned about and check the first few characters. Satyam I believe that mime_content_type does this, by reading a .magic file. In a magic file, there are these described i believe. But how would you detect (by a magic number) if a script is HTML or PHP? No way :P Of course, It's both not valid for an image file, but you might be worried when the first magic bytes are faked. Does somebody care if there are a few magic bytes displayed at the top of his page? Tijnema Ps. Please don't top post. - Original Message - From: Richard Lynch [EMAIL PROTECTED] To: Jonathan [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Wednesday, April 25, 2007 4:30 AM Subject: Re: [PHP] Re: how to detect type of image On Sun, April 22, 2007 10:35 am, Jonathan wrote: Alain Roger wrote: Hi, In my web application, end user is able to load images (png, jpeg, gif,..) into database. I would like to know how can i detect automatically the type of image (pnd, jpeg,...) ? i do not want to check the extension because this is easily faked... just by renaming it. Does it exist a technique for that ? thanks a lot, Is there anything wrong with just using $_FILES['upload_name']['type']? Yes. The first thing wrong, is that the idiot browser-makers can't even agree on what to cram into that when a user uploads a simple JPEG, much less some more esoteric document. So, right there, what you have in there under normal circumstances is pretty much garbage. The second thing wrong is that the Bad Guys can cram any dang thing they want in there, regardless of what they are uploading. So they can upload a nice .exe binary file and cram image/jpeg into the type. If your script is equally insecure throughout, then you could easily end up having an executable file up on your server that the Bad Guy wrote, and all they have to do is surf to it for it to run. That would be bad, just in case it's not terribly obvious. :-) Other than that, though, it's fine and dandy to use it... :-) -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.463 / Virus Database: 269.6.0/775 - Release Date: 24/04/2007 17:43 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] filetype() and exec() issues
On 4/24/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: This question is a two parter a) anyone else noticing filetype() failing on ISO image files? Warning: filetype(): Lstat failed for /var/lib/samba/some/file.iso Nope, didn't fail for me. But what exactly do you want to know about the file? filetype only check wheter the the argument given is a fifo, char, dir, block, link, file, or unknown. What you're doing below with the file command is getting the content type, there you could use the function mime_content_type, but it is deprecated, and seems not to work always. The manual forwards you to the fileinfo functions: http://www.php.net/manual/en/function.finfo-file.php example 592 does what you're doing with the file command below. b) I have a script that during processing will eventually call exec('/usr/bin/file -bi '.$file) over 1000 times, I've added a counter and when it dies on this line it's always after 1020 exec calls, regardless of the file name I'm feeding to `file`. I've reproduced this with both exec, shell_exec, system and the backticks. What am I missing here? Why does it die? Is it because te max execution time reached? then you should extend the max executon time: http://www.php.net/set_time_limit Tijnema snip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What determines the relative directory, and can I control it?
On 4/24/07, Dave M G [EMAIL PROTECTED] wrote: PHP Users, I am developing a content management system, and one of the goals is to separate out the design entirely from the PHP scripting and content. All the PHP scripts which contain the logic that drives the site are all in the web site's root directory, where the main index.php is located. The site uses an .htaccess file that creates user friendly URLs, so basically every time a user does anything on the site, it goes through /index.php. The intention is for the designer of the site to only have access to a subdirectory of the site called layout. If the designer wants, he or she can have multiple styles, which would each be in their own subdirectories. So, for example, there might be a /layout/styleOne directory, and a /layout/styleTwo directory. The way a designer builds a style is with a file called layout.php. This file contains blocks of HTML code that the designer can manipulate in order to customize the layout of the site. For example, that file would be located at /layout/styleOne/layout.php. Right now, if the designer of the site wants to make a call to an external CSS style sheet within layout.php, the designer has to write in the whole path, relative to the index.php file. For example: style type=text/css @import /layout/styleOne/style.css; /style But I'd like to make it so that the designer doesn't need to ever think about paths, and can state the path to the CSS file relative to layout.php, and not relative to index.php. Like so: style type=text/css @import style.css; /style What happens is that index.php includes a file called include.php. That file in turn includes all the PHP scripts on the site. That file includes another file called Page.php which has a way of including layout.php depending on what style the page needs. For example, styleOne or styleTwo. That's a long linear string of includes, but bottom line is, if I'm correct, that the index.php ultimately includes layout.php, and layout.php therefor acts as if it were in the same directory as index.php. I hope I have described the situation adequately. My question is, as implied above: Can I somehow manipulate any of the PHP scripts involved so that the HTML within layout.php will look first in it's own directory for inclusion of files, such as CSS and javascript and anything else? Thank you for your time and assistance. -- Dave M G Ubuntu 7.04 Feisty Fawn Kernel 2.6.20-15-generic Pentium D Dual Core Processor This is a client side problem. After your whole PHP processing has been done, 1 final HTML page is executed. In that page you have set : style type=text/css @import style.css; /style Then the browser will create a NEW request, to get the style.css file. And he will request that file in the same directory the index.php file is in. So what you want is impossible, unless you're gonna create a silly browser ;) what you can do, and what i see a lot is that they let PHP open the CSS file, and display the CSS inline. Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help needed to write an installation script for my php application
On 4/23/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi There, Could you please help me to write an installation script to install a php based application in Windows. 1. I have WAMP5.0 running my my IBM T43 laptop. 2. I have created a php application. 3. I would like to know how to create an installation Wizard for my application. What it should accomplish is that: Once the CD containing my application is loaded to CD drive, it should automatically ask me the standard windows installation questions to install my application in the path specified by me. Your help will be highly appreciated. Thanks, G. Guruswamy (VV, QCG) +91-93412-74717 Have a look at this page: http://www.softpedia.com/get/Authoring-tools/Setup-creators/ It contains (nearly) all installer software, softpedia has a rating system, so search for one with a high rating, and if you don't like it, pick the second :) Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] performance down
On 4/24/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello everyone, recently we tested upgrading our systems from: apache 2.0.55 php 5.1.6 eacclerator 0.9.5 to: apache 2.2.3 php 5.2.0 eaccelerator 0.9.5 but we always get worse performance than before. So maybe it is the newer apache version which slows us down or changes in php 5.2.0. Has anyone come across a similar phenomenon? Dominic Letz What platform are you using? Windows or Linux? Never had any slow PHP versions on my Linux server. Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] voucher manipulation
On 4/24/07, Steven Macintyre [EMAIL PROTECTED] wrote: Alo, I have a client looking to do the following; There is a standard voucher design, in the format of JPG ... now ... they wish to create a voucher system where if you reach so many points etc you can claim a voucher (using the design) with a expiry date ... current + 30days and a unique voucher number. Now, I have looked at ImageCreateFromjpeg etc ... but ... cant figure out how to place the text on it within the specified areas. It will then be emailed to the user. Does anyone know of an idea out there already I can take a look at ... or some advice? Kind regards, Steven Macintyre You're at the right start, you should create a image stream with ImageCreateFromJpeg, and then you should write text to it with one of the following functions: ImageTtfText ImagePsText ImageFtText and then save it, or output it. (ImageJpeg for example) Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems installing php with pdflib
On 4/17/07, Richard Lynch [EMAIL PROTECTED] wrote: On Sat, April 14, 2007 3:55 am, Merlin wrote: I am moving to a new box and want to install php with pdflib again. After configure I get an error saying: pdflib.h not found! Check the path passed to --with-pdflib The path is just fine: '--with-pdflib=/usr/local/lib' configure needs to find TWO things: #1 the lib file which is libpdf.so in /usr/local/lib #2 the header file which is libpdf.h in /usr/local/include If you tell configure to look inside of /usr/local/lib, it can't *find* the libpdf.h file, because it's not inside that directory, it's inside a directory parallel to that. If you tell configure to look in /usr/local, it knows to check in /usr/local/lib for the .so file, and in /usr/local/include for the .h file, and it finds everything it needs. It won't, because his headers are in /usr/local/lib, and not in /usr/include/header I don't know if the following will work, but you could try adding the an include dir to CFLAGS: export CFLAGS=-I /usr/local/lib *note that this will destroy currently set CFLAGS. And then try configuring with --with-pdflib=/usr/local Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Find MAC Address in PHP
On 4/23/07, Davi [EMAIL PROTECTED] wrote: Em Domingo 22 Abril 2007 03:12, Richard Lynch escreveu: On Fri, April 20, 2007 3:00 pm, Nathaniel Hall wrote: ?php $MAC = system(arp 192.168.200.254); echo $MAC; ? does not give me any output. I have copied arp to a place that the apache user can execute from and ensured arp is executable. Use exec and the extra args to get error codes. ARP is a root-command... =] Ok, maybe it's because i've builded my own Linux, and didn't wanted to have any security, but /sbin/arp has chmod value 755 on my system, and so, i can execute it with any user. Can you run 'arp' and get what you want from command line? As web-user? No. i can :) Can you 'su' to PHP user and *then* run it and get what you want? Hum... Not at all... You need to enter the root password... How can you do that? sudo sounds a little better... But... How about security? Hmm, that would mean that you have to store your root password in your PHP script ... I don't prefer that, maybe you could use it on a development server, but don't use it on production server ;) If not, you can't do that. And with a shell-script outputting the MAC to a .txt temp file, reading it from the PHP script? BTW, have a look at suPHP [1]... =] [1] - http://www.howtoforge.com/suphp_debian_etch_ispconfig That's really a big job to install :( Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] posting variables to parent frame
On 4/17/07, Hans [EMAIL PROTECTED] wrote: Hi there, I'm trying to post variables to a parent frame, I'm working from a page that is in an iFrame. However, I don't know how to accomplish this. I tried target='top' to include in the form tag (form action=?=$formurl? target=top) but this didn't succeed. Can you please help me? Thanks in advance! Hans Always have a look at w3schools first :) Then you would have noticed that it is _top instead of top http://www.w3schools.com/tags/tag_form.asp Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Find MAC Address in PHP
On 4/24/07, Davi [EMAIL PROTECTED] wrote: Em Terça 24 Abril 2007 10:07, Tijnema ! escreveu: On 4/23/07, Davi [EMAIL PROTECTED] wrote: Em Domingo 22 Abril 2007 03:12, Richard Lynch escreveu: On Fri, April 20, 2007 3:00 pm, Nathaniel Hall wrote: ?php $MAC = system(arp 192.168.200.254); echo $MAC; ? does not give me any output. I have copied arp to a place that the apache user can execute from and ensured arp is executable. Use exec and the extra args to get error codes. ARP is a root-command... =] Ok, maybe it's because i've builded my own Linux, and didn't wanted to have any security, but /sbin/arp has chmod value 755 on my system, and so, i can execute it with any user. cheatter... =P I hate security ;) Also, i have Apache running as root, so i can execute everything i want :) Can you run 'arp' and get what you want from command line? As web-user? No. i can :) cheatter... =P Can you 'su' to PHP user and *then* run it and get what you want? Hum... Not at all... You need to enter the root password... How can you do that? sudo sounds a little better... But... How about security? Hmm, that would mean that you have to store your root password in your PHP script ... I don't prefer that, maybe you could use it on a development server, but don't use it on production server ;) Yes... You store your root pwd in your script then: ?php $root_pwd=123456; echo system(su - -c arp); ? $ su - -c arp Password: How you'll type your root pwd? =P Something with the proc_* functions as you need bi-directional streams (input/output). Something like this: (not tested, partly copied form example 1926) ?php $root_pwd=123456; $descriptorspec = array( 0 = array(pipe, r), // stdin is a pipe that the child will read from 1 = array(pipe, w), // stdout is a pipe that the child will write to 2 = array(file, /tmp/error-output.txt, a) // stderr is a file to write to ); $process = proc_open('su - -c arp', $descriptorspec, $pipes); if (is_resource($process)) { fwrite($pipes[0], $root_pwd.\r\n); fclose($pipes[0]); echo stream_get_contents($pipes[1]); fclose($pipes[1]); proc_close($process); } ? If not, you can't do that. And with a shell-script outputting the MAC to a .txt temp file, reading it from the PHP script? #!/bin/bash if [ ! $# -eq 1 ]; then echo Usage: $0 target_ip; exit; fi; MAC_ADDR=`sudo arp | grep $1 | cut -d -f18` echo ${MAC_ADDR} /your/html/pub/dir/mac_temp.txt Where's the root password? I guess you need it too when using sudo? ?php $mac=file(mac_temp.txt); foreach($mac_addr as $mac){ echo $mac_addr; } ? Uhm, this is really weird code, i guess you meant this: ?php $mac=file(mac_temp.txt); foreach($mac as $mac_addr){ echo $mac_addr; } ? But well, when you have root access to the server, it might be better to just cheat like i did, and make arp available to the PHP user :) Tijnema BTW, have a look at suPHP [1]... =] [1] - http://www.howtoforge.com/suphp_debian_etch_ispconfig That's really a big job to install :( Yeah!! =P -- Davi Vidal [EMAIL PROTECTED] [EMAIL PROTECTED] -- Religion, ideology, resources, land, spite, love or just because... No matter how pathetic the reason, it's enough to start a war. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Shell used by system()
On 4/24/07, Marco Michelino [EMAIL PROTECTED] wrote: Hi *, is it possible to change the shell used by system() , exec() and similar PHP funtions? I'm running mod_php in apache on Linux. Apache shell is set to /sbin/nologin but PHP insists to call /bin/sh... First, I guess this isn't the fault of PHP, but the very first line in your shell script. It contains something like #!/bin/sh And yes, it will execute /bin/sh. You might want to force execution with another shell by adding that to the system/exec command: system(/bin/anothersh /path/to/myscript.sh); Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] List
On 4/24/07, Beauford [EMAIL PROTECTED] wrote: Does anyone else have this problem with the list. It seems that every time I check my email there is one or more messages from the list that royally screws up Outlook. I usually have to delete all list messages from the actual server and reboot. It only happens with emails from [EMAIL PROTECTED] Just trying to narrow down the problem. Not sure if this is spam that's sneaking into the list messing things up or what. Thanks I'm using Gmail (Webmail) and it's fine, but i think it is a problem because you get a lot of messages from the PHP list, you might want to get the emails in a daily digest, instead of every single email. Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Find MAC Address in PHP
On 4/24/07, chris smith [EMAIL PROTECTED] wrote: On 4/24/07, Tijnema ! [EMAIL PROTECTED] wrote: On 4/24/07, Davi [EMAIL PROTECTED] wrote: Em Terça 24 Abril 2007 10:07, Tijnema ! escreveu: On 4/23/07, Davi [EMAIL PROTECTED] wrote: Em Domingo 22 Abril 2007 03:12, Richard Lynch escreveu: On Fri, April 20, 2007 3:00 pm, Nathaniel Hall wrote: ?php $MAC = system(arp 192.168.200.254); echo $MAC; ? does not give me any output. I have copied arp to a place that the apache user can execute from and ensured arp is executable. Use exec and the extra args to get error codes. ARP is a root-command... =] Ok, maybe it's because i've builded my own Linux, and didn't wanted to have any security, but /sbin/arp has chmod value 755 on my system, and so, i can execute it with any user. cheatter... =P I hate security ;) Also, i have Apache running as root, so i can execute everything i want :) I hope you never make your server public then or try to become a server-administrator.. Wow. It's my development server :) It's LAN only, that's why i don't need security... I AM a server administrator, and yes, i do care about security there ;) Tijnema -- 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] Separating words based on capital letter
On 4/24/07, Dotan Cohen [EMAIL PROTECTED] wrote: I have some categories named in the database as such: OpenSource HomeNetwork I'd like to add a space before each capital letter, ideally not including the first but I can always trim later if need be. As I'm array_walking the database, I have each value at the moment I need it in a string $item. Other than pregging for A-Z how can I accomplish this? I haven't been able to get it down to less than 54 lines of code, which in my opinion means that I'm doing something wrong. Thanks in advance for any ideas. Dotan Cohen http://dotancohen.com/howto/root_email.php http://lyricslist.com/lyrics/lyrics/112/19/adams_bryan/waking_up_the_neighbours.html Maybe you could post your current code here? That way, we can improve your code instead of wasting our time to completly rewrite a script. Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Compilation?
On 4/23/07, Davide Bernard [EMAIL PROTECTED] wrote: I am very new to PHP. Can anyone tell me how do I compile my php 5 code? First you should tell us which operating system you are using, is it windows or is it linux? If it's windows you'd be better off using the binary. If you're using linux,you might want to check out a binary release first, else compiling is also quite simple. Extract tarball. ./configure make make install that will do it :) Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] retrieve POST body?
On 4/22/07, Richard Lynch [EMAIL PROTECTED] wrote: On Sat, April 21, 2007 10:56 pm, Myron Turner wrote: trick for you.You use the Perl script in the action attribute of your form. The Perl script saves the entire posted output to a file, then it sends back a page which uses Javascript to redirect back to the php script, where you can process the file. You send the file name back to the php script from the perl script in the query string of the url. At that point, why not just have Perl call PHP? Surely Perl can do something not unlike 'exec' or whatever to run any shell script you want... I sure wouldn't do another round trip to the browser and add JS into the middle of this solution, if it's viable... Wouldn't work for me, as I can't do Perl. Not everyone has Apache (or whatever) setup correctly that it allows to execute perl files. And what about windows servers? Most of them don't have perl. Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: how to detect type of image
On 4/22/07, Myron Turner [EMAIL PROTECTED] wrote: Jonathan wrote: Alain Roger wrote: Hi, In my web application, end user is able to load images (png, jpeg, gif,..) into database. I would like to know how can i detect automatically the type of image (pnd, jpeg,...) ? i do not want to check the extension because this is easily faked... just by renaming it. Does it exist a technique for that ? thanks a lot, Is there anything wrong with just using $_FILES['upload_name']['type']? $_FILES['upload_name']['type'] appears to believe the extension. Try it--upload a file with a misleading extension. This same question was asked yesterday and the advice was to use string *mime_content_type* ( string filename) That doesn't seem to get fooled very easily, though I suppose you could fool it if you went to the effort of, say, setting up a fake image header, when what you are sending is a time bomb. M. Yeah right, a time bomb with an image header :P It should have an ELF header :) But then it would be detected by the mime_content_type i guess. Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] upload file then move between servers
On 4/21/07, blackwater dev [EMAIL PROTECTED] wrote: I need to allow a user to upload a file. Once the file is up, I need to then move it to another server and wsync it to our webclusters. What's the best way to do this with php? I don't really want php issuing root commands. I've considered storing the file in the db but really need it to be scanned (they should just be images) then pushed out to my servers. Thanks! You could transfer files between servers using FTP.Or using internal network connections. like if you have mounted the second server at /mnt/server2, you could simply move the file with the built in PHP command. http://www.php.net/move_uploaded_file Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to detect type of image
On 4/21/07, Alain Roger [EMAIL PROTECTED] wrote: Hi, In my web application, end user is able to load images (png, jpeg, gif,..) into database. I would like to know how can i detect automatically the type of image (pnd, jpeg,...) ? i do not want to check the extension because this is easily faked... just by renaming it. Does it exist a technique for that ? thanks a lot, -- Alain Use the mime_content_type function for returning the mime type. Check if that matches one of you image mimetypes http://www.php.net/mime_content_type Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] echo or print ?
On 4/18/07, Richard Lynch [EMAIL PROTECTED] wrote: On Tue, April 17, 2007 1:40 am, Christian Haensel wrote: Whenever I see people put their code up for review, I realize they mostly use print instead of echo, while I am using echo 99% of the time. Actually, I can't even remember when I last used the regular print. There used to be a difference, but not really any more, I don't think. Or does print still not allow multiple arguments?... What do you guys use, and what is the advantage (if ther is any) of print over echo? And I am not talking about print_r or anything, just the regular print. :o) I use echo, because I'm old, and got in the habit, back when print() was a function and echo was a language construct, and only echo let you have as many args with commas as you wanted. But there's no significant difference, as far as I know. There is a difference, echo is slightly faster. code used for benchmark: ? $start = microtime(TRUE); for ($i=0; $i10; ++$i) { print ABC; } echo sprintf(With print ($i): %0.3f\n,microtime(TRUE) - $start); $start = microtime(TRUE); for ($i=0; $i10; ++$i) { echo ABC; } echo sprintf(With echo ($i): %0.3f\n,microtime(TRUE) - $start); ? it displays 10 times ABC, first with the print command, and second with the echo command. Result: ABCABCABCsnip print (10): 0.085 ABCABCABCsnip echo (10): 0.076 It's not a lot, but since we are displaying data a lot, (most used function?) it will make a difference in really big scripts. Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Do two lists in a while statement
On 4/21/07, Richard Kurth [EMAIL PROTECTED] wrote: How can I do something like this in the same while statement. This does not work while (list(,$possible) = each($possiblefields) list(,$possibleview) = each($possiblefieldsdiscription)){ } What about using ? while (list(,$possible) = each($possiblefields) list(,$possibleview) = each($possiblefieldsdiscription)){ } Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Do two lists in a while statement
On 4/21/07, Richard Kurth [EMAIL PROTECTED] wrote: On 4/21/07, Richard Kurth [EMAIL PROTECTED] wrote: How can I do something like this in the same while statement. This does not work while (list(,$possible) = each($possiblefields) list(,$possibleview) = each($possiblefieldsdiscription)){ } What about using ? while (list(,$possible) = each($possiblefields) list(,$possibleview) = each($possiblefieldsdiscription)){ } Doesn't mean if both variables are TRUE. Yes, isn't that what you wanted? Normaly a while checks also if it was TRUE. now it checks if both are TRUE.. If you only require one of both to be TRUE, use || instead of . Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Do two lists in a while statement
On 4/21/07, Richard Kurth [EMAIL PROTECTED] wrote: On 4/21/07, Richard Kurth [EMAIL PROTECTED] wrote: On 4/21/07, Richard Kurth [EMAIL PROTECTED] wrote: How can I do something like this in the same while statement. This does not work while (list(,$possible) = each($possiblefields) list(,$possibleview) = each($possiblefieldsdiscription)){ } What about using ? while (list(,$possible) = each($possiblefields) list(,$possibleview) = each($possiblefieldsdiscription)){ } Doesn't mean if both variables are TRUE. Yes, isn't that what you wanted? Normaly a while checks also if it was TRUE. now it checks if both are TRUE.. If you only require one of both to be TRUE, use || instead of . I am trying to fill in the drop down box in the script below but it is not working it is only giving me the $possibleview data but not the $possible data Hmm strange, i don't see any real error, so to test if it's a problem with the while loop, you could assign the backward order. So the code would look like the one below. Please test it, and see if you still get the same problem, or if you get $possible now instead of $possibleview. Tijnema $fieldnumber = 0; while (list(,$field) = each($fields)){ echo TR\n; echo TDSELECT NAME=fieldorder[]\n; reset($possiblefields); reset($possiblefieldsdiscription); $anyselected = ''; while (list(,$possibleview) = each($possiblefieldsdiscription list(,$possible) = each($possiblefields))){ $selected = @(($fieldorder[$fieldnumber] == $possible) ? 'SELECTED' : ''); if ($fieldnumber = count($fieldorder) !$anyselected){ $selected = 'SELECTED'; } echo OPTION value=\$possible\ $selected$possibleview/OPTION\n; } echo /SELECT/TD\n; echo TD$field/TD\n; echo /TR\n; $fieldnumber++; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Do two lists in a while statement
On 4/21/07, Richard Kurth [EMAIL PROTECTED] wrote: -Original Message- From: Tijnema ! [mailto:[EMAIL PROTECTED] Sent: Saturday, April 21, 2007 1:13 PM To: Richard Kurth Cc: php-general@lists.php.net Subject: Re: [PHP] Do two lists in a while statement On 4/21/07, Richard Kurth [EMAIL PROTECTED] wrote: On 4/21/07, Richard Kurth [EMAIL PROTECTED] wrote: On 4/21/07, Richard Kurth [EMAIL PROTECTED] wrote: How can I do something like this in the same while statement. This does not work while (list(,$possible) = each($possiblefields) list(,$possibleview) = each($possiblefieldsdiscription)){ } What about using ? while (list(,$possible) = each($possiblefields) list(,$possibleview) = each($possiblefieldsdiscription)){ } Doesn't mean if both variables are TRUE. Yes, isn't that what you wanted? Normaly a while checks also if it was TRUE. now it checks if both are TRUE.. If you only require one of both to be TRUE, use || instead of . I am trying to fill in the drop down box in the script below but it is not working it is only giving me the $possibleview data but not the $possible data Hmm strange, i don't see any real error, so to test if it's a problem with the while loop, you could assign the backward order. So the code would look like the one below. Please test it, and see if you still get the same problem, or if you get $possible now instead of $possibleview. Tijnema $fieldnumber = 0; while (list(,$field) = each($fields)){ echo TR\n; echo TDSELECT NAME=fieldorder[]\n; reset($possiblefields); reset($possiblefieldsdiscription); $anyselected = ''; while (list(,$possibleview) = each($possiblefieldsdiscription) list(,$possible) = each($possiblefields)){ $selected = @(($fieldorder[$fieldnumber] == $possible) ? 'SELECTED' : ''); if ($fieldnumber = count($fieldorder) !$anyselected){ $selected = 'SELECTED'; } echo OPTION value=\$possible\ $selected$possibleview/OPTION\n; } echo /SELECT/TD\n; echo TD$field/TD\n; echo /TR\n; $fieldnumber++; } It now passes the $possible fields but not the $possibleview so it is picking up the last list but not the first I also tried it with || and it does the same thing Quite strange, I personally never work with list/each, but with foreach. But well,that is personal preference. I updated below code, so that it does the second list inside the while loop. It should work the same. (as long as $possiblefieldsdiscription and $possiblefields have same amount of keys) Tijnema $fieldnumber = 0; while (list(,$field) = each($fields)){ echo TR\n; echo TDSELECT NAME=fieldorder[]\n; reset($possiblefields); reset($possiblefieldsdiscription); $anyselected = ''; while (list(,$possibleview) = each($possiblefieldsdiscription)){ list(,$possible) = each($possiblefields); $selected = @(($fieldorder[$fieldnumber] == $possible) ? 'SELECTED' : ''); if ($fieldnumber = count($fieldorder) !$anyselected){ $selected = 'SELECTED'; } echo OPTION value=\$possible\ $selected$possibleview/OPTION\n; } echo /SELECT/TD\n; echo TD$field/TD\n; echo /TR\n; $fieldnumber++; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] echo or print ?
On 4/21/07, Stut [EMAIL PROTECTED] wrote: Tijnema ! wrote: On 4/18/07, Richard Lynch [EMAIL PROTECTED] wrote: On Tue, April 17, 2007 1:40 am, Christian Haensel wrote: Whenever I see people put their code up for review, I realize they mostly use print instead of echo, while I am using echo 99% of the time. Actually, I can't even remember when I last used the regular print. There used to be a difference, but not really any more, I don't think. Or does print still not allow multiple arguments?... What do you guys use, and what is the advantage (if ther is any) of print over echo? And I am not talking about print_r or anything, just the regular print. :o) I use echo, because I'm old, and got in the habit, back when print() was a function and echo was a language construct, and only echo let you have as many args with commas as you wanted. But there's no significant difference, as far as I know. There is a difference, echo is slightly faster. code used for benchmark: ? $start = microtime(TRUE); for ($i=0; $i10; ++$i) { print ABC; } echo sprintf(With print ($i): %0.3f\n,microtime(TRUE) - $start); $start = microtime(TRUE); for ($i=0; $i10; ++$i) { echo ABC; } echo sprintf(With echo ($i): %0.3f\n,microtime(TRUE) - $start); ? it displays 10 times ABC, first with the print command, and second with the echo command. Result: ABCABCABCsnip print (10): 0.085 ABCABCABCsnip echo (10): 0.076 It's not a lot, but since we are displaying data a lot, (most used function?) it will make a difference in really big scripts. This has been covered before. The difference actually depends on how you're using it, rather than whether you use print or echo. For example, your benchmark shows echo to be slightly faster, but the the following script that I wrote last time this came up shows the opposite. The only difference is that you're outputting a literal whereas I'm printing a variable. http://dev.stut.net/phpspeed/ At the end of the day there are more important things to worry about, especially when you're talking in the region of 0.009 seconds per 100,000 calls it's not going to make anywhere near a significant difference to any script you write, even really really big ones scripts. To put it another way, you would need to make 10,000,000 calls for it to extend the runtime of your script by 1 second. Granted you might have a script that calls it 1000 times, meaning 10,000 requests to that script would waste 1 second. But unless you're getting twitter-like levels of traffic (they spike at over 11k hits a second) it's not worth worrying about, and I'm guessing (hoping) their devs probably wouldn't care either. Get over it and concentrate on the functionality and usability of your code rather than insignificant details like this. -Stut Interesting :) I see there's no big difference between echo and print, but that ?=$x? is faster :) I've learned (not only from this) that whatever you do in PHP is fast, and that you don't need to optimize your code for speed. Unless you're hitting 100k+ hits per hour. But even then it would only save you maybe one hour per year. Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] echo or print ?
On 4/21/07, Stut [EMAIL PROTECTED] wrote: Tijnema ! wrote: On 4/21/07, Stut [EMAIL PROTECTED] wrote: Tijnema ! wrote: There is a difference, echo is slightly faster. code used for benchmark: ? $start = microtime(TRUE); for ($i=0; $i10; ++$i) { print ABC; } echo sprintf(With print ($i): %0.3f\n,microtime(TRUE) - $start); $start = microtime(TRUE); for ($i=0; $i10; ++$i) { echo ABC; } echo sprintf(With echo ($i): %0.3f\n,microtime(TRUE) - $start); ? it displays 10 times ABC, first with the print command, and second with the echo command. Result: ABCABCABCsnip print (10): 0.085 ABCABCABCsnip echo (10): 0.076 It's not a lot, but since we are displaying data a lot, (most used function?) it will make a difference in really big scripts. This has been covered before. The difference actually depends on how you're using it, rather than whether you use print or echo. For example, your benchmark shows echo to be slightly faster, but the the following script that I wrote last time this came up shows the opposite. The only difference is that you're outputting a literal whereas I'm printing a variable. http://dev.stut.net/phpspeed/ At the end of the day there are more important things to worry about, especially when you're talking in the region of 0.009 seconds per 100,000 calls it's not going to make anywhere near a significant difference to any script you write, even really really big ones scripts. To put it another way, you would need to make 10,000,000 calls for it to extend the runtime of your script by 1 second. Granted you might have a script that calls it 1000 times, meaning 10,000 requests to that script would waste 1 second. But unless you're getting twitter-like levels of traffic (they spike at over 11k hits a second) it's not worth worrying about, and I'm guessing (hoping) their devs probably wouldn't care either. Get over it and concentrate on the functionality and usability of your code rather than insignificant details like this. -Stut Interesting :) I see there's no big difference between echo and print, but that ?=$x? is faster :) I've learned (not only from this) that whatever you do in PHP is fast, and that you don't need to optimize your code for speed. Unless you're hitting 100k+ hits per hour. But even then it would only save you maybe one hour per year. I wouldn't go that far. It is definitely possible to write horribly inefficient code with PHP. Believe me, I've inherited enough crap code in my lifetime to testify to that. My point was simply that you need to look at the numbers from benchmarks in perspective, and when efficiency is concerned there's almost always far bigger gains to be made than 0.009 seconds per 100,000 calls to output something. -Stut But what else would you use a lot in your code? all commonly used things (like while, if, echo, etc) are just (nearly) as fast as their alternatives (for, print, etc). Other functions (like file/stream) might be some performance difference, but you probably use this only a few times in your script. So there's not a bigger performance difference then when optimizing echo/print. Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] echo or print ?
On 4/22/07, Stut [EMAIL PROTECTED] wrote: Tijnema ! wrote: But what else would you use a lot in your code? all commonly used things (like while, if, echo, etc) are just (nearly) as fast as their alternatives (for, print, etc). Other functions (like file/stream) might be some performance difference, but you probably use this only a few times in your script. So there's not a bigger performance difference then when optimizing echo/print. Get your head out of the details. Try file-based caching against DB access. And compare that with RAM caching ;) Or SQL query optimisation. Or even server configuration tuning. All these things and others on the same level are far more worthy of your time. -Stut So, optimizing is useless :P I see no point in doing it, even more when it's only for personal usage. The time used for writing optimized code is probably far more then the time you save by running optimized code. :) Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Appending into associative arrays
On 4/17/07, Richard Lynch [EMAIL PROTECTED] wrote: On Sun, April 15, 2007 2:20 pm, Otto Wyss wrote: I want to sort directories according there modification time and thought accociative arrays would be perfect. But when I add an element like $dirs = array (filemtime($d) = $d) the previous ones are lost. I tried array_push but that doesn't seems to work, at least I always get syntax errors. Next try was array_merge(array (...)). So what next? Two files may have the same modification time. You are storing only ONE file for any given timestamp. You could do something like this: foreach($files as $file){ $dirs[filemtime($file)][] = $file; } You will then have an ARRAY for each timestamp with all the files that were modified at that time. So you end up with a big useless array? How big is the chance that there are 2 files modified at the same time? 0.1? or is it 0.01? Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to get var name and value from function?
On 4/19/07, Ford, Mike [EMAIL PROTECTED] wrote: On 19 April 2007 04:36, Richard Lynch wrote: On Wed, April 18, 2007 4:57 am, Ford, Mike wrote: On 17 April 2007 01:18, Richard Lynch wrote: Or is it explicitly stated in the manual somewhere I'm not seeing that one can put things in $GLOBALS directly? [shrug] http://uk2.php.net/manual/en/language.variables.predefined.php #language.variables.superglobals When I read that section of the manual, along with similar variables, such as: $_SERVER, $_GET, $_POST, $_COOKIE, $_FILES, $_ENV, $_REQUEST I do not, in my mind, see anything indicating that it is a documented feature that cramming some value into $_GLOBALS['foo'] is specifically supported... Well the definition of $GLOBALS says: Contains a reference to every variable which is currently available within the global scope of the script. I take that to mean reference as in the operator, so that $GLOBALS['foo'] is a reference to $foo, and when you assign to a reference you also assign to But, notwithstanding that, how about Example 12.3 at http://php.net/global#language.variables.scope.global? Cheers! Mike Hmm, that's quite ugly, what happens when defining a variable outside, and inside a function. and then get the reference to it? Will the first var be overwritten, and when the function ends, it will refer to the old var again? Tijnema - Mike Ford, Electronic Information Services Adviser, JG125, The Headingley Library, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 812 4730 Fax: +44 113 812 3211 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with Curl and POST
On 4/17/07, mbneto [EMAIL PROTECTED] wrote: Hi Richard, I am using the same script. And it is using the CURLOPT_POST. - mb On 4/16/07, Richard Lynch [EMAIL PROTECTED] wrote: HEAD is just like GET, only it gets just the headers (hence the name) usually to see if the document has changed according to LastModified: before doing a full-blown GET. There shouldn't be a HEAD done before a POST... Are you sure you are doing a CURLOPT_POST and not CURLOPT_GET...? On Mon, April 16, 2007 4:43 pm, mbneto wrote: Hi, I am tring to use curl to access, via POST, a remote 'service'. I've managed to test it fine but when I use real data to feed the curl it gives me strange results. When I check the logs of the remote web server one thing that alarms me is that with test data I see A.B.C.D - - [16/Apr/2007:17:41:53 -0400] POST /service.php HTTP/1.1 200 61 with real data (using the same script) A.B.C.D - - [16/Apr/2007:17:48:55 -0400] HEAD /service.php HTTP/1.1 200 - After reading the user contributed notes I found that it must be related with encoding. But even if I use the suggested code $o=;foreach ($post_data as $k=$v) {$o.= $k=.utf8_encode($v).;} $post_data=substr($o,0,-1); echo $post_data; // Echo your data here to check if this is really what you want to insert. // Add error handling if(!curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data)) { echo curl_error($ch); } I get the same results. Any tips? php 5.0.4 I guess you insert data twice, or something like that. I modified above code, test it. Tijnema -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] retrieve POST body?
On 4/19/07, Myron Turner [EMAIL PROTECTED] wrote: André Medeiros wrote: php://stdin perhaps? On 4/18/07, Justin Frim [EMAIL PROTECTED] wrote: André Medeiros wrote: Reading from php://input on a webserver will retrieve the Body of the HTTP Request. Not for me it doesn't. That only seems to work when the form is submitted as application/x-www-form-urlencoded. When the form is submitted as multipart/form-data, php://input is blank. You probably could use this small Perl script via exec: #!/usr/bin/perl if ($ENV{'REQUEST_METHOD'} eq POST) { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); } print $buffer; If you call this script via exec, it can't return the POST data send to the PHP script right? btw, we are here on a PHP list, not PERL :) Tijnema -- _ Myron Turner http://www.room535.org http://www.bstatzero.org http://www.mturner.org/XML_PullParser/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] warning message to hide
On 4/17/07, Richard Lynch [EMAIL PROTECTED] wrote: On Sat, April 14, 2007 12:12 pm, Tijnema ! wrote: try putting an @ sign before this line. something like this: @$conn = pg_connect($conn_string); According to the manual: http://www.php.net/manual/en/language.operators.errorcontrol.php the @ should be placed before the function, so like this: $conn = @pg_connect($conn_string); Actually, the manual explicitly documents the @ operator as being valid in front of any EXPRESSION. It goes on to say that if you can get the value of something, you can use @ on it. The assignment operator returns a value. It is an expression. @$conn = pg_connect($conn_string); is therefore a documented feature. Using @ as a long-term solution is stll morally wrong, of course. :-) Ok, you're right, both are valid. But i think it's better to use it before the function name. (like all examples in the manual do ). Else you might end up with code like this: my_function(@$var); Which will result in a parse error... Tijnema -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] warning message to hide
On 4/18/07, Roman Neuhauser [EMAIL PROTECTED] wrote: # [EMAIL PROTECTED] / 2007-04-18 07:55:05 +0100: On 4/17/07, Richard Lynch [EMAIL PROTECTED] wrote: On Sat, April 14, 2007 12:12 pm, Tijnema ! wrote: try putting an @ sign before this line. something like this: @$conn = pg_connect($conn_string); According to the manual: http://www.php.net/manual/en/language.operators.errorcontrol.php the @ should be placed before the function, so like this: $conn = @pg_connect($conn_string); Actually, the manual explicitly documents the @ operator as being valid in front of any EXPRESSION. Ok, you're right, both are valid. But i think it's better to use it before the function name. (like all examples in the manual do ). Else you might end up with code like this: my_function(@$var); Which will result in a parse error... Any expression means any expression. [EMAIL PROTECTED] ~ 1007:0 php -r 'var_dump($foo);' PHP Notice: Undefined variable: foo in Command line code on line 1 NULL [EMAIL PROTECTED] ~ 1008:0 php -r 'var_dump(@$foo);' NULL Hmm, this is what i get: ~# php -r 'var_dump($foo);' NULL ~# php -r 'var_dump(@$foo);' NULL PHP6 snapshot from a month ago. Tijnema -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Json.php
On 4/17/07, Richard Lynch [EMAIL PROTECTED] wrote: On Mon, April 16, 2007 10:20 am, Tijnema ! wrote: And btw, I think it's better not to create a new link to the class each time the function is called, but just use :: if (!function_exists('json_encode')) { function json_encode($data) { return Services_JSON::encode($data); } } and probably also one for decoding. if (!function_exists('json_decode')) { function json_decode($data) { return Services_JSON::decode($data); } } Actually, if I understand the flame wars of Internals correctly, whichever one of those is correct, the other one ain't gonna work in PHP 6... Or so I gather from the OOP purists fighting the OOP zealots on PHP-Internals. I may be 100% wrong, of course, regarding not only the outcome of this flame-fest, but even if it applies to this JSON thingie. I see that using the class static wouldn't work, because of the $this thing... I just tried, and working with Services_JSON::encode() doesn't work, while $json = new Services_JSON(); $json-encode() does work :) It's my fault, i thought there was only 2 functions inside the class, encode decode. and that those functions were not using any other functions inside the class. Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why can't I ini_set('upload_max_filesize')?
On 4/18/07, Brian Dunning [EMAIL PROTECTED] wrote: We finally got it resolved by editing php.ini. This was classic: A clueless office assistant did it, talked through step-by-step over a cell phone, while an armed security guard accompanied her into their server room. LOL. Never heard of remote access to a server? I use it all day to access my server :) Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why can't I ini_set('upload_max_filesize')?
On 4/17/07, Brian Dunning [EMAIL PROTECTED] wrote: Dang. There is no remote access to the server, no way to remotely edit php.ini - everything is blocked by the firewall. It's running IIS not Apache. I'm not totaly sure about IIS, i never use it, but PHP_INI_PERDIR can also be set in .htaccess file :) Tijnema On Apr 17, 2007, at 1:40 PM, Daniel Brown wrote: That particular variable is a PHP_INI_SYSTEM variable, which means it can only be set in php.ini or httpd.conf. This means that, unfortunately, even if your system uses Apache on Windows and the host allows .htaccess overrides, you still can't set it using php_flags. On 4/17/07, Brian Dunning [EMAIL PROTECTED] wrote: If I do this: ini_set('upload_max_filesize', 30720); echo ini_get('upload_max_filesize'); it returns 2M. Why is it not accepting the ini_set? The server is Windows, PHP 5.2. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] auto page generation
On 4/16/07, tedd [EMAIL PROTECTED] wrote: At 1:31 AM -0400 4/16/07, Jeremy Adams wrote: I'm building a website right now that will be a database of attractions in the Carolina and Virginia area. The idea is that attraction owners can submit data to the database and the database will automatically generate a page containing that information. What I'm trying to figure out is how to generate the pages automatically and have links to them added to the site. If someone could help me or point me in the direction of a book or web page that covers this I would really appreciate it. Jeremy: Welcome to php and mysql, because if you're going to do it yourself, then you're going to have to learn it. Here's some online tutorials to introduce you. http://www.htmlgoodies.com/beyond/php/article.php/3472391 http://www.w3schools.com/php/default.asp http://www.weberdev.com/ViewArticle/433 http://www.weberdev.com/Manuals/PHP/ http://www.unf.edu/~rita0001/eresources/php_tutorials/index.htm As you develop, post specific problems on this list and we'll help. Plus, it would be a good idea to buy a few of books on the subject like the PHP Cookbook, MSQL Cookbook, PHP Developer's Cookbook and PHP Security (not a cookbook). As you see, I'm big into Cookbooks. However, that's a minor fraction of the php, mysql, javascript, and other books I've purchased to do what you're wanting to do. It might be cheaper and quicker to hire one of us. Or just google for some tutorials like : www.tizag.com It has a great tutorial for n00bs... ;) After that you probably will be able to make such site you want to :) Tijnema Cheers, tedd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to get var name and value from function?
On 4/16/07, Ford, Mike [EMAIL PROTECTED] wrote: On 14 April 2007 13:16, Afan Pasalic wrote: Tijnema ! wrote: On 4/14/07, Afan Pasalic [EMAIL PROTECTED] wrote: function value2var($array, $print=0) { foreach ($_POST as $key = $value) I think you should change above line to : foreach ($array as $key = $value) yup! it's print error. I meant $array. { ${$key} = $value; echo ($print ==1) ? $key.': '.$value.'br'; // to test results and seeing array variables and values } } value2var($_POST, 1); but, I don't know how to get info from function back to script?!?!? :-( Uhm, it's not even possible when you don't know the keys i believe. after 2 hours of testing and research I realized this too, but want to be sure. :-( If you really *must* do this yourself (but others have pointed out the folly of it), this would do it: function value2var($array) { foreach ($array as $key = $value) { $GLOBALS['$key'] = $value; } } What's the sense in above function? you're putting the variables from 1 array in another... you could use array_merge for this. But even then it's quite useless... ... or, alternatively, rather than defining you own function, use extract() (http://php.net/extract) with one of the overwrite safety options to avoid blobbing existing variables. That's a better idea. :) Personally, I'd never do this in any form -- if I do it at all, I extract specific indices of the array with code like: foreach (array('name', 'address', 'email', 'setting1', 'setting2') as $key): $GLOBALS[$key] = $array[$key]; endforeach; endforeach? never heard of that statement before, does it really exist in PHP? ... making certain, of course, that those values get properly validated elsewhere. Cheers! Mike Sure, you should always validate your variables, but i would recommend to only get the variables from $_GET/$_POST that you actually gonna need, and not just everything. Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Json.php
On 4/16/07, Jochem Maas [EMAIL PROTECTED] wrote: Otto Wyss wrote: Tijnema ! wrote: *ROFLMFAO*...Did you actually try google for json.php? Second result: http://mike.teczno.com/JSON/JSON.phps This doesn't have a json_encode but needs a $json object which then could be used as $json-encode(...). Thanks anyway. that's going to make it completely impossible to use then isn't it. no way you could possibly wrap the class/objects functionality in a wrapper function. if (!function_exists('json_encode')) { function json_encode($data) { $json = new JSON; // or whatever the class is called. return $json-encode($data); } } The class is called Services_JSON, not JSON. And btw, I think it's better not to create a new link to the class each time the function is called, but just use :: if (!function_exists('json_encode')) { function json_encode($data) { return Services_JSON::encode($data); } } and probably also one for decoding. if (!function_exists('json_decode')) { function json_decode($data) { return Services_JSON::decode($data); } } omg that was hard. Definitely not :) Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to get var name and value from function?
On 4/16/07, Ford, Mike [EMAIL PROTECTED] wrote: On 16 April 2007 16:18, Tijnema ! wrote: On 4/16/07, Ford, Mike [EMAIL PROTECTED] wrote: On 14 April 2007 13:16, Afan Pasalic wrote: Tijnema ! wrote: On 4/14/07, Afan Pasalic [EMAIL PROTECTED] wrote: function value2var($array, $print=0) { foreach ($_POST as $key = $value) I think you should change above line to : foreach ($array as $key = $value) yup! it's print error. I meant $array. { ${$key} = $value; echo ($print ==1) ? $key.': '.$value.'br'; // to test results and seeing array variables and values } } value2var($_POST, 1); but, I don't know how to get info from function back to script?!?!? :-( Uhm, it's not even possible when you don't know the keys i believe. after 2 hours of testing and research I realized this too, but want to be sure. :-( If you really *must* do this yourself (but others have pointed out the folly of it), this would do it: function value2var($array) { foreach ($array as $key = $value) { $GLOBALS['$key'] = $value; } } What's the sense in above function? you're putting the variables from 1 array in another... you could use array_merge for this. But even then it's quite useless... No, not just another array (although I agree about the function being pretty useless!) -- $GLOBALS is a superglobal array that contains a reference to every variable defined in the global scope, so that accessing $GLOBALS['var'] from anywhere is the same as accessing $var in the global scope. It's a way of referencing global variables without having to use a global $var statement. but $_GET and $_POST are also global variables, so you transfer variables from one global variable to another :) I was simply pointing out how you can to get info from function back to script when you don't know the keys, which you'd just said you believed was impossible! ;) ;) You can also return an array ;) I mean to say returning multiple variables (not arrays) Having done which, I proceeded to point out that: ... or, alternatively, rather than defining you own function, use extract() (http://php.net/extract) with one of the overwrite safety options to avoid blobbing existing variables. That's a better idea. :) ... Precisely ;) foreach (array('name', 'address', 'email', 'setting1', 'setting2') as $key): $GLOBALS[$key] = $array[$key]; endforeach; endforeach? never heard of that statement before, does it really exist in PHP? Of course -- would I give you non-working code? (Well, on purpose, anyway! ;) See http://php.net/manual/en/control-structures.alternative-syntax.php Cheers! Mike Never knew there was an alternative syntax... (in all these years...) Of course you would (try to) give working code, but you could've be confused by other programming languages :) Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Saving css state in javascript and passing to php via form submit
On 4/16/07, Tim [EMAIL PROTECTED] wrote: ... You could use AJAX to get things from/to PHP, but why should you? You can use session within javascript too i believe. Tijnema ps. Maybe you could also use AJAX instead of submitting forms the whole time. ... Really, it's not that hard to use AJAX. You might want to look at www.tizag.com, there it is really easy explained. It's nothing more then making new request to scripts inside javascript. Was a great idea and also works great until the moment i needed to upload images :P You have a suggestion for that by any chance Tijnema? Regards, Tim I would use an iframe for this.Didn't test following code, but shoudl work though. iframe name=imgupload/iframe form action=upload.php method=post target=imgupload enctype=multipart/form-data input type=fileinput type=submit value=upload/form and now just make sure that your upload.php script doesn't return anything, or it will be displayed inside the iframe :) If you want to know when upload is done, you should check that through AJAX. you could give the upload an unique number, and store the results of the upload in a database for example, then request that id once in 10 seconds lets say, and when it's done it will return something useful :) Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] I make a patch, how I report?
On 4/16/07, Fernando chucre [EMAIL PROTECTED] wrote: Hello all, I buid a patch for wrapper php fopen. In this patch I create a way for the script access the filedescriptos opened by process. Ex: php file.php 3file_in.txt 7file_out.txt In this case the script can't read the filedescriptor 3 and 7. Not have way for read or write in filedescriptor opends by precess. I make a way for read or write it. A modify de wrapper 'php' for fopen function. (http://br.php.net/manual/en/wrappers.php.php) A create the 'php:/fd/N' which N is the filedescriptor number. how to access fd 7 to write? ex: ? $fd = fopen(php://fd/7,'w'); fwrite($fd,test of write\n); fclose($fd); ? I want know who I send the patch for to be avaliable. Thanks. -- Fernando Chure PSL/CE - Brasil Post it to the PHP internals list: [EMAIL PROTECTED], or subscribe to the list, send empty message to [EMAIL PROTECTED] and then post it. Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array remove function?
On 4/16/07, Jochem Maas [EMAIL PROTECTED] wrote: Richard Lynch wrote: On Wed, April 11, 2007 9:00 pm, Jochem Maas wrote: [PS - I've the pleasure of listening to a colleague do a manual install of Vista over an existing copy of XP and then get the really tricky stuff like the soundcard to work ... for the last week :-/] Give them an Ubuntu (or similar) CD and see if they want to just leave the Dark Side... :-) yeah, but the vista story keeps getting worse. how about: 1. '50% of applications can't use network because the router is in compatible with vista' a total WTF, apparently due to vista network 'auto-tuning' - can only be turned off via the cmdline. 2. undo/redo function in a whole stack of programs doesn't work unless you run the program in 'administrator mode' omg. 3. openvpn doesn't work ... unless you run it in 'administrator mode' 4. when you finally give trying to run anything as anything other than an adminstrator user your still confronted with that freakin' 'administrator mode' popup (which also greys out the rest of the desktop) *everytime* you breath too loudly. 5. don't delete a folder if you want to get anything done today ... well at the least you'll probably get a chance to grab a another cup of coffee. 6. er ... I'll keep you posted. How off-topic is this? Remember, this is the PHP list, not the Vista list. Tijnema ps. The name Microsoft is not really the right name for the company, it should have been called Megasoft, because vista is overkill in size. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: width and height of flash-files
On 4/14/07, Heiko Sudar [EMAIL PROTECTED] wrote: Hi, thx fort he fast infos. the solution is clear for .swf files. does someone have a workaround for flash-video files .flv? Heiko AFAIK, there's not a direct function for that. So, you have a few options, but depend on what you're going to do with it. Are you planning to parse a lot and large .flv files? If so, you should write some code that reads the FLV header. I didn't see someone else already doing, but you should be looking for Metadata in the FLV file, and it seems that the metadata isn't in all FLV files, so then you need to use such tools as FLV Metdata Injector, but i didn't find a linux alternative. If you're only doing a few .flv files, and quite small ones, you might want to convert the FLV files first to another format with ffmpeg. Then use some tools on that. Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to get var name and value from function?
On 4/14/07, Afan Pasalic [EMAIL PROTECTED] wrote: hi, this one I can't figure out: I have to assign value of an array to variable named after key of the array several times in my project to , e.g. after I submit a form with personal info I have $_POST['name'] = 'john doe'; $_POST['address'] = '123 main st.'; $_POST['city'] = 'urbandale'; $_POST['zip'] = '12345'; $_POST['phone'] = '123-456-7980'; etc. Then I assign value to the var name: foreach ($_POST as $key = $value) { ${$key} = $value; } and then validate submitted. Are you sure you want to do this? You never know what a hacker inserts to your POST data, so he could easily define variables inside your script, especially when you're using more dangerous functions like system(). Though, to avoid writing all over again the same lines (even it's only 3 lines) I was thinking to create a function something like: function value2var($array, $print=0) { foreach ($_POST as $key = $value) I think you should change above line to : foreach ($array as $key = $value) { ${$key} = $value; echo ($print ==1) ? $key.': '.$value.'br'; // to test results and seeing array variables and values } } value2var($_POST, 1); but, I don't know how to get info from function back to script?!?!? :-( Uhm, it's not even possible when you don't know the keys i believe. Tijnema any help appreciated. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Images again
On 4/14/07, Børge Holen [EMAIL PROTECTED] wrote: Before mr lynch starts beating up those already dead and probably long since burried horses... Images in a database! See I was just wondering, and that at times leads to late nights I used to read the images from two different files; one watermarked the image and one let it throught without any hazzle. Of course this kind of script was easy enought to get around the watermarking, witch I fixed with the http referer witch as follows IE don't send. I don't particulary like ppl who use IE (ups did I upset someone?) ;D. Hmm, nearly I use IE, NOT because i like it, but because i hate the others more (On windows platform). However I started compressing my scripts and putting them inside one file. And the status is so far: * Query for the image object. * Query for copyright check in case of watermarking. If no watermarking skip to echo * Read the object. * put object in a file outside webroot like /tmp. * read both the watermark and object * merge * echo Is it possible to skip one query and still be able to read ownership from a table and at the same time stream the object, witch lead me to the next question, I can't seem to be able to make imageCreateFromJPEG handle the direct stream, nor that I fetch it in an array, is any of this possible? You should fetch the stream manually in a string, and then use imagecreatefromstring, http://www.php.net/imagecreatefromstring As of now I need two files to make this happen. Either I use one file to check for rights and download throught a second file (close to the old solution) or I try this new thing and end up with one php file witch needs the object stream to be saved before it can be managed proberly. -- --- Børge http://www.arivene.net For the rest of your message, i don't understand what you're trying to do. Show us (parts of) the code you have now, and then explain what you've wanted to do, and what it does now. Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Json.php
On 4/14/07, Otto Wyss [EMAIL PROTECTED] wrote: I've seen a json.php file somewhere in a project for cases where the json module isn't installed (e.g. PHP4), yet I can't find that project again. Is there an official or unofficial download site for json.php? Why isn't this available in the PHP manual (http://ch2.php.net/manual/de/ref.json.php)? O. Wyss *ROFLMFAO*...Did you actually try google for json.php? Second result: http://mike.teczno.com/JSON/JSON.phps Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems installing php with pdflib
On 4/14/07, Merlin [EMAIL PROTECTED] wrote: Hi there, I am moving to a new box and want to install php with pdflib again. After configure I get an error saying: pdflib.h not found! Check the path passed to --with-pdflib The path is just fine: '--with-pdflib=/usr/local/lib' ls /usr/local/lib/pdflib.* /usr/local/lib/pdflib.h How did you get header files in the lib dir? pdflib.h(and all other header files from pdflib) should be in /usr/local/include or /usr/include. then your command should be '--with-pdflib=/usr/local' or just remove it at all, as PHP will find it automatically (i think) ls /usr/local/lib/libpdf.* /usr/local/lib/libpdf.a /usr/local/lib/libpdf.la /usr/local/lib/libpdf.so /usr/local/lib/libpdf.so.1 /usr/local/lib/libpdf.so.1.1.3 That's fine. PHP will search for the headers in pdflibdir (--with-pdflib=...) /include, and for the libraries in pdflibdir/lib Tijnema I do run the same version on the old box which is php 4.4.6 and pdflib 4.03. I do not want to upgrade to a new pdflib since I was totaly satisfied with the installation which runs perfectly. The php version seems also not to be the problem since I tried to configure with 4.2.1 and it failed the same way. I did with pdflib: ./configure make make install Then configured php Has anybody an idea what is wrong? The only difference I do see, is that the other box runs suse 9.0 while this one runs suse 9.3 Thank you for any hint or help, Best regards, Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] warning message to hide
On 4/14/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Quoting Alain Roger [EMAIL PROTECTED]: Hi, Today i discovered that when my host webserver has some issue with PostgreSQL database, my code displays the following error message : *Warning*: pg_connect() [function.pg-connecthttp://www.immense.sk/function.pg-connect]: Unable to connect to PostgreSQL server: could not connect to server: Connection refused Is the server running on host pgsql.exohosting.sk and accepting TCP/IP connections on port 5432? in */www/.php* on line yyy. I would like instead of that, to display my own error message... in fact, i would like to display something like : We are sorry but temporary we have some technical issues. Please try again later. how can i do that ? i tried to do : $conn = pg_connect($conn_string); try putting an @ sign before this line. something like this: @$conn = pg_connect($conn_string); According to the manual: http://www.php.net/manual/en/language.operators.errorcontrol.php the @ should be placed before the function, so like this: $conn = @pg_connect($conn_string); And if you want also to generate your own error. $conn = @pg_connect($conn_string) or die(My error here!); This will show My error here! when the function can't connect. Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dreamhost! PHP as CGI!???
On 4/13/07, Micky Hulse [EMAIL PROTECTED] wrote: I think I just read that PHP is ran as CGI on Dreamhost... this does not sound good. Can anyone confirm? What do you all think? Good? Bad? I have dealt with one other server that did this (PHP as CGI) and I hated it! I just bought a years worth of hosting... I have a trial period so I think I can still cancel. Should I stick with it or find a host that runs PHP under Apache? Please advise. (FYI: Using Expression Engine for CMS/blog -- I read that it is recommended to use EE with PHP not as CGI.) Many thanks in advance! Cheers, Micky Google tells me that it is an optional feature to run PHP as CGI, default it is running under apache. Atleast that's what i found for dreamhost. Tijnema -- Wishlists: http://snipurl.com/vrs9 Switch: http://browsehappy.com/ BCC?: http://snipurl.com/w6f8 My: http://del.icio.us/mhulse -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dreamhost! PHP as CGI!???
On 4/13/07, Richard Davey [EMAIL PROTECTED] wrote: Micky Hulse wrote: I think I just read that PHP is ran as CGI on Dreamhost... this does not sound good. Can anyone confirm? If you've got access to your account with them, you can confirm it yourself. Check the output of a phpinfo(). What do you all think? Good? Bad? Not *that* terrible at all, but if you've only been with Dreamhost for a few days you've got far worse things to experience yet IMHO (shoddy uptime, shoddy servers, shoddy network, etc) Should I stick with it or find a host that runs PHP under Apache? www.pair.com runs PHP 4 as an Apache Module, and are a superb host (I've used them since 1996) - but even better in the next few weeks they rollout PHP 5.2.1 as standard on all servers. Can't wait :) Cheers, Rich I'm using www.dapx.com for my www sites. Setup is a pain in the ass there, it can take a few days before you get a reply. But once you got it, it's a really nice host. Nice speed, really 99.9% uptime, and not much limited stuff :) safe_mode is even turned off :) Tijnema -- Zend Certified Engineer http://www.corephp.co.uk Never trust a computer you can't throw out of a window -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] width and height of flash-files
On 4/13/07, Heiko Sudar [EMAIL PROTECTED] wrote: hi, is there a way to get the width and the height of a flash movie via php? heiko Have a look at this class: http://www.phpclasses.org/browse/file/6443.html It parses the header of an SWF(Flash) file, and it does also get height and width :) Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP editor
On 4/13/07, M.Sokolewicz [EMAIL PROTECTED] wrote: Philip Thompson wrote: On Apr 13, 2007, at 10:26 AM, Jay Blanchard wrote: [snip] Just showing my ignorance, probably, but what exactly is meant by a PHP editor? Does it mean an editor for editing PHP scripts, or an editor written in PHP? [/snip] Something to edit PHP with...unless you're trying to be funny LOL! I don't know why this was so funny, but I laughed at Jay's comment (I can just see the light bulb turn on). Nonetheless, this ignorant user brings up a thought - are there any editors written in PHP? ~Philip I sure hope not. Editors should never be written in scripting-languages in my opinion. - tul Uhm, C is a scripting language too right? Most editors are written in C :) Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sendmail loop
On 4/13/07, John Pillion [EMAIL PROTECTED] wrote: I have a sendmail script that loops through an array of email addresses. the problem is, the list can sometimes be fairly long, and the page does not finish loading until the loop has completed. Currently, I have the majority of the page loading, including text that says messages sending, please wait., with a completed message after the loop. Though that gives an appearance of working (and lets the patient user know what is going on), if the user leaves the page, or the page times out before the loop has finished, not all the emails will be sent. Is there a way to trigger a script to run on the server (in the background)? I had the thought to save the notice to the DB, and then have a cron check every few minutes to send it, but that could be too much load on the servers. Any other alternatives? Thanks! ~J With set_time_limit you could set the timeout value higer: http://www.php.net/set_time_limit So that your script won't timeout when it takes too long. Also, when the user closes his browser, the script will continue! Tijnema Ps. No, this is not a spam application - it is a notice/announcement form for directors/administrators of an organization -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question on Portfoilo's
On 4/11/07, Steve [EMAIL PROTECTED] wrote: If you're working under an NDA or on code that doesn't belong to you, you'll most likely need to hit up the hobbiest side of programming to build your portfolio. Sit down, plan some app that would make your life easier (or someone else's), go through the design process, and then code it to implementation. It doesn't have to be perfect, but it has to be good enough to show off your abilities. It really doesn't matter if the app already exists, you're doing this simply for the sake of self improvement and to build your portfolio. That's where open source comes in nicely. You don't need to make it a full time job, but actively contributing to a project will allow you to say I played a good sized role in __. Think about the google Summer of Code idea, if you participated in that, then you can add that to your portfolio ;) Tijnema Matt Carlson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] So i've been meaning to start a portfolio of some code, so that when I apply for a job, and they want code samples, I have something to show them. Unfortunately, at this time, most of my work is inside of a much larger application, or in code that belongs to my current employer (not a php job, just misc. things i've made). What kind of things do you guys have in your portfolio's/code samples that your provide to a potential employer? What things do you feel I should avoid when putting this kinda of thing together? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP editor
For win i'm using Macromedia Dreamwaver, it's not free, but it has great interface with servers not on your own PC, i'm using several different servers, and i have them all listed in Dreamwaver. I click on a file on one of the servers, and it loads, and when i press save, it saves directly to the server (even if the server isn't in the LAN, it can save through FTP automatically). For linux i prefer Kdevelop :), nice free and buitlin with KDE, which a lot of distributions use... Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Bind IP with fsockopen
On 4/12/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi ive tried \r\n\n and pretty much every other combination I can think of. But I still cant get it to return a line break. Otherwise the script is working though. A simple \r\n should do the job:) Tijnema - Original Message - From: Richard Lynch [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, April 11, 2007 1:19 AM Subject: Re: [PHP] Bind IP with fsockopen fputs adds a newline, and you've got \r\n already, so your total output in the original is \r\n\n In the socket_bind one, you've got none of the \r\n stuff at all, much less \r\n\n On Tue, April 10, 2007 5:56 pm, [EMAIL PROTECTED] wrote: Im having trouble converting this snippet to use the bind_socket function. my original code is.. ? $domain = 'internet.co.uk'; $fs = fsockopen('dac.nic.uk', 2043, $errno, $errstr, 60); if (!$fs) { fclose($fs); } else { fputs($fs, $domain\r\n); $line = fgets($fs, 1024); echo $line; } ? I think im getting stuck on the fputs bit.. I have this which does not work.. ?php $domain = 'internet.co.uk'; $sourceip = 'xx.xx.xx.xx'; // ip you want to bind to $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); socket_bind($sock, $sourceip); socket_connect($sock, 'dac.nic.uk', 2043); // Write $request = $domain\r\n; socket_write($sock, $request); //Read reply // Close socket_close($sock); ? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array remove function?
On 4/10/07, Richard Lynch [EMAIL PROTECTED] wrote: http://php.net/array_flip followed up an unset, followed by another array_flip, I guess... What if you have an array like this: Array ( [0] = Array ( [0] = 1 [1] = 2 [2] = 2 [3] = 2 [4] = 2 [5] = 4 ) [1] = 4 [2] = 2 [3] = 4 ) And i want to remove the 4, but i don't know 1 and 3. using array_flip wouldn't work because of my multi-dimensional array. But what if i'm using array_search? will it return 1 only? will it return 5? Why in the world you'd architect the array with a value when you need to unset by value in the first place is beyond me, though... Sometimes you end up with such arrays, where you need to have non-unique values first, so you store them in the value, and then you need to remove some of the non-unique values. But it's a multi-dimensional array... Tijnema On Tue, April 10, 2007 2:52 pm, Tijnema ! wrote: On 4/10/07, Richard Lynch [EMAIL PROTECTED] wrote: http://php.net/unset That works when you know the key, but will that work when you only know the value? Tijnema On Tue, April 10, 2007 2:49 pm, Tijnema ! wrote: Hi, Is there currently a function that removes a key/value from an array? I use this code right now: function array_remove($array,$remove,$remove_value = true) { foreach($array as $key = $value) { if($remove_value $value != $remove) { $new_array[$key] = $value; } elseif (!$remove_value $key != $remove) { $new_array[$key] = $value; } } return $new_array; } array_remove(array(1=2,2=3),2,true); // array (2=3) array_remove(array(1=2,2=3),2,false); // array (1=2) Anyone knows if there already exists such function? Else should i create future request? Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dynamic web interface and size
On 4/11/07, Richard Lynch [EMAIL PROTECTED] wrote: 1000 pixels? Woof. Guess my 800x600 box is not in your market... 800x600 :| Using 1600x1200 here :) I like the idea,. because most sites are made for 800x600 and they are so small on my screen... Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Bind IP with fsockopen
On 4/11/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Thanks how would I handle the fgets line.. http://www.php.net/socket_read If I echo $sock I get resource ID #4 rather then the responce from the other computer. Before on my original script I returned the responce using fputs($fs, $domain\r\n); // send query $line = fgets($fs, 1024); // store reply echo $line; // output reply so far I have.. ?php $domain = 'internet.co.uk'; $sourceip = 'xx.xx.xx.xx'; // ip you want to bind to $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); socket_bind($sock, $sourceip); socket_connect($sock, 'dac.nic.uk', 2043); // Write $request = $domain\r\n\n; // send request socket_write($sock, $request); // store reply echo $sock; //output reply?? socket_close($sock); // Close ? - Original Message - From: Richard Lynch [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, April 11, 2007 1:19 AM Subject: Re: [PHP] Bind IP with fsockopen fputs adds a newline, and you've got \r\n already, so your total output in the original is \r\n\n In the socket_bind one, you've got none of the \r\n stuff at all, much less \r\n\n On Tue, April 10, 2007 5:56 pm, [EMAIL PROTECTED] wrote: Im having trouble converting this snippet to use the bind_socket function. my original code is.. ? $domain = 'internet.co.uk'; $fs = fsockopen('dac.nic.uk', 2043, $errno, $errstr, 60); if (!$fs) { fclose($fs); } else { fputs($fs, $domain\r\n); $line = fgets($fs, 1024); echo $line; } ? I think im getting stuck on the fputs bit.. I have this which does not work.. ?php $domain = 'internet.co.uk'; $sourceip = 'xx.xx.xx.xx'; // ip you want to bind to $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); socket_bind($sock, $sourceip); socket_connect($sock, 'dac.nic.uk', 2043); // Write $request = $domain\r\n; socket_write($sock, $request); //Read reply // Close socket_close($sock); ? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Array remove function?
Hi, Is there currently a function that removes a key/value from an array? I use this code right now: function array_remove($array,$remove,$remove_value = true) { foreach($array as $key = $value) { if($remove_value $value != $remove) { $new_array[$key] = $value; } elseif (!$remove_value $key != $remove) { $new_array[$key] = $value; } } return $new_array; } array_remove(array(1=2,2=3),2,true); // array (2=3) array_remove(array(1=2,2=3),2,false); // array (1=2) Anyone knows if there already exists such function? Else should i create future request? Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array remove function?
On 4/10/07, Richard Lynch [EMAIL PROTECTED] wrote: http://php.net/unset That works when you know the key, but will that work when you only know the value? Tijnema On Tue, April 10, 2007 2:49 pm, Tijnema ! wrote: Hi, Is there currently a function that removes a key/value from an array? I use this code right now: function array_remove($array,$remove,$remove_value = true) { foreach($array as $key = $value) { if($remove_value $value != $remove) { $new_array[$key] = $value; } elseif (!$remove_value $key != $remove) { $new_array[$key] = $value; } } return $new_array; } array_remove(array(1=2,2=3),2,true); // array (2=3) array_remove(array(1=2,2=3),2,false); // array (1=2) Anyone knows if there already exists such function? Else should i create future request? Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MD5 bot Question
On 4/10/07, tedd [EMAIL PROTECTED] wrote: At 1:17 PM -0400 4/10/07, Robert Cummings wrote: -snip- That should have read: ... since no subset of... Oh well, now it makes sense ! :-) Actually, I see exactly what you are saying. If you take a small portion of a file and MD5 it, it will give you a signature. If I simply change a single pixel in the image and that pixel is NOT included in the small portion you use for your MD5, then the MD5 check will return the same signature as before the alteration. However, if your portion includes the pixel change, then the resultant MD5 will be different. That's the reason why you need to alter a significant portion of the image so that smaller portions will probably contain some alteration. Thanks for explaining that. tedd That just means that you should store about 10-20 MD5 summed parts, and then take the same 10-20 parts (and MD5 sum) and compare, and if a few (or maybe just 1) match, then you know it's same image :) Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Novice PHP Question - Listing Folder Contents
On 4/10/07, revDAVE [EMAIL PROTECTED] wrote: I apologize in advance, however I know almost nothing about PHP - ( but I am trying to learn now)... I am wondering if it is possible to create a PHP page that can: 1 - Get the contents of everything in its own folder at the same level ( just list sub folders filenames - not their contents) http://www.php.net/manual/en/function.scandir.php 2 - List/ display the contents on the same Web-page http://www.php.net/manual/en/function.file-get-contents.php Q: I'm sure this is most likely doable - but I sure could use some help - any ideas how to do this? Example list: file1.php file2.php file22.txt file1.pdf - that sort of thing -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array remove function?
On 4/10/07, Daevid Vincent [EMAIL PROTECTED] wrote: OMG. Now that is the best idea. How simple. Guess I learned something new today too! :) -Original Message- From: Lori Lay [mailto:[EMAIL PROTECTED] Use array_search() and unset()? Interesting, I didn't thought of that :) But should i submit a future request for such function? Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Novice PHP Question - Listing Folder Contents
On 4/10/07, revDAVE [EMAIL PROTECTED] wrote: On 4/10/2007 1:13 PM, Tijnema ! [EMAIL PROTECTED] wrote: http://www.php.net/manual/en/function.scandir.php 2 - List/ display the contents on the same Web-page http://www.php.net/manual/en/function.file-get-contents.php WOW COOL - That was quick - thanks Tijnema Brad! From here: http://us.php.net/manual/en/function.scandir.php I created a folder on a site called 'test' - inside that I created a folder called 'tmp' and put a few small files in there - test1.php and test1.pdf - inside the 'test' folder - I put a page with this code in it: ---START-- !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 / titleUntitled Document/title /head body ?php $dir= '/tmp'; This links to /tmp, and that's probably not what you want, you want it relative to your page try: ?php $dir = './tmp'; $files1 = scandir($dir); $files2 = scandir($dir, 1); print_r($files1); print_r($files2); ? /body /html --- END I believe I'm using php 5.xx and other simple php code tests works ok... What did I do wrong? * It returned this: Array ( [0] = . [1] = .. [2] = 20070319-203422-202.180.53.58-request_body-cIifAH [3] = 20070331-205545-210.151.155.75-request_body-ndb6cr [4] = 20070407-120415-74.120.199.72-request_body-e04f0i [5] = cpbandwidth [6] = horde_32001.log [7] = impatt8G6tEI [8] = impattnZ83wN [9] = mysql.sock [10] = sess_081964a8e938ed5ce96599ca69c3735f [11] = sess_0a68937c12c590e4e888729a6f3b3909 [12] = sess_196a3d41dcf968745b769fd0cc109027 [13] = sess_1d76fbb6d9a20281764dd704d7b3b42b [14] = sess_1df95e42d90db2a3b56b01b13418436f [15] = sess_251f03b20e722badf7f50b79bdf2d658 [16] = sess_2c6ca7e9f66fdec29eec68eb82b1af74 [17] = sess_372c43405de9f29c9f7da7e2f744b76b [18] = sess_3ec91e33b50ba9907a5c5a1708536e72 [19] = sess_3f53f2e40741897d8bf2221e1654ffe4 [20] = sess_57cb8a894f1ffb0e401b4f056aef72e1 [21] = sess_57fff08ce0f8e04aa5bdf951beac4a09 [22] = sess_60d24ab7ad329193f4c0a86b8523d620 [23] = sess_62b717b4d1cb02a212d069bbda572537 [24] = sess_643b41e3f4cbcddff8691733ec5ced73 [25] = sess_73954a8cdafc3ec27e100334f41f4687 [26] = sess_96b7e378fbe36ef9dd0d6971f055f1f4 [27] = sess_a4924e20ddf793e3b105f8e571fcb8f9 [28] = sess_ab4f0779de0d62ffdb663e2e5fa0e545 [29] = sess_b10ba9bb132e6b7e595e5dd6534456c7 [30] = sess_b509845b62cd47325f7e87da19950c8f [31] = sess_ce336da97e49a065da7a1e17f67905fe [32] = sess_cee73725b4740fd4a71007acc415e315 [33] = sess_d93ffa5f105f1f1be98c8d25d507d4d2 [34] = sess_db0673c8f47533b927ebd220b158b9a6 [35] = sess_db6015a1a82369de458bea63790dd2a7 [36] = sess_ea54cce4bee772eca9d051b9665ad767 [37] = sess_fc8499d1de617bfd49f3ed6a64a55dfe ) Array ( [0] = sess_fc8499d1de617bfd49f3ed6a64a55dfe [1] = sess_ea54cce4bee772eca9d051b9665ad767 [2] = sess_db6015a1a82369de458bea63790dd2a7 [3] = sess_db0673c8f47533b927ebd220b158b9a6 [4] = sess_d93ffa5f105f1f1be98c8d25d507d4d2 [5] = sess_cee73725b4740fd4a71007acc415e315 [6] = sess_ce336da97e49a065da7a1e17f67905fe [7] = sess_b509845b62cd47325f7e87da19950c8f [8] = sess_b10ba9bb132e6b7e595e5dd6534456c7 [9] = sess_ab4f0779de0d62ffdb663e2e5fa0e545 [10] = sess_a4924e20ddf793e3b105f8e571fcb8f9 [11] = sess_96b7e378fbe36ef9dd0d6971f055f1f4 [12] = sess_73954a8cdafc3ec27e100334f41f4687 [13] = sess_643b41e3f4cbcddff8691733ec5ced73 [14] = sess_62b717b4d1cb02a212d069bbda572537 [15] = sess_60d24ab7ad329193f4c0a86b8523d620 [16] = sess_57fff08ce0f8e04aa5bdf951beac4a09 [17] = sess_57cb8a894f1ffb0e401b4f056aef72e1 [18] = sess_3f53f2e40741897d8bf2221e1654ffe4 [19] = sess_3ec91e33b50ba9907a5c5a1708536e72 [20] = sess_372c43405de9f29c9f7da7e2f744b76b [21] = sess_2c6ca7e9f66fdec29eec68eb82b1af74 [22] = sess_251f03b20e722badf7f50b79bdf2d658 [23] = sess_1df95e42d90db2a3b56b01b13418436f [24] = sess_1d76fbb6d9a20281764dd704d7b3b42b [25] = sess_196a3d41dcf968745b769fd0cc109027 [26] = sess_0a68937c12c590e4e888729a6f3b3909 [27] = sess_081964a8e938ed5ce96599ca69c3735f [28] = mysql.sock [29] = impattnZ83wN [30] = impatt8G6tEI [31] = horde_32001.log [32] = cpbandwidth [33] = 20070407-120415-74.120.199.72-request_body-e04f0i [34] = 20070331-205545-210.151.155.75-request_body-ndb6cr [35] = 20070319-203422-202.180.53.58-request_body-cIifAH [36] = .. [37] = . ) -- Thanks - RevDave [EMAIL PROTECTED] [db-lists] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MD5 bot Question
On 4/9/07, tedd [EMAIL PROTECTED] wrote: At 4:38 AM -0700 4/8/07, benifactor wrote: hmm, why don't you md5 more then once.. I read somewhere that MD5'ing anything more than once, does not increase security. Cheers, tedd Not in this case, as it doesn't goes about decrypting the key here, that's impossible with MD5, you can only bruteforce. But that's totally not of interest, a cracker doesn't want to implement a MD5 bruteforcer in his bot that brute forces the MD5 key each time (which can take up to several years to complete on regular PCs). Tijnema -- --- 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] DOM and XSLTProcessor
On 4/9/07, Buesching, Logan J [EMAIL PROTECTED] wrote: Greetings, I apologize if this is a little long, but I am trying to put as much information as I have done in this first post. I am running PHP 5 and attempting to use DOM to create data to show on a webpage and using XSLTProcessor with an XSLT sheet to output it into XHTML. Everything is pretty fine an dandy until I wish to print raw text, such as xdebug and var_dump. My knowledge of DOM and XSLTProcessor is about a 5/10, such that I know most basics, but not the more advanced things. Whenever I try to add data using createTextNode, it is always escaped, such that if I do strongsomething/strong, when shown to the screen, it shows lt;stronggt; etc... Here is the general outline: ?php $doc=new DOMDocument(1.0); $root=$doc-createElement(root); $wantedCode=$doc-createTextNode(strongSomething/strong); $root-appendChild($wantedCode); $doc-appendChild($root); $proc=new XSLTProcessor; $proc-importStylesheet(DOMDocument::load(test.xslt)); echo $proc-transformToXML($doc); ? SomeSheet is something like: xsl:template match=/ xsl:value-of select=./ /xsl:template The expected output that I would like to get is: strongSomething/strong (This would just bold my text, not literally see the strong tags). The actual output is: lt;stronggt;Somethinglt;/stronggt; (This outputs the strong tags to the end user, which is what I do not want). I checked the manual at: http://us3.php.net/manual/en/function.dom-domdocument-createtextnode.php . A user comment suggested to use CDATA nodes, so I attempted to change my code to the following: ?php $doc=new DOMDocument(1.0); $root=$doc-createElement(root); //note the change right here $wantedCode=$doc-createCDATASection(strongSomething/strong); $root-appendChild($wantedCode); $doc-appendChild($root); $proc=new XSLTProcessor; $proc-importStylesheet(DOMDocument::load(test.xslt)); echo $proc-transformToXML($doc); ? But this was of no success; it just had the same output. Is there anyone that is able to help me out here? Thanks, Logan Try using htmlspecialchars_decode before outputting your data: http://www.php.net/manual/en/function.htmlspecialchars-decode.php Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MD5 bot Question
On 4/9/07, Robert Cummings [EMAIL PROTECTED] wrote: On Mon, 2007-04-09 at 09:45 -0400, tedd wrote: At 8:49 AM -0400 4/9/07, Robert Cummings wrote: On Mon, 2007-04-09 at 08:46 -0400, tedd wrote: At 1:21 AM -0700 4/9/07, Micky Hulse wrote: Maybe use flash for this... harder to crack? (Of course, Flash will open door to other problems.) Sorry, coming in on this late. Good work Tedd! Very interesting. M: Tijnema showed how MD5 could be used to identify an image file and crack my arrow captcha. That's really what this thread was about. I finally came up with enough variations to make it impractical. However, this did make me wonder about the images that M$ and others are using for captchas -- like find the kitty in a set of pictures. The MD5 application could be used to identify as many pictures as any spammer would need. So, I think MD5 method, as described in this thread, would work very well to crack those type of captchas. I doubt Microsoft is using a static image repository for captchas. Cheers, Rob. I doubt that their image repository infinite. Plus, I envision a method where a bot could: 1. Scan the site, gather the images and key phrase. 2 MD5 the images. 3. Place all the MD5's with the associate key phrase in a dB. 4. Refresh and repeat. With repeated refreshes (not attempts at trying to enter), the key phrases associated with the MD5's will build and the bot will learn. It works like this -- the phrase find the kitty or key word kitty will always be associated with the picture of the kitty WHEN kitty is the solution. All other key phrases/words associated with the kitty picture will eventually stack out as just be background noise as data is gathered. As such, a bot could have a foundation at making an intelligent guess. Also, every guess (successful or not) provides even more data to be considered. The more data gathered, the better the guess. Hi Tedd, Put down the crack pipe please... captcha images are usually generated on the fly. Their image repository is 0. Their image universe is all of the permutations of an image containing all of the range of serial codes embedded in the images according to their morphing routine. I highly doubt the US Government could afford the space required to store all of the permutations. Considering the number of bytes available to a dynamically generated image, it is highly likely that the images would be capable of exhausting the entire md5 universe. Cheers, Rob. And then not to mention that md5 has a limitation, and that there probably would be 2 different images, with the same MD5... Using MD5 on the normal write the key CAPTCHAs isn't gonna work, they are mostly generated on the fly, and even if they weren't, then there probably a lot solutions, and not just 8 that i had with your arrow captcha. Those write the key CAPTCHAs are the best crackable with an OCR reader. But that's why they are so transformed these days. So that requires extra steps to make it readable. I think that we can conclude that a non-crackable CAPTCHA doesn't exist, but also that there doesn't exist a real hard to crack CAPTCHA. All current CAPTCHAs can be broken quite easy. MD5 can help in some cases, but only if the CAPTCHA uses static images/audio/video/etc. Just about your Audio CAPTCHA, you could use MD5 to crack it, as the number has the same MD5 sum each time. Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] redirect http to https
On 4/9/07, Ben Liu [EMAIL PROTECTED] wrote: What's the prescribed method for redirecting a user forcibly to from the non-SSL secured version of a page to the SSL-secured version? Is this handled at the web server level or at the script level. I found this by googling: ?php if($_SERVER['SERVER_PORT'] !== $encport || $_SERVER['HTTPS'] !== on) {header(Location: https://.$_SERVER['SERVER_NAME'].$_SERVER ['SCRIPT_NAME']);exit;} ? What do people think about this solution? Thanks, - Ben Apache mod_rewrite maybe? Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php