[PHP] wget --spider and ignore_user_abort(TRUE)
Hi there, I am trying to get a script to run in background no matter what, but I am obviously doing it wrong. Here is the entire code: The file /tmp/aborting get touched if I abort the connection in a browser, or if I run "wget blabla/script.php" and kill wget... in fact it works perfectly in any way, but it doesn't work when I use the "--spider" option of wget. That option does a HEAD request and as soon as it receives the HTTP code 200 closes the connection. The script is then aborted and the file /tmp/aborting never get touched. I initially thought that ignore_user_abort() never get to be parsed because the connection is closed before and I set it in the php.ini file, but that didn't work. I then realized that PHP has to get at least to the ob_flush() call, that's proved by putting a sleep(10) just before the ob_start() call: wget --spider waits 10 seconds before exiting. Why is ignore_user_abort(TRUE) ignored, what am I missing? I probably shouldn't say that while asking for help, but... is this a bug? I am using PHP 5.2.6-pl7-gentoo via Apache 2.2.9-r1 (Gentoo) with "worker" MPM. Thank you for your help, tillo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] wget --spider and ignore_user_abort(TRUE)
> I need the PHP script to keep running until the end) Until the end of what? Time? If you want your HTTP request to finish and a script to continue regardless then use the method I suggested, an start a shell process going. -- Richard Heyes HTML5 Graphing for FF, Chrome, Opera and Safari: http://www.rgraph.org (Updated November 1st) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] wget --spider and ignore_user_abort(TRUE)
> - if I use wget --spider (HEAD request) the script exits just after the > first output, all the functions below never get executed > > This has nothing to do with any system command. Then have your HTTP request trigger a system command that runs on regardless. The HTTP request continues on after triggering the system command, not giving a "tiny rats ass" what it does. You can use the exec() code I gave you to do this (ie using an ampersand and redirecting the output streams). -- Richard Heyes HTML5 Graphing for FF, Chrome, Opera and Safari: http://www.rgraph.org (Updated November 1st) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] wget --spider and ignore_user_abort(TRUE)
On Tue, 04 Nov 2008 13:24:41 +0100, Jochem Maas wrote: > try testing for the request type (i.e. HEAD) and if found don't output > anything at all. This is a nice workaround and works perfectly, thanks! > seems like apache (not the user) is shutting down the request as soon as > it recieves the first byte of the request body. I thought so, I just hoped there was some way to make PHP (or Apache) continue the work in any case. The no-output way works for me, thank you. tillo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] removing text from a string
I have a file that looks like: 1. Some Text here 2. Another Line of Text 3. Yet another line of text 340. All the way to number 340 And I want to remove the Number, period, and blank space at the begining of each line. How can I accomplish this? Opening the file to modify it is easy, I'm just lost at how to remove the text.: //print the modified line and \n } fclose($fp); } ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] COM and com_safearray_proxy objects
Hi all, I'm trying to get my head around COM and interfaces and I'm making slow progress but have hit a problem. I have an IProduct interface and using com_print_typeinfo($iproduct) I can see it has the following property (amongst others): /* DISPID=1745027081 */ var $Description; /* DISPID=1745027081 */ /* VT_BSTR [8] */ var $Description; If I do var_dump($iproduct->Description) I get the following output: object(com_safearray_proxy)#7 (0) {} Now I have no idea what a com_safearray_proxy object is at all, and googling it hardly produces any results so I can't imagine it's very common. Any ideas how I am to access that property in my code? Thanks all, Alex -- Alex Bovey Web Developer | Alex Bovey Consultancy Ltd Registered in England & Wales no. 6471391 | VAT no. 934 8959 65 PHP | MySQL | AJAX | XHTML | CSS | Javascript | XML | W3C Accessibility -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] removing text from a string
= 0)) $thedata = trim(mb_substr($thedata, $position_of_dot, mb_strlen($thedata, $encoding), $encoding)); } //print the modified line and \n } } @fclose($fp); ?> [mb_strpos] http://in.php.net/manual/en/function.mb-strpos.php [mb_substr] http://in.php.net/manual/en/function.mb-substr.php //A yeti -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Grouping records
> I have transactional records with the following structure Records of what kind? Is it SQL? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] removing text from a string
> -Original Message- > From: Adam Williams [mailto:[EMAIL PROTECTED] > Sent: Tuesday, November 04, 2008 8:04 AM > To: PHP General list > Subject: [PHP] removing text from a string > > I have a file that looks like: > > 1. Some Text here > 2. Another Line of Text > 3. Yet another line of text > 340. All the way to number 340 > > And I want to remove the Number, period, and blank space at the > begining > of each line. How can I accomplish this? > > Opening the file to modify it is easy, I'm just lost at how to remove > the text.: > > $filename = "results.txt"; > > $fp = fopen($filename, "r") or die ("Couldn't open $filename"); > if ($fp) > { > while (!feof($fp)) > { > $thedata = fgets($fp); > //Do something to remove the "1. " > //print the modified line and \n > } > fclose($fp); > } > ?> http://www.regular-expressions.info Hints: * "^" is the beginning-of-line marker in RegEx. (Usually.) * "\d+" is compound: - "\d" is the "digit" marker. (0-9) - "+" after it means "one or more". * "\." is just a period, but needs to be "escaped" in RegEx because it has special meaning. * "\s" is whitespace. * "/" surrounding the pattern are just delimiters. They are not part of the pattern itself. HTH, Todd Boyd Web Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Recursive Directory Listing
> Joe, > > Here is a simplified recursive version of your above statement. > > $dir = '.'; > function displayDir($dir='.') { >$show = FALSE; >$results = glob($dir.'/*'); >foreach ( $results AS $entry ) { >if ( is_dir($entry) && !in_array($entry, array('.', '..')) ) { >$dirs[] = $entry; >$show = TRUE; >} >} >if ( $show ) { >echo ''; >foreach ( $dirs AS $entry ) { >echo '', basename($entry); >displayDir($entry); >echo ''; >} >echo ''; >} > } > displayDir($dir); > ?> > Hope this helps > -- > Jim Lucas Excellent, Jim. Thanks very much for your help. At the risk of straying too far from the original subject/call-for-help, is there a way to flag the *first* time the function runs through a creation? Though my design doesn't call for it now, I could see the value of styling the first level separately than the sub-directories. Again, thanks very much! --joe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: removing text from a string
Adam Williams a écrit : I have a file that looks like: 1. Some Text here 2. Another Line of Text 3. Yet another line of text 340. All the way to number 340 And I want to remove the Number, period, and blank space at the begining of each line. How can I accomplish this? Opening the file to modify it is easy, I'm just lost at how to remove the text.: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: removing text from a string
> ... I was thinking more like this: ltrim($line, '0123456789 .'); -- Richard Heyes HTML5 Graphing for FF, Chrome, Opera and Safari: http://www.rgraph.org (Updated November 1st) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: removing text from a string
> ltrim($line, '0123456789 .'); I am feeling a bit boneheaded now. How easy things can be. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Recursive Directory Listing
Joe Schaeffer wrote: >> Joe, >> >> Here is a simplified recursive version of your above statement. >> >> > $dir = '.'; >> function displayDir($dir='.') { >>$show = FALSE; >>$results = glob($dir.'/*'); >>foreach ( $results AS $entry ) { >>if ( is_dir($entry) && !in_array($entry, array('.', '..')) ) { >>$dirs[] = $entry; >>$show = TRUE; >>} >>} >>if ( $show ) { >>echo ''; >>foreach ( $dirs AS $entry ) { >>echo '', basename($entry); >>displayDir($entry); >>echo ''; >>} >>echo ''; >>} >> } >> displayDir($dir); >> ?> >> Hope this helps >> -- >> Jim Lucas > > Excellent, Jim. Thanks very much for your help. > > At the risk of straying too far from the original > subject/call-for-help, is there a way to flag the *first* time the > function runs through a creation? Though my design doesn't call > for it now, I could see the value of styling the first level > separately than the sub-directories. > > Again, thanks very much! > --joe > I would say to do that with CSS, not building it into the output. #navigation ul { Top level UL } #navigation ul li { Top level List Items } #navigation ul ul { second/third/etc... ul inside the Top UL } #navigation ul ul li { second/third/etc.. List Items } '; displayDir('.'); echo ''; ?> -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] removing text from a string
Thanks Boyd, your code did exactly what I wanted! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Recursive Directory Listing
> -Original Message- > From: Joe Schaeffer [mailto:[EMAIL PROTECTED] > Sent: Tuesday, November 04, 2008 8:56 AM > To: Jim Lucas > Cc: php-general@lists.php.net > Subject: Re: [PHP] Recursive Directory Listing > > > > $dir = '.'; > > function displayDir($dir='.') { > >$show = FALSE; > >$results = glob($dir.'/*'); > >foreach ( $results AS $entry ) { > >if ( is_dir($entry) && !in_array($entry, array('.', > '..')) ) { > >$dirs[] = $entry; > >$show = TRUE; > >} > >} > >if ( $show ) { > >echo ''; > >foreach ( $dirs AS $entry ) { > >echo '', basename($entry); > >displayDir($entry); > >echo ''; > >} > >echo ''; > >} > > } > > displayDir($dir); > > ?> > > Excellent, Jim. Thanks very much for your help. > > At the risk of straying too far from the original > subject/call-for-help, is there a way to flag the *first* time the > function runs through a creation? Though my design doesn't call > for it now, I could see the value of styling the first level > separately than the sub-directories. Just use a Boolean flag. Set $firstUL to true before your loop starts, then false after your loop's first iteration (and every subsequent iteration). Only perform your "special" UL formatting when it's true. HTH, Todd Boyd Web Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reaching network share with libssh2 functions
If it's a permissions issue, it's related to Windows. Is it a user share or a system share? Can you access the shares when you log directly into the windows box? Have you tried command line ssh to see if it's specifically related to the PHP library? Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Jacob Overgaard wrote: > Hi all > I have a php script which connects to a copssh server installed on a > Windows 2000 SP4 machine. However, the trouble is that I can not see > the contents of the shared network folders when connecting through > ssh2_exec. If I use putty instead, there is no problem seeing these > folders. I guess that it is something to do with lack of permission, > but I am not sure how to solve this problem, so I hoped for some > assistance from this forum as it seems to be related to the use of > libssh2 functions. > Best wishes > Jacob > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] removing text from a string
> Thanks Boyd, your code did exactly what I wanted! Y'know you could do this with ltrim()... :-) -- Richard Heyes HTML5 Graphing for FF, Chrome, Opera and Safari: http://www.rgraph.org (Updated November 1st) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Time zones and $_ENV vs getenv
On Mon, 3 Nov 2008 13:01:14 -0200 [EMAIL PROTECTED] (John Coppens) wrote: > I'm confused... Can someone point me to some more tests I could do? Solved. Apparently the apachectl start/stop/restart script didn't work correctly, or wasn't able to do its work. I _thought_ I had restart apache after each modification, but it just continued running. John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] COM and VARIANT types
> I think this may be what you are looking for, but I don't know how > much it helps: > > http://www.marin.clara.net/COM/variant_type_definitions.htm > > Andrew Thanks Andrew - it's a start! Alex -- Alex Bovey Web Developer | Alex Bovey Consultancy Ltd Registered in England & Wales no. 6471391 | VAT no. 934 8959 65 PHP | MySQL | AJAX | XHTML | CSS | Javascript | XML | W3C Accessibility -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Reaching network share with libssh2 functions
Hi all I have a php script which connects to a copssh server installed on a Windows 2000 SP4 machine. However, the trouble is that I can not see the contents of the shared network folders when connecting through ssh2_exec. If I use putty instead, there is no problem seeing these folders. I guess that it is something to do with lack of permission, but I am not sure how to solve this problem, so I hoped for some assistance from this forum as it seems to be related to the use of libssh2 functions. Best wishes Jacob -- Jacob Overgaard, Ph.D Staff crystallographer Department of Chemistry University of Aarhus Langelandsgade 140 DK-8000 Aarhus C Email: [EMAIL PROTECTED] Tel: +45 8942 3891 This message was sent using IMP, the Internet Messaging Program. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Yahoo/Gmail/Hotmail Contacts API
Hi Everyone, Thanks for all the recommendation. Will explore them all. Regards, Feris On Sun, Nov 2, 2008 at 7:52 PM, Eric Butera <[EMAIL PROTECTED]> wrote: > On Sun, Nov 2, 2008 at 5:03 AM, Richard Heyes <[EMAIL PROTECTED]> wrote: > >> Open id's really a toy at this point. > > > > Now that MS and Google have signed up it will soon get a lot bigger. > > > > http://news.bbc.co.uk/1/hi/technology/7699320.stm > > > > -- > > Richard Heyes > > > > HTML5 Graphing for FF, Chrome, Opera and Safari: > > http://www.rgraph.org (Updated October 25th) > > > > When we see the ability to log into said services with openid, you'll > have an argument. AOL has been a provider for years, nothing has > changed. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
Re: [PHP] wget --spider and ignore_user_abort(TRUE)
On Tue, 04 Nov 2008 11:59:20 +, Richard Heyes wrote: >> I need the PHP script to keep running until the end) > > Until the end of what? Time? Until the end of the script. > If you want your HTTP request to finish and > a script to continue regardless then use the method I suggested, an > start a shell process going. I insist :) sorry. You didn't understand what I am doing, probably because of my ESL... - I have a PHP script - this PHP script has X sequential functions - every function must be executed - if I open the page (GET request), all is fine - if I open the page then stop the client connection while the script is still running, all is fine (client sends an RST, ignore_user_abort kicks in, script goes through all of its X functions then exits at the end of the script) - if I use wget --spider (HEAD request) the script exits just after the first output, all the functions below never get executed This has nothing to do with any system command. Is it clear now? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending mail with Outlook high priority
> Is there any PHP functionality for sending mail and attaching a high > priority to the mail item ? My htmlMimeMail code will do this for and, make it much easier too. -- Richard Heyes HTML5 Graphing for FF, Chrome, Opera and Safari: http://www.rgraph.org (Updated November 1st) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] basic php question...
hi guys... i've got a button that i want to select, and i want the app to process some logic, and then return the user to the page. my question is how?? something like base page: button link" foo.php -process logic -return the user to the base page, with the same querystring that was initially used to generate the initial base page foo.php doesn't have any display function, just the logic thoughts/sample php pages/psuedo code chunks... thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] basic php question...
Is anything changing on the page? If not, AJAX might be the way to go, http://xajaxproject.org Otherwise, pass the parameters you want to foo.php and have it redirect to the proper page with the proper arguments. Another alternative, is to store the parameters in the session and pass them from foo.php without passing them to it. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com bruce wrote: > hi guys...foo > > i've got a button that i want to select, and i want the app to process some > logic, and then return the user to the page. my question is how?? > > something like > > base page: > > button link" > > foo.php > -process logic > -return the user to the base page, with the same querystring that > was initially used to generate the initial base page > > > foo.php doesn't have any display function, just the logic > > thoughts/sample php pages/psuedo code chunks... > > thanks > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] removing text from a string
On Tue, 2008-11-04 at 08:04 -0600, Adam Williams wrote: > I have a file that looks like: > > 1. Some Text here > 2. Another Line of Text > 3. Yet another line of text > 340. All the way to number 340 > > And I want to remove the Number, period, and blank space at the begining > of each line. How can I accomplish this? > > Opening the file to modify it is easy, I'm just lost at how to remove > the text.: > > $filename = "results.txt"; > > $fp = fopen($filename, "r") or die ("Couldn't open $filename"); > if ($fp) > { > while (!feof($fp)) > { > $thedata = fgets($fp); > //Do something to remove the "1. " > //print the modified line and \n > } > fclose($fp); > } > ?> > I'd go with a regular expression any day for something like this. Something like: "/$[0-9]{1,3}\.\ .*^/g" should do what you need. Note the space before the last period. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] basic php question...
and what's the best way to do the redirect sample code would be cool! -Original Message- From: Micah Gersten [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 04, 2008 11:33 AM To: bruce Cc: php-general@lists.php.net Subject: Re: [PHP] basic php question... Is anything changing on the page? If not, AJAX might be the way to go, http://xajaxproject.org Otherwise, pass the parameters you want to foo.php and have it redirect to the proper page with the proper arguments. Another alternative, is to store the parameters in the session and pass them from foo.php without passing them to it. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com bruce wrote: > hi guys...foo > > i've got a button that i want to select, and i want the app to process some > logic, and then return the user to the page. my question is how?? > > something like > > base page: > > button link" > > foo.php > -process logic > -return the user to the base page, with the same querystring that > was initially used to generate the initial base page > > > foo.php doesn't have any display function, just the logic > > thoughts/sample php pages/psuedo code chunks... > > thanks > > > -- 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] Recursive Directory Listing
On Tue, 2008-11-04 at 09:56 -0500, Joe Schaeffer wrote: > > Joe, > > > > Here is a simplified recursive version of your above statement. > > > > > $dir = '.'; > > function displayDir($dir='.') { > >$show = FALSE; > >$results = glob($dir.'/*'); > >foreach ( $results AS $entry ) { > >if ( is_dir($entry) && !in_array($entry, array('.', '..')) ) > > { > >$dirs[] = $entry; > >$show = TRUE; > >} > >} > >if ( $show ) { > >echo ''; > >foreach ( $dirs AS $entry ) { > >echo '', basename($entry); > >displayDir($entry); > >echo ''; > >} > >echo ''; > >} > > } > > displayDir($dir); > > ?> > > Hope this helps > > -- > > Jim Lucas > > Excellent, Jim. Thanks very much for your help. > > At the risk of straying too far from the original > subject/call-for-help, is there a way to flag the *first* time the > function runs through a creation? Though my design doesn't call > for it now, I could see the value of styling the first level > separately than the sub-directories. > > Again, thanks very much! > --joe > There's a very easy way to solve this styling issue. Give each tag a class, so all the lists have the same class. In your css file, set a style for the top list with: ul.class {style here} and then override lists within lists with: ul.class ul.class {style here} Basically this is applying overriding styles to lists of that class that occur within lists of that same class. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] wget --spider and ignore_user_abort(TRUE)
On Tue, 04 Nov 2008 10:03:11 +, Richard Heyes wrote: >> I am trying to get a script to run in background no matter what, but I >> am obviously doing it wrong. > > 1. Have it executed via a shell command. 2. Redirect all output. > 3. Append the ampersand. This is not what I need, but thanks. The code snippet I wrote is just an example of the PHP connection handling going wrong (or not as I want to). The real script doesn't sleep and does much more then executing a system command. The question here is: why a PHP script called via 'wget --spider' through Apache/2 gets killed as soon as the HTTP reply code is sent, even if ignore_user_abort() is set? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Recursive Directory Listing
On Tue, 2008-11-04 at 07:51 -0800, Jim Lucas wrote: > Joe Schaeffer wrote: > >> Joe, > >> > >> Here is a simplified recursive version of your above statement. > >> > >> >> $dir = '.'; > >> function displayDir($dir='.') { > >>$show = FALSE; > >>$results = glob($dir.'/*'); > >>foreach ( $results AS $entry ) { > >>if ( is_dir($entry) && !in_array($entry, array('.', '..')) > >> ) { > >>$dirs[] = $entry; > >>$show = TRUE; > >>} > >>} > >>if ( $show ) { > >>echo ''; > >>foreach ( $dirs AS $entry ) { > >>echo '', basename($entry); > >>displayDir($entry); > >>echo ''; > >>} > >>echo ''; > >>} > >> } > >> displayDir($dir); > >> ?> > >> Hope this helps > >> -- > >> Jim Lucas > > > > Excellent, Jim. Thanks very much for your help. > > > > At the risk of straying too far from the original > > subject/call-for-help, is there a way to flag the *first* time the > > function runs through a creation? Though my design doesn't call > > for it now, I could see the value of styling the first level > > separately than the sub-directories. > > > > Again, thanks very much! > > --joe > > > > I would say to do that with CSS, not building it into the output. > > > #navigation ul { > Top level UL > } > #navigation ul li { > Top level List Items > } > #navigation ul ul { > second/third/etc... ul inside the Top UL > } > #navigation ul ul li { > second/third/etc.. List Items > } > > > > echo ''; > displayDir('.'); > echo ''; > > ?> > -- > Jim Lucas > >"Some men are born to greatness, some achieve greatness, >and some have greatness thrust upon them." > > Twelfth Night, Act II, Scene V > by William Shakespeare > > This will teach me to read ahead to the end of the thread, I've already been beaten to the answer! Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Recursive Directory Listing
Joe Schaeffer wrote: Joe, Here is a simplified recursive version of your above statement. '; foreach ( $dirs AS $entry ) { echo '', basename($entry); displayDir($entry); echo ''; } echo ''; } } displayDir($dir); ?> Hope this helps -- Jim Lucas Excellent, Jim. Thanks very much for your help. At the risk of straying too far from the original subject/call-for-help, is there a way to flag the *first* time the function runs through a creation? Though my design doesn't call for it now, I could see the value of styling the first level separately than the sub-directories. Hi, This one makes use of the SPL and can handle a filter. Maybe not the cleanest way, but good enough for me. function DirectoryIterator($path, $filter = FALSE) { $files = new RecursiveDirectoryIterator($path); foreach($files as $file) { if ($filter !== FALSE) { if (array_search($file->getFileName(), $filter) !== FALSE) { continue; } } if ($file->isDir()) { $name = $file->__toString(); echo str_replace(chr(92), chr(92).chr(92), $name).chr(92).chr(92)."\n"; DirectoryIterator($name, $filter); } } } $path = 'C:\\projects\\sites\\www.example.com\\'; DirectoryIterator($path, array('.svn'));
RE: [PHP] basic php question...
> -Original Message- > From: Micah Gersten [mailto:[EMAIL PROTECTED] > Sent: Tuesday, November 04, 2008 1:33 PM > To: bruce > Cc: php-general@lists.php.net > Subject: Re: [PHP] basic php question... > > Is anything changing on the page? If not, AJAX might be the way to go, > http://xajaxproject.org > Otherwise, pass the parameters you want to foo.php and have it redirect > to the proper page with the proper arguments. > Another alternative, is to store the parameters in the session and pass > them from foo.php without passing them to it. > > bruce wrote: > > hi guys...foo > > > > i've got a button that i want to select, and i want the app to > process some > > logic, and then return the user to the page. my question is how?? > > > > something like > > > > base page: > > > > button link" > > > > foo.php > > -process logic > > -return the user to the base page, with the same querystring that > > was initially used to generate the initial base page > > > > > > foo.php doesn't have any display function, just the logic If you're going to go with AJAX (involving Javascript), you may as well just use Javascript: history.go(-1); HTH, Todd Boyd Web Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] basic php question...
There can be no output before this (even whitespace before open php tags) Kaleb <>< On Nov 4, 2008, at 1:41 PM, bruce wrote: and what's the best way to do the redirect sample code would be cool! -Original Message- From: Micah Gersten [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 04, 2008 11:33 AM To: bruce Cc: php-general@lists.php.net Subject: Re: [PHP] basic php question... Is anything changing on the page? If not, AJAX might be the way to go, http://xajaxproject.org Otherwise, pass the parameters you want to foo.php and have it redirect to the proper page with the proper arguments. Another alternative, is to store the parameters in the session and pass them from foo.php without passing them to it. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com bruce wrote: hi guys...foo i've got a button that i want to select, and i want the app to process some logic, and then return the user to the page. my question is how?? something like base page: button link" foo.php -process logic -return the user to the base page, with the same querystring that was initially used to generate the initial base page foo.php doesn't have any display function, just the logic thoughts/sample php pages/psuedo code chunks... thanks -- 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] basic php question...
On Tue, 2008-11-04 at 11:27 -0800, bruce wrote: > hi guys... > > i've got a button that i want to select, and i want the app to process some > logic, and then return the user to the page. my question is how?? > > something like > > base page: > > button link" > > foo.php > -process logic > -return the user to the base page, with the same querystring that > was initially used to generate the initial base page > > > foo.php doesn't have any display function, just the logic > > thoughts/sample php pages/psuedo code chunks... > > thanks > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php I think you need to read up a bit more on PHP to understand how it works, i.e. general process flow. PHP doesn't get attached to buttons, and if there's no output, you're best of using AJAX as previously suggested. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] basic php question...
2008/11/4 bruce <[EMAIL PROTECTED]>: > and what's the best way to do the redirect > Header redirects are my preferred method, because of the Back button on the browser. > sample code would be cool! > It is available at php.net/manual -- Dotan Cohen http://what-is-what.com http://gibberish.co.il א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת ä-ö-ü-ß-Ä-Ö-Ü
Re: [PHP] basic php question...
2008/11/4 Boyd, Todd M. <[EMAIL PROTECTED]>: > If you're going to go with AJAX (involving Javascript), you may as well > just use Javascript: > > # processing goes here > ?> > >history.go(-1); > > That will not work for users who browse without Javascript enabled, such as those who use the popular Firefox extension NoScript or who are browsing from a cellphone / PDA. -- Dotan Cohen http://what-is-what.com http://gibberish.co.il א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת ä-ö-ü-ß-Ä-Ö-Ü
Re: [PHP] basic php question...
> hi guys...foo > >> > >> i've got a button that i want to select, and i want the app to > >> process > > some > >> logic, and then return the user to the page. my question is how?? > >> > >> something like > >> > >> base page: > >> > >> button link" > >> > >> foo.php > >> -process logic > >> -return the user to the base page, with the same querystring that > >> was initially used to generate the initial base page > >> > >> > >> foo.php doesn't have any display function, just the logic > >> > >> thoughts/sample php pages/psuedo code chunks... Where's your code breaking? what have you written already that has failed to work right? Sounds like you aren't even using PHP... As for the redirects, there are a host of ways, even some which can have output on the page yet still redirect flawlessly using the META tags. Wolf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] removing text from a string
> -Original Message- > From: Ashley Sheridan [mailto:[EMAIL PROTECTED] > Sent: Tuesday, November 04, 2008 1:40 PM > To: Adam Williams > Cc: PHP General list > Subject: Re: [PHP] removing text from a string > > On Tue, 2008-11-04 at 08:04 -0600, Adam Williams wrote: > > I have a file that looks like: > > > > 1. Some Text here > > 2. Another Line of Text > > 3. Yet another line of text > > 340. All the way to number 340 > > > > And I want to remove the Number, period, and blank space at the > begining > > of each line. How can I accomplish this? > > > > Opening the file to modify it is easy, I'm just lost at how to remove > > the text.: > > > > > $filename = "results.txt"; > > > > $fp = fopen($filename, "r") or die ("Couldn't open $filename"); > > if ($fp) > > { > > while (!feof($fp)) > > { > > $thedata = fgets($fp); > > //Do something to remove the "1. " > > //print the modified line and \n > > } > > fclose($fp); > > } > > ?> > > > I'd go with a regular expression any day for something like this. > Something like: > > "/$[0-9]{1,3}\.\ .*^/g" > > should do what you need. Note the space before the last period. That would only work for files with 1-999 lines, and will wind up matching the entire line (since you used $ and ^ and a greedy .* inbetween... also... $ is "end-of-line" and ^ is "beginning-of-line" :)) rather than just the "line number" part. I would stick with my originally-posted regex ("/^\d+\.\s/"), but I would modify yours like this if I were to use it instead: "/^[0-9]+\.\ (.*)$/" (What was the "g" modifier for, anyway?) Then, you could grab the capture group made with (.*) and use it as the "clean" data. (It would be group 1 in the match results and "$1" in a preg_replace() call, I believe. Group 0 should be the entire match.) Todd Boyd Web Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] basic php question...
> -Original Message- > From: Dotan Cohen [mailto:[EMAIL PROTECTED] > Sent: Tuesday, November 04, 2008 1:49 PM > To: Boyd, Todd M. > Cc: php-general@lists.php.net > Subject: Re: [PHP] basic php question... > > 2008/11/4 Boyd, Todd M. <[EMAIL PROTECTED]>: > > If you're going to go with AJAX (involving Javascript), you may as > well > > just use Javascript: > > > > ># processing goes here > > ?> > > > >history.go(-1); > > > > > > That will not work for users who browse without Javascript enabled, > such as those who use the popular Firefox extension NoScript or who > are browsing from a cellphone / PDA. Repeat: > > If you're going to go with AJAX (involving Javascript), you may as > well > > just use Javascript: Todd Boyd Web Programmer
Re: [PHP] basic php question...
> users who browse without Javascript enabled, Heretics! -- Richard Heyes HTML5 Graphing for FF, Chrome, Opera and Safari: http://www.rgraph.org (Updated November 1st) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: removing text from a string
Replying to myself now. On Tue, Nov 4, 2008 at 7:40 AM, Yeti <[EMAIL PROTECTED]> wrote: >> ltrim($line, '0123456789 .'); > > I am feeling a bit boneheaded now. How easy things can be. > This would not work if the character string after the number started with a number too. EXAMPLE So if one still wanted the speedy string functions a simple trim() [1] or another ltrim() [2] would have to be added. EXAMPLE Still there is one flaw in this construct: If there was no white space between the '017.' and the '85 apples ..' we get the old mishap again. EXAMPLE To stick with the string functions one could either use the strpos($line, '.') + substr() [3] method or do it with explode(), implode() [4]: EXAMPLE So it seems that the regular expressions posted are not a bad choice after all. //A yeti [1] http://in.php.net/manual/en/function.trim.php [2] http://in.php.net/manual/en/function.ltrim.php [3] http://marc.info/?l=php-general&m=122580865009265&w=2 [4] http://in.php.net/manual/en/function.explode.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] basic php question...
> -Original Message- > From: Wolf [mailto:[EMAIL PROTECTED] > Sent: Tuesday, November 04, 2008 2:28 PM > To: Richard Heyes > Cc: Dotan Cohen; php-general@lists.php.net; Boyd, Todd M. > Subject: Re: [PHP] basic php question... > > Richard Heyes <[EMAIL PROTECTED]> wrote: > > > users who browse without Javascript enabled, > > > > Heretics! > > lynx works great! Boo! links2 or bust! (Unless lynx does frames properly now?) Todd Boyd Web Programmer
Re: [PHP] basic php question...
2008/11/4 Wolf <[EMAIL PROTECTED]>: > Also remember, all US based sites have to be in compliance with ADA as well, > otherwise you'll spend a lot of time re-writing your stuff if it doesn't work > for someone to use a disabilities enabled browser to surf your site. > Is there a compliance test? -- Dotan Cohen http://what-is-what.com http://gibberish.co.il א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת ä-ö-ü-ß-Ä-Ö-Ü
RE: [PHP] basic php question...
> -Original Message- > From: Wolf [mailto:[EMAIL PROTECTED] > Sent: Tuesday, November 04, 2008 2:30 PM > To: php-general@lists.php.net > Subject: Re: [PHP] basic php question... > > > Richard Heyes <[EMAIL PROTECTED]> wrote: > > > users who browse without Javascript enabled, > > > > Heretics! > > Also remember, all US based sites have to be in compliance with ADA as > well, otherwise you'll spend a lot of time re-writing your stuff if it > doesn't work for someone to use a disabilities enabled browser to surf > your site. All U.S.-based GOVERNMENT and GOVERNMENT-RELATED sites (i.e., funded, regulated, etc.) have to be in compliance. If I'm making a version of Simon Says using PHP at my own leisure and putting it up for my friends and others to play, or if I'm designing a website management system for a company in the audiovisual industry, those without Javascript/Flash/Whatever can sit and spin. :) Todd Boyd Web Programmer
RE: [PHP] basic php question...
> -Original Message- > From: Dotan Cohen [mailto:[EMAIL PROTECTED] > Sent: Tuesday, November 04, 2008 2:34 PM > To: Wolf > Cc: php-general@lists.php.net > Subject: Re: [PHP] basic php question... > > 2008/11/4 Wolf <[EMAIL PROTECTED]>: > > Also remember, all US based sites have to be in compliance with ADA > as well, otherwise you'll spend a lot of time re-writing your stuff if > it doesn't work for someone to use a disabilities enabled browser to > surf your site. > > > > Is there a compliance test? There's a link at the bottom of this page for an automated test: http://pamil-visions.com/W3C-compliance.php HTH, Todd Boyd Web Programmer
Re: [PHP] basic php question...
Boyd, Todd M. schreef: >> -Original Message- >> From: Wolf [mailto:[EMAIL PROTECTED] >> Sent: Tuesday, November 04, 2008 2:30 PM >> To: php-general@lists.php.net >> Subject: Re: [PHP] basic php question... >> >> >> Richard Heyes <[EMAIL PROTECTED]> wrote: users who browse without Javascript enabled, >>> Heretics! >> Also remember, all US based sites have to be in compliance with ADA as >> well, otherwise you'll spend a lot of time re-writing your stuff if it >> doesn't work for someone to use a disabilities enabled browser to surf >> your site. > > All U.S.-based GOVERNMENT and GOVERNMENT-RELATED sites (i.e., funded, > regulated, etc.) have to be in compliance. which is a nice way of saying that the government upholds a statuatory mandate to be able to say 'go f*** yourself' to everyone via HTTP >:-> > Todd Boyd > Web Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] basic php question...
2008/11/4 Boyd, Todd M. <[EMAIL PROTECTED]>: > All U.S.-based GOVERNMENT and GOVERNMENT-RELATED sites (i.e., funded, > regulated, etc.) have to be in compliance. If I'm making a version of Simon > Says using PHP at my own leisure and putting it up for my friends and others > to play, or if I'm designing a website management system for a company in the > audiovisual industry, those without Javascript/Flash/Whatever can sit and > spin. :) > Not quite. The retailer Target had a suit brought against them by some ADA watchdog group. They had to be in compliance too, which they weren't. Now, lots of $$$ later, they are. -- Dotan Cohen http://what-is-what.com http://gibberish.co.il א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת ä-ö-ü-ß-Ä-Ö-Ü
RE: [PHP] basic php question...
> -Original Message- > From: Dotan Cohen [mailto:[EMAIL PROTECTED] > Sent: Tuesday, November 04, 2008 2:45 PM > To: Boyd, Todd M. > Cc: PHP General list > Subject: Re: [PHP] basic php question... > > 2008/11/4 Boyd, Todd M. <[EMAIL PROTECTED]>: > > All U.S.-based GOVERNMENT and GOVERNMENT-RELATED sites (i.e., funded, > regulated, etc.) have to be in compliance. If I'm making a version of > Simon Says using PHP at my own leisure and putting it up for my friends > and others to play, or if I'm designing a website management system for > a company in the audiovisual industry, those without > Javascript/Flash/Whatever can sit and spin. :) > > > > Not quite. The retailer Target had a suit brought against them by some > ADA watchdog group. They had to be in compliance too, which they > weren't. Now, lots of $$$ later, they are. Again, read: > > All U.S.-based GOVERNMENT and GOVERNMENT-RELATED sites (i.e., funded, "Government-regulated" would be the key phrase there. Todd Boyd Web Programmer
Re: [PHP] basic php question...
2008/11/4 Boyd, Todd M. <[EMAIL PROTECTED]>: >> Is there a compliance test? > > There's a link at the bottom of this page for an automated test: > > http://pamil-visions.com/W3C-compliance.php > Thanks! -- Dotan Cohen http://what-is-what.com http://gibberish.co.il א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת ä-ö-ü-ß-Ä-Ö-Ü
RE: [PHP] basic php question...
hi Kaleb looks like the header approach will work for my needs.. thanks -Original Message- From: Kaleb Pomeroy [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 04, 2008 11:46 AM To: bruce Cc: 'Micah Gersten'; php-general@lists.php.net Subject: Re: [PHP] basic php question... There can be no output before this (even whitespace before open php tags) Kaleb <>< On Nov 4, 2008, at 1:41 PM, bruce wrote: > and what's the best way to do the redirect > > sample code would be cool! > > > -Original Message- > From: Micah Gersten [mailto:[EMAIL PROTECTED] > Sent: Tuesday, November 04, 2008 11:33 AM > To: bruce > Cc: php-general@lists.php.net > Subject: Re: [PHP] basic php question... > > > Is anything changing on the page? If not, AJAX might be the way to > go, > http://xajaxproject.org > Otherwise, pass the parameters you want to foo.php and have it > redirect > to the proper page with the proper arguments. > Another alternative, is to store the parameters in the session and > pass > them from foo.php without passing them to it. > > Thank you, > Micah Gersten > onShore Networks > Internal Developer > http://www.onshore.com > > > > bruce wrote: >> hi guys...foo >> >> i've got a button that i want to select, and i want the app to >> process > some >> logic, and then return the user to the page. my question is how?? >> >> something like >> >> base page: >> >> button link" >> >> foo.php >> -process logic >> -return the user to the base page, with the same querystring that >> was initially used to generate the initial base page >> >> >> foo.php doesn't have any display function, just the logic >> >> thoughts/sample php pages/psuedo code chunks... >> >> thanks >> >> >> > > -- > 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] basic php question...
Richard Heyes <[EMAIL PROTECTED]> wrote: > > users who browse without Javascript enabled, > > Heretics! lynx works great! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] wget --spider and ignore_user_abort(TRUE)
> The question here is: why a PHP script called via 'wget --spider' through > Apache/2 gets killed as soon as the HTTP reply code is sent, even if > ignore_user_abort() is set? A script ending naturally is not the same as a user aborting. -- Richard Heyes HTML5 Graphing for FF, Chrome, Opera and Safari: http://www.rgraph.org (Updated November 1st) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] basic php question...
Richard Heyes <[EMAIL PROTECTED]> wrote: > > users who browse without Javascript enabled, > > Heretics! Also remember, all US based sites have to be in compliance with ADA as well, otherwise you'll spend a lot of time re-writing your stuff if it doesn't work for someone to use a disabilities enabled browser to surf your site. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] wget --spider and ignore_user_abort(TRUE)
> I am trying to get a script to run in background no matter what, but I am > obviously doing it wrong. 1. Have it executed via a shell command. 2. Redirect all output. 3. Append the ampersand. eg. A commandx such as: sleep 5 >/dev/null 2>&1 & would become: /dev/null 2>&1 &'); ?> -- Richard Heyes HTML5 Graphing for FF, Chrome, Opera and Safari: http://www.rgraph.org (Updated November 1st) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] wget --spider and ignore_user_abort(TRUE)
On Tue, 04 Nov 2008 11:37:15 +, Richard Heyes wrote: >> The question here is: why a PHP script called via 'wget --spider' >> through Apache/2 gets killed as soon as the HTTP reply code is sent, >> even if ignore_user_abort() is set? > > A script ending naturally is not the same as a user aborting. I agree, but why is the script ending? Does PHP is set to stop running as soon as it knows the size of the reply, required by an HEAD request? How can I override this? (by "script" I mean the PHP script. Your previous post forks PHP and runs a system command without exiting it when the script exits ("nohup" should be used instead of the output redirection), I understood that but it is not what I need; I need the PHP script to keep running until the end) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] basic php question...
"Boyd wrote: > > -Original Message- > > From: Wolf [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, November 04, 2008 2:30 PM > > To: php-general@lists.php.net > > Subject: Re: [PHP] basic php question... > > > > > > Richard Heyes <[EMAIL PROTECTED]> wrote: > > > > users who browse without Javascript enabled, > > > > > > Heretics! > > > > Also remember, all US based sites have to be in compliance with ADA as > > well, otherwise you'll spend a lot of time re-writing your stuff if it > > doesn't work for someone to use a disabilities enabled browser to surf > > your site. > > All U.S.-based GOVERNMENT and GOVERNMENT-RELATED sites (i.e., funded, > regulated, etc.) have to be in compliance. If I'm making a version of Simon > Says using PHP at my own leisure and putting it up for my friends and others > to play, or if I'm designing a website management system for a company in the > audiovisual industry, those without Javascript/Flash/Whatever can sit and > spin. :) True, but how many people you want to send you email saying your site blew up their browser? I've had a number of sites that weren't Gov' funded or Gov' related that were still ADA because even private citizens can be said to be discriminating... Never know when someone will get upset and wanna sue. 1,000,000 lawyers in the laurential abyss... A good start! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mailing lists
On Tue, Nov 4, 2008 at 4:48 AM, Richard Heyes <[EMAIL PROTECTED]> wrote: > > Or ignorance. Even in the face of something that's blindingly obvious. :%s/Even/Especially -- http://www.parasane.net/ [EMAIL PROTECTED] || [EMAIL PROTECTED] Ask me about our current hosting/dedicated server deals! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: SV: [PHP] Problems with images..
On Mon, Nov 3, 2008 at 2:46 PM, Ashley Sheridan <[EMAIL PROTECTED]>wrote: > On Mon, 2008-11-03 at 15:56 +0100, Anders Norrbring wrote: > > > Anders Norrbring wrote: > > > > > > > I've been staring myself blind, so now I don't get anywhere, please > > > do > > > > advice.. > > > > > > > > I have a web page printed with PHP, in a table I need to display > > > > images that are stored in a SQL DB. > > > > Getting the images into variables isn't an issue at all, but how do I > > > > output it? > > > > This is what I want to accomplish: > > > > > > > > Current image: - THE IMAGE HERE - > > > > > > > > Starting to pull my hair.. > > > > Anders. > > > > > > > > > > > > fetchimg.php: > > > > > > header('Content-Type: image/jpeg'); > > > $img=; > > > print $img; > > > > > > True Per, but I would prefer one single file in this case.. > > > > Anders. > > > > > You can have the image script as part of the same PHP file, by checking > to see if it is being called for an image rather than a normal page, but > it just makes things more convoluted. Also, the base64 method will not > work in IE. I had a similar problem at work that could only be solved by > using a separate script to output the image. It can't be streamed inline > in a consistent manner. > > > Ash > www.ashleysheridan.co.uk > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > I too prefer to have the image called from a separate page. That way if the images are of differeing types (tiff/png/jpg/etc) I can locate all the handling code in the getimage.php file and its becomes the one place to handle this kind of stuff -- Bastien Cat, the other other white meat
RE: [PHP] removing text from a string
On Tue, 2008-11-04 at 13:53 -0600, Boyd, Todd M. wrote: > > -Original Message- > > From: Ashley Sheridan [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, November 04, 2008 1:40 PM > > To: Adam Williams > > Cc: PHP General list > > Subject: Re: [PHP] removing text from a string > > > > On Tue, 2008-11-04 at 08:04 -0600, Adam Williams wrote: > > > I have a file that looks like: > > > > > > 1. Some Text here > > > 2. Another Line of Text > > > 3. Yet another line of text > > > 340. All the way to number 340 > > > > > > And I want to remove the Number, period, and blank space at the > > begining > > > of each line. How can I accomplish this? > > > > > > Opening the file to modify it is easy, I'm just lost at how to > remove > > > the text.: > > > > > > > > $filename = "results.txt"; > > > > > > $fp = fopen($filename, "r") or die ("Couldn't open $filename"); > > > if ($fp) > > > { > > > while (!feof($fp)) > > > { > > > $thedata = fgets($fp); > > > //Do something to remove the "1. " > > > //print the modified line and \n > > > } > > > fclose($fp); > > > } > > > ?> > > > > > I'd go with a regular expression any day for something like this. > > Something like: > > > > "/$[0-9]{1,3}\.\ .*^/g" > > > > should do what you need. Note the space before the last period. > > That would only work for files with 1-999 lines, and will wind up > matching the entire line (since you used $ and ^ and a greedy .* > inbetween... also... $ is "end-of-line" and ^ is "beginning-of-line" :)) > rather than just the "line number" part. I would stick with my > originally-posted regex ("/^\d+\.\s/"), but I would modify yours like > this if I were to use it instead: > > "/^[0-9]+\.\ (.*)$/" (What was the "g" modifier for, anyway?) > > Then, you could grab the capture group made with (.*) and use it as the > "clean" data. (It would be group 1 in the match results and "$1" in a > preg_replace() call, I believe. Group 0 should be the entire match.) > > > Todd Boyd > Web Programmer > If you notice the original question, the list only goes up to 340, so that works fine, and he wants to match the whole line, not just part of it, as the g modifier makes it match multiple lines. Sorry that i got the start and end line matches the wrong way round, i always seem to do that! Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] basic php question...
On Tue, 2008-11-04 at 16:15 -0500, Wolf wrote: > "Boyd wrote: > > > -Original Message- > > > From: Wolf [mailto:[EMAIL PROTECTED] > > > Sent: Tuesday, November 04, 2008 2:30 PM > > > To: php-general@lists.php.net > > > Subject: Re: [PHP] basic php question... > > > > > > > > > Richard Heyes <[EMAIL PROTECTED]> wrote: > > > > > users who browse without Javascript enabled, > > > > > > > > Heretics! > > > > > > Also remember, all US based sites have to be in compliance with ADA as > > > well, otherwise you'll spend a lot of time re-writing your stuff if it > > > doesn't work for someone to use a disabilities enabled browser to surf > > > your site. > > > > All U.S.-based GOVERNMENT and GOVERNMENT-RELATED sites (i.e., funded, > > regulated, etc.) have to be in compliance. If I'm making a version of Simon > > Says using PHP at my own leisure and putting it up for my friends and > > others to play, or if I'm designing a website management system for a > > company in the audiovisual industry, those without > > Javascript/Flash/Whatever can sit and spin. :) > > True, but how many people you want to send you email saying your site blew up > their browser? I've had a number of sites that weren't Gov' funded or Gov' > related that were still ADA because even private citizens can be said to be > discriminating... Never know when someone will get upset and wanna sue. > > 1,000,000 lawyers in the laurential abyss... A good start! > It's a legal requirement in the UK now also. The Disability Discriminations Act see's to that. I also believe that Australia has a similar thing, and the EU is trying to bring something in as well. Testing sites in something like Lynx will show how it appears to some disability browsers (speech, Braille, etc) Also, there's a huge SEO factor to making your site accessible, so for a little bit of extra work, it can't hurt ;) Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] wget --spider and ignore_user_abort(TRUE)
Martino Dell'Ambrogio schreef: > On Tue, 04 Nov 2008 11:59:20 +, Richard Heyes wrote: > >>> I need the PHP script to keep running until the end) >> Until the end of what? Time? > Until the end of the script. > >> If you want your HTTP request to finish and >> a script to continue regardless then use the method I suggested, an >> start a shell process going. > > I insist :) sorry. You didn't understand what I am doing, probably > because of my ESL... > > - I have a PHP script > > - this PHP script has X sequential functions > > - every function must be executed > > - if I open the page (GET request), all is fine > > - if I open the page then stop the client connection while the script is > still running, all is fine (client sends an RST, ignore_user_abort kicks > in, script goes through all of its X functions then exits at the end of > the script) > > - if I use wget --spider (HEAD request) the script exits just after the > first output, all the functions below never get executed try testing for the request type (i.e. HEAD) and if found don't output anything at all. seems like apache (not the user) is shutting down the request as soon as it recieves the first byte of the request body. > > This has nothing to do with any system command. > > Is it clear now? > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Grouping records
Audit records from a financial application. flx_l_rgb.JPG Matthew Halpin Systems Administrator Felix Resources Limited Level 6, 316 Adelaide Street, Brisbane, Qld 4000 P: 07 3248 7903 F: 07 3211 7328 M: 0417 604 103 E: [EMAIL PROTECTED] -Original Message- From: Yeti [mailto:[EMAIL PROTECTED] Sent: Wednesday, 5 November 2008 12:28 AM To: Matthew Halpin; PHP Generals Mailing List Subject: Re: [PHP] Grouping records > I have transactional records with the following structure Records of what kind? Is it SQL? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mailing lists
>Which is why it's always best to remember one thing, especially in > programming: never underestimate the power of stupidity. Or ignorance. Even in the face of something that's blindingly obvious. -- Richard Heyes HTML5 Graphing for FF, Chrome, Opera and Safari: http://www.rgraph.org (Updated November 1st) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reaching network share with libssh2 functions
Have you turned on error logging? What code are you using? Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Jacob Overgaard wrote: > > Thanks, Micah > > I can access the share when I log directly in to the windows machine > with a bash shell. It seems isolated to the PHP library. > > Thanks, > Jacob > > Citat af Micah Gersten <[EMAIL PROTECTED]>: > >> If it's a permissions issue, it's related to Windows. Is it a user >> share or a system share? Can you access the shares when you log >> directly into the windows box? Have you tried command line ssh to see >> if it's specifically related to the PHP library? >> >> Thank you, >> Micah Gersten >> >> Jacob Overgaard wrote: >>> Hi all >>> I have a php script which connects to a copssh server installed on a >>> Windows 2000 SP4 machine. However, the trouble is that I can not see >>> the contents of the shared network folders when connecting through >>> ssh2_exec. If I use putty instead, there is no problem seeing these >>> folders. I guess that it is something to do with lack of permission, >>> but I am not sure how to solve this problem, so I hoped for some >>> assistance from this forum as it seems to be related to the use of >>> libssh2 functions. >>> Best wishes >>> Jacob >>> >> > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] What kind of handler used for a dba file?
I used dba-open (http://us2.php.net/manual/en/function.dba-open.php) to create a simple database file. The linux file command tells me that the file is just "data": # file test.db test.db: data I assume this is refered to a "Constant Database" or a DB2 file. I'm able to insert, fetch, and delete entries. However I'm trying to find out exactly what kind of file this is since the documentation doesn't tell me what "default" handler it used when creating the file. thanks, -eric -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What kind of handler used for a dba file?
On Tue, 2008-11-04 at 17:41 -0500, Eric Wood wrote: > I used dba-open (http://us2.php.net/manual/en/function.dba-open.php) to > create a simple database file. The linux file command tells me that the > file is just "data": > > # file test.db > test.db: data > > I assume this is refered to a "Constant Database" or a DB2 file. > > I'm able to insert, fetch, and delete entries. However I'm trying to > find out exactly what kind of file this is since the documentation > doesn't tell me what "default" handler it used when creating the file. > > thanks, > -eric > Have you tried opening the file on a Linux system to see what it thinks it is? Linux is good for this sort of thing, because it doesn't rely on just the file extension to identify files. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Электронная реклама 648-67-61 все адре са и базы Москвы и России
Отличное предложение. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Электронна я реклама 648-67-61 все адреса и базы Москвы и России
On Tue, 2008-11-04 at 18:05 +0200, feliks wrote: > Отличное предложение. > > wtf? Ash www.ashleysheridan.co.uk
Re: [PHP] Grouping records
Ok, this looks quite "databasey" so I guess you will have a query like: SELECT Rowid, Person, Timediff FROM transitional_records ORDER BY Timediff I don't know what DB you use. let's say it is MySQL (the others are similar). Always provide such things when asking for advice. Else it's not easy to help. EXAMPLE So what we get is an array like this .. array ( Person => (string), Timediff => (numeric) ); Rowid, Person and Timediff are the only Values we need to get each entries Groupid. Now back to our example .. EXAMPLE 60) { if (!isset($persons[$row['Person']])) $persons[$row['Person']] = 0; ++$persons[$row['Person']]; } if (isset($persons[$row['Person']])) $rowids[$row['Rowid']] = $persons[$row['Person']]; } var_dump($rowids); mysql_free_result($result); ?> So what is that script doing? Well, first of all we set 2 arrays $persons and $rowids; $persons is some sort of buffer for each person's current Groupid whilst processing the table entries. $rowids contains Groupid for each Row (set whilst processing) WHILE LOOP: First the current row's Groupid is set to the default value, which is zero ( $rowids[CURRENT_ID] = 0 ). Then we check whether the Timediff of the current row is greater than 60 or not. IF it is the person's current Groupid is incremented ( $persons[CURRENT_PERSON] += 1 ) After the IF statement the current rowid's Groupid is changed to $persons[CURRENT_PERSON] if that one exists. As result we should get an array $rowids with the Groupid for each array. So simply loop through that array and have the database SET the Groupid somehow like this .. EXAMPLE $group) { echo << I hope I could help a little Be more specific next time //A yeti -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Электронная реклама 648-67-61 все адреса и базы Москвы и России
Command unkown. Make sure you typed it right. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] building an admin tree with varying node types
Hi. I'm trying to build a new admin interface for my cms, in a single screen. I was thinking to have a tree-view on the left side of that screen, something like +Site-Name + UserGroups and Users (node-type section) + Administrators (node-type usergroup) - administrator (node-type user) + Editors (node-type usergroup) - Joe + Regular users - guest + Site main pages (node-type section) - frontpage (node-type article) - contactpage Then on the right side of the screen, i'd have pieces of HTML+JS ("weblets") provide a "form service" to display/edit properties of different node-types. Since i have to store access-rights for the different nodes, i have created a sql table that holds my tree, like: CREATE TABLE master_admin_tree ( /* tn == tree node */ tn_idinteger, tn_language_idinteger, tn_parent_idinteger, tn_pathlongtext, tn_level_orderinteger, tn_labelvarchar(250), tn_descriptionlongtext, tn_type_idinteger, tn_value_intinteger, tn_value_vcvarchar(250), tn_value_textlongtext, /* stores many values in JSON format */ tn_flags_intinteger, tn_flags_textlongtext, tn_owner_user_idinteger, tn_owner_group_idinteger, resource_rights_idinteger, PRIMARY KEY (tn_id, tn_language_id) ); The problem is that i'd rather not store all user-groups and users in this table. Users and groups are stored in their own tables, just 2 flat list tables without tree-structure. I wonder if it would get too complicated to load the users and groups from their own tables, format them to be tree-nodes in master_admin_tree, put them in the tree and work with them. I can't fully envision the problems that might arise with a dynamic loading approach like this, but i do know it would be a bitch to put a tree-node in master_admin_tree that loads up the desired groups-list (that's doable), but then to load the users in those groups as nodes under each group. Should i just go for redundant data in master_admin_tree and on creation of a user also put a tree record in master_admin_tree? Or is there a way to load,store and manage tree-nodes that represent records in other flat-list tables? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] basic php question...
Richard Heyes a écrit : users who browse without Javascript enabled, Heretics! No, paranoid :D -- Mickaël Wolff aka Lupus Michaelis http://lupusmic.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] basic php question...
Do disability browsers support JavaScript? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] basic php question...
On Wednesday 05 November 2008 1:20:34 am Yeti wrote: > Do disability browsers support JavaScript? This is not a PHP question, basic or otherwise. However, the answer to your question is "some do, some don't to varying degrees, just to keep life interesting". Search engines, however, do not. So you still need to make sure your site works sans-JS if you want Google to grok it. -- Larry Garfield [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php