php-general Digest 16 Jul 2008 07:23:32 -0000 Issue 5571
php-general Digest 16 Jul 2008 07:23:32 - Issue 5571 Topics (messages 276878 through 276901): Re: Advice on a radar chart 276878 by: Richard Heyes 276880 by: tedd 276881 by: Richard Heyes Re: Math Weirdness 276879 by: tedd is there a problem with php script pulling HTML out of database as it writes the page?? 276882 by: Rod Clay 276883 by: Stut 276884 by: Alex Chamberlain 276885 by: dg 276886 by: Rod Clay 276887 by: dg 276888 by: Rod Clay Re: Warning:Cannot modify header information - Error 276889 by: Daniel Brown Changing PHP.ini 276890 by: Adam Gerson 276891 by: bruce 276897 by: Thorsten Suckow-Homberg Re: is there a problem with php script pulling HTML out of database as it writes the page??] 276892 by: Rod Clay Lookimg for a script 276893 by: Pete Holsberg 276899 by: Daniel Brown Re: DB search and case sensitive comparison 276894 by: Chris test 276895 by: Børge Holen Re: is there a problem with php script pulling HTML out of database as it writes the page??]] 276896 by: Rod Clay Downloading a file 276898 by: Robbert van Andel Your Event T's 276900 by: Jeff Saxby How can i get the location of an exit()/die() from within register_shutdown_function()? 276901 by: Mathijs van Veluw Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- If you are willing to use googles chart api .. http://code.google.com/apis/chart/#radar Nope. It's not something I need to implement, mmore a personal (albeit with this lists help) project. -- Richard Heyes Employ me: http://www.phpguru.org/cv ---End Message--- ---BeginMessage--- At 8:26 PM +0100 7/15/08, Richard Heyes wrote: If you are willing to use googles chart api .. http://code.google.com/apis/chart/#radar Nope. It's not something I need to implement, mmore a personal (albeit with this lists help) project. -- Richard Heyes Richard: What do you want to implement as a radar chart? Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com ---End Message--- ---BeginMessage--- What do you want to implement as a radar chart? Nothing in particular. Just a generic radar chart for representing data. -- Richard Heyes Employ me: http://www.phpguru.org/cv ---End Message--- ---BeginMessage--- At 8:21 PM +0200 7/15/08, Jochem Maas wrote: Robert Cummings schreef: On Tue, 2008-07-15 at 12:37 -0400, tedd wrote: At 12:31 PM -0400 7/15/08, Robert Cummings wrote: Umm... here it is to unlimited precision: 14 Cheers, Rob. Yeah and here's Like or not, that's all there is to it. Weird... you're client bastar-dized my beautiful pi symbol. no it's the worst round error ever. how exactly do you go from 3.1 to .25 :-P Well, someone's client took infinity and turned it into an integral. tdd -- --- http://sperling.com http://ancientstones.com http://earthstones.com ---End Message--- ---BeginMessage--- Hello. Again, I'm fairly new to php so please forgive me if my question is a very simple or obvious one. I've just tried testing for the first time some php code that is pulling text out of a database to print it on the webpage. Some of this text includes HTML, specifically in this case an img src=x statement. Much to my surprise, this is not working. Is there a problem with pulling HTML out of a database like this as the page is being written? There's no problem of course if my php code is writing the HTML to the page - in this case, the img src=xx statement works fine and the image is displayed. Why is it a problem when my php script pulls the HTML code out of a database and writes it to the page from there?? It would appear that when my php script writes HTML to the page a process of some kind is executed to, in this case, get the image and put it on the page. Apparently this same process is NOT executed if the HTML is retrieved from a database and simply written to the page from there. Is this correct? And, if it is, can anyone suggest a workaround, another way to get done what I'm trying to do here? Thanks for any help you can give me. Rod Clay ---End Message--- ---BeginMessage--- On 15 Jul 2008, at 22:36, Rod Clay wrote: Hello. Again, I'm fairly new to php so please forgive me if my question is a very simple or obvious one. I've just tried testing for the first time some php code that is pulling text out of a database to print it on the webpage. Some of this text includes HTML, specifically in this case an img src=x statement. Much to my surprise, this is not working. Is there a problem
php-general Digest 16 Jul 2008 19:26:05 -0000 Issue 5572
php-general Digest 16 Jul 2008 19:26:05 - Issue 5572 Topics (messages 276902 through 276930): Re: How can i get the location of an exit()/die() from within register_shutdown_function()? 276902 by: Chris 276904 by: Mathijs van Veluw 276908 by: Thijs Lensselink 276909 by: tedd 276911 by: Eric Butera 276912 by: Mathijs van Veluw 276913 by: Eric Butera 276914 by: Mathijs van Veluw 276915 by: Mathijs van Veluw 276925 by: tedd 276929 by: Eric Butera 276930 by: tedd Re: Downloading a file 276903 by: Tom Chubb 276910 by: Robbert van Andel ÂÅÓÅÄËÉ Ó ÕÎÉËÁÌØÎÙÍ ×ÓÔÒÏÅÎÎÙÍ ÇÒÉÌÅÍ ÄÌÑ ÄÁÞÉ á 276905 by: ïÔ ïïï äÁÞÎÙÊ ÄÏÍ ñ Re: Changing PHP.ini 276906 by: Jay Blanchard Re: Byte range support 276907 by: Manuel Vacelet Re: Freelance PHP development in India 276916 by: Ryan S 276919 by: Manuel Lemos Re: Math Weirdness 276917 by: Shawn McKenzie 276918 by: Jason Pruim 276920 by: Jay Blanchard 276922 by: Daniel Brown implementing a website search feature using php 276921 by: Sudhakar 276923 by: Robert Cummings 276926 by: tedd 276927 by: Eric Butera Copying Multiple Files from One Server to Another Server 276924 by: Wei, Alice J. Re: is there a problem with php script pulling HTML out of database as it writes the page?? 276928 by: Daniel Brown Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- Mathijs van Veluw wrote: Hello there, I have an shutdown function to catch fatal-errors etc.. Now when there is an exit() somewhere i get an empty message from get_last_error(). I want to know the location of this exit() or die(). Is there a way to get the file and line-number from where the exit/die originated? debug_backtrace ? -- Postgresql php tutorials http://www.designmagick.com/ ---End Message--- ---BeginMessage--- Chris wrote: Mathijs van Veluw wrote: Hello there, I have an shutdown function to catch fatal-errors etc.. Now when there is an exit() somewhere i get an empty message from get_last_error(). I want to know the location of this exit() or die(). Is there a way to get the file and line-number from where the exit/die originated? debug_backtrace ? This won't work from within the register_shutdown_function() function. This because the scope is cleared, and the debug_backtrace starts from within the register_shutdown_function() function. ---End Message--- ---BeginMessage--- Quoting Mathijs van Veluw [EMAIL PROTECTED]: Hello there, I have an shutdown function to catch fatal-errors etc.. Now when there is an exit() somewhere i get an empty message from get_last_error(). I want to know the location of this exit() or die(). Is there a way to get the file and line-number from where the exit/die originated? Thx in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I don't think this is possible in PHP. When exit(0); is called. PHP execution stops. In the manual there is a small comment about exit inside a register_shutdown_function [snip] Multiple calls to register_shutdown_function() can be made, and each will be called in the same order as they were registered. If you call exit() within one registered shutdown function, processing will stop completely and no other registered shutdown functions will be called. [/snip] ---End Message--- ---BeginMessage--- At 9:23 AM +0200 7/16/08, Mathijs van Veluw wrote: Hello there, I have an shutdown function to catch fatal-errors etc.. Now when there is an exit() somewhere i get an empty message from get_last_error(). I want to know the location of this exit() or die(). Is there a way to get the file and line-number from where the exit/die originated? Thx in advance. Mathijs: For MySQL failures I use: $result = mysql_query($query) or die(report($query,__LINE__ ,__FILE__)); function report($query, $line, $file) { echo($query . 'br' .$line . 'br/' . $file . 'br/' . mysql_error()); } Perhaps you can modify that for your use. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com ---End Message--- ---BeginMessage--- On Wed, Jul 16, 2008 at 3:23 AM, Mathijs van Veluw [EMAIL PROTECTED] wrote: Hello there, I have an shutdown function to catch fatal-errors etc.. Now when there is an exit() somewhere i get an empty message from get_last_error(). I want to know the location of this exit() or die(). Is there a way to get the file and line-number from where the exit/die originated? Thx in advance. The way I handle this is by
[PHP] How can i get the location of an exit()/die() from within register_shutdown_function()?
Hello there, I have an shutdown function to catch fatal-errors etc.. Now when there is an exit() somewhere i get an empty message from get_last_error(). I want to know the location of this exit() or die(). Is there a way to get the file and line-number from where the exit/die originated? Thx in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How can i get the location of an exit()/die() from within register_shutdown_function()?
Mathijs van Veluw wrote: Hello there, I have an shutdown function to catch fatal-errors etc.. Now when there is an exit() somewhere i get an empty message from get_last_error(). I want to know the location of this exit() or die(). Is there a way to get the file and line-number from where the exit/die originated? debug_backtrace ? -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Downloading a file
On 16/07/2008, Robbert van Andel [EMAIL PROTECTED] wrote: I am having trouble getting a file to download to work in Internet Explorer. The site works fine in FireFox. The page retrieves the contents of a file from a database and outputs the following ?PHP header(Content-type: application/octet-stream); header(Content-Disposition: attachment; filename=\{$data['filename']}\); header(Content-Description: PHP Generated Data); echo $data['file']; ? Where $data['filename'] is the name of the file as stored in the database and $data['file'] is the contents of the file. The script used to download the file is called view.php. As I mentioned, this works great in FireFox but with Internet Explorer, I get the following error: Internet Explorer cannot download view.php from www.yourdomain.com. Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later. Any help would be greatly appreciated. Robbert Start here: http://www.google.co.uk/search?source=ighl=enrlz=q=php+download+file+internet+explorer+headersmeta =
Re: [PHP] How can i get the location of an exit()/die() from withinregister_shutdown_function()?
Chris wrote: Mathijs van Veluw wrote: Hello there, I have an shutdown function to catch fatal-errors etc.. Now when there is an exit() somewhere i get an empty message from get_last_error(). I want to know the location of this exit() or die(). Is there a way to get the file and line-number from where the exit/die originated? debug_backtrace ? This won't work from within the register_shutdown_function() function. This because the scope is cleared, and the debug_backtrace starts from within the register_shutdown_function() function. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Changing PHP.ini
[snip] By visiting php.info in a web browser I have confirmed the location of my php.ini file as /usr/local/php5/lib/php.ini. I open that file and edit the line: ; - display_errors = Off and change it to display_errors = On I then retstart Appache and visit php.info which still reports display_errors = Off. What else can I do? [/snip] Make sure that you do not have more than one php.ini -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Byte range support
On Tue, Jul 15, 2008 at 3:53 PM, Manuel Vacelet [EMAIL PROTECTED] wrote: Hello all, How can I make my php apps aware of byte range HTTP request ? I have a script that output data to user if she's granted to do so. But as of today, if download fails, she must restart the download from the beginning because my server (my php script) doesn't support range byte requests (actually, this is what curl and wget claims!) FYI, I found what I was looking for in PEAR HTTP Download package: http://pear.php.net/package/HTTP_Download -- Manuel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How can i get the location of an exit()/die() from within register_shutdown_function()?
Quoting Mathijs van Veluw [EMAIL PROTECTED]: Hello there, I have an shutdown function to catch fatal-errors etc.. Now when there is an exit() somewhere i get an empty message from get_last_error(). I want to know the location of this exit() or die(). Is there a way to get the file and line-number from where the exit/die originated? Thx in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I don't think this is possible in PHP. When exit(0); is called. PHP execution stops. In the manual there is a small comment about exit inside a register_shutdown_function [snip] Multiple calls to register_shutdown_function() can be made, and each will be called in the same order as they were registered. If you call exit() within one registered shutdown function, processing will stop completely and no other registered shutdown functions will be called. [/snip] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How can i get the location of an exit()/die() from within register_shutdown_function()?
At 9:23 AM +0200 7/16/08, Mathijs van Veluw wrote: Hello there, I have an shutdown function to catch fatal-errors etc.. Now when there is an exit() somewhere i get an empty message from get_last_error(). I want to know the location of this exit() or die(). Is there a way to get the file and line-number from where the exit/die originated? Thx in advance. Mathijs: For MySQL failures I use: $result = mysql_query($query) or die(report($query,__LINE__ ,__FILE__)); function report($query, $line, $file) { echo($query . 'br' .$line . 'br/' . $file . 'br/' . mysql_error()); } Perhaps you can modify that for your use. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Downloading a file
Thanks, that did the trick. I'd done a google search before but didn't come up with any answers but hadn't added headers to the search phrase. In case anyone is interested in the solution, my script included session_start and I found that by adding session_cache_limiter(none) before session_start resolved the problem (http://bytes.com/forum/thread554529.html) Robbert From: Tom Chubb [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 16, 2008 1:41 AM To: Robbert van Andel Cc: php-general@lists.php.net Subject: Re: [PHP] Downloading a file On 16/07/2008, Robbert van Andel [EMAIL PROTECTED] wrote: I am having trouble getting a file to download to work in Internet Explorer. The site works fine in FireFox. The page retrieves the contents of a file from a database and outputs the following ?PHP header(Content-type: application/octet-stream); header(Content-Disposition: attachment; filename=\{$data['filename']}\); header(Content-Description: PHP Generated Data); echo $data['file']; ? Where $data['filename'] is the name of the file as stored in the database and $data['file'] is the contents of the file. The script used to download the file is called view.php. As I mentioned, this works great in FireFox but with Internet Explorer, I get the following error: Internet Explorer cannot download view.php from www.yourdomain.com. Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later. Any help would be greatly appreciated. Robbert Start here: http://www.google.co.uk/search?source=ig http://www.google.co.uk/search?source=ighl=enrlz=q=php+download+file+int ernet+explorer+headersmeta hl=enrlz=q=php+download+file+internet+explorer+headersmeta=
Re: [PHP] How can i get the location of an exit()/die() from within register_shutdown_function()?
On Wed, Jul 16, 2008 at 3:23 AM, Mathijs van Veluw [EMAIL PROTECTED] wrote: Hello there, I have an shutdown function to catch fatal-errors etc.. Now when there is an exit() somewhere i get an empty message from get_last_error(). I want to know the location of this exit() or die(). Is there a way to get the file and line-number from where the exit/die originated? Thx in advance. The way I handle this is by throwing exceptions in my code. So let's say that there is a db connection/query failure for whatever reason. Instead of using query() or die() which is not user friendly, I throw an exception which bubbles up. Once it hits the top then I can catch it, log it accordingly, and show the user a friendlier error page saying Oops! With an exception you get exactly what you want, a full-blown stack trace complete with paths, line numbers etc. You also get the ability to be graceful about what you show to the end user. ...but I have the feeling that you're already dealing with a situation in lots of existing code. Perhaps you could combine some suggestions in this thread and replace your die/exit statements with a custom function which logs a debug_backtrace() and then really dies, but gracefully of course. :) As an aside, if I were to see some jibberish about a query and line numbers when I click a link I'd leave that site. (And for the archives) It is a security vuln to show full file paths to an end user. If someone is tampering with your system we shouldn't give them any more information than they can already get. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How can i get the location of an exit()/die() from within register_shutdown_function()?
Eric Butera wrote: On Wed, Jul 16, 2008 at 3:23 AM, Mathijs van Veluw [EMAIL PROTECTED] wrote: Hello there, I have an shutdown function to catch fatal-errors etc.. Now when there is an exit() somewhere i get an empty message from get_last_error(). I want to know the location of this exit() or die(). Is there a way to get the file and line-number from where the exit/die originated? Thx in advance. The way I handle this is by throwing exceptions in my code. So let's say that there is a db connection/query failure for whatever reason. Instead of using query() or die() which is not user friendly, I throw an exception which bubbles up. Once it hits the top then I can catch it, log it accordingly, and show the user a friendlier error page saying Oops! With an exception you get exactly what you want, a full-blown stack trace complete with paths, line numbers etc. You also get the ability to be graceful about what you show to the end user. ...but I have the feeling that you're already dealing with a situation in lots of existing code. Perhaps you could combine some suggestions in this thread and replace your die/exit statements with a custom function which logs a debug_backtrace() and then really dies, but gracefully of course. :) As an aside, if I were to see some jibberish about a query and line numbers when I click a link I'd leave that site. (And for the archives) It is a security vuln to show full file paths to an end user. If someone is tampering with your system we shouldn't give them any more information than they can already get. Well i don't use 'OR die()' stuff. But exceptions. For some reason from within the register_shutdown_function() function i get an empty error message. This only occurs, as far as i know, when there is an exit somewhere. I want to trace where this comes from. But i think that this isn't possible, as i looked on the web and there arn't any solutions. Thx for the help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How can i get the location of an exit()/die() from within register_shutdown_function()?
On Wed, Jul 16, 2008 at 9:41 AM, Mathijs van Veluw [EMAIL PROTECTED] wrote: Well i don't use 'OR die()' stuff. But exceptions. For some reason from within the register_shutdown_function() function i get an empty error message. This only occurs, as far as i know, when there is an exit somewhere. I want to trace where this comes from. But i think that this isn't possible, as i looked on the web and there arn't any solutions. Thx for the help. Well if this is a very specific issue that you're trying to resolve perhaps you could try and figure out how the user triggered the error. You could just save the remote address and request uri, do some access log searching and re-produce the path the user took through your site. This has been a helpful technique for me several times. One of the main problems for me is that I know how to use the systems I build, so I wouldn't click on stuff in the weird order some users do. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How can i get the location of an exit()/die() from within register_shutdown_function()?
Eric Butera wrote: On Wed, Jul 16, 2008 at 9:41 AM, Mathijs van Veluw [EMAIL PROTECTED] wrote: Well i don't use 'OR die()' stuff. But exceptions. For some reason from within the register_shutdown_function() function i get an empty error message. This only occurs, as far as i know, when there is an exit somewhere. I want to trace where this comes from. But i think that this isn't possible, as i looked on the web and there arn't any solutions. Thx for the help. Well if this is a very specific issue that you're trying to resolve perhaps you could try and figure out how the user triggered the error. You could just save the remote address and request uri, do some access log searching and re-produce the path the user took through your site. This has been a helpful technique for me several times. One of the main problems for me is that I know how to use the systems I build, so I wouldn't click on stuff in the weird order some users do. Well it is an cronjobed php script that executs several other scripts depending on the time. Something within those cronjobs triggers the shutdown function without an exit, which i find very strange. I think i have to debug it to trace the exact steps what its doing, because there is no exit within that script. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Freelance PHP development in India
No apologies necessary, good luck! Cheers! R - Original Message From: Denis L. Menezes [EMAIL PROTECTED] To: Ryan S [EMAIL PROTECTED]; Wolf [EMAIL PROTECTED] Cc: PHP General php-general@lists.php.net Sent: Monday, July 14, 2008 3:31:43 PM Subject: Re: [PHP] Freelance PHP development in India Dear Ryan, Wolf. Apologies for asking from India only. No offence meant. It is because I am from India and I can personally meet and discuss with the programmers. Cost is also an issue. Mine is a startup and the finances are low. :-( Apologies. Denis - Original Message - From: Ryan S [EMAIL PROTECTED] To: Wolf [EMAIL PROTECTED]; [EMAIL PROTECTED] Cc: PHP General php-general@lists.php.net Sent: Monday, July 14, 2008 8:34 PM Subject: Re: [PHP] Freelance PHP development in India snip Dear friends. I am looking for freelance web developers in India. Can contact me? Why just in India? There are a number of us available via the world. Wolf /snip I'm guessing because he wants a REAL cheap solution... what you (probably) charge for 5-7hrs work would probably be the same that someone in india charges for a day or two or the whole project. HTH Cheers! R -- 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] Math Weirdness
Jochem Maas wrote: Robert Cummings schreef: On Tue, 2008-07-15 at 12:37 -0400, tedd wrote: At 12:31 PM -0400 7/15/08, Robert Cummings wrote: Umm... here it is to unlimited precision: ¼ Cheers, Rob. Yeah and here's ƒ Like or not, that's all there is to it. Weird... you're client bastar-dized my beautiful pi symbol. no it's the worst round error ever. how exactly do you go from 3.1 to .25 :-P Easy, subtract 2.85 -Shawn Cheers, Rob. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Math Weirdness
On Jul 16, 2008, at 11:39 AM, Shawn McKenzie wrote: Jochem Maas wrote: Robert Cummings schreef: On Tue, 2008-07-15 at 12:37 -0400, tedd wrote: At 12:31 PM -0400 7/15/08, Robert Cummings wrote: Umm... here it is to unlimited precision: ¼ Cheers, Rob. Yeah and here's ƒ Like or not, that's all there is to it. Weird... you're client bastar-dized my beautiful pi symbol. no it's the worst round error ever. how exactly do you go from 3.1 to .25 :-P Easy, subtract 2.85 And then put it in Jay's pocket since we know he's skimming! If you're lucky maybe he'll cut you in for not telling the boss :P -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 11287 James St Holland, MI 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Freelance PHP development in India
Hello, on 07/14/2008 01:20 AM Denis L. Menezes said the following: Dear friends. I am looking for freelance web developers in India. Can contact me? As Thiago mentioned, there is a directory of PHP professionals available for taking PHP jobs that is sorted by country. Here you may find many developers from India: http://www.phpclasses.org/professionals/country/in/ If you want to post a job of interest to these developers, you may do it here: http://www.phpclasses.org/post_job.html -- Regards, Manuel Lemos Find and post PHP jobs http://www.phpclasses.org/jobs/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Math Weirdness
[snip] And then put it in Jay's pocket since we know he's skimming! If you're lucky maybe he'll cut you in for not telling the boss :P [/snip] Allegedly. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] implementing a website search feature using php
i want to implement a feature where a user searches with a keyword and search results are displayed according to the keyword or phrase entered by the user. following are the steps i want to follow. please advice if i am missing out any steps or i can add any step. 1. read the keyword entered by user using $search = $_POST[searchkeyword]; 2. read all the files from the root directory into a variable (as all files will be saved in the root directory) 3. from step 2 filter and read only files with html and php extensions into a variable 4. read the entire contents of all html and php files into a variable 5. compare $search with all the individual html and php file contents from step 4 6. if a match is found with either html or php file then display a brief title and brief description which will be a link to the actual file which has the keyword. 7. display search results in a serial order as 1. Brief Title of the page 2. Brief Title of the page ... 8. at the bottom of the page based on the total number of results found from step 6 i would like to provide a link to page 1 page 2 page3 ... (i can decide to display only 10 results per page) please advice. any help will be greatly appreciated. thanks.
Re: [PHP] Math Weirdness
On Tue, Jul 15, 2008 at 3:50 PM, tedd [EMAIL PROTECTED] wrote: Well, someone's client took infinity and turned it into an integral. tdd Yeah, but they stole your 'e' to make up for it. -- /Daniel P. Brown Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] implementing a website search feature using php
On Wed, 2008-07-16 at 22:50 +0530, Sudhakar wrote: i want to implement a feature where a user searches with a keyword and search results are displayed according to the keyword or phrase entered by the user. following are the steps i want to follow. please advice if i am missing out any steps or i can add any step. 1. read the keyword entered by user using $search = $_POST[searchkeyword]; 2. read all the files from the root directory into a variable (as all files will be saved in the root directory) 3. from step 2 filter and read only files with html and php extensions into a variable 4. read the entire contents of all html and php files into a variable 5. compare $search with all the individual html and php file contents from step 4 6. if a match is found with either html or php file then display a brief title and brief description which will be a link to the actual file which has the keyword. 7. display search results in a serial order as 1. Brief Title of the page 2. Brief Title of the page ... 8. at the bottom of the page based on the total number of results found from step 6 i would like to provide a link to page 1 page 2 page3 ... (i can decide to display only 10 results per page) Either use something like htdig or Lucene or run a cron that crawls your files as you indicate above and caches the content to a MySQL (or other db server) FULLTEXT column. Then query/search accordingly. You can feel free to re-invent this particular wheel... but you'll probably spend a lot of time doing it wrong. 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
[PHP] Copying Multiple Files from One Server to Another Server
Hi, I am running into a problem here with handling the files. My client wants me to copy all the files to one server over to another server. Currently, I use a very slow way that has to handle my code by writing in and out files manually as in the following: $lines3 = file(http://192.168.10.63/test/B1Depth-$id.dat;); $file3=http://192.168.10.63/test/B1Depth-$id.dat;; $count3= count($lines3); $ourFileName3 = C:/Inetpub/wwwroot/test/B1Depth-$beam_id.dat; $ourFileHandle3 = fopen($ourFileName3, 'wb') or die(can't open file); $newFileHandle3 = fopen($ourFileName3, 'a') or die(can't open file); for ($i = 0; $i=1; $i++) { rtrim($lines3[$i]); echo $lines3[$i] . br; $content= fwrite($ourFileHandle3, $lines3[$i]); } fclose($ourFileHandle3); for ($i = 2; $i =$count3; $i++) { rtrim($lines3[$i]); echo $lines3[$i] . br; $content= fwrite($newFileHandle3, $lines3[$i]); } fclose($newFileHandle3); Is there some way that I can do something like a cp and copy it over? Or, how should I go about doing this without going through this manually, since I won't be able to know how many files that would be needed to be copied? I would welcome any suggestions on this. Alice == Alice Wei MIS 2009 School of Library and Information Science Indiana University Bloomington [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How can i get the location of an exit()/die() from within register_shutdown_function()?
At 9:15 AM -0400 7/16/08, Eric Butera wrote: As an aside, if I were to see some jibberish about a query and line numbers when I click a link I'd leave that site. (And for the archives) It is a security vuln to show full file paths to an end user. If someone is tampering with your system we shouldn't give them any more information than they can already get. It can certainly help you for debugging, but I agree, it's not for production. tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] implementing a website search feature using php
At 10:50 PM +0530 7/16/08, Sudhakar wrote: i want to implement a feature where a user searches with a keyword and search results are displayed according to the keyword -snip- It sounds like you want a search for a site -- if so, see this: http://sperling.com/examples/search/ It's a lot less work. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] implementing a website search feature using php
On Wed, Jul 16, 2008 at 1:20 PM, Sudhakar [EMAIL PROTECTED] wrote: i want to implement a feature where a user searches with a keyword and search results are displayed according to the keyword or phrase entered by the user. following are the steps i want to follow. please advice if i am missing out any steps or i can add any step. 1. read the keyword entered by user using $search = $_POST[searchkeyword]; 2. read all the files from the root directory into a variable (as all files will be saved in the root directory) 3. from step 2 filter and read only files with html and php extensions into a variable 4. read the entire contents of all html and php files into a variable 5. compare $search with all the individual html and php file contents from step 4 6. if a match is found with either html or php file then display a brief title and brief description which will be a link to the actual file which has the keyword. 7. display search results in a serial order as 1. Brief Title of the page 2. Brief Title of the page ... 8. at the bottom of the page based on the total number of results found from step 6 i would like to provide a link to page 1 page 2 page3 ... (i can decide to display only 10 results per page) please advice. any help will be greatly appreciated. thanks. Zend Search Lucene is pretty nice. http://framework.zend.com/manual/en/zend.search.lucene.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is there a problem with php script pulling HTML out of database as it writes the page??
On Tue, Jul 15, 2008 at 5:43 PM, Stut [EMAIL PROTECTED] wrote: Code please, we're not mind readers! I sensed you would say that, Stuart. ;-P -- /Daniel P. Brown Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How can i get the location of an exit()/die() from within register_shutdown_function()?
On Wed, Jul 16, 2008 at 1:53 PM, tedd [EMAIL PROTECTED] wrote: At 9:15 AM -0400 7/16/08, Eric Butera wrote: As an aside, if I were to see some jibberish about a query and line numbers when I click a link I'd leave that site. (And for the archives) It is a security vuln to show full file paths to an end user. If someone is tampering with your system we shouldn't give them any more information than they can already get. It can certainly help you for debugging, but I agree, it's not for production. tedd I register an error handler a shutdown function on new features so that I can get error reports via email. I hate trying to sift thru logs and junk so I really need it in my face. Of course this is a performance hit as it actually has to send emails and parse errors, but after I haven't got any mails in a while I turn it off. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How can i get the location of an exit()/die() from within register_shutdown_function()?
At 2:18 PM -0400 7/16/08, Eric Butera wrote: On Wed, Jul 16, 2008 at 1:53 PM, tedd [EMAIL PROTECTED] wrote: At 9:15 AM -0400 7/16/08, Eric Butera wrote: As an aside, if I were to see some jibberish about a query and line numbers when I click a link I'd leave that site. (And for the archives) It is a security vuln to show full file paths to an end user. If someone is tampering with your system we shouldn't give them any more information than they can already get. It can certainly help you for debugging, but I agree, it's not for production. tedd I register an error handler a shutdown function on new features so that I can get error reports via email. I hate trying to sift thru logs and junk so I really need it in my face. Of course this is a performance hit as it actually has to send emails and parse errors, but after I haven't got any mails in a while I turn it off. I don't really know how others debug, I work alone. But, I do all my stuff online and use the following function: function report($query, $line, $file) { echo($query . 'br' .$line . 'br/' . $file . 'br/' . mysql_error()); } That gives me immediate notice of where the error occurred and what the error was. When I take my code to production, I simply comment out the echo(). I used to use a global to do that (show/not show errors), but consider all my error stuff in is one file, it's easy enough to comment out what I don't want to show. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Copy Function Errors
Hi, I have a snippet of code here: shell_exec(tar cvf /var/www/html/test/$id/data.tar /var/www/html/test/$id/data); $file1=http:/www.mysite.com/test/$id/data.tar; $file2=http://www.mysite2.com/test/$id/.tar;; copy($file1,$file2); I got the following error in the access log of the server: [Wed Jul 16 15:45:57 2008] [error] PHP Warning: copy(http://www.mysite.com/test/145/data.tar) [a href='function.copy'function.copy/a]: failed to open stream: HTTP wrapper does not support writeable connections. in /var/www/html/beam_calculation.php on line 20 Is there something I could do here to allow my file be copied to the remote server? Anything is appreciated. Alice == Alice Wei MIS 2009 School of Library and Information Science Indiana University Bloomington [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copy Function Errors
On Wed, 2008-07-16 at 15:58 -0400, Wei, Alice J. wrote: Hi, I have a snippet of code here: shell_exec(tar cvf /var/www/html/test/$id/data.tar /var/www/html/test/$id/data); $file1=http:/www.mysite.com/test/$id/data.tar; $file2=http://www.mysite2.com/test/$id/.tar;; copy($file1,$file2); I got the following error in the access log of the server: [Wed Jul 16 15:45:57 2008] [error] PHP Warning: copy(http://www.mysite.com/test/145/data.tar) [a href='function.copy'function.copy/a]: failed to open stream: HTTP wrapper does not support writeable connections. in /var/www/html/beam_calculation.php on line 20 Is there something I could do here to allow my file be copied to the remote server? Use the ftp functions. 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
[PHP] Child PID exit signal Illegal instruction (4)
Hey, I'm running PHP 5.2.6 on FreeBSD 7.0-RELEASE-p2, using apache 2.2.9. I have a PHP script that is valid code (I tested it on another server and it worked fine). The problem is, it keeps killing the httpd processes and outputting nothing. I get this message in my apache error logs each time the php script is called: [Wed Jul 16 20:10:18 2008] [notice] child pid 70553 exit signal Illegal instruction (4) And same thing in /var/log/messages: kernel: pid 70649 (httpd), uid 80: exited on signal 4 I read that it has to do with PCRE, so I tried commenting out all the preg and ereg functions, but that also didn't work. Here's a list of the modules I'm using: [PHP Modules] bz2 date dom filter gd geoip hash iconv libxml mbstring mcrypt memcache mysql mysqli pcre Reflection session SimpleXML sockets SPL standard xml zip zlib This is really frustrating me. I'm about to switch over to Lighttpd to see if it would help :-\ Any suggestions/ideas/comments/solutions would greatly be appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Copy Function Errors
Hi, I have a snippet of code here: shell_exec(tar cvf /var/www/html/test/$id/data.tar /var/www/html/test/$id/data); $file1=http:/www.mysite.com/test/$id/data.tar; $file2=http://www.mysite2.com/test/$id/.tar;; copy($file1,$file2); I got the following error in the access log of the server: [Wed Jul 16 15:45:57 2008] [error] PHP Warning: copy(http://www.mysite.com/test/145/data.tar) [a href='function.copy'function.copy/a]: failed to open stream: HTTP wrapper does not support writeable connections. in /var/www/html/beam_calculation.php on line 20 Is there something I could do here to allow my file be copied to the remote server? Use the ftp functions. Thanks for the tip. I have revised my code to: // define some variables $local_file = C:/Inetpub/wwwroot/test/$id/beamdata.tar; $server_file = http://192.168.10.63/test/$id/beamdata.tar;; // set up basic connection $ftp_server=http://192.168.10.63;; $conn_id = ftp_connect($ftp_server); // login with username and password $ftp_user_name=apache; $ftp_user_pass=x; $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // try to download $server_file and save to $local_file if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) { echo Successfully written to $local_file\n; } else { echo There was a problem\n; } // close the connection ftp_close($conn_id); I have put this snippet in the local server of where I want the files to be copied to. However, I see this on my remote server in the logs: 192.168.10.62 - - [16/Jul/2008:16:40:24 -0400] GET /beam_calculation.php?id=145no=16 HTTP/1.1 200 22 - Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727) Is there something I have missed here? Alice -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copy Function Errors
On Wed, Jul 16, 2008 at 4:45 PM, Wei, Alice J. [EMAIL PROTECTED] wrote: Hi, I have a snippet of code here: shell_exec(tar cvf /var/www/html/test/$id/data.tar /var/www/html/test/$id/data); $file1=http:/www.mysite.com/test/$id/data.tar; $file2=http://www.mysite2.com/test/$id/.tar;; copy($file1,$file2); I got the following error in the access log of the server: [Wed Jul 16 15:45:57 2008] [error] PHP Warning: copy(http://www.mysite.com/test/145/data.tar) [a href='function.copy'function.copy/a]: failed to open stream: HTTP wrapper does not support writeable connections. in /var/www/html/beam_calculation.php on line 20 Is there something I could do here to allow my file be copied to the remote server? Use the ftp functions. Thanks for the tip. I have revised my code to: // define some variables $local_file = C:/Inetpub/wwwroot/test/$id/beamdata.tar; $server_file = http://192.168.10.63/test/$id/beamdata.tar;; // set up basic connection $ftp_server=http://192.168.10.63;; $conn_id = ftp_connect($ftp_server); // login with username and password $ftp_user_name=apache; $ftp_user_pass=x; $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // try to download $server_file and save to $local_file if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) { echo Successfully written to $local_file\n; } else { echo There was a problem\n; } // close the connection ftp_close($conn_id); I have put this snippet in the local server of where I want the files to be copied to. However, I see this on my remote server in the logs: 192.168.10.62 - - [16/Jul/2008:16:40:24 -0400] GET /beam_calculation.php?id=145no=16 HTTP/1.1 200 22 - Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727) Is there something I have missed here? Are you considered a special student at the University? -- /Daniel P. Brown Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copy Function Errors
On Wed, 2008-07-16 at 16:53 -0400, Daniel Brown wrote: On Wed, Jul 16, 2008 at 4:45 PM, Wei, Alice J. [EMAIL PROTECTED] wrote: Is there something I have missed here? Are you considered a special student at the University? Now, now, no need to be mean. We were all noobs at one time or another. 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] Copy Function Errors
On Wed, 2008-07-16 at 16:45 -0400, Wei, Alice J. wrote: Hi, I have a snippet of code here: shell_exec(tar cvf /var/www/html/test/$id/data.tar /var/www/html/test/$id/data); $file1=http:/www.mysite.com/test/$id/data.tar; $file2=http://www.mysite2.com/test/$id/.tar;; copy($file1,$file2); I got the following error in the access log of the server: [Wed Jul 16 15:45:57 2008] [error] PHP Warning: copy(http://www.mysite.com/test/145/data.tar) [a href='function.copy'function.copy/a]: failed to open stream: HTTP wrapper does not support writeable connections. in /var/www/html/beam_calculation.php on line 20 Is there something I could do here to allow my file be copied to the remote server? Use the ftp functions. Thanks for the tip. I have revised my code to: // define some variables $local_file = C:/Inetpub/wwwroot/test/$id/beamdata.tar; $server_file = http://192.168.10.63/test/$id/beamdata.tar;; // set up basic connection $ftp_server=http://192.168.10.63;; Shouldn't that be: $ftp_server=192.168.10.63; http:// indicates a protocol and I don't think ftp supports the protocol prefix understood by browsers. 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] Copy Function Errors
-Original Message- From: Wei, Alice J. [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 16, 2008 3:46 PM To: Robert Cummings Cc: php-general@lists.php.net Subject: RE: [PHP] Copy Function Errors ---8--- snip Is there something I could do here to allow my file be copied to the remote server? Use the ftp functions. Thanks for the tip. I have revised my code to: // define some variables $local_file = C:/Inetpub/wwwroot/test/$id/beamdata.tar; $server_file = http://192.168.10.63/test/$id/beamdata.tar;; // set up basic connection $ftp_server=http://192.168.10.63;; $conn_id = ftp_connect($ftp_server); // login with username and password $ftp_user_name=apache; $ftp_user_pass=x; $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // try to download $server_file and save to $local_file if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) { echo Successfully written to $local_file\n; } else { echo There was a problem\n; } // close the connection ftp_close($conn_id); I have put this snippet in the local server of where I want the files to be copied to. However, I see this on my remote server in the logs: 192.168.10.62 - - [16/Jul/2008:16:40:24 -0400] GET /beam_calculation.php?id=145no=16 HTTP/1.1 200 22 - Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727) Is there something I have missed here? Alice, Here are some Wikipedia articles that should give you a good start on understanding the fundamental differences between the two protocols you are confusing with each other: http://en.wikipedia.org/wiki/FTP http://en.wikipedia.org/wiki/HTTP HTTP itself does not intrinsically handle file uploads in a server/client relationship. Web forms that include file uploads generally have a handler function on the other end, and post files via a form element. FTP's main function is the transfer of files (hence [F]ile [T]ransfer [P]rotocol), and is more in line with what you're trying to do here. HTH, Todd Boyd Web Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is there a problem with php script pulling HTML out of database as it writes the page??
On 16 Jul 2008, at 19:18, Daniel Brown wrote: On Tue, Jul 15, 2008 at 5:43 PM, Stut [EMAIL PROTECTED] wrote: Code please, we're not mind readers! I sensed you would say that, Stuart. ;-P Can you sense what I'm thinking right now? BTW, if anyone is looking for a PHP5/MySQL dev job in or around Camberley, Surrey, England please drop me your CV. Looking for all levels to join a small team (me + 2 non-devs). Contact me personally for more info. Sorry, remote working is not an option. We will consider both perm and contract but perm is preferred. Oh, and you'd be working for me so bear that in mind ;) -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is there a problem with php script pulling HTML out of database as it writes the page??
On Wed, Jul 16, 2008 at 5:28 PM, Stut [EMAIL PROTECTED] wrote: Oh, and you'd be working for me so bear that in mind ;) *crickets* (And not the games.) -- /Daniel P. Brown Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Copy Function Errors
Hi Alice... I just caught/saw this thread. I'm asuming you haven't found/solved what you're trying to do. So, What exactly are you trying to accomplish? What OS are you running on both the client/server machine? Are you trying to copy from a directory on one box, to a directory on another box? Is this a one time thing? Are the boxes on the same network (physically close together)? Are you able to login to the remote box from your initial server? Let me know what you're looking to do, and I can probably get you going. -regards... -Original Message- From: Boyd, Todd M. [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 16, 2008 2:28 PM To: Wei, Alice J. Cc: php-general@lists.php.net Subject: RE: [PHP] Copy Function Errors -Original Message- From: Wei, Alice J. [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 16, 2008 3:46 PM To: Robert Cummings Cc: php-general@lists.php.net Subject: RE: [PHP] Copy Function Errors ---8--- snip Is there something I could do here to allow my file be copied to the remote server? Use the ftp functions. Thanks for the tip. I have revised my code to: // define some variables $local_file = C:/Inetpub/wwwroot/test/$id/beamdata.tar; $server_file = http://192.168.10.63/test/$id/beamdata.tar;; // set up basic connection $ftp_server=http://192.168.10.63;; $conn_id = ftp_connect($ftp_server); // login with username and password $ftp_user_name=apache; $ftp_user_pass=x; $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // try to download $server_file and save to $local_file if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) { echo Successfully written to $local_file\n; } else { echo There was a problem\n; } // close the connection ftp_close($conn_id); I have put this snippet in the local server of where I want the files to be copied to. However, I see this on my remote server in the logs: 192.168.10.62 - - [16/Jul/2008:16:40:24 -0400] GET /beam_calculation.php?id=145no=16 HTTP/1.1 200 22 - Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727) Is there something I have missed here? Alice, Here are some Wikipedia articles that should give you a good start on understanding the fundamental differences between the two protocols you are confusing with each other: http://en.wikipedia.org/wiki/FTP http://en.wikipedia.org/wiki/HTTP HTTP itself does not intrinsically handle file uploads in a server/client relationship. Web forms that include file uploads generally have a handler function on the other end, and post files via a form element. FTP's main function is the transfer of files (hence [F]ile [T]ransfer [P]rotocol), and is more in line with what you're trying to do here. HTH, Todd Boyd Web Programmer -- 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] Corrupted ZIP files (downloaded via a php script) : Internext Explorer 7
Hi, I have a set of files stored in a directory and I need to serve those via a php script (in order to protect, control access etc). The problem is that zip files (exe also) get corrupted when I try from IE7. I've read the posts from this list and google etc with no idea of how to solve it. The stored files are ok (tested from firefox or direct copy). When I use IE7 the file size is smaller. In my test a config.zip with 248 bytes ends up with 214 bytes. This is the code used header(Pragma: public); header('Expires: '.gmdate('D, d M Y H:i:s').' GMT'); header(Cache-Control: must-revalidate, post-check=0, pre-check=0); header(Cache-Control: private,false); header(Content-Type: .$type); if($remove_date_from_file == false) header('Content-Disposition: attachment; filename='.basename($file).''); else { $name_ = substr(basename($file),0,strrpos(basename($file),.)); $ext_ = substr(basename($file),strrpos(basename($file),.)); $new_name_ = substr($name_,0,strlen($name_)-15).$ext_; header('Content-Disposition: attachment; filename='.$new_name_.''); } header(Content-Transfer-Encoding: binary); header('Content-Length: '.filesize($file)); while(!feof($fp)) { echo fgets($fp) ; } fclose($fp); I've added a debug to send me a message with the header and it comes the same way no matter what browser. Pragma: public Expires: Wed, 16 Jul 2008 23:12:00 GMT Cache-Control: must-revalidate, post-check=0, pre-check=0 Cache-Control: private Content-Type: application/zip Content-Disposition: attachment; filename=config.zip Content-Transfer-Encoding: binary Content-Length: 248 Am I doing something wrong or do I have to start looking to the server's configuration (like mod_deflate)?
[PHP] Soap Call Error
Hello Guys, I have been getting a wierd soap exception lately [faultstring] = looks like we got no XML document [faultcode] = Client [faultcodens] = http://schemas.xmlsoap.org/soap/envelope/ What does that mean? The call gets properly called and it does what it needs to do, but the response xml is always a $fault? Did anyone have this problem? I am using php 5.2.6 for the info. and below is my method... private function createThread($userID, $applianceTitle, $applianceDetails_link){ // Define Client try { $client = new SoapClient($this-createThreadWSDL, array(trace = 1 )); } catch(SoapFault $fault) { return ; } // Define Input array $params = array( 'subject'= $applianceTitle, 'body' = $applianceDetails_link, 'communityID' = $this-parentCommunityID, 'userID' = $userID ); //Make the Call try { $result = $client-__soapCall('createThread', array('parameters'=$params), NULL, $this-header); return $result; } catch (SoapFault $fault){ return $fault; } } Thanks
RE: [PHP] Copy Function Errors
Hi Alice... I just caught/saw this thread. I'm asuming you haven't found/solved what you're trying to do. So, What exactly are you trying to accomplish? What OS are you running on both the client/server machine? Are you trying to copy from a directory on one box, to a directory on another box? Is this a one time thing? Are the boxes on the same network (physically close together)? Are you able to login to the remote box from your initial server? Let me know what you're looking to do, and I can probably get you going. What I am trying to accomplish is something simple, which is to copy the files from one single directory, which is already tarred, and have it be copied to a remote server. I am guessing that it is never too difficult to untar it when I get it successfully copied to another server. Right now it appears to me that it keeps on going to the second loop that says it failed, probably because my password and user do not match? I have tried switching that to apache, which is what I set in my httpd.conf for user and group. I was browsing through the articles Todd suggested, and the port number 1025 kept popping up. I am not sure if I am supposed to open this port on my remote and my local machine. I do have ssh, which is port 22 open. Thanks in advance. Alice -regards... -Original Message- From: Boyd, Todd M. [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 16, 2008 2:28 PM To: Wei, Alice J. Cc: php-general@lists.php.net Subject: RE: [PHP] Copy Function Errors -Original Message- From: Wei, Alice J. [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 16, 2008 3:46 PM To: Robert Cummings Cc: php-general@lists.php.net Subject: RE: [PHP] Copy Function Errors ---8--- snip Is there something I could do here to allow my file be copied to the remote server? Use the ftp functions. Thanks for the tip. I have revised my code to: // define some variables $local_file = C:/Inetpub/wwwroot/test/$id/beamdata.tar; $server_file = http://192.168.10.63/test/$id/beamdata.tar;; // set up basic connection $ftp_server=http://192.168.10.63;; $conn_id = ftp_connect($ftp_server); // login with username and password $ftp_user_name=apache; $ftp_user_pass=x; $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // try to download $server_file and save to $local_file if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) { echo Successfully written to $local_file\n; } else { echo There was a problem\n; } // close the connection ftp_close($conn_id); I have put this snippet in the local server of where I want the files to be copied to. However, I see this on my remote server in the logs: 192.168.10.62 - - [16/Jul/2008:16:40:24 -0400] GET /beam_calculation.php?id=145no=16 HTTP/1.1 200 22 - Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727) Is there something I have missed here? Alice, Here are some Wikipedia articles that should give you a good start on understanding the fundamental differences between the two protocols you are confusing with each other: http://en.wikipedia.org/wiki/FTP http://en.wikipedia.org/wiki/HTTP HTTP itself does not intrinsically handle file uploads in a server/client relationship. Web forms that include file uploads generally have a handler function on the other end, and post files via a form element. FTP's main function is the transfer of files (hence [F]ile [T]ransfer [P]rotocol), and is more in line with what you're trying to do here. HTH, Todd Boyd Web Programmer -- 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