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] 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 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 --- Begin Message --- 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: click here ... 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: click here ... 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] lang]['_key_']?> Fixed
Sorry to bothering list. I damn bug generated by mysef and ignited by sort order... 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 --- Begin Message --- 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] 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 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 --- Begin Message --- 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. ---> 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('http://X/";> 23/10/2008 29/10/2008 DOWNTOWN BURJ DUBAI 2 AED ','',array(),'document', 'literal'); /* Send the SOAP message and specify the soapaction */ $response = $client->send($mysoapmsg, $soapaction); if ($client->fault) { echo 'Fault'; print_r($response); echo ''; } echo "SOAP query"; echo '' . htmlspecialchars($client->request, ENT_QUOTES) . ''; echo "SOAP response"; echo '' . htmlspecialchars($client->response, ENT_QUOTES) . ''; // 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 "Record found: ".$result["NumRecs"]; // extract the collection of record (object collRecord) $collrecord = $result["collRecord"]; foreach ($collrecord["CRecord"] as $record){ echo "Property: ".$record["Property"]; echo "Place: ".$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 --- Begin Message --- 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 --- Begin Message --- 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 --- Begin Message --- 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=12192374021&r=1&w=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 --- Begin Message --- 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
Re: Fwd: [PHP] php not reading file properly
So I made a cron jop to copy the log to the web folder every 5 minutes. That worked fine. It seems that php can't read the /var/log/httpd folder without root perms. On Wed, Aug 20, 2008 at 7:53 PM, Ashley Sheridan <[EMAIL PROTECTED]>wrote: > Yeah, Apache is still running, but it is the access log you are trying > to read, at the same time that you are Apache is being accessed. > Accessing the log from the terminal will be fine while Apache is > running, as it is unlikely it is being accessed at the very same > instant. Are you able to access other files? Also, have you tried > copying the file to another temporary version from within PHP an > accessing that? If that doesn't work, try executing a Bash script that > copies it someplace. Make sure to run the script in the background, and > maybe add a sleep period to it so that it doesn't interfere with Apache > accessing things. > > Ash > www.ashleysheridan.co.uk > > > -- Forwarded message -- > From: "sean greenslade" <[EMAIL PROTECTED]> > To: "Micah Gersten" <[EMAIL PROTECTED]> > Date: Wed, 20 Aug 2008 19:41:54 -0400 > Subject: Re: Fwd: [PHP] php not reading file properly > Ashley Sheridan wrote: > > >As it's the Apache access log that you are trying to read in, are you sure > that Apache is >not in the process of writing to it as you are > attempting to read from it? That might explain >why it seems to be empty, > although I would have thought it would just append the data to >the end of > the file, rather than rewriting the whole thing. > > I dunno. Like I said, I can read it thru the terminal. Apache is still > running then. > > As for Micah's response, that function won't work either. > > On Wed, Aug 20, 2008 at 7:34 PM, Micah Gersten <[EMAIL PROTECTED]> wrote: > > > If the directory above it doesn't have execute privileges, it won't be > > able to read it either. > > Also, why not use the PHP5 function file_get_contents()? > > > > Thank you, > > Micah Gersten > > onShore Networks > > Internal Developer > > http://www.onshore.com > > > > > > > > sean greenslade wrote: > > > Thanks for the advice. I changed the perms to 777 and changed the user > > and > > > group to apache, but it still won't open. > > > > > > > > > On Wed, Aug 20, 2008 at 3:35 PM, Robbert van Andel < > > [EMAIL PROTECTED]>wrote: > > > > > > > > >> Does the user your PHP instance runs as have access to the file? It's > > >> possible that it runs under a different users depending on if you're > > running > > >> the script on the terminal or in a web browser. The function fopen > will > > >> return false if the file fails to open. Find out if $fh is equal to > > false. > > >> While you're debugging, you might consider changing the display errors > > >> setting to see what warning fopen generates if the file fails to open. > > From > > >> http://us.php.net/fopen > > >> Errors/Exceptions > > >> > > >> If the open fails, the function an error of level *E_WARNING* is > > >> generated. You may use @< > > http://us.php.net/manual/en/language.operators.errorcontrol.php>to > > suppress this warning. > > >> > > >> > > >> On Wed, Aug 20, 2008 at 12:15 PM, sean greenslade < > > [EMAIL PROTECTED]>wrote: > > >> > > >> > > >>> I have this snippet of code that is supposed to read the apache > access > > log > > >>> and display it: > > >>> > >>>$myFile = "/var/log/httpd/access_log"; > > >>>$fh = fopen($myFile, 'r'); > > >>>$theData = fread($fh, filesize($myFile)); > > >>>fclose($fh); > > >>>echo > > >>>"This weeks apache log (clears every sunday morning):". > > >>>substr($theData,0,2000); > > >>> ?> > > >>> For some reason, it displays the logs when I run the php file thru > > >>> terminal: > > >>> php -f /web/apache.php > > >>> > > >>> but not when I access it thru the web. when I browse to it, it just > > >>> displays > > >>> the static text ("This weeks apache log (clears every sunday > > morning):"), > > >>> not the log text. > > >>> > > >>> Very confused, > > >>> zootboy > > >>> > > >>> > > >> > > > > > > > > > > > > > > > -- > Feh. > > -- Feh.