php-general Digest 16 Apr 2011 13:36:27 -0000 Issue 7275
Topics (messages 312403 through 312408):
Re: $_POST vars
312403 by: Nathan Nobbe
312404 by: Stuart Dallas
312405 by: Jim Giner
How to write a PHP coding to list out all files and directories as links to
them?
312406 by: Mikhail S
312407 by: David Robley
Re: upload big files
312408 by: Daniel Jost
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net
To post to the list, e-mail:
php-gene...@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
On Thu, Apr 14, 2011 at 2:53 AM, Stuart Dallas <stu...@3ft9.com> wrote:
> On Thursday, 14 April 2011 at 07:11, Nathan Nobbe wrote:
> On Wed, Apr 13, 2011 at 3:30 PM, Stuart Dallas <stu...@3ft9.com> wrote:
> > > On Wednesday, 13 April 2011 at 19:47, Nathan Nobbe wrote:
> > > I never make any assumptions about the source of any data when I'm
> developing software, whether in PHP or not. Returning to a previous point,
> usage of global variables as the source of data anywhere other than the
> initial script a request hits is tantamount to negligence. But that's just
> my opinion.
> > Who said you should make assumptions. One thing you know is that $_POST
> was populated by the contents of HTTP POST, or most of it anyways, lol.
>
> Again, I don't see how that "knowledge" is useful?
>
you know what doesn't belong there.
> > Here's an example, suppose you have an object, any object in php should
> let you dynamically create a public member variable on it on the fly unless
> there's an explicit override in __get().
> >
> > $oXml = new
> SimpleXmlElement('<vendor-data><content>real-data</content></vendor-data>');
> >
> > now someone decides to use it to store something clever, because they
> can, and it's so much easier than creating an appropriate location
> >
> > $oXml->myCleverValue = 'something unrelated';
> >
> > whoops the client web service stopped processing our request successfully
> because the clever new node inadvertently broke the validation against the
> xsd.
> >
> > or I'm running through some code and see it in a for loop
> >
> > foreach($oXml as $node => $value)
> >
> > but I don't see any clever value in the docs from the vendor..
> >
> > Separation of concerns for data. The same reason you have a typical
> directory structure on an operating system and the same reason you don't
> have 10 projects all in the same vcs repository. but nothing is written in
> stone..
>
> Whoa, whoa, whoa! At what point did I say I think it's ok to put arbitrary
> data into $_POST?
when you suggested to OP to put the result of a query into $_POST.
> As I said in a previous email, I was responding to the OP's question which
> was essentially "is it possible to fake a form post" and the answer is yes
the question was more like, how do i abstract the input for a template such
that it can be supplied data via $_POST in one case and the result of a
select in another.
> I have at no point advocated using $_POST for data that you simply want to
> be globally available.
>
you've recommended populating $_POST with data that has nothing to do with
HTTP POST, it is by nature globally available.
-nathan
--- End Message ---
--- Begin Message ---
On Thursday, 14 April 2011 at 23:08, Nathan Nobbe wrote:
On Thu, Apr 14, 2011 at 2:53 AM, Stuart Dallas <stu...@3ft9.com> wrote:
> > On Thursday, 14 April 2011 at 07:11, Nathan Nobbe wrote:
> > On Wed, Apr 13, 2011 at 3:30 PM, Stuart Dallas <stu...@3ft9.com> wrote:
> > > > On Wednesday, 13 April 2011 at 19:47, Nathan Nobbe wrote:
> > > > I never make any assumptions about the source of any data when I'm
> > > > developing software, whether in PHP or not. Returning to a previous
> > > > point, usage of global variables as the source of data anywhere other
> > > > than the initial script a request hits is tantamount to negligence. But
> > > > that's just my opinion.
> > > Who said you should make assumptions. One thing you know is that $_POST
> > > was populated by the contents of HTTP POST, or most of it anyways, lol.
> >
> > Again, I don't see how that "knowledge" is useful?
>
> you know what doesn't belong there.
It's coming from the client, over which you have no control whatsoever. It
doesn't matter what you think you know about what it should contain, you
actually don't know anything about what it does contain and you should write
your code accordingly. You can't afford to assume anything about data coming
into your application from sources you don't control.
> > > Here's an example, suppose you have an object, any object in php should
> > > let you dynamically create a public member variable on it on the fly
> > > unless there's an explicit override in __get().
> > >
> > > $oXml = new
> > > SimpleXmlElement('<vendor-data><content>real-data</content></vendor-data>');
> > >
> > > now someone decides to use it to store something clever, because they
> > > can, and it's so much easier than creating an appropriate location
> > >
> > > $oXml->myCleverValue = 'something unrelated';
> > >
> > > whoops the client web service stopped processing our request successfully
> > > because the clever new node inadvertently broke the validation against
> > > the xsd.
> > >
> > > or I'm running through some code and see it in a for loop
> > >
> > > foreach($oXml as $node => $value)
> > >
> > > but I don't see any clever value in the docs from the vendor..
> > >
> > > Separation of concerns for data. The same reason you have a typical
> > > directory structure on an operating system and the same reason you don't
> > > have 10 projects all in the same vcs repository. but nothing is written
> > > in stone..
> >
> > Whoa, whoa, whoa! At what point did I say I think it's ok to put arbitrary
> > data into $_POST?
>
> when you suggested to OP to put the result of a query into $_POST.
Terminology confusion. To me, the "result of a query" is the data, not the
resource. Personally I think it was pretty clear that's what I meant based on
what the OP was planning to do, but I can see how that might not have been
crystal clear.
> > As I said in a previous email, I was responding to the OP's question which
> > was essentially "is it possible to fake a form post" and the answer is yes
>
>
> the question was more like, how do i abstract the input for a template such
> that it can be supplied data via $_POST in one case and the result of a
> select in another.
That's not what he asked, but it is one possible answer to his question.
> > I have at no point advocated using $_POST for data that you simply want to
> > be globally available.
> you've recommended populating $_POST with data that has nothing to do with
> HTTP POST, it is by nature globally available.
I have suggested that there is nothing wrong with modifying data in the $_POST
global variable to essentially fake that it had come from a form post. I never
suggested that it should be used as a generic global store.
I think we've started going around in circles and this is no longer benefiting
anyone. I think we're essentially saying the same thing, but where you're
relying on rules around how $_POST should be used I'm advocating vigilant
defensive programming techniques, and it seems we're going to have to agree to
disagree.
-Stuart
--
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
--- End Message ---
--- Begin Message ---
Guys - the problem has been solved.
Give it a rest.
(sent only to the list)
(remainder deleted for the benefit of all :) )
--- End Message ---
--- Begin Message ---
How to write a PHP coding to list out all files and directories as links to
them?
This is somewhat similar to some index pages. When new file or folder is
added to the directory, HTML page should display the newly created
file/folder together with previous ones after it is being refreshed. (prefer
in alphabatical order)
How to achieve this sort of functionality in PHP? Please provide sample
coding as well. (and any references)
Thanks.
--
Mike
http://jp.shopsloop.com/
--- End Message ---
--- Begin Message ---
Mikhail S wrote:
> How to write a PHP coding to list out all files and directories as links
> to them?
>
> This is somewhat similar to some index pages. When new file or folder is
> added to the directory, HTML page should display the newly created
> file/folder together with previous ones after it is being refreshed.
> (prefer in alphabatical order)
>
> How to achieve this sort of functionality in PHP? Please provide sample
> coding as well. (and any references)
>
> Thanks.
>
> --
> Mike
> http://jp.shopsloop.com/
Start with http://php.net/manual/en/function.opendir.php for a basic method.
Alternatively you can use the SPL DirectoryIterator class
http://php.net/manual/en/class.directoryiterator.php
http://php.net is your first resource for php
Cheers
--
David Robley
Hm..what's this red button fo:=/07<NO CARRIER
Today is Setting Orange, the 32nd day of Discord in the YOLD 3177.
--- End Message ---
--- Begin Message ---
hi!
this form would not really be a nice solution to upload 300mb. there would
be no progress bar and no other possibility for the user to get feedback.
you should consider to use a java uploaded - or a bit nicer - a javascript
based solution like this: http://www.uploadify.com/
<http://www.uploadify.com/>daniel
2011/4/14 Ricardo Martinez <harisel...@gmail.com>
> Hi List!
>
> Need can upload big files ( around 300MB ) the system must be easy of use (
> cann't use ftp ).
>
> Was thinking in make it, using a form with post, and update the cfg files
> for can upload big files.
> But don't know how it going to work. I think that can give a lot of errors
> or be unestable.
>
> Just asking if anyone had a project like this one ;)
>
> Greetings!
>
> --
> Ricardo
> _______________________________________________
> IT Architect
> website: http://www.pulsarinara.com
>
--- End Message ---