Re: [PHP] Is it possible to click download button,and run 2 tasks downloading a file and show number of downloads(ajax)simultaneously?
oh my bad:)! there is a cool solution,I forgot the blank page!:) yep! solved:) window.open('download.php', '_blank' ); now I can count up,and download:) $(".button").click(function(){ var id=$(this).attr('id'); var dataString = 'id='+ id ; $.ajax({ type: "POST", url: "download_number.php", data: dataString, cache: false, success: function(html) { $("#div_"+id).html(html); } }); window.open('download.php', '_blank' ); }); so cool!!:) On Mon, Oct 15, 2012 at 7:42 PM, Negin Nickparsa wrote: > Thanks Tedd, > > ajax works fine now,when submiting a button it will show the number and it > doesn't have any problem > > > $(function() { > > $(".button").click(function(){ > var id=$(this).attr('id'); > var dataString = 'id='+ id ; > $.ajax({ >type: "POST", >url: "download_number.php", >data: dataString, >cache: false, >success: function(html) >{ > $("#div_"+id).html(html); > } }); > } > > button: > > > > div: > > > > > > by the way* I totally will refuse this approach* because,although the > ajax is working,but I can't do anything for click to download the related > file because when I go to my php page I can't redirect it to a page for > download and besides echo the output to be written in div element,so > that,the best solution is just redirect to a page and download the file in > first place. after submiting write a $_POST['submit'] and just store the > download count,update the table and if user refreshed the page,can see the > number of downloads,*as sure there isn't anything better than this.* > > Marco suggested me iframe,reloading it,like a manual ajax but I think it > has much of troubles. > > by the way thanks for all helps. > > > >
Re: [PHP] Is it possible to click download button,and run 2 tasks downloading a file and show number of downloads(ajax)simultaneously?
Thanks Tedd, ajax works fine now,when submiting a button it will show the number and it doesn't have any problem $(function() { $(".button").click(function(){ var id=$(this).attr('id'); var dataString = 'id='+ id ; $.ajax({ type: "POST", url: "download_number.php", data: dataString, cache: false, success: function(html) { $("#div_"+id).html(html); } }); } button: div: by the way* I totally will refuse this approach* because,although the ajax is working,but I can't do anything for click to download the related file because when I go to my php page I can't redirect it to a page for download and besides echo the output to be written in div element,so that,the best solution is just redirect to a page and download the file in first place. after submiting write a $_POST['submit'] and just store the download count,update the table and if user refreshed the page,can see the number of downloads,*as sure there isn't anything better than this.* Marco suggested me iframe,reloading it,like a manual ajax but I think it has much of troubles. by the way thanks for all helps.
Re: [PHP] Is it possible to click download button,and run 2 tasks downloading a file and show number of downloads(ajax)simultaneously?
On Oct 14, 2012, at 7:41 AM, Negin Nickparsa wrote: > I wanted to refresh the download count when clicking the button first is it > possible? Yes, it is possible. The following is an example of a server-side php script refreshing a Web page via a javascript client-side action: http://php1.net/a/zipcode-states/ The action is triggered by simply using the selection control, which in turn activates an onchange javascript routine that causes a slave php script to run retrieving data from a database returning the data thereby causing an ajax script to update the selection control. All the code (html, javascript) is there except for the php script, which should be trivial to write. Cheers, tedd _ t...@sperling.com http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is it possible to change the html title from the WYSIWYG editor?
Search engines would still be indexing the original page's title. I need each unique URL to have its own unique, robot friendly title. Again, this question is strictly within WP context. On Mon, Feb 13, 2012 at 6:49 PM, Bastien wrote: > > > Bastien Koert > > On 2012-02-13, at 5:34 PM, Haluk Karamete wrote: > >> Yeah, but n the context of wordpress, that does not fly. >> If I do a die; in the middle of wp's tinymce editor, and check back >> the page, the title is already out there. >> >> first 5 lines would be something like >> >> >> >> >> >> >> the wordpress page title we were trying toi change is already >> here... >> http://gmpg.org/xfn/11"; /> >> >> But this question is a wp question. I accidentally dropped it in the PHP >> group. >> >> On Mon, Feb 13, 2012 at 2:24 PM, Daniel Brown wrote: >>> On Mon, Feb 13, 2012 at 17:15, Haluk Karamete >>> wrote: >>> >>> Please keep the replies on the list for all to benefit, including >>> the archives. >>> Isn't it TinyMCE considered a WYSIWYG one? but, anyway, that's beside the main point. >>> >>> Indeed. Hence: >>> >>> " even web-based things like TinyMCE, et al." >>> To your suggestion... I don't think your snippet would do any good as far as search engines... search engines would still take the title in the . here, we are already in the the_content(). >>> >>> Did you understand what I meant by "very basic example?" You'd >>> need to modify your .* tag in the head, as well, >>> obviously. That's all quite logical, and well beyond the scope of the >>> initial question. >>> >>> -- >>> >>> Network Infrastructure Manager >>> http://www.php.net/ >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> > > Any reason you can't just use JS to alter the title tag on the page loading? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is it possible to change the html title from the WYSIWYG editor?
Bastien Koert On 2012-02-13, at 5:34 PM, Haluk Karamete wrote: > Yeah, but n the context of wordpress, that does not fly. > If I do a die; in the middle of wp's tinymce editor, and check back > the page, the title is already out there. > > first 5 lines would be something like > > > > > > > the wordpress page title we were trying toi change is already > here... > http://gmpg.org/xfn/11"; /> > > But this question is a wp question. I accidentally dropped it in the PHP > group. > > On Mon, Feb 13, 2012 at 2:24 PM, Daniel Brown wrote: >> On Mon, Feb 13, 2012 at 17:15, Haluk Karamete >> wrote: >> >>Please keep the replies on the list for all to benefit, including >> the archives. >> >>> Isn't it TinyMCE considered a WYSIWYG one? but, anyway, that's beside >>> the main point. >> >>Indeed. Hence: >> >>" even web-based things like TinyMCE, et al." >> >>> To your suggestion... >>> >>> I don't think your snippet would do any good as far as search >>> engines... search engines would still take the title in the . >>> here, we are already in the the_content(). >> >>Did you understand what I meant by "very basic example?" You'd >> need to modify your .* tag in the head, as well, >> obviously. That's all quite logical, and well beyond the scope of the >> initial question. >> >> -- >> >> Network Infrastructure Manager >> http://www.php.net/ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > Any reason you can't just use JS to alter the title tag on the page loading? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is it possible to change the html title from the WYSIWYG editor?
Yeah, but n the context of wordpress, that does not fly. If I do a die; in the middle of wp's tinymce editor, and check back the page, the title is already out there. first 5 lines would be something like the wordpress page title we were trying toi change is already here... http://gmpg.org/xfn/11"; /> But this question is a wp question. I accidentally dropped it in the PHP group. On Mon, Feb 13, 2012 at 2:24 PM, Daniel Brown wrote: > On Mon, Feb 13, 2012 at 17:15, Haluk Karamete wrote: > > Please keep the replies on the list for all to benefit, including > the archives. > >> Isn't it TinyMCE considered a WYSIWYG one? but, anyway, that's beside >> the main point. > > Indeed. Hence: > > " even web-based things like TinyMCE, et al." > >> To your suggestion... >> >> I don't think your snippet would do any good as far as search >> engines... search engines would still take the title in the . >> here, we are already in the the_content(). > > Did you understand what I meant by "very basic example?" You'd > need to modify your .* tag in the head, as well, > obviously. That's all quite logical, and well beyond the scope of the > initial question. > > -- > > Network Infrastructure Manager > http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is it possible to change the html title from the WYSIWYG editor?
On Mon, Feb 13, 2012 at 17:15, Haluk Karamete wrote: Please keep the replies on the list for all to benefit, including the archives. > Isn't it TinyMCE considered a WYSIWYG one? but, anyway, that's beside > the main point. Indeed. Hence: " even web-based things like TinyMCE, et al." > To your suggestion... > > I don't think your snippet would do any good as far as search > engines... search engines would still take the title in the . > here, we are already in the the_content(). Did you understand what I meant by "very basic example?" You'd need to modify your .* tag in the head, as well, obviously. That's all quite logical, and well beyond the scope of the initial question. -- Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is it possible to change the html title from the WYSIWYG editor?
On Mon, Feb 13, 2012 at 15:50, Haluk Karamete wrote: > you may find it weird, actually very weird, but is the following possible> > > load up a post or page into the admin panel and place something like > this in to the editor; > > > //assume exec-PHP already active > > $current_page_url_here = get_current_url(); > > echo "click me"; > > if ( $_GET['var1']=='val1' ) > { > //change the current post's html title to val1 > without using javascript/jquery > } > ?> > > so when the visitor, clicks on the "click me", same page reloads but > this time, the title reads val1, and that's what search engines see > too. > and if it is also possible to change, the_title() to be equal to val1, > that's even better. > > But, is such a thing technically possible? Or is it too late at that > time to make those changes? > Could ob_start in any shape or form be deployed here to achieve this goal? This is not a WYSIWYG editor question; WYSIWYG editors are things like KompoZer, Dreamweaver, FrontPage, and even web-based things like TinyMCE, et al. That aside, try this very basic example (and expounded) and see if it's what you're trying to achieve: '; if (isset($_GET['title'])) { echo $_GET['title']; } else { echo 'The title has not been set!'; } echo ''.PHP_EOL; echo 'Change Title'.PHP_EOL; ?> -- Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is it possible to change the html title from the WYSIWYG editor?
Based on the terms you're using it sounds like this is a Wordpress question. You'd have a lot better chances of getting an answer if you query a group of WP gurus/geeks. Marc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] is it possible to change the html title from the WYSIWYG editor?
you may find it weird, actually very weird, but is the following possible> load up a post or page into the admin panel and place something like this in to the editor; click me"; if ( $_GET['var1']=='val1' ) { //change the current post's html title to val1 without using javascript/jquery } ?> so when the visitor, clicks on the "click me", same page reloads but this time, the title reads val1, and that's what search engines see too. and if it is also possible to change, the_title() to be equal to val1, that's even better. But, is such a thing technically possible? Or is it too late at that time to make those changes? Could ob_start in any shape or form be deployed here to achieve this goal? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to install PHP on IIS?
On 16 November 2010 13:30, Jay Blanchard wrote: > [snip] > http://www.wampserver.com/en/ > [/snip] > > And yes, I know that this is Apache - I am just not a fan of IIS. > > I quite like it. It probably does way so much more than I need or want and I think I can do everything that I can on Apache. IIS7 is certainly a massive leap ahead of the PWS I first tried to use. IIS+FastCGI+PHP. Add the Rewrite plugin and the PHP extensions WinCache and SQLSvr (PDO if you want it) and you have a well defined simple setup. Obviously, getting to grips with the administration UI is a bit different to just editing a plain text config file, but IIS does use an XML file for its config, so, once you know the xsd, you can do that by hand also. Full docs on the xsd are available online, so really, I'd guess in terms of ability, IIS and Apache are on-par. Richard. -- Richard Quadling Twitter : EE : Zend @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to install PHP on IIS?
Richard Quadling wrote: On 16 November 2010 13:21, Jay Blanchard wrote: [snip] Hi Folks, is it possible to install PHP on IIS? If yes, can someone please guide me on how to go about doing it? Thanks [/snip] http://www.wampserver.com/en/ Jay, if that had been wimpserver ... I think it's a good point. Windows + IIS + MySQL + PHP == WINP(y) server :-P KDK -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to install PHP on IIS?
On Tue, 16 Nov 2010 12:16:25 +0530 Himani Aggarwal wrote: > Hi Folks, is it possible to install PHP on IIS? If yes, can someone > please guide me on how to go about doing it? Thanks Now, why would you wanna do something crazy like that?! :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Is it possible to install PHP on IIS?
[snip] http://www.wampserver.com/en/ [/snip] And yes, I know that this is Apache - I am just not a fan of IIS. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to install PHP on IIS?
On 16 November 2010 13:21, Jay Blanchard wrote: > [snip] >>> Hi Folks, is it possible to install PHP on IIS? If yes, can someone > please guide me on how to go about doing it? Thanks > [/snip] > > http://www.wampserver.com/en/ > Jay, if that had been wimpserver ... -- Richard Quadling Twitter : EE : Zend @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Is it possible to install PHP on IIS?
[snip] >> Hi Folks, is it possible to install PHP on IIS? If yes, can someone please guide me on how to go about doing it? Thanks [/snip] http://www.wampserver.com/en/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to install PHP on IIS?
On 2010-11-16, at 6:55 AM, Richard Quadling wrote: > On 16 November 2010 06:46, Himani Aggarwal wrote: >> Hi Folks, is it possible to install PHP on IIS? If yes, can someone please >> guide me on how to go about doing it? Thanks >> > > PHP on IIS. Certainly. > > http://docs.php.net/manual/en/install.windows.iis7.php : IIS7 specific > instructions. > http://docs.php.net/manual/en/install.windows.manual.php : General > instructions for installing PHP manually. > http://docs.php.net/manual/en/install.windows.commandline.php : > Additional instructions for better integration of PHP into the > commandline. > > > > > -- > Richard Quadling > Twitter : EE : Zend > @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php The windows web platform installer is also an option and will install php/Mysql and other apps like moodle, sugarcrm and others. Bastien > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to install PHP on IIS?
On 16 November 2010 06:46, Himani Aggarwal wrote: > Hi Folks, is it possible to install PHP on IIS? If yes, can someone please > guide me on how to go about doing it? Thanks > PHP on IIS. Certainly. http://docs.php.net/manual/en/install.windows.iis7.php : IIS7 specific instructions. http://docs.php.net/manual/en/install.windows.manual.php : General instructions for installing PHP manually. http://docs.php.net/manual/en/install.windows.commandline.php : Additional instructions for better integration of PHP into the commandline. -- Richard Quadling Twitter : EE : Zend @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to install PHP on IIS?
Himani, See http://blogs.iis.net/bills/archive/2006/09/19/how-to-install-php-on-iis7-_2800_rc1_2900_.aspx?WT.mc_id=soc-c-in-loc--cfp. Also, see http://blogs.iis.net/donraman/archive/2009/10/07/installing-php-on-windows.aspx?WT.mc_id=soc-c-in-loc--cfp On Tue, Nov 16, 2010 at 12:16 PM, Himani Aggarwal < incrediblehim...@gmail.com> wrote: > Hi Folks, is it possible to install PHP on IIS? If yes, can someone please > guide me on how to go about doing it? Thanks >
[PHP] Is it possible to install PHP on IIS?
Hi Folks, is it possible to install PHP on IIS? If yes, can someone please guide me on how to go about doing it? Thanks
[PHP] Is it possible to create a global namespace alias?
Is it possible to create a global namespace alias in PHP or does the alias have to be defined in EVERY file that I use? Here is an example: file: main.php file: index.php The above code doesn’t work for me. The namespace alias defined in the main.php file isn’t accessible in the index.php file. Is there a way to make the “nsItem” alias a “global” one, so that I don’t have to define it in EVERY file that I want to use? -Matt
[PHP] Is it possible to create a global namespace alias?
Is it possible to create a global namespace alias in PHP or does the alias have to be defined in EVERY file that I use? Here is an example: file: main.php file: index.php The above code doesn’t work for me. The namespace alias defined in the main.php file isn’t accessible in the index.php file. Is there a way to make the “nsItem” alias a “global” one, so that I don’t have to define it in EVERY file that I want to use? -Matt
Re: [PHP] Is it possible to send POST vars through aheaderredirect?
tedd wrote: > At 1:18 PM -0600 2/5/09, Shawn McKenzie wrote: >> tedd wrote: >>> At 2:52 AM -0700 2/5/09, TS wrote: I want my script to run and redirect with the var to another page without the user seeing it. Currently, I am using GET and header("Location: http://domain/?somevar=somevalue";) >>> >>> That would, by definition, allow the user to see it. >>> >>> If you want to pass a variable to another script, I know of four >>> choices, namely: >>> >>> 1. Use POST; >>> 2. Use GET; >>> 3. Write the variable to a database; >>> 4. Include the next script. >>> >>> HTH's >>> >>> tedd >>> >> >> 5. Stick it in the session >> >> -- >> Thanks! >> -Shawn > > Duh! > > Thanks, I should wait a day before posting anything. > > tedd > Only a day? Sometimes I click send before I'm even finished ty -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to send POST vars through a headerredirect?
At 1:18 PM -0600 2/5/09, Shawn McKenzie wrote: tedd wrote: At 2:52 AM -0700 2/5/09, TS wrote: I want my script to run and redirect with the var to another page without the user seeing it. Currently, I am using GET and header("Location: http://domain/?somevar=somevalue";) That would, by definition, allow the user to see it. If you want to pass a variable to another script, I know of four choices, namely: 1. Use POST; 2. Use GET; 3. Write the variable to a database; 4. Include the next script. HTH's tedd 5. Stick it in the session -- Thanks! -Shawn Duh! Thanks, I should wait a day before posting anything. 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] Is it possible to send POST vars through a headerredirect?
tedd wrote: > At 2:52 AM -0700 2/5/09, TS wrote: >> I want my script to run and redirect with >> the var to another page without the user seeing it. Currently, I am using >> GET and >> >> header("Location: http://domain/?somevar=somevalue";) > > That would, by definition, allow the user to see it. > > If you want to pass a variable to another script, I know of four > choices, namely: > > 1. Use POST; > 2. Use GET; > 3. Write the variable to a database; > 4. Include the next script. > > HTH's > > tedd > 5. Stick it in the session -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Is it possible to send POST vars through a header redirect?
At 2:52 AM -0700 2/5/09, TS wrote: I want my script to run and redirect with the var to another page without the user seeing it. Currently, I am using GET and header("Location: http://domain/?somevar=somevalue";) That would, by definition, allow the user to see it. If you want to pass a variable to another script, I know of four choices, namely: 1. Use POST; 2. Use GET; 3. Write the variable to a database; 4. Include the next script. HTH's 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] Is it possible to send POST vars through a header redirect?
I thought the question was pretty straight forward. Sorry about that. As someone mentioned, yes I'm just trying to hide the var from the user. What I meant by I don't want it to stick with the session, is that I don't want it to be available from page to page. I want my script to run and redirect with the var to another page without the user seeing it. Currently, I am using GET and header("Location: http://domain/?somevar=somevalue";) I'll try some of the previous responses thanks for the help. -Original Message- From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] Sent: Wednesday, February 04, 2009 12:58 PM To: Mike Roberts Cc: TS; php-general@lists.php.net Subject: RE: [PHP] Is it possible to send POST vars through a header redirect? Just look at the headers of EVERY email that comes from the mailing list, as they contain the unsubscribe email address. On Wed, 2009-02-04 at 09:47 -0500, Mike Roberts wrote: > Ladies and Gentlemen. > I am a recruiter who joined this list to understand a little about PHP. I respected the boundaries, and never tried to recruit you. Now I am asking for a courtesy in return. I have tried several ways and several times to be excluded from the list, but I still get emails. Can somebody who is 'in charge' please remove me from the list. Thank you. > > > > > > Michael Roberts > Senior Recruitment Strategist > Corporate Staffing Services > 150 Monument Road, Suite 510 > Bala Cynwyd, PA 19004 > P 610-771-1084 > F 610-771-0390 > E mrobe...@jobscss.com > > -Original Message- > From: TS [mailto:sunnrun...@gmail.com] > Sent: Tuesday, February 03, 2009 5:47 PM > To: php-general@lists.php.net > Subject: [PHP] Is it possible to send POST vars through a header redirect? > > I'm trying to send vars via POST somehow. Is this possible? > > Currently I'm doing > > header("Location: http://domain/index.php?var=3";); > > but, want to send POST or some other method that doesn't stick with the session. > > Thanks, T > > Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Is it possible to send POST vars through a header redirect?
Just look at the headers of EVERY email that comes from the mailing list, as they contain the unsubscribe email address. On Wed, 2009-02-04 at 09:47 -0500, Mike Roberts wrote: > Ladies and Gentlemen. > I am a recruiter who joined this list to understand a little about PHP. I > respected the boundaries, and never tried to recruit you. Now I am asking for > a courtesy in return. I have tried several ways and several times to be > excluded from the list, but I still get emails. Can somebody who is 'in > charge' please remove me from the list. Thank you. > > > > > > Michael Roberts > Senior Recruitment Strategist > Corporate Staffing Services > 150 Monument Road, Suite 510 > Bala Cynwyd, PA 19004 > P 610-771-1084 > F 610-771-0390 > E mrobe...@jobscss.com > > -Original Message- > From: TS [mailto:sunnrun...@gmail.com] > Sent: Tuesday, February 03, 2009 5:47 PM > To: php-general@lists.php.net > Subject: [PHP] Is it possible to send POST vars through a header redirect? > > I'm trying to send vars via POST somehow. Is this possible? > > Currently I'm doing > > header("Location: http://domain/index.php?var=3";); > > but, want to send POST or some other method that doesn't stick with the > session. > > Thanks, T > > Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to send POST vars through a header redirect?
Stuart wrote: > 2009/2/4 Jônatas Zechim : >> Try curl > > 1) I really wish people would look at other replies to a post before > sending their own. Duplicates are rarely useful. > > 2) CURL cannot perform a "header redirect" as the OP is asking for, so > the more useful response is to ask what they're actually trying to > achieve because they're wanting to know how to do something that's not > possible so the question is flawed. > > Rant over. > > -Stuart > >> -Mensagem original- >> De: Stuart [mailto:stut...@gmail.com] >> Enviada em: quarta-feira, 4 de fevereiro de 2009 07:52 >> Para: TS >> Cc: php-general@lists.php.net >> Assunto: Re: [PHP] Is it possible to send POST vars through a header >> redirect? >> >> 2009/2/3 TS : >>> I'm trying to send vars via POST somehow. Is this possible? >>> >>> Currently I'm doing >>> >>> header("Location: http://domain/index.php?var=3";); >>> >>> but, want to send POST or some other method that doesn't stick with the >>> session. >> I'm not sure what you mean by "stick with the session". What exactly >> are you trying to achieve? >> >> -Stuart >> >> -- >> http://stut.net/ Well, since the OP can't POST using header, then maybe alternatives to help them out? If you want to use sessions or are already using them (i.e. session_start() on each of the pages), you can just use session vars: session_start(); $_SESSION['var'] = 3; header("Location: http://domain/index.php";); exit; Then in the next page you have the var: session_start(); $var = $_SESSION['var']; -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RES: [PHP] Is it possible to send POST vars through a header redirect?
U can do it by using a session, or using a XML request via JS to save the vars. -Mensagem original- De: Morris [mailto:morris...@gmail.com] Enviada em: quarta-feira, 4 de fevereiro de 2009 16:00 Para: tedd Cc: Mike Roberts; php-general@lists.php.net Assunto: Re: [PHP] Is it possible to send POST vars through a header redirect? Not possible to send POST in header if your aim is to hide vars from users. Could think about dynamically send POST using Javascript. form.send(); This requires some JS knowledge about how to exchange data between PHP and JS 2009/2/4 tedd > At 9:47 AM -0500 2/4/09, Mike Roberts wrote: > >> Ladies and Gentlemen. >> I am a recruiter who joined this list to understand a little about PHP. I >> respected the boundaries, and never tried to recruit you. Now I am asking >> for a courtesy in return. I have tried several ways and several times to be >> excluded from the list, but I still get emails. Can somebody who is 'in >> charge' please remove me from the list. Thank you. >> >> Michael Roberts >> > > > Have you tried? > > To unsubscribe, visit: http://www.php.net/unsub.php >> > > > It's at the bottom of every post. > > 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to send POST vars through a header redirect?
Not possible to send POST in header if your aim is to hide vars from users. Could think about dynamically send POST using Javascript. form.send(); This requires some JS knowledge about how to exchange data between PHP and JS 2009/2/4 tedd > At 9:47 AM -0500 2/4/09, Mike Roberts wrote: > >> Ladies and Gentlemen. >> I am a recruiter who joined this list to understand a little about PHP. I >> respected the boundaries, and never tried to recruit you. Now I am asking >> for a courtesy in return. I have tried several ways and several times to be >> excluded from the list, but I still get emails. Can somebody who is 'in >> charge' please remove me from the list. Thank you. >> >> Michael Roberts >> > > > Have you tried? > > To unsubscribe, visit: http://www.php.net/unsub.php >> > > > It's at the bottom of every post. > > 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] Is it possible to send POST vars through a header redirect?
At 9:47 AM -0500 2/4/09, Mike Roberts wrote: Ladies and Gentlemen. I am a recruiter who joined this list to understand a little about PHP. I respected the boundaries, and never tried to recruit you. Now I am asking for a courtesy in return. I have tried several ways and several times to be excluded from the list, but I still get emails. Can somebody who is 'in charge' please remove me from the list. Thank you. Michael Roberts Have you tried? To unsubscribe, visit: http://www.php.net/unsub.php It's at the bottom of every post. 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] Is it possible to send POST vars through a header redirect?
Ladies and Gentlemen. I am a recruiter who joined this list to understand a little about PHP. I respected the boundaries, and never tried to recruit you. Now I am asking for a courtesy in return. I have tried several ways and several times to be excluded from the list, but I still get emails. Can somebody who is 'in charge' please remove me from the list. Thank you. Michael Roberts Senior Recruitment Strategist Corporate Staffing Services 150 Monument Road, Suite 510 Bala Cynwyd, PA 19004 P 610-771-1084 F 610-771-0390 E mrobe...@jobscss.com -Original Message- From: TS [mailto:sunnrun...@gmail.com] Sent: Tuesday, February 03, 2009 5:47 PM To: php-general@lists.php.net Subject: [PHP] Is it possible to send POST vars through a header redirect? I'm trying to send vars via POST somehow. Is this possible? Currently I'm doing header("Location: http://domain/index.php?var=3";); but, want to send POST or some other method that doesn't stick with the session. Thanks, T -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to send POST vars through a header redirect?
2009/2/4 Jônatas Zechim : > Try curl 1) I really wish people would look at other replies to a post before sending their own. Duplicates are rarely useful. 2) CURL cannot perform a "header redirect" as the OP is asking for, so the more useful response is to ask what they're actually trying to achieve because they're wanting to know how to do something that's not possible so the question is flawed. Rant over. -Stuart > -Mensagem original- > De: Stuart [mailto:stut...@gmail.com] > Enviada em: quarta-feira, 4 de fevereiro de 2009 07:52 > Para: TS > Cc: php-general@lists.php.net > Assunto: Re: [PHP] Is it possible to send POST vars through a header redirect? > > 2009/2/3 TS : >> I'm trying to send vars via POST somehow. Is this possible? >> >> Currently I'm doing >> >> header("Location: http://domain/index.php?var=3";); >> >> but, want to send POST or some other method that doesn't stick with the >> session. > > I'm not sure what you mean by "stick with the session". What exactly > are you trying to achieve? > > -Stuart > > -- > http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RES: [PHP] Is it possible to send POST vars through a header redirect?
Try curl -Mensagem original- De: Stuart [mailto:stut...@gmail.com] Enviada em: quarta-feira, 4 de fevereiro de 2009 07:52 Para: TS Cc: php-general@lists.php.net Assunto: Re: [PHP] Is it possible to send POST vars through a header redirect? 2009/2/3 TS : > I'm trying to send vars via POST somehow. Is this possible? > > Currently I'm doing > > header("Location: http://domain/index.php?var=3";); > > but, want to send POST or some other method that doesn't stick with the > session. I'm not sure what you mean by "stick with the session". What exactly are you trying to achieve? -Stuart -- http://stut.net/ -- 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] Is it possible to send POST vars through a header redirect?
2009/2/3 TS : > I'm trying to send vars via POST somehow. Is this possible? > > Currently I'm doing > > header("Location: http://domain/index.php?var=3";); > > but, want to send POST or some other method that doesn't stick with the > session. I'm not sure what you mean by "stick with the session". What exactly are you trying to achieve? -Stuart -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to send POST vars through a header redirect?
On Tue, Feb 3, 2009 at 2:54 PM, Jim Lucas wrote: > TS wrote: > > I'm trying to send vars via POST somehow. Is this possible? > > > > Currently I'm doing > > > > header("Location: http://domain/index.php?var=3";); > > > > but, want to send POST or some other method that doesn't stick with the > session. > > > > Thanks, T > > > > > > No, it is not possible. You will need to look into cURL or something else. > > But it cannot be done via the header() function. > I second that you need to use curl: $header = array( "MIME-Version"=>"1.0", "Content-type"=>"text/html; charset=utf-8" ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $this->elqPosturl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_TIMEOUT, $this->curlOptTimeOut); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1); curl_setopt($ch, CURLOPT_PROXY, $this->proxyServer); curl_setopt($ch, CURLOPT_PROXYPORT, $this->proxyPort); curl_setopt($ch, CURLOPT_POSTFIELDS, $inputArray); curl_setopt($ch, CURLOPT_USERAGENT, 'MSIE'); curl_setopt($ch, CURLOPT_HTTPHEADER, $header); curl_setopt($ch, CURLOPT_HEADER, 1); $data = curl_exec($ch); Thanks, V
Re: [PHP] Is it possible to send POST vars through a header redirect?
On Tue, Feb 3, 2009 at 2:54 PM, Jim Lucas wrote: > TS wrote: >> I'm trying to send vars via POST somehow. Is this possible? >> >> Currently I'm doing >> >> header("Location: http://domain/index.php?var=3";); >> >> but, want to send POST or some other method that doesn't stick with the >> session. >> >> Thanks, T >> >> > > No, it is not possible. You will need to look into cURL or something else. > > But it cannot be done via the header() function. > > -- > 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 > > You could always create major overhead and stick it in the database. Ha... -- Kyle Terry | www.kyleterry.com Help kick start VOOM (Very Open Object Model) for a library of PHP classes. http://www.voom.me | IRC EFNet #voom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to send POST vars through a header redirect?
TS wrote: > I'm trying to send vars via POST somehow. Is this possible? > > Currently I'm doing > > header("Location: http://domain/index.php?var=3";); > > but, want to send POST or some other method that doesn't stick with the > session. > > Thanks, T > > No, it is not possible. You will need to look into cURL or something else. But it cannot be done via the header() function. -- 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
[PHP] Is it possible to send POST vars through a header redirect?
I'm trying to send vars via POST somehow. Is this possible? Currently I'm doing header("Location: http://domain/index.php?var=3";); but, want to send POST or some other method that doesn't stick with the session. Thanks, T -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Is it possible to restart Windows Apache (service) on a PHP script?
DOH!. I'm sorry I didn't read the fact that this was on Windows. My bad... Um. Out of curiosity, why would you run LAMP as WAMP? It just seems so wrong. Not to start an OS religion war, I use XP all day long, but I would never use it as my dedicated web server -- that's why God invented Unix/Linux. Best tool for the job and all that stuff... You're just asking for all kinds of headaches and limitations (such as the one you're encountering now) by using the back of a screwdriver to hammer a nail IYKWIM. You'll poke your eye out! :) > -Original Message- > From: Daevid Vincent [mailto:[EMAIL PROTECTED] > Sent: Monday, October 22, 2007 1:26 PM > To: php-general@lists.php.net > Subject: RE: [PHP] Is it possible to restart Windows Apache > (service) on a PHP script? > > What we do is setup 'sudo' to run certain commands (or a > shell/ruby script > for example), then have PHP/Apache exec() the script via sudo > (or use a DBUS > call to a 'root' enabled ruby daemon), which then restarts apache or > whatever we want. > > Be VERY careful with the way you do this or you can give > crackers all kinds > of ways to cause you pain. > > > For example: > > [EMAIL PROTECTED]:/etc# cat /etc/sudoers > Cmnd_Alias CHMOD = /bin/chmod > Cmnd_Alias REBOOT = /sbin/reboot, /sbin/shutdown > > rootALL=(ALL) ALL > www-dataALL=NOPASSWD: /bin/date, /sbin/hwclock, > REBOOT, /usr/bin/dpkg, > /usr/sbin/chpasswd, > /usr/bin/passwd, /usr/sbin/srvwatch, > /usr/sbin/srvtalk > > Then in the PHP web page: > > exec("/usr/bin/sudo /sbin/reboot"); > > > D.Vin > > "Voice or no voice, the people can alway be brought to the > bidding of the > leaders. This is easy. All you have to do is tell them that > they are being > attacked, and denounce the pacifists for a lack of patriotism > and exposing > the country to danger. It works the same in every country." --Hermann > Goering, Hitler's Reich Marshall at the Nuremberg Trials After WWII > > Sound like G.W.Bush? > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Is it possible to restart Windows Apache (service) on a PHP script?
What we do is setup 'sudo' to run certain commands (or a shell/ruby script for example), then have PHP/Apache exec() the script via sudo (or use a DBUS call to a 'root' enabled ruby daemon), which then restarts apache or whatever we want. Be VERY careful with the way you do this or you can give crackers all kinds of ways to cause you pain. For example: [EMAIL PROTECTED]:/etc# cat /etc/sudoers Cmnd_Alias CHMOD = /bin/chmod Cmnd_Alias REBOOT = /sbin/reboot, /sbin/shutdown rootALL=(ALL) ALL www-dataALL=NOPASSWD: /bin/date, /sbin/hwclock, REBOOT, /usr/bin/dpkg, /usr/sbin/chpasswd, /usr/bin/passwd, /usr/sbin/srvwatch, /usr/sbin/srvtalk Then in the PHP web page: exec("/usr/bin/sudo /sbin/reboot"); D.Vin "Voice or no voice, the people can alway be brought to the bidding of the leaders. This is easy. All you have to do is tell them that they are being attacked, and denounce the pacifists for a lack of patriotism and exposing the country to danger. It works the same in every country." --Hermann Goering, Hitler's Reich Marshall at the Nuremberg Trials After WWII Sound like G.W.Bush?
Re: [PHP] Is it possible to restart Windows Apache (service) on a PHP script?
You could try using exec to set up an "AT" job with a short delay which will then run 'net apache restart' - I'm not a total windows guru so I can't give you the exact recipe... Something like exec('AT 12:00 "net apache restart"'); Check the documentation on the AT command... One possible extra advantage is that you could cancel the 'AT' job during the delay period if you clicked restart by accident :) Louie Miranda wrote: > Thanks for your suggestions. > > But, both did not worked. > > Louie > > On 10/19/07, Philip Thompson <[EMAIL PROTECTED]> wrote: >> On 10/19/07, Robert Degen <[EMAIL PROTECTED]> wrote: >>> Why don't you try a >>> >>> passthru('net apache restart') >>> >>> perhabs another parameter order, but I think It won't work. >>> Stopping it might work, but restarting... >>> >>> >>> >>> On Fr, Okt 19, 2007 at 04:32:45 +0800, Louie Miranda wrote: Is it possible to restart Windows Apache (service) on a PHP script? i have installed PHP/Apache on a Windows machine. Added the ext >>> windows32 service. But could not find any how to or information online. Please help! -- Louie Miranda ([EMAIL PROTECTED]) >> This reminds me of the time I was remoting into a machine (using Altiris, >> I >> think) to do some work on it. I then needed to restart it... so I did. >> Well, >> class, what happens when you turn off Mr. Computer? >> >> Not saying that this is the same thing... b/c if you push a "restart" >> command, then it *should* come back up. =/ Sorry, I don't know the exact >> command, but consider using exec(). >> >> Good Luck, >> ~Philip >> >> PS... Yay, it's Friday! >> > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to restart Windows Apache (service) on a PHP script?
Thanks for your suggestions. But, both did not worked. Louie On 10/19/07, Philip Thompson <[EMAIL PROTECTED]> wrote: > > On 10/19/07, Robert Degen <[EMAIL PROTECTED]> wrote: > > > > Why don't you try a > > > > passthru('net apache restart') > > > > perhabs another parameter order, but I think It won't work. > > Stopping it might work, but restarting... > > > > > > > > On Fr, Okt 19, 2007 at 04:32:45 +0800, Louie Miranda wrote: > > > Is it possible to restart Windows Apache (service) on a PHP script? > > > > > > i have installed PHP/Apache on a Windows machine. Added the ext > > windows32 > > > service. > > > But could not find any how to or information online. > > > > > > Please help! > > > > > > -- > > > Louie Miranda ([EMAIL PROTECTED]) > > > > This reminds me of the time I was remoting into a machine (using Altiris, > I > think) to do some work on it. I then needed to restart it... so I did. > Well, > class, what happens when you turn off Mr. Computer? > > Not saying that this is the same thing... b/c if you push a "restart" > command, then it *should* come back up. =/ Sorry, I don't know the exact > command, but consider using exec(). > > Good Luck, > ~Philip > > PS... Yay, it's Friday! > -- Louie Miranda ([EMAIL PROTECTED]) http://www.axishift.com Security Is A Series Of Well-Defined Steps chmod -R 0 / ; and smile :)
Re: [PHP] Is it possible to restart Windows Apache (service) on a PHP script?
On 10/19/07, Robert Degen <[EMAIL PROTECTED]> wrote: > > Why don't you try a > > passthru('net apache restart') > > perhabs another parameter order, but I think It won't work. > Stopping it might work, but restarting... > > > > On Fr, Okt 19, 2007 at 04:32:45 +0800, Louie Miranda wrote: > > Is it possible to restart Windows Apache (service) on a PHP script? > > > > i have installed PHP/Apache on a Windows machine. Added the ext > windows32 > > service. > > But could not find any how to or information online. > > > > Please help! > > > > -- > > Louie Miranda ([EMAIL PROTECTED]) > This reminds me of the time I was remoting into a machine (using Altiris, I think) to do some work on it. I then needed to restart it... so I did. Well, class, what happens when you turn off Mr. Computer? Not saying that this is the same thing... b/c if you push a "restart" command, then it *should* come back up. =/ Sorry, I don't know the exact command, but consider using exec(). Good Luck, ~Philip PS... Yay, it's Friday!
Re: [PHP] Is it possible to restart Windows Apache (service) on a PHP script?
Why don't you try a passthru('net apache restart') perhabs another parameter order, but I think It won't work. Stopping it might work, but restarting... On Fr, Okt 19, 2007 at 04:32:45 +0800, Louie Miranda wrote: > Is it possible to restart Windows Apache (service) on a PHP script? > > i have installed PHP/Apache on a Windows machine. Added the ext windows32 > service. > But could not find any how to or information online. > > Please help! > > -- > Louie Miranda ([EMAIL PROTECTED]) > http://www.axishift.com > > Security Is A Series Of Well-Defined Steps > chmod -R 0 / ; and smile :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Is it possible to restart Windows Apache (service) on a PHP script?
Is it possible to restart Windows Apache (service) on a PHP script? i have installed PHP/Apache on a Windows machine. Added the ext windows32 service. But could not find any how to or information online. Please help! -- Louie Miranda ([EMAIL PROTECTED]) http://www.axishift.com Security Is A Series Of Well-Defined Steps chmod -R 0 / ; and smile :)
[PHP] Is it possible to create a php.so
I have several background processes written in PHP. In our design, we have the parent process which check if there is work to process, and if so launch a child process via exec() to do actual work. By design, we want the child process to do just what it was told to do and gracefully terminate. We don't want the child process to live longer than 10 minutes. My coworker looked at ZendPlatform, and APC, but he found that these does not do anything for PHP program that are run from command line. I know at this point ZendPlatform does not support command line. Is this true with APC? Is there any other caching implementation that we can use? Is it possible to compile PHP so that the core of it is in a dynamically linked library (I am running in a Linux/Unix environment)? Can I turn my PHP code into a dynamic link library ? Thanks Khai -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to disable eval()?
Thank you. It is already enough for me. It works. On 8/16/07, Steffen Ebermann <[EMAIL PROTECTED]> wrote: > On Thu, Aug 16, 2007 at 09:50:30PM +0800, hshh wrote: > > I try to disable eval() function in php script, but failed. > > In php.ini disable_functions=eval is not work, but other functions. > > So, is it possible to disable eval()? Thanks. > > It don't work because eval() isn't a function. > > The Suhosin protection system would let you do so. If an option: > http://www.hardened-php.net/suhosin/configuration.html#suhosin.executor.disable_eval > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to disable eval()?
On Thu, Aug 16, 2007 at 09:50:30PM +0800, hshh wrote: > I try to disable eval() function in php script, but > failed. In php.ini disable_functions=eval is not work, > but other functions. > So, is it possible to disable eval()? Thanks. It don't work because eval() isn't a function. The Suhosin protection system would let you do so. If an option: http://www.hardened-php.net/suhosin/configuration.html#suhosin.executor.disable_eval -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Is it possible to disable eval()?
Hi, I try to disable eval() function in php script, but failed. In php.ini disable_functions=eval is not work, but other functions. So, is it possible to disable eval()? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to stop an image from being cached?
Dan wrote: ... You should also look at this: http://www.mnot.net/cache_docs/ Very informative. -- Richard Heyes +44 (0)844 801 1072 http://www.websupportsolutions.co.uk Knowledge Base and HelpDesk software that can cut the cost of online support -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to stop an image from being cached?
On Thu, July 26, 2007 6:32 pm, Tijnema wrote: > Also, if you use solution 2, the image will still stay forever in the Not forever. Just until something else being downloaded shoves it out due to the folder size restriction. The browser might even be "smart" and keep oft-used resources in the cache in favor of others rather than be strictly FIFO. So a random URL makes browsers that were dumb enough to cache something they shouldn't have cached (if you sent no cache headers) "clog" up their cache with the un-re-usable files that it shouldn't have saved anyway. Oooh, hurt me. :-) -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to stop an image from being cached?
On Thu, July 26, 2007 4:56 pm, Dan wrote: > Is there any tactic short of changing the name constantly of the image > to > avoid browser caching of an image? You can try to use all the zillion header calls people will send you. Somewhere out there is a really stupid browser that will insist on caching it. src="somebody.jpg?" will make it very difficult for any halfway-decent browser to cache. However, that can lead to some issues when the URL of the image is embedded elsewhere, as some folks will strip off the GET arg on the assumption that it's invalid for a JPEG. Embedding the random bit so that it LOOKS like a directory, but isn't, will avoid that problem. I blogged about how to do this kind of thing (in another context) over here: http://richardlynch.blogspot.com/2006/06/php-downloads-content-disposition.html There are shorter / better explanations out there, but I don't know where without Googling, and you know how to Google, right? -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to stop an image from being cached?
Awesome, seems to work. Thanks Tijnema! - Dan ""Dan"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Well, this is only one specific image that constantly changes, the rest of the page is handled regularly. From what you've said if I go with this header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past That will effect only the one specific image I use this on when generating it right? - Dan "Tijnema" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On 7/27/07, Dan <[EMAIL PROTECTED]> wrote: Is this header you're refering to the header of the page which contains the image, or the image itself? - Dan The image itself. Also note, that if you use my solution 2, you still might get problems, as the page that is calling might be cached, and in the cached page, it refers to the image with the same unique code, and it will use the cached image again. Also, if you use solution 2, the image will still stay forever in the temp folder of the browser(unless the user is cleaning it). If you use solution 1, the browser will keep it only for this page, and will remove it afterwards. Tijnema "Tijnema" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On 7/27/07, brian <[EMAIL PROTECTED]> wrote: >> Tijnema wrote: >> > On 7/26/07, Dan <[EMAIL PROTECTED]> wrote: >> > >> >> I have a situation where there is a single image let's call it >> >> somebody.jpg. >> >> I want to be able to dynamicly create this image using php, >> >> basicilly >> >> I have >> >> PHP set to handle .jpg files also, so I then go through and create >> >> an >> >> image >> >> based upon some info I get from a database call and then use >> >> header('Content-Type: image/jpeg'); >> >> passthru($file); >> >> to send the image to the user. >> >> >> >> My problem is once they view the image their browser "helpfully" >> >> caches it >> >> so they don't have to download it again. >> >> >> >> Is there any tactic short of changing the name constantly of the >> >> image >> >> to >> >> avoid browser caching of an image? >> >> >> >> - Dan >> > >> > >> > Solution 1: >> > Send a header() that avoids caching (can't remember it exactly) >> >> You can try: >> >> header('Cache-Control: no-store, no-cache, must-revalidate, >> Post-Check=0, Pre-Check=0'); >> >> brian > > That's HTTP/1.1 only, but this is what I got from PHP site: > header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 > header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past > ?> > > Tijnema > > -- > Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to stop an image from being cached?
Well, this is only one specific image that constantly changes, the rest of the page is handled regularly. From what you've said if I go with this header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past That will effect only the one specific image I use this on when generating it right? - Dan "Tijnema" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On 7/27/07, Dan <[EMAIL PROTECTED]> wrote: Is this header you're refering to the header of the page which contains the image, or the image itself? - Dan The image itself. Also note, that if you use my solution 2, you still might get problems, as the page that is calling might be cached, and in the cached page, it refers to the image with the same unique code, and it will use the cached image again. Also, if you use solution 2, the image will still stay forever in the temp folder of the browser(unless the user is cleaning it). If you use solution 1, the browser will keep it only for this page, and will remove it afterwards. Tijnema "Tijnema" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On 7/27/07, brian <[EMAIL PROTECTED]> wrote: >> Tijnema wrote: >> > On 7/26/07, Dan <[EMAIL PROTECTED]> wrote: >> > >> >> I have a situation where there is a single image let's call it >> >> somebody.jpg. >> >> I want to be able to dynamicly create this image using php, >> >> basicilly >> >> I have >> >> PHP set to handle .jpg files also, so I then go through and create >> >> an >> >> image >> >> based upon some info I get from a database call and then use >> >> header('Content-Type: image/jpeg'); >> >> passthru($file); >> >> to send the image to the user. >> >> >> >> My problem is once they view the image their browser "helpfully" >> >> caches it >> >> so they don't have to download it again. >> >> >> >> Is there any tactic short of changing the name constantly of the >> >> image >> >> to >> >> avoid browser caching of an image? >> >> >> >> - Dan >> > >> > >> > Solution 1: >> > Send a header() that avoids caching (can't remember it exactly) >> >> You can try: >> >> header('Cache-Control: no-store, no-cache, must-revalidate, >> Post-Check=0, Pre-Check=0'); >> >> brian > > That's HTTP/1.1 only, but this is what I got from PHP site: > header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 > header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past > ?> > > Tijnema > > -- > Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to stop an image from being cached?
On 7/27/07, Dan <[EMAIL PROTECTED]> wrote: Is this header you're refering to the header of the page which contains the image, or the image itself? - Dan The image itself. Also note, that if you use my solution 2, you still might get problems, as the page that is calling might be cached, and in the cached page, it refers to the image with the same unique code, and it will use the cached image again. Also, if you use solution 2, the image will still stay forever in the temp folder of the browser(unless the user is cleaning it). If you use solution 1, the browser will keep it only for this page, and will remove it afterwards. Tijnema "Tijnema" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On 7/27/07, brian <[EMAIL PROTECTED]> wrote: >> Tijnema wrote: >> > On 7/26/07, Dan <[EMAIL PROTECTED]> wrote: >> > >> >> I have a situation where there is a single image let's call it >> >> somebody.jpg. >> >> I want to be able to dynamicly create this image using php, basicilly >> >> I have >> >> PHP set to handle .jpg files also, so I then go through and create an >> >> image >> >> based upon some info I get from a database call and then use >> >> header('Content-Type: image/jpeg'); >> >> passthru($file); >> >> to send the image to the user. >> >> >> >> My problem is once they view the image their browser "helpfully" >> >> caches it >> >> so they don't have to download it again. >> >> >> >> Is there any tactic short of changing the name constantly of the image >> >> to >> >> avoid browser caching of an image? >> >> >> >> - Dan >> > >> > >> > Solution 1: >> > Send a header() that avoids caching (can't remember it exactly) >> >> You can try: >> >> header('Cache-Control: no-store, no-cache, must-revalidate, >> Post-Check=0, Pre-Check=0'); >> >> brian > > That's HTTP/1.1 only, but this is what I got from PHP site: > header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 > header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past > ?> > > Tijnema > > -- > Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to stop an image from being cached?
Is this header you're refering to the header of the page which contains the image, or the image itself? - Dan "Tijnema" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On 7/27/07, brian <[EMAIL PROTECTED]> wrote: Tijnema wrote: > On 7/26/07, Dan <[EMAIL PROTECTED]> wrote: > >> I have a situation where there is a single image let's call it >> somebody.jpg. >> I want to be able to dynamicly create this image using php, basicilly >> I have >> PHP set to handle .jpg files also, so I then go through and create an >> image >> based upon some info I get from a database call and then use >> header('Content-Type: image/jpeg'); >> passthru($file); >> to send the image to the user. >> >> My problem is once they view the image their browser "helpfully" >> caches it >> so they don't have to download it again. >> >> Is there any tactic short of changing the name constantly of the image >> to >> avoid browser caching of an image? >> >> - Dan > > > Solution 1: > Send a header() that avoids caching (can't remember it exactly) You can try: header('Cache-Control: no-store, no-cache, must-revalidate, Post-Check=0, Pre-Check=0'); brian That's HTTP/1.1 only, but this is what I got from PHP site: Tijnema -- Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to stop an image from being cached?
On 7/27/07, Chris Aitken <[EMAIL PROTECTED]> wrote: >> header('Cache-Control: no-store, no-cache, must-revalidate, >> Post-Check=0, Pre-Check=0'); >> >> brian > >That's HTTP/1.1 only, but this is what I got from PHP site: >header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 >header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past >?> > But wouldn't that make every image on the page be uncached and reloaded each time? Not very efficient if the shell of the site keeps getting loaded if only 1 or 2 images need to be forced. Regards Chris Aitken The Web Hub Designer and Programmer Phone : 02 4648 0808 Mobile : 0411 132 075 Yes, that depends on which way it is used, I wouldn't recommend loading images from the database that don't get changed... And you can of course also use an if-statement/switch-statement/in_array function in your image.php script, like this: $img = $_GET['img']; if($img == "test_a.jpg" || $img == "test_b.jpg") { header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past } OR: $img = $_GET['img']; switch($img) { case "test_a.jpg": case "test_b.jpg": header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past } OR: $img = $_GET['img']; $noncached_images = array("test_a.jpg","test_b.jpg"); if(in_array($img,$noncached_images)) { header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past } Tijnema -- Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Is it possible to stop an image from being cached?
>> header('Cache-Control: no-store, no-cache, must-revalidate, >> Post-Check=0, Pre-Check=0'); >> >> brian > >That's HTTP/1.1 only, but this is what I got from PHP site: >header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 >header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past >?> > But wouldn't that make every image on the page be uncached and reloaded each time? Not very efficient if the shell of the site keeps getting loaded if only 1 or 2 images need to be forced. Regards Chris Aitken The Web Hub Designer and Programmer Phone : 02 4648 0808 Mobile : 0411 132 075 - Making The Web Work The Web Hub http://www.thewebhub.com.au/ [EMAIL PROTECTED] - Confidentiality Statement: This message is intended only for the use of the Addressee and may contain information that is PRIVILEDGED and CONFIDENTIAL. If you are not the intended recipient, dissemination of this communication is prohibited. If you have received this communication in error, please erase all copies of the message and its attachments and notify us immediately. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to stop an image from being cached?
On 7/27/07, brian <[EMAIL PROTECTED]> wrote: Tijnema wrote: > On 7/26/07, Dan <[EMAIL PROTECTED]> wrote: > >> I have a situation where there is a single image let's call it >> somebody.jpg. >> I want to be able to dynamicly create this image using php, basicilly >> I have >> PHP set to handle .jpg files also, so I then go through and create an >> image >> based upon some info I get from a database call and then use >> header('Content-Type: image/jpeg'); >> passthru($file); >> to send the image to the user. >> >> My problem is once they view the image their browser "helpfully" >> caches it >> so they don't have to download it again. >> >> Is there any tactic short of changing the name constantly of the image to >> avoid browser caching of an image? >> >> - Dan > > > Solution 1: > Send a header() that avoids caching (can't remember it exactly) You can try: header('Cache-Control: no-store, no-cache, must-revalidate, Post-Check=0, Pre-Check=0'); brian That's HTTP/1.1 only, but this is what I got from PHP site: Tijnema -- Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to stop an image from being cached?
Tijnema wrote: On 7/26/07, Dan <[EMAIL PROTECTED]> wrote: I have a situation where there is a single image let's call it somebody.jpg. I want to be able to dynamicly create this image using php, basicilly I have PHP set to handle .jpg files also, so I then go through and create an image based upon some info I get from a database call and then use header('Content-Type: image/jpeg'); passthru($file); to send the image to the user. My problem is once they view the image their browser "helpfully" caches it so they don't have to download it again. Is there any tactic short of changing the name constantly of the image to avoid browser caching of an image? - Dan Solution 1: Send a header() that avoids caching (can't remember it exactly) You can try: header('Cache-Control: no-store, no-cache, must-revalidate, Post-Check=0, Pre-Check=0'); brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Is it possible to stop an image from being cached?
> Solution 1: > Send a header() that avoids caching (can't remember it exactly) > Solution 2: > Call the image like this: > > Or if you were creating it with a php script: > My preferred way of doing it, and making sure its reloaded each time is to do it this way... the U variable pretty much guarantees a random string each time its loaded. image.jpg?".date("U")." Regards Chris Aitken The Web Hub Designer and Programmer Phone : 02 4648 0808 Mobile : 0411 132 075 - Making The Web Work The Web Hub http://www.thewebhub.com.au/ [EMAIL PROTECTED] - Confidentiality Statement: This message is intended only for the use of the Addressee and may contain information that is PRIVILEDGED and CONFIDENTIAL. If you are not the intended recipient, dissemination of this communication is prohibited. If you have received this communication in error, please erase all copies of the message and its attachments and notify us immediately. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to stop an image from being cached?
On 7/26/07, Dan <[EMAIL PROTECTED]> wrote: I have a situation where there is a single image let's call it somebody.jpg. I want to be able to dynamicly create this image using php, basicilly I have PHP set to handle .jpg files also, so I then go through and create an image based upon some info I get from a database call and then use header('Content-Type: image/jpeg'); passthru($file); to send the image to the user. My problem is once they view the image their browser "helpfully" caches it so they don't have to download it again. Is there any tactic short of changing the name constantly of the image to avoid browser caching of an image? - Dan Solution 1: Send a header() that avoids caching (can't remember it exactly) Solution 2: Call the image like this: Or if you were creating it with a php script: Tijnema -- Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Is it possible to stop an image from being cached?
I have a situation where there is a single image let's call it somebody.jpg. I want to be able to dynamicly create this image using php, basicilly I have PHP set to handle .jpg files also, so I then go through and create an image based upon some info I get from a database call and then use header('Content-Type: image/jpeg'); passthru($file); to send the image to the user. My problem is once they view the image their browser "helpfully" caches it so they don't have to download it again. Is there any tactic short of changing the name constantly of the image to avoid browser caching of an image? - Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to get the name of the top most calling script?
On Sat, June 9, 2007 7:18 pm, barophobia wrote: > I know that __FILE__ and __LINE__ report on the file and line that > they occur in. What I want is to be able to get the file name and line > of the calling script. The only way I can do this so far is by passing > the values through function arguments. > > Is there any way around this? If you want the main file, var_dump($_SERVER); If you want the whole backtrace, search php.net for backtrace function. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to get the name of the top most calling script?
On 6/10/07, barophobia <[EMAIL PROTECTED]> wrote: Hello, I know that __FILE__ and __LINE__ report on the file and line that they occur in. What I want is to be able to get the file name and line of the calling script. The only way I can do this so far is by passing the values through function arguments. Is there any way around this? Thanks, Chris. You could also use the the suberglobal $GLOBALS Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Is it possible to get the name of the top most calling script?
Hello, I know that __FILE__ and __LINE__ report on the file and line that they occur in. What I want is to be able to get the file name and line of the calling script. The only way I can do this so far is by passing the values through function arguments. Is there any way around this? Thanks, Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is it possible to manipulate vars here..
On 02/08/06, Jochen Kaechelin <[EMAIL PROTECTED]> wrote: .. to build a url like http://devil.server.com/vitims_page.php?? Not sure what you're trying to do, but switch register_globals OFF. Also, if you are trying to concatenate strings inside the function, use ., not +. -- http://www.web-buddha.co.uk http://www.projectkarma.co.uk
[PHP] is it possible to manipulate vars here..
.. to build a url like http://devil.server.com/vitims_page.php?? // a,b,c,d are coming from a form // and are defined in a dropdown of the form // there are no form fields which can be filled by the user // a maybe Germany, England // b maybe Support, Training // register_globals = on function build_url(a,b,c,d) { $urlpart[a] = "parta"; // $urlpart["Germany"] = "Stuttgart"; $urlpart[b] = "partb"; $urlpart[c] = "partc"; $urlpart[d] = "partd"; $url = ""; if($a!="") $url.= $url+$urlpart[a]; if($b!="") $url.= $url+$urlpart[b]; if($c!="") $url.= $url+$urlpart[c]; if($d!="") $url.= $url+$urlpart[d]; return $url; } $link = build_url($a,$b,$c,$d); echo $link; -- Jochen Kaechelin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Is it possible to use header() to POST form data?
[snip] Does anyone know if it's possible to use the header() function to POST form data to a URL? If so what syntax needs to be used? [/snip] You will want to check out http://www.php.net/curl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to use header() to POST form data?
On Thu, Dec 15, 2005 at 03:02:01PM -0800, pw wrote: > Philip Hallstrom wrote: > >>Does anyone know if it's possible to use the > >>header() function to POST form data to a URL? > >> > >>If so what syntax needs to be used? > > > > > >No, but a quick search for "HTTP POST PHP example" will get you the code > >you need. > > > > Thanks, > > I googled and, as you said, there was code there. > > 'sendToHost' I've always disliked this well known function, mostly because it is prone to to many unexepcted errors, and that for the fact that it is very old. You would be best off using on of the following solutions: http:://php.net/curl http://php.net/fsockopen (note the ability to handle errors in Example 1) http://us3.php.net/manual/en/ref.stream.php (if you want to write your own) Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to use header() to POST form data?
Philip Hallstrom wrote: Does anyone know if it's possible to use the header() function to POST form data to a URL? If so what syntax needs to be used? No, but a quick search for "HTTP POST PHP example" will get you the code you need. Thanks, I googled and, as you said, there was code there. 'sendToHost' Hopefully it's current enough to work for me. Thanks again, Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to use header() to POST form data?
Does anyone know if it's possible to use the header() function to POST form data to a URL? If so what syntax needs to be used? No, but a quick search for "HTTP POST PHP example" will get you the code you need. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Is it possible to use header() to POST form data?
Hello, Does anyone know if it's possible to use the header() function to POST form data to a URL? If so what syntax needs to be used? Thanks, Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to save a file with UTF-8 encoding and noBOM using PHP?
Thanks also, Richard! You were right on. Just a note: I just visited the W3C validation service again, and it seems they have recently updated it. It no longer complains if it finds a BOM in your document binary. So it would appear that it's no longer an issue with enough XML parsers to be relevant anymore. Still, it is nice to have a program -like I do- that has that flexibility. -Jon "Richard Lynch" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Thu, April 28, 2005 4:14 am, Jon M. said: >> No matter what I do to the strings to encode them in whatever format >> before >> using "fwrite", it ALWAYS seems to end up writing the actual file in >> "iso-8859-1". > > How do you know? > > What are you using to determine the format of the file? > > We are contending that either you are *not* writing UTF-8 data, but are > writing iso-8859-1 data, or the software telling you that it's not UTF-8 > is just plain *wrong* > > fwrite just takes your data and dumps it on the hard drive. > > It doesn't know UTF-8 from U2. > >> Isn't the encoding of the characters in PHP's strings, and the encoding >> of >> the actual binary file on your hard drive, two totally different things? >> Or >> am I just misinformed? > > You are mis-informed. > >> How do you actually control the way the binary file itself is written, >> and >> not just the text that is saved in the file? > > If you are using Windows, then *WINDOWS* is, perhaps, guessing on the > binary format based on the file 'extension' (.txt) and on the contents. > > First, try renaming the file to, err, whatever Windows thinks UTF-8 file > extensions should be... ".utf8" ??? Whatever Notepad uses. > > Next, forget what Windows desktop tells you. It's bull. > > When you get the data back out of the file, what format is it? > > PS You may be confusing Windows by writing UTF-8 without the BOM, and so > Windows then thinksit's iso-8859-1, because it's no longer a valid UTF-8 > file! You can make Windows happy; or you can make W3c happy. Not both. > > -- > Like Music? > http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to save a file with UTF-8 encoding and noBOMusing PHP?
(Rasmus wrote:) "If you fwrite UTF-8 data to the file, then it is a UTF-8 file." Thanks Rasmus! Honestly, that is REALLY helpful! I was just coming back here to post that I had found that very same answer. But I am glad to hear it confirmed by the experts. Bottom line: I was just being silly/ignorant. I went and downloaded a simple HEX editor and compared the actual binary output of several files that I had created using both PHP, and my favorite text editor (emeditor from emeditor.com). I then realized what probably everyone else here already knew: that (most of the time) the actual binary output from "Windows 1252" and "ISO-8859-1" and "UTF-8 without the byte order mark" -are completely identical! I had the false impression that when a file was saved in UTF-8, that there was an actual binary "marker" that specified this (e.g. binary marker = "This file is saved in UTF-8!") -there simply is no such thing. The only thing that would set "UTF-8" apart -binarilly speaking- is the BOM, and I had stripped that out, making the file exactly the same as plain old "ANSI" (since I didn't have any characters that required "UTF-8", like from other languages etc.). My text editor displays the current character encoding in the status bar, but since there was no way for it to tell whether it was saved with Windows 1252 or UTF-8, it just displayed that the file was encoded "windows default - ISO-8859-1". This is where I got confused. It turned out that my PHP script has been faithfully saving the file in UTF-8 the whole time, and everything was fine. I was just not educated enough about what actually changed when you save a file in UTF-8 but didn't have any characters that differed from ANSI (which in my case, the "change" was nothing, since ALL of the characters in my test document where interchangeable with ANSI). Well, this has been a learning experience! I hope that this post will help some poor ignoramus like myself, sometime in the future! :) And hopefully I am right about what I said above, and not flaunting my ignorance once again -lol Thanks again, to everyone who helped me! You guys really got me on the right track. Not the least of which was simply causing me to think about what I was asking more deeply. -Jon "Rasmus Lerdorf" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Jon M. wrote: >> No matter what I do to the strings to encode them in whatever format >> before using "fwrite", it ALWAYS seems to end up writing the actual file >> in "iso-8859-1". >> >> Isn't the encoding of the characters in PHP's strings, and the encoding >> of the actual binary file on your hard drive, two totally different >> things? Or am I just misinformed? > > A file is completely defined by its contents. If you fwrite UTF-8 data to > the file, then it is a UTF-8 file. Whether your editor, or whatever it is > you are using to determine the file is being written as iso-8859-1 is > smart enough to pick this up is a completely different question. > > Why don't you try creating the same contents with PHP and with your > preferred text editor and then compare the contents. Perhaps your editor > is dropping a hint somewhere in it that you are not writing to the file > from PHP. > > -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to save a file with UTF-8 encoding and noBOM using PHP?
Jon M. wrote: No matter what I do to the strings to encode them in whatever format before using "fwrite", it ALWAYS seems to end up writing the actual file in "iso-8859-1". Isn't the encoding of the characters in PHP's strings, and the encoding of the actual binary file on your hard drive, two totally different things? Or am I just misinformed? A file is completely defined by its contents. If you fwrite UTF-8 data to the file, then it is a UTF-8 file. Whether your editor, or whatever it is you are using to determine the file is being written as iso-8859-1 is smart enough to pick this up is a completely different question. Why don't you try creating the same contents with PHP and with your preferred text editor and then compare the contents. Perhaps your editor is dropping a hint somewhere in it that you are not writing to the file from PHP. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to save a file with UTF-8 encoding and noBOM using PHP?
On Thu, April 28, 2005 4:14 am, Jon M. said: > No matter what I do to the strings to encode them in whatever format > before > using "fwrite", it ALWAYS seems to end up writing the actual file in > "iso-8859-1". How do you know? What are you using to determine the format of the file? We are contending that either you are *not* writing UTF-8 data, but are writing iso-8859-1 data, or the software telling you that it's not UTF-8 is just plain *wrong* fwrite just takes your data and dumps it on the hard drive. It doesn't know UTF-8 from U2. > Isn't the encoding of the characters in PHP's strings, and the encoding of > the actual binary file on your hard drive, two totally different things? > Or > am I just misinformed? You are mis-informed. > How do you actually control the way the binary file itself is written, and > not just the text that is saved in the file? If you are using Windows, then *WINDOWS* is, perhaps, guessing on the binary format based on the file 'extension' (.txt) and on the contents. First, try renaming the file to, err, whatever Windows thinks UTF-8 file extensions should be... ".utf8" ??? Whatever Notepad uses. Next, forget what Windows desktop tells you. It's bull. When you get the data back out of the file, what format is it? PS You may be confusing Windows by writing UTF-8 without the BOM, and so Windows then thinksit's iso-8859-1, because it's no longer a valid UTF-8 file! You can make Windows happy; or you can make W3c happy. Not both. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to save a file with UTF-8 encoding and noBOM using PHP?
> 1. First I want to know how to make the actual binary file that is written, > to be encoded as UTF-8. This is my PRIMARY question. I think this part is the key. If the string originated from your text editor, then your text editor needs to be in UTF-8 mode. If you are importing the data from a file or database then you need to be sure that the data is UTF-8 encoded. If you know that the encoding is instead ISO-8859-1 then you can convert it to UTF-8 with the php function utf_encode. fwrite will then write out the bytes that you presented to it. I guess the same applies in reverse when you read the file back in to the application that will view the text. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to save a file with UTF-8 encoding and noBOM using PHP?
Wow, nice to hear from the guy who created PHP! :) I need to make 2 things clearer though: 1. First I want to know how to make the actual binary file that is written, to be encoded as UTF-8. This is my PRIMARY question. 2. How to have "fwrite" write the file without the BOM. (to make it more compatible with certain XML parsers -per the W3C's recommendation). No matter what I do to the strings to encode them in whatever format before using "fwrite", it ALWAYS seems to end up writing the actual file in "iso-8859-1". Isn't the encoding of the characters in PHP's strings, and the encoding of the actual binary file on your hard drive, two totally different things? Or am I just misinformed? Example: When I open up Windows "Notepad", then I type some stuff into it, and then I choose "file", "save as", "encoding: UTF-8", then I click "save". So how do I do this SAME thing using PHP? Could someone give me a actual code example of how to do that? I'm just s lost. How do you actually control the way the binary file itself is written, and not just the text that is saved in the file? "Rasmus Lerdorf" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Jon M. wrote: >> "Richard Lynch" <[EMAIL PROTECTED]> wrote in message >> news:[EMAIL PROTECTED] >> >>>On Thu, April 21, 2005 5:07 pm, Jon M. said: >>> I am trying to have a file that I generated with PHP saved as UTF-8 without the BOM (Byte Order Mark). Does PHP do anything like this? I am a beginner with PHP, but very technically experienced otherwise. I'm talking about the FILE encoding here -just to be clear. e.g. fopen("what_ever_file", "a+") now I want PHP save the file itself with UTF-8, NOT system default. I have searched for hours to find an answer, but have not found any info on the subject. Does PHP have any ability to create a text file saved in UTF-8 encoding??? >>> >>>Maybe I'm just being dumb, but I think if you UTF-8 encode your data, and >>>http://php.net/fwrite it, you're gonna get what you want... >>> >>>Dunno about the Byte-Order-Mark part, but I guess you could strip it out >>>of the UTF-8 encoded data before writing, if you wanted to. >>> >>>-- >>>Like Music? >>>http://l-i-e.com/artists.htm >> >> >> >> That was the first thing I tried, and it doesn't seem to work (it always >> saves in windows default encoding). Unless I missing something about what >> you can do with fwrite. Did you actually test that before you replied, >> and found that it would? If so, how? The Byte Order Mark is a part of the >> binary file that is written, how would one go about stripping it out?? >> >> BTW, note to PHP developers: If "fwrite" had a "encoding" parameter, e.g. >> "UTF-8", that would be REALLY handy. > > Strings in PHP are binary-safe and character-encoding neutral. fwrite > doesn't have a clue what it is writing, it just writes what is in memory. > > I'd question why you would want to strip the BOM. Any modern system deals > with the byte-order-mark correctly. But you can simply strip it manually > if it is present in the first 2 bytes before your fwrite if you really > need to get rid of it. > > -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to save a file with UTF-8 encoding and no BOM using PHP?
On Fri, April 22, 2005 9:54 pm, Rasmus Lerdorf said: >>>Maybe I'm just being dumb, but I think if you UTF-8 encode your data, >>> and >>>http://php.net/fwrite it, you're gonna get what you want... >>> >>>Dunno about the Byte-Order-Mark part, but I guess you could strip it out >>>of the UTF-8 encoded data before writing, if you wanted to. >> >> That was the first thing I tried, and it doesn't seem to work (it always >> saves in windows default encoding). Unless I missing something about >> what >> you can do with fwrite. Did you actually test that before you replied, >> and >> found that it would? If so, how? The Byte Order Mark is a part of the >> binary >> file that is written, how would one go about stripping it out?? I didn't try anything. I wouldn't know a UTF-8 it it walked up and bit me on the ass. :-) But I *do* know that PHP's fwrite is much too low-level to be doing encoding types and whatnot. It just writes whatever you tell it. If you think it's always saving in windows default encoding, perhaps your test is not distinguishing between having no BOM (whatever that is) and having the Windows BOM or whatever makes you think it's Windows format. As far as getting rid of the BOM, assuming you've got your UTF-8 string thingie, and you know where the BOM occurs, you'd just use http://php.net/substr on it, I reckon... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to save a file with UTF-8 encoding and no BOM using PHP?
Jon M. wrote: "Richard Lynch" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On Thu, April 21, 2005 5:07 pm, Jon M. said: I am trying to have a file that I generated with PHP saved as UTF-8 without the BOM (Byte Order Mark). Does PHP do anything like this? I am a beginner with PHP, but very technically experienced otherwise. I'm talking about the FILE encoding here -just to be clear. e.g. fopen("what_ever_file", "a+") now I want PHP save the file itself with UTF-8, NOT system default. I have searched for hours to find an answer, but have not found any info on the subject. Does PHP have any ability to create a text file saved in UTF-8 encoding??? Maybe I'm just being dumb, but I think if you UTF-8 encode your data, and http://php.net/fwrite it, you're gonna get what you want... Dunno about the Byte-Order-Mark part, but I guess you could strip it out of the UTF-8 encoded data before writing, if you wanted to. -- Like Music? http://l-i-e.com/artists.htm That was the first thing I tried, and it doesn't seem to work (it always saves in windows default encoding). Unless I missing something about what you can do with fwrite. Did you actually test that before you replied, and found that it would? If so, how? The Byte Order Mark is a part of the binary file that is written, how would one go about stripping it out?? BTW, note to PHP developers: If "fwrite" had a "encoding" parameter, e.g. "UTF-8", that would be REALLY handy. Strings in PHP are binary-safe and character-encoding neutral. fwrite doesn't have a clue what it is writing, it just writes what is in memory. I'd question why you would want to strip the BOM. Any modern system deals with the byte-order-mark correctly. But you can simply strip it manually if it is present in the first 2 bytes before your fwrite if you really need to get rid of it. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to save a file with UTF-8 encoding and no BOM using PHP?
"Richard Lynch" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Thu, April 21, 2005 5:07 pm, Jon M. said: >> I am trying to have a file that I generated with PHP saved as UTF-8 >> without >> the BOM (Byte Order Mark). Does PHP do anything like this? I am a >> beginner >> with PHP, but very technically experienced otherwise. I'm talking about >> the >> FILE encoding here -just to be clear. >> >> e.g. fopen("what_ever_file", "a+") now I want PHP save the file itself >> with >> UTF-8, NOT system default. >> >> I have searched for hours to find an answer, but have not found any info >> on >> the subject. >> >> Does PHP have any ability to create a text file saved in UTF-8 >> encoding??? > > Maybe I'm just being dumb, but I think if you UTF-8 encode your data, and > http://php.net/fwrite it, you're gonna get what you want... > > Dunno about the Byte-Order-Mark part, but I guess you could strip it out > of the UTF-8 encoded data before writing, if you wanted to. > > -- > Like Music? > http://l-i-e.com/artists.htm That was the first thing I tried, and it doesn't seem to work (it always saves in windows default encoding). Unless I missing something about what you can do with fwrite. Did you actually test that before you replied, and found that it would? If so, how? The Byte Order Mark is a part of the binary file that is written, how would one go about stripping it out?? BTW, note to PHP developers: If "fwrite" had a "encoding" parameter, e.g. "UTF-8", that would be REALLY handy. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to save a file with UTF-8 encoding and no BOM using PHP?
On Thu, April 21, 2005 5:07 pm, Jon M. said: > I am trying to have a file that I generated with PHP saved as UTF-8 > without > the BOM (Byte Order Mark). Does PHP do anything like this? I am a beginner > with PHP, but very technically experienced otherwise. I'm talking about > the > FILE encoding here -just to be clear. > > e.g. fopen("what_ever_file", "a+") now I want PHP save the file itself > with > UTF-8, NOT system default. > > I have searched for hours to find an answer, but have not found any info > on > the subject. > > Does PHP have any ability to create a text file saved in UTF-8 encoding??? Maybe I'm just being dumb, but I think if you UTF-8 encode your data, and http://php.net/fwrite it, you're gonna get what you want... Dunno about the Byte-Order-Mark part, but I guess you could strip it out of the UTF-8 encoded data before writing, if you wanted to. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Is it possible to save a file with UTF-8 encoding and no BOM using PHP?
I am trying to have a file that I generated with PHP saved as UTF-8 without the BOM (Byte Order Mark). Does PHP do anything like this? I am a beginner with PHP, but very technically experienced otherwise. I'm talking about the FILE encoding here -just to be clear. e.g. fopen("what_ever_file", "a+") now I want PHP save the file itself with UTF-8, NOT system default. I have searched for hours to find an answer, but have not found any info on the subject. Does PHP have any ability to create a text file saved in UTF-8 encoding??? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Is it possible to get the whole address (including http:// ) ?
Hello, I know for example how to get http vars or basename, but this time I need to get the whole address, including http:// . Is it possible? Thanks in advance, Lab. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to pass arguements when using PHP before 4.3.n?[SOLVED]
Jay Blanchard wrote: Is it possible to pass arguements when using PHP before 4.3.n when doing command line stuff? I have built a small script that opens a file, reads from it, and returns some results. Instead of changing the fopen line each time I would just like to pass the name of the file to be tested. I tried as a URL /usr/local/bin/php mySmallScript.php?n=foo.php Didn't work. Wait... Heck. Works fine if you do not mind the headers. $argv and $argc are the answers. /usr/local/bin/php mySmallScript.php foo.php foo.php will be in $argv[1] Use -q if you don't want the headers: /usr/local/bin/php -q mySmallScript.php foo.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Is it possible to pass arguements when using PHP before 4.3.n?[SOLVED]
Is it possible to pass arguements when using PHP before 4.3.n when doing command line stuff? I have built a small script that opens a file, reads from it, and returns some results. Instead of changing the fopen line each time I would just like to pass the name of the file to be tested. I tried as a URL /usr/local/bin/php mySmallScript.php?n=foo.php Didn't work. Wait... Heck. Works fine if you do not mind the headers. $argv and $argc are the answers. /usr/local/bin/php mySmallScript.php foo.php foo.php will be in $argv[1] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Is it possible to see if a jpeg is RGB or CMYK via PHP GD2?
I'm allowing user to upload images to a gallery. However, some user seem to have both RGB and CMYK jpeg images. I get an error from ImageCreateFromJPEG when the script is creating thumbnails from a CMYK jpeg. Can I somehow see if the image is RGB or CMYK, so I know when to skip the automatic thumbnail creation? Regards, SED
RE: [PHP] is it possible to have the following URL?
Thank you so much. That worked perfectly. Don't know why I didn't think of trying the anchor tag there. susan -Original Message- From: Erwin Kerk [mailto:[EMAIL PROTECTED] Sent: Monday, September 22, 2003 11:48 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] is it possible to have the following URL? This should work: https://url_locaion.org/prev_page.php?SID=$SID&uid=$uid&ELEM_ID=$id#tag Erwin Susan Ator wrote: >I am passing 3 pieces of information on every URL. For example: > >https://url_location.org/page.php?SID=$SID&uid=$uid&ELEM_ID=$id > > >I need to be able to return to a previous page using an anchor tag like so: > >https://url_locaion.org/prev_page.php#tag?SID=$SID&uid=$uid&ELEM_ID=$id > >So far it doesn't work at all. Is this even possible? Just using the >javascript:history.go(-1) doesn't work in every browser. > >susan > > > -- 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] is it possible to have the following URL?
This should work: https://url_locaion.org/prev_page.php?SID=$SID&uid=$uid&ELEM_ID=$id#tag Erwin Susan Ator wrote: I am passing 3 pieces of information on every URL. For example: https://url_location.org/page.php?SID=$SID&uid=$uid&ELEM_ID=$id I need to be able to return to a previous page using an anchor tag like so: https://url_locaion.org/prev_page.php#tag?SID=$SID&uid=$uid&ELEM_ID=$id So far it doesn't work at all. Is this even possible? Just using the javascript:history.go(-1) doesn't work in every browser. susan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] is it possible to have the following URL?
I am passing 3 pieces of information on every URL. For example: https://url_location.org/page.php?SID=$SID&uid=$uid&ELEM_ID=$id I need to be able to return to a previous page using an anchor tag like so: https://url_locaion.org/prev_page.php#tag?SID=$SID&uid=$uid&ELEM_ID=$id So far it doesn't work at all. Is this even possible? Just using the javascript:history.go(-1) doesn't work in every browser. susan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to test an uploaded file to check the type?
> Is it possible to check a file in $_FILES['userfile']['tmp_name'] to > make sure it is of a certain format? I want to allow a user to only > upload jpegs or mpegs, and want to check what format the file is in. If there are only a few types, and you know what those types should look like, it shouldn't be too hard. Maybe. For instance, you could try having ypur application open the putative jpeg with the GIMP, and if the GIMP fails to open it or bombs, then your application rejects the upload. ;-P (If you actually did use the GIMP for this, however, you don't want to call the GIMP directly from PHP/Apache. Not only would it bog your web app down, but it would potentially open your site up to secure attacks against a piece of software that is not known to be secure. What you'd want is something like a cron job to look at the upload directory for new uploads and pass them to a script that would call the GIMP to do the check. That way, if the GIMP dies, there is no open shell connected to an IP port. The cron job would also want to call something to clean up any dead processes left around.) I think there are dedicated jpeg validation libraries floating around. Not sure about MPEG. If it's a simple format, you may be able to write your own parser (regex?) for it, in which case, maybe you only need to check the first 100 or 1000 or so bytes. Checking to make sure a file was _not_ an MS-DOS executable used to be fairly easy. Anyway, whether you parse or let the user tell you (MISE) depends on how careful you need to be (i. e., what your application is going to do with the upload). -- Joel Rees, programmer, Kansai Systems Group Altech Corporation (Alpsgiken), Osaka, Japan http://www.alpsgiken.co.jp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to test an uploaded file to checkthe type?
> Concerning infecting the server, if the files are chmodded without the > executable bit, shouldn't that be considered *safer* > It may seem that mime_content_type() isnt an option. I tried it on a > flash file, and it reported it as text/plain. Well, again, everything is dependent on what you're planning on doing with it. As an example, there are many, many, many web hosts out there that allow uploads of files through a form into a web directory. These forms can include CGI scripts. If a hacker uploads a malicious script and you don't have the proper permissions set (i.e. you're running apache as root) your system can be r00ted. Running PHP in safe mode does /a lot/ to help. Making sure any directories you need to make writable (i.e. file storage directories) have .htaccess files or (preferably) it set in the main apache config that they are off limits to web browsers also helps. There are linux virus protection programs available which can be run as a cron job to check files for windows viruses btw. I checked up the price on one and it was like $700 for a server license. :( -Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to test an uploaded file to check the type?
Thank you for your reply. A little background on what Im doing with file uploading. 1. Im allowing registered users to upload avatars for their own usage. 2. Im allowing image uploading for submitted articles by certain registered users. 3. And Im currently constructing a media gallery, where images, mp3, realaudio, etc can be presented/downloaded/streamed. All 3 points are based on a file upload class that I put together. Of which each section has their own allowed set of mime-types, based on what is supplied via $_FILES['xxx']['type'] An analogy that I have in mind is this. Lets look at the file upload class as the Post Office. They practically allow any package to be delivered to anyone by anyone. They do scrutiny checks on packages. Unfortunately, this one package, has a pipe bomb in it. Its delivered to my mailbox, and poses a threat. Now, is it the fault of the PostOffice for allowing that particular package through? What else can this PostOffice do to tighten things up? So Im at the point, where Im trying to figure out what else I can do to "tighten" scrutiny checks. Concerning infecting the server, if the files are chmodded without the executable bit, shouldn't that be considered *safer* It may seem that mime_content_type() isnt an option. I tried it on a flash file, and it reported it as text/plain. What would really be cool, is a php extension to a virus scanner. (Hey can I dream) Once again, thanks for your pointers/thoughts/comments. Dan Anderson wrote: There are some very good reasons to check a file's mime type. For one thing, if you send a user an executable when you meant to send them a jpg, and that executable unleashes a virus, that is no good. Not only will noone visit your site if they know you are a source of viruses, you may get sued for damages. (Computers are expensive!) Everything depends on how the file is used. If, for instance, the only person who will be downloading or handling the file will be the person who uploaded it, everything should be fine. (NObody's going to infect / r00t their own computer intentionally). But let's say you run the file yourself. In that case, that file can hurt your server. So basically, if you don't check your files scrupulously a hacker can and will do something evil. -Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to test an uploaded file to check thetype?
There are some very good reasons to check a file's mime type. For one thing, if you send a user an executable when you meant to send them a jpg, and that executable unleashes a virus, that is no good. Not only will noone visit your site if they know you are a source of viruses, you may get sued for damages. (Computers are expensive!) Everything depends on how the file is used. If, for instance, the only person who will be downloading or handling the file will be the person who uploaded it, everything should be fine. (NObody's going to infect / r00t their own computer intentionally). But let's say you run the file yourself. In that case, that file can hurt your server. So basically, if you don't check your files scrupulously a hacker can and will do something evil. -Dan On Mon, 2003-07-14 at 00:24, Gerard Samuel wrote: > Gerard Samuel wrote: > > >> A client-supplied value isn't going to be too useful - it can be > >> spoofed, or > >> may not be present. (I believe a Windows browser would set the mime-type > >> based purely on the file extension, though I haven't tested this > >> myself). > >> > > > > Then my apologies. I thought php determined the file type on upload, > > and not rely on user input as your're saying. > > Makes me rethink some of my own code :) > > Looking for opinions. Can a spoofed uploaded file hurt a script or a > webserver?? > Reason why Im asking is because, I looked over the magic.mime file on my > server, and I see that it > doesn't support flash files (I may be wrong), of which I currently allow > flash files to be uploaded. > So who knows what else it may not support. > I guess, can it really be bad for your script, your server, and/or your > health?? > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to test an uploaded file to check the type?
> So, check $_FILES['userfile']['type'] against a set of allowed file > types, and you're set... What about this: array getimagesize ( string filename [, array imageinfo]) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to test an uploaded file to check the type?
David Otton wrote: On Mon, 14 Jul 2003 00:24:03 -0400, you wrote: ... The show-resource.php script just has to set the correct mime type header and stream out the contents of the file. And it is safe to use the browser supplied mime type here. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to test an uploaded file to check the type?
On Mon, 14 Jul 2003 00:24:03 -0400, you wrote: >Looking for opinions. Can a spoofed uploaded file hurt a script or a >webserver?? >Reason why Im asking is because, I looked over the magic.mime file on my >server, and I see that it >doesn't support flash files (I may be wrong), of which I currently allow >flash files to be uploaded. >So who knows what else it may not support. >I guess, can it really be bad for your script, your server, and/or your >health?? The following is just uninformed opinion, as I haven't sat down and tested any of this, or even thought about it to any great degree. I'd welcome anyone telling me where I'm wrong. I wouldn't want user-created data to end up under the webroot. I'd always be worrying about, say, someone uploading a file that used SSI to sneak the database password file out of the server, or something. And even if I plugged that hole, there might be another, and another... rather than plug individual holes, I'd want to avoid that entire class of problems. The best approach, IMO, is to keep such uploaded files outside the webroot, and call them via a PHP script. Something like /show_resource.php?resourceid=1535 with the resource directory either wy over there, or (my preference) replaced by a database table. The show-resource.php script just has to set the correct mime type header and stream out the contents of the file. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php