Re: [PHP] Does this seem wrong to anyone else?
How about this one? function recursive_mkdir($dir) { if (is_dir($dir)) return true; if (recursive_mkdir(dirname($dir))) return @mkdir($dir); return false; } On Thu, Aug 21, 2008 at 1:04 AM, Ashley Sheridan [EMAIL PROTECTED] wrote: Whats even more fun is inheriting somebody elses' *undocumented* code. Oh, and if just happens to be in a strange programming language that you don't know too well, all the better! Sounds awful, but it did happen to me once :-/ Ash www.ashleysheridan.co.uk -- Forwarded message -- From: Jochem Maas [EMAIL PROTECTED] To: Robert Cummings [EMAIL PROTECTED] Date: Thu, 21 Aug 2008 00:52:09 +0200 Subject: Re: [PHP] Does this seem wrong to anyone else? Robert Cummings schreef: On Wed, 2008-08-20 at 14:09 -0700, Stephen Johnson wrote: I am debugging someone else¹s code, and this is what they have : 1055function mkdir_recursive($pathname, $mode) 1056{ 1057is_dir(dirname($pathname)) || mkdir_recursive(dirname($pathname), $mode); 1058return is_dir($pathname) || @mkdir($pathname, $mode); 1059} The part that bothers me is that mkdir_recursive calls itself from within itself. I am not an expert on this particular type of thing, and maybe that is allowed, but it seems wrong to me, and this error is being generated: That's the point of recursion... to recursively call oneself! Fatal error: Call to undefined function mkdir_recursive() in x.php on line 1057 the call to mkdir_recursive() on line 1057 is made inside mkdir_recursive() so it's impossible that the function doesn't exist ... unless the function you posted is actually a method of a class, in which case some time in the past the project included a standalone function mkdir_recursive() which is been removed. at least that would be my first/best guess. Not sure why you're getting that error since it appears to be well defined above... unless x.php is not the same file in which mkdir_recursive() ha sbeen defined. I'll wager it's not... in which case you need to ensure the file that contains the mkdir_recursive() function declaration is included into x.php. BTW, FWIW, I wouldn't call the above code good quality since it obfuscates its intent by using || hackishness. It's succinct but less obvious. it's plain horrid, not to mention using is_dir() dirname() twice unnecessarily, providing no checks as to whether the path exists and is a file or whether file permissions are okay (if your gonna wrap mkdir() might as well do a proper job) , etc. worst of all the call to mkdir() is error suppressed ... a nice big wtf waiting to happen when it fails. oh and there is absolutely no need to use recursion here, a while loop could be used instead which would be more efficient. lastly Stut pointed out that php5 negates the need for this function altogether, but you might still be stuck on php4 for some reason. ain't it fun inheriting other peoples 'code' ;-) Cheers, Rob. -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Accountancy for a webshop/ecommerce system
Rene Veerman wrote: What i'm worried about is the accounting part of a webshop system. I've downloaded some accounting manuals and programs, to see 'how its done'. I've also downloaded some other webshop php apps (notably oscommerce.com) to see how they do things. OS-commerce provides very little reporting. There's no balance sheet, no statement of loss/profits, etc. I'm wondering how a webshop operator/owner would keep track of inventory and profits/losses. I don't know much about e.g. osCommerce, but I would expect a webshop system to only provide the input for a general ledger- and/or inventory-system. Just like a human shop-assistant or cashier does when he/she operates the check-out register. Taken to the extreme, a webshop system would require accountancy reporting functionality, a general ledger, journals, etc. This sounds like a severe case of scope-creep. I don't think any of that belongs in a webshop system, just like a webshop doesn't belong in a general ledger system. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Breaking a line in two
Right, that's what I can't imagine why he would possibly need to keep the space. Warren Vail -Original Message- From: Micah Gersten [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 20, 2008 9:24 AM To: [EMAIL PROTECTED]; PHP General Subject: Re: [PHP] Re: Breaking a line in two Actually, in HTML the space is irrelevant if you are breaking the line. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Ashley Sheridan wrote: Unfortunately, the wordwrap function won't do what he needs. He needed to add a br/ *after* the space, and not replace the space. Ash www.ashleysheridan.co.uk -- -- Subject: Re: [PHP] Re: Breaking a line in two From: Micah Gersten [EMAIL PROTECTED] Date: Wed, 20 Aug 2008 10:49:49 -0500 To: php-general@lists.php.net To: php-general@lists.php.net If you use wordwrap, you don't need nl2br. See Example 1 for wordwrap. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Lupus Michaelis wrote: Ron Piggott a écrit : This is 23 characters long. I want br added after the 12th character, following the first space: I guess you want to use wordwrap http://www.php.net/wordwrap and nl2br http://www.php.net/nl2br. -- 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] Accountancy for a webshop/ecommerce system
Per Jessen wrote: Rene Veerman wrote: What i'm worried about is the accounting part of a webshop system. I've downloaded some accounting manuals and programs, to see 'how its done'. I've also downloaded some other webshop php apps (notably oscommerce.com) to see how they do things. OS-commerce provides very little reporting. There's no balance sheet, no statement of loss/profits, etc. I'm wondering how a webshop operator/owner would keep track of inventory and profits/losses. I don't know much about e.g. osCommerce, but I would expect a webshop system to only provide the input for a general ledger- and/or inventory-system. Just like a human shop-assistant or cashier does when he/she operates the check-out register. Taken to the extreme, a webshop system would require accountancy reporting functionality, a general ledger, journals, etc. This sounds like a severe case of scope-creep. I don't think any of that belongs in a webshop system, just like a webshop doesn't belong in a general ledger system. I'd second that - to an extent. Some tracking of costs does form part of the 'shop', such as the value of the stock currently held, and adding stock WITH it's cost makes sense in this situation as at least you can then see where an increase in the supply price hits your margin on the sale price. So you should be able to see THAT from shop admin. I'm not sure if zencart has the costings elements in it, but the bitweaver port of zencart which I'm using does and I assume that was part of the port. My ACCOUNTANT prefers that the company accounts are in Sage, and things like 'capitol depreciation', rent, insurance and other abstract accounting concepts are much more appropriate there. But the transfer between the two is simply a monthly total on sales, and a summary for the record of how it is made up. In my case this ties up with a printout of the Paypal receipts for the same period, and the 'finance' costs can then be added to the Sage accounts as a bank charge. Although factoring the Paypal (or other payment service) charges back into the shops own profit margin calculation could be useful. -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/lsces/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ?=class::$lang[$this-lang]['_key_']? Not working
Hello, I god very weird problem on cent os server. I use php templates on TYPO3 based system. which uses short tags some how ?=class::$lang[$this-lang]['_key_']? was not working. System works perfectly on my ubuntu machine. Another problem was. I can get $this-lang I can get print_r(class::$lang) but I cannot access them. Another weirdness was some parts of the script can get class::$lang[$this-lang]['_key_'] values Does anybody give me clue ? PS: This code 4th or 5th level deep require. Is there any ini parameter for this ? Regards Sancar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forward slashes and header requests
I had a similar thing happen with a file management system. I found the best way to fix it was to use $location = str_replace('//','/', $_SERVER['REQUEST_URI']); Ash www.ashleysheridan.co.uk ---BeginMessage--- PHP List, I have built my own CMS system, and I've just finished setting it up so that it sends a test cookie to see if the browser has cookies enabled. If it doesn't, it does URL rewriting to handle sessions. Part of this process involves reloading the page, and sending back a header to get it to go to the right page. In amongst the code, I have this line: header (Location: /$userRequest); $userRequest can sometimes be empty, such as when someone only types the domain name in their browser's URL field. Like, http://www.mynicesite.com;. But, I've learned that if I just do this: header (Location: $userRequest); Then the the browser displays nothing at all. There has to be at least something after Location: in the header() command. That's why I put the forward slash in, thinking that it would take people to the root directory of the site. It works for when people put nothing in the URL other than the domain name. And it works for every other page or directory on the site. But, I've also learned that if someone creates a link like this: a href=/click here/a ... then what happens is that the system gets confused about what directory it is in and will lose track of any files located by relative paths. CSS files and images are not found, and the page comes up completely unformatted. I've done a lot of experimenting, and one thing I tried was this: $userRequest = trim($_SERVER['REQUEST_URI'], /); ... so that I would take the slash back out of the URL when it came back. But it still doesn't work, so now I'm wondering if the browser is doing something different when it handles a single forward slash. Bottom line, I can't figure out why this: a href=/click here/a ... does not work with this: $userRequest = trim($_SERVER['REQUEST_URI'], /); header (Location: /$userRequest); Any suggestions or help would be greatly appreciated. -- Dave M G -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ?=class::$lang[$this-lang]['_key_']? Fixed myBAD
Sorry to bothering list. my_bad I damn bug generated by mysef and ignited by sort order... /my_bad Sorry. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Semi-ADVERT, not really spam, sorry for it
This one time, at band camp, Robert Cummings [EMAIL PROTECTED] wrote: Your assumption that this will occur is clearly based on false presumptions. For instance you assume that what has happened before will happen again. Secondly, your assertion that there are pedants waiting to pick apart poorly thought out arguments is baseless. Lastly, you forgot to send in your dues to the list to ensure unmolested posting of ridiculous statements. Please return to your rock and draw up another strategy to offend the list. See what I mean? Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] include methods of one class in another
Hello, firstly, sorry for my English... I have class: //--- class manageClassError{ private $errorsList=array(); private function addError($ex){ $errorsList[]=$ex; } public function isError(){ return (bool)(count($this-errorsList)); } public function getErrorsList(){ return $this-errorsList; } public function returnLastError(){ $cErrorsList=count($this-errorsList); If($cErrorsList==0){ return false; }else{ return $this-errorsList[$cErrorsList-1]; } } } //--- this class alone can't do anything practicality, but if include this class to another it can salve other class to copy code of first class... so i had many class,which contain all method of manageClassError and i need to mark managing error in other class...can you help me? P.S. I think, use extends isn't good for my idea... -- === С уважением, Манылов Павел aka [R-k] icq: 949-388-0 mailto:[EMAIL PROTECTED] === А ещё говорят так: I was at this restaurant. The sign said Breakfast Anytime. So I ordered French Toast in the Rennaissance. -- Steven Wright [fortune] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Licensing
Richard Heyes wrote: Okay, I've taken your points on board and come up with this: http://www.phpguru.org/static/license.html Better? License costs in EUR, CHF and DKK? Seriously, I would quote the price in one currency only, and leave it for people to convert. There's one 'm' too many in commmercial. GPL is probably sufficiently well known not to warrant an explanation, but what is QPL? /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Timing problem, putting PNG into PDF
I'm using GD to crop save an uploaded image, and then embedding it into a PDF made with FPDI. It works great when the image is small or low-res. When the uploaded file is bigger, more than a couple hundred K or so, it fails. I think that the image is not done writing yet by the time I try to do the $pdf-Image. Any suggestions? Some way to force it to hang out and pause until the image is done writing? I know that this is naive but maybe sleep will do the job. Try to write the file and then put something like sleep(2) to give it time to finish the IO. http://www.php.net/manual/en/function.sleep.php -- Thodoris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Timing problem, putting PNG into PDF
2008/8/12 Brian Dunning [EMAIL PROTECTED]: I'm using GD to crop save an uploaded image, and then embedding it into a PDF made with FPDI. It works great when the image is small or low-res. When the uploaded file is bigger, more than a couple hundred K or so, it fails. I think that the image is not done writing yet by the time I try to do the $pdf-Image. Any suggestions? Some way to force it to hang out and pause until the image is done writing? It's more likely you're hitting a memory limit in your script. Pare your script down to just the resize action, and turn error reporting on. What function are you calling to do the resize? It shouldn't return until it's finished processing. BTW, ImageMagick produces smoother results than GDLib when resizing. -- http://www.otton.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include methods of one class in another
On Thu, Aug 21, 2008 at 6:10 AM, Pavel [EMAIL PROTECTED] wrote: Hello, firstly, sorry for my English... I have class: //--- class manageClassError{ private $errorsList=array(); private function addError($ex){ $errorsList[]=$ex; } public function isError(){ return (bool)(count($this-errorsList)); } public function getErrorsList(){ return $this-errorsList; } public function returnLastError(){ $cErrorsList=count($this-errorsList); If($cErrorsList==0){ return false; }else{ return $this-errorsList[$cErrorsList-1]; } } } //--- this class alone can't do anything practicality, but if include this class to another it can salve other class to copy code of first class... so i had many class,which contain all method of manageClassError and i need to mark managing error in other class...can you help me? P.S. I think, use extends isn't good for my idea... -- === С уважением, Манылов Павел aka [R-k] icq: 949-388-0 mailto:[EMAIL PROTECTED] === А ещё говорят так: I was at this restaurant. The sign said Breakfast Anytime. So I ordered French Toast in the Rennaissance. -- Steven Wright [fortune] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php You can make your error class a singleton, perhaps make the methods static, or use some sort of dependency injection. This way you can call it from your other classes. Two quick examples: class foo { /** * @var manageClassError */ protected $error; public function __construct(manageClassError $error) { $this-error = $error; } public function process() { $this-error-addError('uh oh'); } } or class foo { public function process() { $error = manageClassError::getInstance(); $error-addError('uh oh'); } }
Re: [PHP] RE: Sale 79% OFF !!!
Ooh, ooh, I must go and rush out to buy some. No wait, I'm a programmer, I have no love life... How did this get through? And do they really expect it to work?! Ash www.ashleysheridan.co.uk ---BeginMessage--- Dear php-general@lists.php.net, Canadian Doctor Beatriz Best Price 2008! http://btm.http://oqm.http://xxv.Dear php-general@lists.php.net, Canadian Doctor Jimmie Best Price 2008!?axnsisterspell.com?uuqsisterspell.com?mms -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Does this seem wrong to anyone else?
Yeti schreef: How about this one? function recursive_mkdir($dir) { if (is_dir($dir)) return true; if (recursive_mkdir(dirname($dir))) return @mkdir($dir); return false; } covers half of one of my gripes about the OP's originally posted function. and it introduces a regression in that file mode is no longer supported. so I'd say it's no better. On Thu, Aug 21, 2008 at 1:04 AM, Ashley Sheridan [EMAIL PROTECTED] wrote: Whats even more fun is inheriting somebody elses' *undocumented* code. Oh, and if just happens to be in a strange programming language that you don't know too well, all the better! Sounds awful, but it did happen to me once :-/ Ash www.ashleysheridan.co.uk -- Forwarded message -- From: Jochem Maas [EMAIL PROTECTED] To: Robert Cummings [EMAIL PROTECTED] Date: Thu, 21 Aug 2008 00:52:09 +0200 Subject: Re: [PHP] Does this seem wrong to anyone else? Robert Cummings schreef: On Wed, 2008-08-20 at 14:09 -0700, Stephen Johnson wrote: I am debugging someone else¹s code, and this is what they have : 1055function mkdir_recursive($pathname, $mode) 1056{ 1057is_dir(dirname($pathname)) || mkdir_recursive(dirname($pathname), $mode); 1058return is_dir($pathname) || @mkdir($pathname, $mode); 1059} The part that bothers me is that mkdir_recursive calls itself from within itself. I am not an expert on this particular type of thing, and maybe that is allowed, but it seems wrong to me, and this error is being generated: That's the point of recursion... to recursively call oneself! Fatal error: Call to undefined function mkdir_recursive() in x.php on line 1057 the call to mkdir_recursive() on line 1057 is made inside mkdir_recursive() so it's impossible that the function doesn't exist ... unless the function you posted is actually a method of a class, in which case some time in the past the project included a standalone function mkdir_recursive() which is been removed. at least that would be my first/best guess. Not sure why you're getting that error since it appears to be well defined above... unless x.php is not the same file in which mkdir_recursive() ha sbeen defined. I'll wager it's not... in which case you need to ensure the file that contains the mkdir_recursive() function declaration is included into x.php. BTW, FWIW, I wouldn't call the above code good quality since it obfuscates its intent by using || hackishness. It's succinct but less obvious. it's plain horrid, not to mention using is_dir() dirname() twice unnecessarily, providing no checks as to whether the path exists and is a file or whether file permissions are okay (if your gonna wrap mkdir() might as well do a proper job) , etc. worst of all the call to mkdir() is error suppressed ... a nice big wtf waiting to happen when it fails. oh and there is absolutely no need to use recursion here, a while loop could be used instead which would be more efficient. lastly Stut pointed out that php5 negates the need for this function altogether, but you might still be stuck on php4 for some reason. ain't it fun inheriting other peoples 'code' ;-) Cheers, Rob. -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ?=class::$lang[$this-lang]['_key_']? Not working
Sancar Saran schreef: Hello, I god very weird problem on cent os server. I use php templates on TYPO3 based system. which uses short tags some how ?=class::$lang[$this-lang]['_key_']? was not working. ah ... so the typo3 code is just as much of a nightmare as the interface, which I never understood far enough to even create a page with a title (H1/2 tag) ... and I'm not *that* stupid ... let alone a useful site. System works perfectly on my ubuntu machine. Another problem was. I can get $this-lang I can get print_r(class::$lang) but I cannot access them. Another weirdness was some parts of the script can get class::$lang[$this-lang]['_key_'] values Does anybody give me clue ? PS: This code 4th or 5th level deep require. Is there any ini parameter for this ? Regards Sancar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include methods of one class in another
Pavel schreef: Hello, firstly, sorry for my English... I have class: //--- class manageClassError{ private $errorsList=array(); private function addError($ex){ $errorsList[]=$ex; } public function isError(){ return (bool)(count($this-errorsList)); } public function getErrorsList(){ return $this-errorsList; } public function returnLastError(){ $cErrorsList=count($this-errorsList); If($cErrorsList==0){ return false; }else{ return $this-errorsList[$cErrorsList-1]; } } } //--- this class alone can't do anything practicality, but if include this class to another it can salve other class to copy code of first class... so i had many class,which contain all method of manageClassError and i need to mark managing error in other class...can you help me? use a decorator pattern or wait till hell freezes over and the core devs actually allow the Traits functionality into php. Traits is actually well thought out and implemented addition AFAICT ... but there are countless half-baked, 'must-have', buzzword-of-the-moment stuff that needs to be implemented first ... and the unicode stuff (which is actually going to be kick-ass if they get it right) you can attribute this to the Narky::Sarcasm namespace. P.S. I think, use extends isn't good for my idea... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Semi-ADVERT, not really spam, sorry for it
Robert Cummings schreef: On Thu, 2008-08-21 at 08:23 +1000, Kevin Waterson wrote: This one time, at band camp, V S Rawat [EMAIL PROTECTED] wrote: Sorry for bothering the rest of you. I hope you wouldn't really mind if some of our colleagues who are doing such a lovely volunteer work here get to earn some money for a bottle of beer and more. Rest assured that it is no fraud/ scam/ cheating. I am very much here to take the brickbats. Oh my.. You will upset the list gods and guru's. There will follow from this at least 50 mails saying how bad you are, followed by a bunch of pedants that will pick holes in their arguments. Your assumption that this will occur is clearly based on false presumptions. For instance you assume that what has happened before will happen again. Secondly, your assertion that there are pedants waiting to pick apart poorly thought out arguments is baseless. Lastly, you forgot to send in your dues to the list to ensure unmolested posting of ridiculous statements. Please return to your rock and draw up another strategy to offend the list. I don't think he got it smartarse ;-) Cheers, Rob. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RE: Sale 79% OFF !!!
Ashley Sheridan wrote: And do they really expect it to work?! Yes, and it does. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Does this seem wrong to anyone else?
Hi, I am new here.. Hmm, I think what you should add in your function, Yeti, is else - wont it will be for better performance? and not the suppress the error, and Jochem, then it will be perfect - wont it? I am not sure about the else - but as long you provide to the PHP Processor more information - wont it make him be faster? function recursive_mkdir($dir) { if (is_dir($dir)) return true; else { if (recursive_mkdir(dirname($dir))) return @mkdir($dir); return false; } } On Thu, Aug 21, 2008 at 3:42 PM, Jochem Maas [EMAIL PROTECTED] wrote: Yeti schreef: How about this one? function recursive_mkdir($dir) { if (is_dir($dir)) return true; if (recursive_mkdir(dirname($dir))) return @mkdir($dir); return false; } covers half of one of my gripes about the OP's originally posted function. and it introduces a regression in that file mode is no longer supported. so I'd say it's no better. On Thu, Aug 21, 2008 at 1:04 AM, Ashley Sheridan [EMAIL PROTECTED] wrote: Whats even more fun is inheriting somebody elses' *undocumented* code. Oh, and if just happens to be in a strange programming language that you don't know too well, all the better! Sounds awful, but it did happen to me once :-/ Ash www.ashleysheridan.co.uk -- Forwarded message -- From: Jochem Maas [EMAIL PROTECTED] To: Robert Cummings [EMAIL PROTECTED] Date: Thu, 21 Aug 2008 00:52:09 +0200 Subject: Re: [PHP] Does this seem wrong to anyone else? Robert Cummings schreef: On Wed, 2008-08-20 at 14:09 -0700, Stephen Johnson wrote: I am debugging someone else¹s code, and this is what they have : 1055function mkdir_recursive($pathname, $mode) 1056{ 1057is_dir(dirname($pathname)) || mkdir_recursive(dirname($pathname), $mode); 1058return is_dir($pathname) || @mkdir($pathname, $mode); 1059} The part that bothers me is that mkdir_recursive calls itself from within itself. I am not an expert on this particular type of thing, and maybe that is allowed, but it seems wrong to me, and this error is being generated: That's the point of recursion... to recursively call oneself! Fatal error: Call to undefined function mkdir_recursive() in x.php on line 1057 the call to mkdir_recursive() on line 1057 is made inside mkdir_recursive() so it's impossible that the function doesn't exist ... unless the function you posted is actually a method of a class, in which case some time in the past the project included a standalone function mkdir_recursive() which is been removed. at least that would be my first/best guess. Not sure why you're getting that error since it appears to be well defined above... unless x.php is not the same file in which mkdir_recursive() ha sbeen defined. I'll wager it's not... in which case you need to ensure the file that contains the mkdir_recursive() function declaration is included into x.php. BTW, FWIW, I wouldn't call the above code good quality since it obfuscates its intent by using || hackishness. It's succinct but less obvious. it's plain horrid, not to mention using is_dir() dirname() twice unnecessarily, providing no checks as to whether the path exists and is a file or whether file permissions are okay (if your gonna wrap mkdir() might as well do a proper job) , etc. worst of all the call to mkdir() is error suppressed ... a nice big wtf waiting to happen when it fails. oh and there is absolutely no need to use recursion here, a while loop could be used instead which would be more efficient. lastly Stut pointed out that php5 negates the need for this function altogether, but you might still be stuck on php4 for some reason. ain't it fun inheriting other peoples 'code' ;-) Cheers, Rob. -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RE: Sale 79% OFF !!!
I don't understand how people can fall for this kind of thing, all those Nigerian scams and the like. For every person that falls for it, a million more emails get sent, making everyone elses lives hell :( Ash www.ashleysheridan.co.uk ---BeginMessage--- Ashley Sheridan wrote: And do they really expect it to work?! Yes, and it does. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Does this seem wrong to anyone else?
daniel danon schreef: Hi, I am new here.. Hmm, I think what you should add in your function, Yeti, is else - wont it will be for better performance? and not the suppress the error, and Jochem, then it will be perfect - wont it? no, see my original critique. and note what Stut said about php5 ... i.e. just use mkdir($dir, $mode, true); I am not sure about the else - but as long you provide to the PHP Processor more information - wont it make him be faster? no. function recursive_mkdir($dir) { if (is_dir($dir)) return true; else { if (recursive_mkdir(dirname($dir))) return @mkdir($dir); return false; } } On Thu, Aug 21, 2008 at 3:42 PM, Jochem Maas [EMAIL PROTECTED] wrote: Yeti schreef: How about this one? function recursive_mkdir($dir) { if (is_dir($dir)) return true; if (recursive_mkdir(dirname($dir))) return @mkdir($dir); return false; } covers half of one of my gripes about the OP's originally posted function. and it introduces a regression in that file mode is no longer supported. so I'd say it's no better. On Thu, Aug 21, 2008 at 1:04 AM, Ashley Sheridan [EMAIL PROTECTED] wrote: Whats even more fun is inheriting somebody elses' *undocumented* code. Oh, and if just happens to be in a strange programming language that you don't know too well, all the better! Sounds awful, but it did happen to me once :-/ Ash www.ashleysheridan.co.uk -- Forwarded message -- From: Jochem Maas [EMAIL PROTECTED] To: Robert Cummings [EMAIL PROTECTED] Date: Thu, 21 Aug 2008 00:52:09 +0200 Subject: Re: [PHP] Does this seem wrong to anyone else? Robert Cummings schreef: On Wed, 2008-08-20 at 14:09 -0700, Stephen Johnson wrote: I am debugging someone else¹s code, and this is what they have : 1055function mkdir_recursive($pathname, $mode) 1056{ 1057is_dir(dirname($pathname)) || mkdir_recursive(dirname($pathname), $mode); 1058return is_dir($pathname) || @mkdir($pathname, $mode); 1059} The part that bothers me is that mkdir_recursive calls itself from within itself. I am not an expert on this particular type of thing, and maybe that is allowed, but it seems wrong to me, and this error is being generated: That's the point of recursion... to recursively call oneself! Fatal error: Call to undefined function mkdir_recursive() in x.php on line 1057 the call to mkdir_recursive() on line 1057 is made inside mkdir_recursive() so it's impossible that the function doesn't exist ... unless the function you posted is actually a method of a class, in which case some time in the past the project included a standalone function mkdir_recursive() which is been removed. at least that would be my first/best guess. Not sure why you're getting that error since it appears to be well defined above... unless x.php is not the same file in which mkdir_recursive() ha sbeen defined. I'll wager it's not... in which case you need to ensure the file that contains the mkdir_recursive() function declaration is included into x.php. BTW, FWIW, I wouldn't call the above code good quality since it obfuscates its intent by using || hackishness. It's succinct but less obvious. it's plain horrid, not to mention using is_dir() dirname() twice unnecessarily, providing no checks as to whether the path exists and is a file or whether file permissions are okay (if your gonna wrap mkdir() might as well do a proper job) , etc. worst of all the call to mkdir() is error suppressed ... a nice big wtf waiting to happen when it fails. oh and there is absolutely no need to use recursion here, a while loop could be used instead which would be more efficient. lastly Stut pointed out that php5 negates the need for this function altogether, but you might still be stuck on php4 for some reason. ain't it fun inheriting other peoples 'code' ;-) Cheers, Rob. -- 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 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] Developing a game using Ming
On Wednesday 20 August 2008 4:42:19 pm Jochem Maas wrote: Yasir Malik schreef: What about FlashDevelop? I'm on the Papervision list, and a lot of people are raving abut that at the moment, and best of all it's open source. Could be a much better option than creating SWF files from PHP. Thanks, Ashley, I'll check that out. I was fuzzy on how I could use PHP to generate a static file with event-based dynamic content. if you want to write a flash game you'll have to write lots of actionscript, and debugging that will be impossible if your write it all as simple [php] strings which your passing into Ming. your going to need Flash or some free Flash dev env (like FlashDevelop, as Ashley suggested, assuming its upto the job) If you're trying to be cheap and/or Open Sourcy about it, have a look at OpenLazlo. It's an XML/JS framework, all open source, that compiles to SWF and plays in a normal Flash 9 browser plugin. I've only recently started looking into it, but it looks impressive. -- Larry Garfield [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] New Bie Issues
hi all! I am running behind an issues for a couple of days [SOAP is killing me] Please find the code attached here - which is used to call data from a .NET server. [I got this code from another site] Some modifications have been done.- but am getting a result - *Server was unable to process request. ---gt; Object reference not set to an instance of an object.* The code follows - require_once('nusoap/lib/nusoap.php'); // define the soapaction as found in the wsdl $soapaction = http://XX;; // endpoint address $wsdl = http://.asmx?WSDL;; $namespace = http://X//;; $client = new nusoap_client($wsdl, true); // you will find the serializeEnvelope() prototype by making a search in nusoap.php $mysoapmsg = $client-serializeEnvelope('Search xmlns=http://X/; arrDate23/10/2008/arrDate depDate29/10/2008/depDate locationDOWNTOWN BURJ DUBAI/location persons2/persons currencyAED/currency agentid/agentid lngCode/lngCode /Search','',array(),'document', 'literal'); /* Send the SOAP message and specify the soapaction */ $response = $client-send($mysoapmsg, $soapaction); if ($client-fault) { echo 'h3Fault/h3pre'; print_r($response); echo '/pre'; } echo pSOAP query/p; echo 'pre' . htmlspecialchars($client-request, ENT_QUOTES) . '/pre'; echo pSOAP response/p; echo 'pre' . htmlspecialchars($client-response, ENT_QUOTES) . '/pre'; // start to use the result by following the structure of the SOAP response // first extract the SearchResult $searchresult = $response[SearchResult]; // then you can access the Status message echo Status message: .$searchresult[Status]; // continue with the Result level $result = $searchresult[Result]; // wich allow access to NumRecs (number of record found) echo brRecord found: .$result[NumRecs]; // extract the collection of record (object collRecord) $collrecord = $result[collRecord]; foreach ($collrecord[CRecord] as $record){ echo brProperty: .$record[Property]; echo brPlace: .$record[Place]; } Can any one help? My skill level in SOAP is almost 0 :D thanks! -- -Sathish Menon To accomplish great things, we must dream as well as act.
Re: [PHP] RE: Sale 79% OFF !!!
Because there is 1 or more out there who don't know any better and get sucked in. And when you look at it as being able to use a name book or dictionary (readily available mind you) along with a list of domains.Once you add them together, the resources needed for sending the emails is tiny. So it takes no investment to send out a million emails. And every valid response after the first one is bonus. Ashley Sheridan [EMAIL PROTECTED] wrote: I don't understand how people can fall for this kind of thing, all those Nigerian scams and the like. For every person that falls for it, a million more emails get sent, making everyone elses lives hell :( Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Developing a game using Ming
On Thursday 21 August 2008 8:59:58 am Larry Garfield wrote: If you're trying to be cheap and/or Open Sourcy about it, have a look at OpenLazlo. It's an XML/JS framework, all open source, that compiles to SWF and plays in a normal Flash 9 browser plugin. I've only recently started looking into it, but it looks impressive. And of course I should probably include a link: http://www.openlaszlo.org/ -- Larry Garfield [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RE: Sale 79% OFF !!!
Oh yes, I understand the technicalities involved, I just despair at peoples stupidity! Ash www.ashleysheridan.co.uk ---BeginMessage--- Because there is 1 or more out there who don't know any better and get sucked in. And when you look at it as being able to use a name book or dictionary (readily available mind you) along with a list of domains.Once you add them together, the resources needed for sending the emails is tiny. So it takes no investment to send out a million emails. And every valid response after the first one is bonus. Ashley Sheridan [EMAIL PROTECTED] wrote: I don't understand how people can fall for this kind of thing, all those Nigerian scams and the like. For every person that falls for it, a million more emails get sent, making everyone elses lives hell :( Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Semi-ADVERT, not really spam, sorry for it
On Thu, 2008-08-21 at 14:50 +0200, Jochem Maas wrote: Robert Cummings schreef: On Thu, 2008-08-21 at 08:23 +1000, Kevin Waterson wrote: This one time, at band camp, V S Rawat [EMAIL PROTECTED] wrote: Sorry for bothering the rest of you. I hope you wouldn't really mind if some of our colleagues who are doing such a lovely volunteer work here get to earn some money for a bottle of beer and more. Rest assured that it is no fraud/ scam/ cheating. I am very much here to take the brickbats. Oh my.. You will upset the list gods and guru's. There will follow from this at least 50 mails saying how bad you are, followed by a bunch of pedants that will pick holes in their arguments. Your assumption that this will occur is clearly based on false presumptions. For instance you assume that what has happened before will happen again. Secondly, your assertion that there are pedants waiting to pick apart poorly thought out arguments is baseless. Lastly, you forgot to send in your dues to the list to ensure unmolested posting of ridiculous statements. Please return to your rock and draw up another strategy to offend the list. I don't think he got it smartarse ;-) :) -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Semi-ADVERT, not really spam, sorry for it
What was that? You just quoted his email but didn't add anything! Ash www.ashleysheridan.co.uk ---BeginMessage--- On Thu, 2008-08-21 at 14:50 +0200, Jochem Maas wrote: Robert Cummings schreef: On Thu, 2008-08-21 at 08:23 +1000, Kevin Waterson wrote: This one time, at band camp, V S Rawat [EMAIL PROTECTED] wrote: Sorry for bothering the rest of you. I hope you wouldn't really mind if some of our colleagues who are doing such a lovely volunteer work here get to earn some money for a bottle of beer and more. Rest assured that it is no fraud/ scam/ cheating. I am very much here to take the brickbats. Oh my.. You will upset the list gods and guru's. There will follow from this at least 50 mails saying how bad you are, followed by a bunch of pedants that will pick holes in their arguments. Your assumption that this will occur is clearly based on false presumptions. For instance you assume that what has happened before will happen again. Secondly, your assertion that there are pedants waiting to pick apart poorly thought out arguments is baseless. Lastly, you forgot to send in your dues to the list to ensure unmolested posting of ridiculous statements. Please return to your rock and draw up another strategy to offend the list. I don't think he got it smartarse ;-) :) -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Semi-ADVERT, not really spam, sorry for it
On Thu, 2008-08-21 at 16:04 +0100, Ashley Sheridan wrote: What was that? You just quoted his email but didn't add anything! I added an evil smiley face... probably looks like part of the quote though since it leads with the character. The blanks lines hsould have helped resolve that. Cheers, Rob. Ash www.ashleysheridan.co.uk email message attachment, Forwarded message - Re: [PHP] Semi-ADVERT, not really spam, sorry for it Forwarded Message From: Robert Cummings [EMAIL PROTECTED] To: Jochem Maas [EMAIL PROTECTED] Cc: php-general@lists.php.net Subject: Re: [PHP] Semi-ADVERT, not really spam, sorry for it Date: Thu, 21 Aug 2008 10:57:43 -0400 On Thu, 2008-08-21 at 14:50 +0200, Jochem Maas wrote: Robert Cummings schreef: On Thu, 2008-08-21 at 08:23 +1000, Kevin Waterson wrote: This one time, at band camp, V S Rawat [EMAIL PROTECTED] wrote: Sorry for bothering the rest of you. I hope you wouldn't really mind if some of our colleagues who are doing such a lovely volunteer work here get to earn some money for a bottle of beer and more. Rest assured that it is no fraud/ scam/ cheating. I am very much here to take the brickbats. Oh my.. You will upset the list gods and guru's. There will follow from this at least 50 mails saying how bad you are, followed by a bunch of pedants that will pick holes in their arguments. Your assumption that this will occur is clearly based on false presumptions. For instance you assume that what has happened before will happen again. Secondly, your assertion that there are pedants waiting to pick apart poorly thought out arguments is baseless. Lastly, you forgot to send in your dues to the list to ensure unmolested posting of ridiculous statements. Please return to your rock and draw up another strategy to offend the list. I don't think he got it smartarse ;-) :) -- http://www.interjinn.com Application and Templating Framework for PHP -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Semi-ADVERT, not really spam, sorry for it
Ah, I see! Ash www.ashleysheridan.co.uk ---BeginMessage--- On Thu, 2008-08-21 at 16:04 +0100, Ashley Sheridan wrote: What was that? You just quoted his email but didn't add anything! I added an evil smiley face... probably looks like part of the quote though since it leads with the character. The blanks lines hsould have helped resolve that. Cheers, Rob. Ash www.ashleysheridan.co.uk email message attachment, Forwarded message - Re: [PHP] Semi-ADVERT, not really spam, sorry for it Forwarded Message From: Robert Cummings [EMAIL PROTECTED] To: Jochem Maas [EMAIL PROTECTED] Cc: php-general@lists.php.net Subject: Re: [PHP] Semi-ADVERT, not really spam, sorry for it Date: Thu, 21 Aug 2008 10:57:43 -0400 On Thu, 2008-08-21 at 14:50 +0200, Jochem Maas wrote: Robert Cummings schreef: On Thu, 2008-08-21 at 08:23 +1000, Kevin Waterson wrote: This one time, at band camp, V S Rawat [EMAIL PROTECTED] wrote: Sorry for bothering the rest of you. I hope you wouldn't really mind if some of our colleagues who are doing such a lovely volunteer work here get to earn some money for a bottle of beer and more. Rest assured that it is no fraud/ scam/ cheating. I am very much here to take the brickbats. Oh my.. You will upset the list gods and guru's. There will follow from this at least 50 mails saying how bad you are, followed by a bunch of pedants that will pick holes in their arguments. Your assumption that this will occur is clearly based on false presumptions. For instance you assume that what has happened before will happen again. Secondly, your assertion that there are pedants waiting to pick apart poorly thought out arguments is baseless. Lastly, you forgot to send in your dues to the list to ensure unmolested posting of ridiculous statements. Please return to your rock and draw up another strategy to offend the list. I don't think he got it smartarse ;-) :) -- http://www.interjinn.com Application and Templating Framework for PHP -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RE: Sale 79% OFF !!!
On Thu, Aug 21, 2008 at 10:28 AM, Ashley Sheridan [EMAIL PROTECTED]wrote: Oh yes, I understand the technicalities involved, I just despair at peoples stupidity! Ash www.ashleysheridan.co.uk -- Forwarded message -- From: Wolf [EMAIL PROTECTED] To: [EMAIL PROTECTED] Date: Thu, 21 Aug 2008 10:00:33 -0400 Subject: Re: [PHP] RE: Sale 79% OFF !!! Because there is 1 or more out there who don't know any better and get sucked in. And when you look at it as being able to use a name book or dictionary (readily available mind you) along with a list of domains.Once you add them together, the resources needed for sending the emails is tiny. So it takes no investment to send out a million emails. And every valid response after the first one is bonus. Ashley Sheridan [EMAIL PROTECTED] wrote: I don't understand how people can fall for this kind of thing, all those Nigerian scams and the like. For every person that falls for it, a million more emails get sent, making everyone elses lives hell :( Ash www.ashleysheridan.co.uk -- 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 I never cease to be amazed at the continuing stupidity of the human race. -- Bastien Cat, the other other white meat
Re: [PHP] Developing a game using Ming
If you're trying to be cheap and/or Open Sourcy about it, have a look at OpenLazlo. It's an XML/JS framework, all open source, that compiles to SWF and plays in a normal Flash 9 browser plugin. I've only recently started looking into it, but it looks impressive. And of course I should probably include a link: http://www.openlaszlo.org/ Thanks, Larry. I'll check that out, too, and choose the best one. The replies to my post are greatly appreciated. Also, can the email addresses be removed when top quoting? I was surprised to see my email address showing up in plain in http://marc.info/?t=12192374021r=1w=2 Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Sale 79% OFF !!!
Bastien Koert wrote: I never cease to be amazed at the continuing stupidity of the human race. There is a movie called Idiocracy that sums up the stupidity of the human race quite well it's a very funny movie if you're in the right mood, otherwise it's. well... stupid! Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mandriva Linux Contributor [http://www.mandriva.com/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Sale 79% OFF !!!
Indeed. Hehe, i forgot about that film it's pretty good 2008/8/21 Colin Guthrie [EMAIL PROTECTED] Bastien Koert wrote: I never cease to be amazed at the continuing stupidity of the human race. There is a movie called Idiocracy that sums up the stupidity of the human race quite well it's a very funny movie if you're in the right mood, otherwise it's. well... stupid! Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mandriva Linux Contributor [http://www.mandriva.com/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Luke Slater
Re: [PHP] include methods of one class in another
use a decorator pattern or wait till hell freezes over and the core devs actually allow the Traits functionality into php. I must read about patterns, thanks :) -- === С уважением, Манылов Павел aka [R-k] icq: 949-388-0 mailto:[EMAIL PROTECTED] === А ещё говорят так: We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise. -- Larry Wall [fortune]
Re: [PHP] RE: Sale 79% OFF !!!
I never cease to be amazed at the continuing stupidity of the human race. Agreed. A person is smart; people are stupid. Besides, 79% off! How could I go wrong? Jay I only pay 21% Moore -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Ejecutar comando con php con otro usuario.
Como puedo ejecutar un comando de sistema con otro usuario que no sea www-data??? si realizo un exec(sh miscript.sh); se ejecuta con www-data y me gustaria ejecutarlo con mi usuario. (linux) Gracias d antemano
Re: [PHP] Ejecutar comando con php con otro usuario.
CanihoJR [EMAIL PROTECTED] wrote: Como puedo ejecutar un comando de sistema con otro usuario que no sea www-data??? si realizo un exec(sh miscript.sh); se ejecuta con www-data y me gustaria ejecutarlo con mi usuario. (linux) Gracias d antemano Check your permissions. Wolf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Sale 79% OFF !!!
On Thu, Aug 21, 2008 at 9:32 AM, Colin Guthrie [EMAIL PROTECTED] wrote: Bastien Koert wrote: I never cease to be amazed at the continuing stupidity of the human race. There is a movie called Idiocracy that sums up the stupidity of the human race quite well it's a very funny movie if you're in the right mood, otherwise it's. well... stupid! It's got what programmers crave! ;) -James Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mandriva Linux Contributor [http://www.mandriva.com/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Sale 79% OFF !!!
On Thu, 2008-08-21 at 13:26 -0700, James Ausmus wrote: On Thu, Aug 21, 2008 at 9:32 AM, Colin Guthrie [EMAIL PROTECTED] wrote: Bastien Koert wrote: I never cease to be amazed at the continuing stupidity of the human race. There is a movie called Idiocracy that sums up the stupidity of the human race quite well it's a very funny movie if you're in the right mood, otherwise it's. well... stupid! It's got what programmers crave! ;) Chicks? On Sale?? Hmmm... turkey or chicken? Buck, buck, bkwk! Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Sale 79% OFF !!!
I thought Hackers might be more appropriate. Angelina Jolie looked a lot better back then too... Ash www.ashleysheridan.co.uk ---BeginMessage--- On Thu, 2008-08-21 at 13:26 -0700, James Ausmus wrote: On Thu, Aug 21, 2008 at 9:32 AM, Colin Guthrie [EMAIL PROTECTED] wrote: Bastien Koert wrote: I never cease to be amazed at the continuing stupidity of the human race. There is a movie called Idiocracy that sums up the stupidity of the human race quite well it's a very funny movie if you're in the right mood, otherwise it's. well... stupid! It's got what programmers crave! ;) Chicks? On Sale?? Hmmm... turkey or chicken? Buck, buck, bkwk! Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Quick question regarding getcwd() and directory location.
I'll throw out an example here. I have a directory structure of: /var/www/example/ And in that i have a file: index.php That file echo's getcwd() and returns: /var/www/example/ Now i tell Apache or Lighty that if a directory does not have an index.php file, that it should use /example/index.php (for example via DirectoryIndex of Apache) Then i make a new directory: /var/www/test/ And browse to it and it echo's /var/www/example/ since its running that file via DirectoryIndex This is true for all directories i make. Both for Windows and Linux based servers. To my question. I am trying to get the full path of the current directory i am in. Not from where the file is executing. How is that possible so it displays a full path to that directory (regardless to the server setup)? I have tried a variation of things and have gotten mixed results. Using $_SERVER[SCRIPT_FILENAME] gives me the index file and the full path to that. $_SERVER[DOCUMENT_ROOT] gets me part of the way but on a hosted server with multiple domains it only gives me a partial path (rough example: /var/www/ when the directory is /var/www/domain.com/test/) And __FILE__ gives me the index.php's path. I have also tried realpath(.); And server(pwd); with no luck. Any help would be appreciated. Ólafur Waage -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Restore Leading Zeros in Zip Codes
Hi, RE: Restore Leading Zeros in Zip Codes Does anyone happen to have a script that will restore the leading zeros in a mixed data set of 5 digit zip codes and 10 digit zip+4 codes? Any suggestions? Thanks, Keith
Re: [PHP] Quick question regarding getcwd() and directory location.
Once you tell apache to load /example/index.php, that's where you are. You might try looking at the $_SERVER['HTTP_REFERER']. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Ólafur Waage wrote: I'll throw out an example here. I have a directory structure of: /var/www/example/ And in that i have a file: index.php That file echo's getcwd() and returns: /var/www/example/ Now i tell Apache or Lighty that if a directory does not have an index.php file, that it should use /example/index.php (for example via DirectoryIndex of Apache) Then i make a new directory: /var/www/test/ And browse to it and it echo's /var/www/example/ since its running that file via DirectoryIndex This is true for all directories i make. Both for Windows and Linux based servers. To my question. I am trying to get the full path of the current directory i am in. Not from where the file is executing. How is that possible so it displays a full path to that directory (regardless to the server setup)? I have tried a variation of things and have gotten mixed results. Using $_SERVER[SCRIPT_FILENAME] gives me the index file and the full path to that. $_SERVER[DOCUMENT_ROOT] gets me part of the way but on a hosted server with multiple domains it only gives me a partial path (rough example: /var/www/ when the directory is /var/www/domain.com/test/) And __FILE__ gives me the index.php's path. I have also tried realpath(.); And server(pwd); with no luck. Any help would be appreciated. Ólafur Waage -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Restore Leading Zeros in Zip Codes
if (strlen($zip) == 4 || strlen($zip) == 9) $zip = 0$zip; Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Keith Spiller wrote: Hi, RE: Restore Leading Zeros in Zip Codes Does anyone happen to have a script that will restore the leading zeros in a mixed data set of 5 digit zip codes and 10 digit zip+4 codes? Any suggestions? Thanks, Keith -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Restore Leading Zeros in Zip Codes
That's actually not going to work if there's more than 1 zero missing. This is better. if (strlen($zip) 5) $zip = sprintf('%05d',$zip); else if (strlen($zip) 10) { $zipArray = explode('-', $zip); $zip = sprintf('%05d',$zipArray[0]); $zip .= - . $zipArray[1]; } Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Micah Gersten wrote: if (strlen($zip) == 4 || strlen($zip) == 9) $zip = 0$zip; Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Keith Spiller wrote: Hi, RE: Restore Leading Zeros in Zip Codes Does anyone happen to have a script that will restore the leading zeros in a mixed data set of 5 digit zip codes and 10 digit zip+4 codes? Any suggestions? Thanks, Keith -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forward slashes and header requests
Ashley, Thank you for responding. best way to fix it was to use $location = str_replace('//','/', $_SERVER['REQUEST_URI']); Unfortunately the trim() command I use seems to destroy all slashes anyway, so this doesn't seem to have an impact. Thank you for the suggestion, though. Anyone have any other ideas? -- Dave M G -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Restore Leading Zeros in Zip Codes
I'd try something like; If(strlen($zipcode) = 5) $zipcode = sprintf(%05d,$zipcode); Else { $zipcode = sprintf(%09d,$zipcode); $zipcode = substr($zipcode,0,5).-.substr(zipcode,5); } This isn't real elegant, but it should do the trick. You may notice that the 10 character zip code is not 10 digits but rather 5 plus 4, or 9 digits. Warren Vail -Original Message- From: Keith Spiller [mailto:[EMAIL PROTECTED] Sent: Thursday, August 21, 2008 7:44 PM To: php-general@lists.php.net Subject: [PHP] Restore Leading Zeros in Zip Codes Hi, RE: Restore Leading Zeros in Zip Codes Does anyone happen to have a script that will restore the leading zeros in a mixed data set of 5 digit zip codes and 10 digit zip+4 codes? Any suggestions? Thanks, Keith -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Restore Leading Zeros in Zip Codes
Dave brought up something I forgot, what if the - is already in the sip code; Modify the code as follows; If(strlen($zipcode) = 5) $zipcode = sprintf(%05d,$zipcode); Else { $zipcode = sprintf(%09d,str_replace(-,,$zipcode)); $zipcode = substr($zipcode,0,5).-.substr(zipcode,5); } -Original Message- From: Warren Vail [mailto:[EMAIL PROTECTED] Sent: Thursday, August 21, 2008 8:08 PM To: 'Keith Spiller'; php-general@lists.php.net Subject: RE: [PHP] Restore Leading Zeros in Zip Codes I'd try something like; If(strlen($zipcode) = 5) $zipcode = sprintf(%05d,$zipcode); Else { $zipcode = sprintf(%09d,$zipcode); $zipcode = substr($zipcode,0,5).-.substr(zipcode,5); } This isn't real elegant, but it should do the trick. You may notice that the 10 character zip code is not 10 digits but rather 5 plus 4, or 9 digits. Warren Vail -Original Message- From: Keith Spiller [mailto:[EMAIL PROTECTED] Sent: Thursday, August 21, 2008 7:44 PM To: php-general@lists.php.net Subject: [PHP] Restore Leading Zeros in Zip Codes Hi, RE: Restore Leading Zeros in Zip Codes Does anyone happen to have a script that will restore the leading zeros in a mixed data set of 5 digit zip codes and 10 digit zip+4 codes? Any suggestions? Thanks, Keith -- 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] Restore Leading Zeros in Zip Codes
I never considered the dash a digit, but then I forgot a dollar sign on one of the variable names, but you can probably figure that out. Warren Vail -Original Message- From: Warren Vail [mailto:[EMAIL PROTECTED] Sent: Thursday, August 21, 2008 8:17 PM To: 'Warren Vail'; 'Keith Spiller'; php-general@lists.php.net Subject: RE: [PHP] Restore Leading Zeros in Zip Codes Dave brought up something I forgot, what if the - is already in the sip code; Modify the code as follows; If(strlen($zipcode) = 5) $zipcode = sprintf(%05d,$zipcode); Else { $zipcode = sprintf(%09d,str_replace(-,,$zipcode)); $zipcode = substr($zipcode,0,5).-.substr(zipcode,5); } -Original Message- From: Warren Vail [mailto:[EMAIL PROTECTED] Sent: Thursday, August 21, 2008 8:08 PM To: 'Keith Spiller'; php-general@lists.php.net Subject: RE: [PHP] Restore Leading Zeros in Zip Codes I'd try something like; If(strlen($zipcode) = 5) $zipcode = sprintf(%05d,$zipcode); Else { $zipcode = sprintf(%09d,$zipcode); $zipcode = substr($zipcode,0,5).-.substr(zipcode,5); } This isn't real elegant, but it should do the trick. You may notice that the 10 character zip code is not 10 digits but rather 5 plus 4, or 9 digits. Warren Vail -Original Message- From: Keith Spiller [mailto:[EMAIL PROTECTED] Sent: Thursday, August 21, 2008 7:44 PM To: php-general@lists.php.net Subject: [PHP] Restore Leading Zeros in Zip Codes Hi, RE: Restore Leading Zeros in Zip Codes Does anyone happen to have a script that will restore the leading zeros in a mixed data set of 5 digit zip codes and 10 digit zip+4 codes? Any suggestions? Thanks, Keith -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php