php-general Digest 19 Apr 2007 20:58:49 -0000 Issue 4744
php-general Digest 19 Apr 2007 20:58:49 - Issue 4744 Topics (messages 253251 through 253283): Re: Json.php 253251 by: Jochem Maas 253267 by: Roman Neuhauser serialize an object 253252 by: Tobias Wurst 253253 by: Stut 253254 by: Zoltán Németh 253256 by: Buesching, Logan J 253257 by: Buesching, Logan J 253269 by: for 253274 by: Tobias Wurst Re: register_argc_argv directive 253255 by: David Giragosian Migrating php4 to php5 on a shared host 253258 by: Al 253260 by: clive 253261 by: Zoltán Németh Re: CSS vs. Tables OT 253259 by: tedd 253263 by: tedd 253265 by: Philip Thompson 253266 by: Wolf 253275 by: Jim Moseby 253276 by: Dave Goodchild Re: how to get var name and value from function? 253262 by: Tijnema ! PHP Text Messaging 253264 by: Philip Thompson 253282 by: Brian Seymour 253283 by: Daniel Brown Re: retrieve POST body? 253268 by: Myron Turner 253281 by: Tijnema ! Session with microtime 253270 by: Panquekas 253277 by: Jim Lucas Re: auto page generation 253271 by: Michelle Konzack Re: free allocated memory: HOW ? 253272 by: Michelle Konzack Re: Suggestions for Web based FileServer/Mailaccess 253273 by: Michelle Konzack Re: sendmail smrsh symlinks not working against php scripts 253278 by: dan1 253279 by: dan1 Re: Problems with Curl and POST 253280 by: Tijnema ! Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- Roman Neuhauser wrote: ... You'll have to change the code. I'm suggesting a nice clean way that'll not only conform to the probable rules of PHP 6 (which are not specific to PHP, at least static is not), but that'll also conform to the rules of good design. You're saying the changes are superfluous. Ok then, but what do you really want? I'm fine with you just griping, if it's labeled as such. I just want it to keep working - the code began life in Nov 2003, when php5 was still in beta3 ... I'm all for writing better code but *having* to fix something that works bites. I wouldn't do it that way. A single class should not be a database driver *and* manage connections. fair enough, although personally I find that going a bit far, I don't see the win in splitting up the 'driver' and 'connection manager'. not that this is the problem in this case. You wouldn't be having this upgrade problem if static DB::query(...) wasn't there, and it's there because class DB is a client library *and* a connection manager. So I'd say this design mistake (and the fact that PHP allowed you to have almostatic methods) are the problem in this case. I might plead with internals for: ;-) class DB { almostatic function query() { /*existence of $this is MY problem */ } } though I can't see atm how the connection management is the problem, I assume you think this because of the way connection ids and transaction ids in ibase are interchangable. regardless I have a problem, I'll keep looking at the code until a clean solution presents itself, it's in/out there somewhere. I could easily split out the actual connection management into a seperate object but I'd still be stuck with the problem described above (which is not actually related to connection management). Not if you make the separation visible to the client code, which, as you I don't follow you here. could you try an explain it in idiot language? :-P write below, is actually only a fraction of those 1's of lines of code. Do those 1's of lines of code concern you? rlynch says indirection and separation of concerns are useless, you either have decent programmers and global search replace, or you don't. yes no. I don't have an endless budget or legions of world-class analysts, designers and programmers at my disposal for building megabucks codebases that implement near-on perfect loosely-coupled application designs, and I don't have the same legion to do search and replace. I'm at a complete loss then. Richard, what would you advise to someone in such a messy situation? my advice to myself is find a way to fix it, and then do it - not sure what exactly that means in terms of design or code but I figure that has to be an answer/solution somewhere :-) ---End Message--- ---BeginMessage--- # [EMAIL PROTECTED] / 2007-04-19 10:50:19 +0200: Roman Neuhauser wrote: I wouldn't do it that way. A single class should not be a database driver *and* manage connections. fair enough, although personally I find that going a bit far, I don't see the win in splitting up the 'driver'
Re: [PHP] Json.php
# [EMAIL PROTECTED] / 2007-04-19 02:19:14 +0200: Roman Neuhauser wrote: # [EMAIL PROTECTED] / 2007-04-18 11:54:59 +0200: but a practical question for you Roman (seeing as your very much into OOP), I'm not very much into OOP, I'm very much into programming techniques that allow me to limit the number of balls I need to keep in the air at any given moment, and to write code that is less likely to contain bugs, is easier to understand, more flexible, and takes fewer lines. sure, I wasn't trying to offend! - in practice much of what you have shown here (alot of interesting stuff) has been OOP code. No offense taken, that was just to clarify that I'm not an OOP devotee. But try a bit of functional programming in a language like PHP without objects. ;) how would you write a single method that could be called statically or not so that one can transparently use the same method to do stuff in different contexts? I would not. not helpful. the method in question exists and works. Except it got you into trouble. php6 will probably decide to make it not work anymore (for no technical reason whatsoever), My stance is it worked for no technical technical reason whatsoever, but our evaluations are OT for the purposes of this discussion. so I'm looking to find a nice clean way of keeping my code giving the same result whilst conform to the probable rules that php6 will dictate. You'll have to change the code. I'm suggesting a nice clean way that'll not only conform to the probable rules of PHP 6 (which are not specific to PHP, at least static is not), but that'll also conform to the rules of good design. You're saying the changes are superfluous. Ok then, but what do you really want? I'm fine with you just griping, if it's labeled as such. I wouldn't do it that way. A single class should not be a database driver *and* manage connections. fair enough, although personally I find that going a bit far, I don't see the win in splitting up the 'driver' and 'connection manager'. not that this is the problem in this case. You wouldn't be having this upgrade problem if static DB::query(...) wasn't there, and it's there because class DB is a client library *and* a connection manager. So I'd say this design mistake (and the fact that PHP allowed you to have almostatic methods) are the problem in this case. I could easily split out the actual connection management into a seperate object but I'd still be stuck with the problem described above (which is not actually related to connection management). Not if you make the separation visible to the client code, which, as you write below, is actually only a fraction of those 1's of lines of code. Do those 1's of lines of code concern you? rlynch says indirection and separation of concerns are useless, you either have decent programmers and global search replace, or you don't. yes no. I don't have an endless budget or legions of world-class analysts, designers and programmers at my disposal for building megabucks codebases that implement near-on perfect loosely-coupled application designs, and I don't have the same legion to do search and replace. I'm at a complete loss then. Richard, what would you advise to someone in such a messy situation? -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] warning message to hide
# [EMAIL PROTECTED] / 2007-04-18 23:03:08 -0500: On Wed, April 18, 2007 2:21 am, Tijnema ! wrote: Hmm, this is what i get: ~# php -r 'var_dump($foo);' NULL ~# php -r 'var_dump(@$foo);' NULL PHP6 snapshot from a month ago. Your php.ini doesn't have error_reporting cranked up to include E_NOTICE. That's your first mistake. :-) :-) :-) [Roman's does have that setting changed.] No, I've been using php-recommended.ini for the last several years. It has that error_reporting = E_ALL by default, and that's one of the reasons I've been using it. -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] retrieve POST body?
This is starting to get super ugly indeed... I was hoping I wouldn't have to essentially write an HTTP daemon from scratch, so I'll keep the sockets in mind as a *last* resort. As much as it would simplify things if $HTTP_RAW_POST_DATA (and friends) was fixed to always contain the data regardless of the Content-Type header used, it's going to take a long time before that fix trickles down into other people's PHP installations. Not everyone runs the latest versions, and this particular script I'm working on is being designed to be widely portable. *sigh* I started experimenting today with the idea of reconstructing a POST body from the $_POST[] and $_FILES[] arrays. It's doable, but with limitations. Form field names must not be permitted to contain periods, spaces, or opening square brackets. Those all get converted to underscores before the keys are created to the $_POST[] array, with no way to determine the original name. And if the form field name has both opening and closing square brackets respectively, weird funky sub-arraying occurs. Anyhow, I'd also need to do a workaround to this form field naming limitation, because server-side form-based image maps send the coordinates as formfieldname.x and formfieldname.y, no exceptions. So I'd have to search for any array key pairs that have identical names save for a _x and _y ending, and change the underscore back to a period. Of course this could mess up other form fields that just happen to end in _x and _y as specified in the HTML form, so I'd have to try several combinations (one each found key pair at a time + one for no changes) and keep comparing the hashes until I've found the correct POST body reconstruction. Then there's the final challenge: figuring out the order in which the form-data blocks were arranged in the original multipart body! It turns out the order of the $_POST[] array elements are created in the same order as the respective form-data parts in the original POST request, but if the form contains a file upload, it throws a wrench in the operation. The trouble is the $_POST[] array does not contain any elements for the file upload, so it's anyone's guess as to where in the multipart POST body the uploaded file data was inserted. The only solution I can think of is to try all the possible combinations until the correct hash is found. But if the form has several fields and multiple file uploads, this could take quite a long time... But hey, is this any dirtier than writing an entire middle-ware HTTP server in PHP? ;-) Richard Lynch wrote: One possibly super ugly hack... You could maybe write your own middle-ware HTTP server thingie with some kinda socket functions, do what you want with the input, and then pass it on to PHP somehow... I think you might maybe be better off putting in a Feature Request to get RAW_HTTP_POST_HEADERS or whatever it is turned on for multipart/form-data, or even declaring it a Bug. It might just get labeled bogus as a bug though... You may even have some luck looking at PHP source to try to submit a patch for it... Doesn't seem like it would be THAT hard to do, once you find the dang lines of C code that do file upload, and the other lines that do the RAW_HTTP thing... 'Course, it would take me months just to find those lines of code, knowing me. :-v -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] how to get var name and value from function?
On 19 April 2007 04:36, Richard Lynch wrote: On Wed, April 18, 2007 4:57 am, Ford, Mike wrote: On 17 April 2007 01:18, Richard Lynch wrote: Or is it explicitly stated in the manual somewhere I'm not seeing that one can put things in $GLOBALS directly? [shrug] http://uk2.php.net/manual/en/language.variables.predefined.php #language.variables.superglobals When I read that section of the manual, along with similar variables, such as: $_SERVER, $_GET, $_POST, $_COOKIE, $_FILES, $_ENV, $_REQUEST I do not, in my mind, see anything indicating that it is a documented feature that cramming some value into $_GLOBALS['foo'] is specifically supported... Well the definition of $GLOBALS says: Contains a reference to every variable which is currently available within the global scope of the script. I take that to mean reference as in the operator, so that $GLOBALS['foo'] is a reference to $foo, and when you assign to a reference you also assign to But, notwithstanding that, how about Example 12.3 at http://php.net/global#language.variables.scope.global? Cheers! Mike - Mike Ford, Electronic Information Services Adviser, JG125, The Headingley Library, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 812 4730 Fax: +44 113 812 3211 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Json.php
Roman Neuhauser wrote: ... You'll have to change the code. I'm suggesting a nice clean way that'll not only conform to the probable rules of PHP 6 (which are not specific to PHP, at least static is not), but that'll also conform to the rules of good design. You're saying the changes are superfluous. Ok then, but what do you really want? I'm fine with you just griping, if it's labeled as such. I just want it to keep working - the code began life in Nov 2003, when php5 was still in beta3 ... I'm all for writing better code but *having* to fix something that works bites. I wouldn't do it that way. A single class should not be a database driver *and* manage connections. fair enough, although personally I find that going a bit far, I don't see the win in splitting up the 'driver' and 'connection manager'. not that this is the problem in this case. You wouldn't be having this upgrade problem if static DB::query(...) wasn't there, and it's there because class DB is a client library *and* a connection manager. So I'd say this design mistake (and the fact that PHP allowed you to have almostatic methods) are the problem in this case. I might plead with internals for: ;-) class DB { almostatic function query() { /*existence of $this is MY problem */ } } though I can't see atm how the connection management is the problem, I assume you think this because of the way connection ids and transaction ids in ibase are interchangable. regardless I have a problem, I'll keep looking at the code until a clean solution presents itself, it's in/out there somewhere. I could easily split out the actual connection management into a seperate object but I'd still be stuck with the problem described above (which is not actually related to connection management). Not if you make the separation visible to the client code, which, as you I don't follow you here. could you try an explain it in idiot language? :-P write below, is actually only a fraction of those 1's of lines of code. Do those 1's of lines of code concern you? rlynch says indirection and separation of concerns are useless, you either have decent programmers and global search replace, or you don't. yes no. I don't have an endless budget or legions of world-class analysts, designers and programmers at my disposal for building megabucks codebases that implement near-on perfect loosely-coupled application designs, and I don't have the same legion to do search and replace. I'm at a complete loss then. Richard, what would you advise to someone in such a messy situation? my advice to myself is find a way to fix it, and then do it - not sure what exactly that means in terms of design or code but I figure that has to be an answer/solution somewhere :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] serialize an object
hi, i use serialize() to save my object in $_SESSION. But i have one Problem: the member-variables from the baseclass are not saved.. :( How can i fix this? thanks in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] serialize an object
Tobias Wurst wrote: i use serialize() to save my object in $_SESSION. Why? There's no point in serialising something into $_SESSION. Anything you put in there gets serialised by the session handler. But i have one Problem: the member-variables from the baseclass are not saved.. :( How can i fix this? Pass. I know you can specify member variables to be saved in __sleep(), so I guess that would be one possible workaround. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] serialize an object
as far as I know serialize() saves all the properties of the object... and I think you can store objects in session without serializing it since PHP serializes-unserializes it for you automatically - or not? greets Zoltán Németh 2007. 04. 19, csütörtök keltezéssel 13.17-kor Tobias Wurst ezt írta: hi, i use serialize() to save my object in $_SESSION. But i have one Problem: the member-variables from the baseclass are not saved.. :( How can i fix this? thanks in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] register_argc_argv directive
On 4/18/07, Richard Lynch [EMAIL PROTECTED] wrote: On Wed, April 18, 2007 9:04 am, Bagus Nugroho wrote: I'm confuse about usage of php.ini directive register_argc_argv. Is used for command line purpose only? I suspect that in CGI (and possibly even FCGI) $argv and $argc may also end up being populated, due to the way CGI works. But, yes, essentially you'd be using those in CLI in most circumstances. I'm not sure why you'd want to not fill in argv/argc in CLI... But I suppose if you've got a fancy GetOPTS package of some sort going, you might need that turned off or something... Or maybe there's some sort of big time savings to turn them off... There may even be Security Considerations for some people/cases where having those off is better... I'm just making up answers as I go here for why that setting might even exist, but I guess somebody needed it sometime in the past. -- 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 $argv and $argc came in way handy when I wrote several php-gtk apps a few years ago, which uses the CLI exe version... David
RE: [PHP] serialize an object
From the PHP manual: -Original Message- From: Zoltán Németh [mailto:[EMAIL PROTECTED] Sent: Thursday, April 19, 2007 8:40 AM To: Tobias Wurst Cc: php-general@lists.php.net Subject: Re: [PHP] serialize an object as far as I know serialize() saves all the properties of the object... and I think you can store objects in session without serializing it since PHP serializes-unserializes it for you automatically - or not? greets Zoltán Németh 2007. 04. 19, csütörtök keltezéssel 13.17-kor Tobias Wurst ezt írta: hi, i use serialize() to save my object in $_SESSION. But i have one Problem: the member-variables from the baseclass are not saved.. :( How can i fix this? thanks in advance -- 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] serialize an object
Sorry for that ctrl+enter sends, when I wanted ctrl+V to paste :( All registered variables are serialized after the request finishes. Registered variables which are undefined are marked as being not defined. On subsequent accesses, these are not defined by the session module unless the user defines them later. Warning Some types of data can not be serialized thus stored in sessions. It includes resource variables or objects with circular references (i.e. objects which passes a reference to itself to another object). Note: Session handling was added in PHP 4.0.0. Note: Please note when working with sessions that a record of a session is not created until a variable has been registered using the session_register() function or by adding a new key to the $_SESSION superglobal array. This holds true regardless of if a session has been started using the session_start() function. So I'd assume his class has a circular reference if it cannot be serialized, and how to fix that I'm going to pass on. -Original Message- From: Zoltán Németh [mailto:[EMAIL PROTECTED] Sent: Thursday, April 19, 2007 8:40 AM To: Tobias Wurst Cc: php-general@lists.php.net Subject: Re: [PHP] serialize an object as far as I know serialize() saves all the properties of the object... and I think you can store objects in session without serializing it since PHP serializes-unserializes it for you automatically - or not? greets Zoltán Németh 2007. 04. 19, csütörtök keltezéssel 13.17-kor Tobias Wurst ezt írta: hi, i use serialize() to save my object in $_SESSION. But i have one Problem: the member-variables from the baseclass are not saved.. :( How can i fix this? thanks in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Migrating php4 to php5 on a shared host
I've got 2 sites on a shared host running php4 and I think it's a matter of when, not if, I should move them to one of my host's php5 servers. I don't see anything in the php manual on migrating that indicates my code would be affected. I'm a little concerned about gotchas that would take my sites down while I fix the particulars for php5. Anyone had experience or comments on the subject. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CSS vs. Tables OT
At 8:59 AM +1200 4/19/07, Bruce Cowin wrote: Now can we please close this thread! There are better forums to discuss this - it has nothing to do with PHP!! Lori Lori: True, it has nothing to do with php programming other than compliance, accessibility, data gathering and data presentation. If php lived in a vacuum where computation was all there was, then that would not be a concern. However, we use other languages to grab our input and present our findings. IMO, to be well rounded we have to understand other languages such as html, xml, mysql, css, javascript and even ajax. These languages have both good and bad practices and carry with them responsibilities to our clients and adherence to standards and compliance issues. It's more than just pounding code. I think it's good that we discuss these things because it brings about an understanding and appreciation of issues where our actions may have far reaching influence on important matters of which we may not be aware. Knowledge carries with it responsibility. 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] Migrating php4 to php5 on a shared host
Al wrote: Anyone had experience or comments on the subject. setup php5 dev (local||hosted) server, setup site on dev server, test clive -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Migrating php4 to php5 on a shared host
I suggest installing php locally on a dev machine, testing your code on it and if it works just go on. greets Zoltán Németh 2007. 04. 19, csütörtök keltezéssel 10.03-kor Al ezt írta: I've got 2 sites on a shared host running php4 and I think it's a matter of when, not if, I should move them to one of my host's php5 servers. I don't see anything in the php manual on migrating that indicates my code would be affected. I'm a little concerned about gotchas that would take my sites down while I fix the particulars for php5. Anyone had experience or comments on the subject. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to get var name and value from function?
On 4/19/07, Ford, Mike [EMAIL PROTECTED] wrote: On 19 April 2007 04:36, Richard Lynch wrote: On Wed, April 18, 2007 4:57 am, Ford, Mike wrote: On 17 April 2007 01:18, Richard Lynch wrote: Or is it explicitly stated in the manual somewhere I'm not seeing that one can put things in $GLOBALS directly? [shrug] http://uk2.php.net/manual/en/language.variables.predefined.php #language.variables.superglobals When I read that section of the manual, along with similar variables, such as: $_SERVER, $_GET, $_POST, $_COOKIE, $_FILES, $_ENV, $_REQUEST I do not, in my mind, see anything indicating that it is a documented feature that cramming some value into $_GLOBALS['foo'] is specifically supported... Well the definition of $GLOBALS says: Contains a reference to every variable which is currently available within the global scope of the script. I take that to mean reference as in the operator, so that $GLOBALS['foo'] is a reference to $foo, and when you assign to a reference you also assign to But, notwithstanding that, how about Example 12.3 at http://php.net/global#language.variables.scope.global? Cheers! Mike Hmm, that's quite ugly, what happens when defining a variable outside, and inside a function. and then get the reference to it? Will the first var be overwritten, and when the function ends, it will refer to the old var again? Tijnema - Mike Ford, Electronic Information Services Adviser, JG125, The Headingley Library, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 812 4730 Fax: +44 113 812 3211 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- 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] CSS vs. Tables OT
At 11:36 PM -0500 4/18/07, Richard Lynch wrote: But I don't think we're going to reach that Utopia where IE and FF actually follow the standards in the same ways well enough to get out of this CSS hack nightmare. Well, as long as the old IE browsers are being used, then we'll continue to have problems. But even those problems can be solved. True, some requires hacks BUT that's a good thing that we can use the code to solve the problems. To me, that's not a hack, but rather a solution. And I don't see the CSS spec author folks really addressing some fundamental problems that real-world designers need addressed so they can get the layouts they want. I disagree. The CSS folks have solved hundreds of different types of layouts and have provided the techniques to solve almost any problem imaginable. Plus, they have been foremost in promoting a completely new medium -- these people have done wonders! Whether they *ought* to want those layouts, or whether they are good layouts for websites is arguable, but there it is... The CSS folks don't seem to be addressing the needs of their Designer user-base, afaics... IF there is a problem, it is that the designers aren't taking the time to look at what's available. If a designer wants a two column layout with a footer, side bar, header and is liquid -- it's there! If the designer wants a static keep to the top left corner of the browser window three column with only a header -- it's there too! In fact, I may be going out on a limb here, but I challenge anyone to describe a layout that isn't covered. I'm hoping some day (soon) this will all be worked out all nicey-nice. Similar to most php questions posted here, all one has to do is look. 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] PHP Text Messaging
Hi. I have attempted to look at the archives for this, but keep getting redirected back to the main PHP site when I click on the archive link. With that said, does anyone know of any good resources for sending text messages using PHP? I have Googled this topic and found a few, but find it hard to judge which ones are good. I have also looked at the SAM package, but wasn't sure how much that is being used by the community. Thanks in advance, ~Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CSS vs. Tables OT
On Apr 19, 2007, at 9:08 AM, tedd wrote: At 8:59 AM +1200 4/19/07, Bruce Cowin wrote: Now can we please close this thread! There are better forums to discuss this - it has nothing to do with PHP!! Lori Lori: True, it has nothing to do with php programming other than compliance, accessibility, data gathering and data presentation. If php lived in a vacuum where computation was all there was, then that would not be a concern. However, we use other languages to grab our input and present our findings. IMO, to be well rounded we have to understand other languages such as html, xml, mysql, css, javascript and even ajax. These languages have both good and bad practices and carry with them responsibilities to our clients and adherence to standards and compliance issues. It's more than just pounding code. I think it's good that we discuss these things because it brings about an understanding and appreciation of issues where our actions may have far reaching influence on important matters of which we may not be aware. Knowledge carries with it responsibility. Cheers, tedd *CLAP CLAP CLAP* =P -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CSS vs. Tables OT
That, and the big OT at the end means Off-Topic... So if you don't want to get OT, just hit delete. ;) tedd wrote: At 8:59 AM +1200 4/19/07, Bruce Cowin wrote: Now can we please close this thread! There are better forums to discuss this - it has nothing to do with PHP!! Lori Lori: True, it has nothing to do with php programming other than compliance, accessibility, data gathering and data presentation. If php lived in a vacuum where computation was all there was, then that would not be a concern. However, we use other languages to grab our input and present our findings. IMO, to be well rounded we have to understand other languages such as html, xml, mysql, css, javascript and even ajax. These languages have both good and bad practices and carry with them responsibilities to our clients and adherence to standards and compliance issues. It's more than just pounding code. I think it's good that we discuss these things because it brings about an understanding and appreciation of issues where our actions may have far reaching influence on important matters of which we may not be aware. Knowledge carries with it responsibility. Cheers, tedd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Json.php
# [EMAIL PROTECTED] / 2007-04-19 10:50:19 +0200: Roman Neuhauser wrote: I wouldn't do it that way. A single class should not be a database driver *and* manage connections. fair enough, although personally I find that going a bit far, I don't see the win in splitting up the 'driver' and 'connection manager'. not that this is the problem in this case. You wouldn't be having this upgrade problem if static DB::query(...) wasn't there, and it's there because class DB is a client library *and* a connection manager. So I'd say this design mistake (and the fact that PHP allowed you to have almostatic methods) are the problem in this case. I might plead with internals for: ;-) class DB { almostatic function query() { /*existence of $this is MY problem */ } } Existence of $this is YOUR problem only as long as you don't share the code with anybody else. At that moment, you have made life harder for someone else. though I can't see atm how the connection management is the problem, I assume you think this because of the way connection ids and transaction ids in ibase are interchangable. No, I've had virtually zero exposure to Interbase/Firebird, and have had no idea about the phenomenon you mention. I think it's a problem because of the ways it reduces quality of the code. Or does DB not handle database connections? If not, how come the static call DB::query(SELECT fubar FROM snafu) works? Guess it does things besides querying (probably why it's a generic DB in the first place). regardless I have a problem, I'll keep looking at the code until a clean solution presents itself, it's in/out there somewhere. I could easily split out the actual connection management into a seperate object but I'd still be stuck with the problem described above (which is not actually related to connection management). Not if you make the separation visible to the client code, which, as you I don't follow you here. could you try an explain it in idiot language? :-P Split the two functions, and don't try to hide the fact that they're two functions; after all, if you do it correctly, the static one will probably end in a different class. write below, is actually only a fraction of those 1's of lines of code. Do those 1's of lines of code concern you? rlynch says indirection and separation of concerns are useless, you either have decent programmers and global search replace, or you don't. yes no. I don't have an endless budget or legions of world-class analysts, designers and programmers at my disposal for building megabucks codebases that implement near-on perfect loosely-coupled application designs, and I don't have the same legion to do search and replace. I'm at a complete loss then. Richard, what would you advise to someone in such a messy situation? my advice to myself is find a way to fix it, and then do it - not sure what exactly that means in terms of design or code but I figure that has to be an answer/solution somewhere :-) Don't try to cram connection management into a db client driver class. The rest will just fall out of it. -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] retrieve POST body?
André Medeiros wrote: php://stdin perhaps? On 4/18/07, Justin Frim [EMAIL PROTECTED] wrote: André Medeiros wrote: Reading from php://input on a webserver will retrieve the Body of the HTTP Request. Not for me it doesn't. That only seems to work when the form is submitted as application/x-www-form-urlencoded. When the form is submitted as multipart/form-data, php://input is blank. You probably could use this small Perl script via exec: #!/usr/bin/perl if ($ENV{'REQUEST_METHOD'} eq POST) { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); } print $buffer; -- _ Myron Turner http://www.room535.org http://www.bstatzero.org http://www.mturner.org/XML_PullParser/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: serialize an object
On 19.04.2007 13:17 Tobias Wurst wrote: hi, i use serialize() to save my object in $_SESSION. you don't need this. php serializes your objects for you But i have one Problem: the member-variables from the baseclass are not saved.. :( How can i fix this? can you provide a small example? thanks in advance -- gosha bine extended php parser ~ http://code.google.com/p/pihipi blok ~ http://www.tagarga.com/blok -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session with microtime
hello, I'm writting a script where I use the function microtime with sessions and I have a problem. This is my code: if( $_SESSION['uperm'] == '1' ){ $t_start = microtime(1); } () if( $_SESSION['uperm'] == '1' ){ $t_end = microtime(1) - $t_start; $time .= \n . 'PThis page was loaded in ' . number_format($t_end, 3) . ' seconds./P'; } And when I log with any account (admin or user) is echoed to me something like this: This page was loaded in 1,177,003,846.594 seconds. This is too much because the page isn't loaded in this time. And when I refresh the page it appears: This page was loaded in 0.012 seconds. Why is this? I can't explain. And this started to appear when I put the if to check the user permissions. If I turn off the if it'll run normally. Can anyone explain why is that? Thanks in advance.
[PHP] Re: auto page generation
Hello Tim, Am 2007-04-16 19:22:21, schrieb Tim: Also can i reccomend: Web Database Applications with PHP and MySQL Do you know an equivalent book for php5 and PostgreSQL 8.1/8.2? Greetings Michelle Konzack Systemadministrator Tamay Dogan Network Debian GNU/Linux Consultant -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ # Debian GNU/Linux Consultant # Michelle Konzack Apt. 917 ICQ #328449886 50, rue de Soultz MSN LinuxMichi 0033/6/6192519367100 Strasbourg/France IRC #Debian (irc.icq.com) signature.pgp Description: Digital signature
[PHP] Re: free allocated memory: HOW ?
Hello Arthur, Am 2007-04-12 13:40:08, schrieb Arthur Erdös: Hello all, is there a way to free memory allocated by variables in PHP?? This is a very important issue concerning long running scripts... I have a script that generates 5000 Newsletters and when the script finishes it uses 1.8 GB (!!) of RAM. Although I am using unset() to clean up variables (tried with $var = null too). Are you running Linux? If yes, are aou realy sure it eat this amount of memory? I have a pgp-cli prog which seems to eat 12 GByte (of 16 GByte) after one week of use, but the stuff is ONLY cached... Greetings Michelle Konzack Systemadministrator Tamay Dogan Network Debian GNU/Linux Consultant -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ # Debian GNU/Linux Consultant # Michelle Konzack Apt. 917 ICQ #328449886 50, rue de Soultz MSN LinuxMichi 0033/6/6192519367100 Strasbourg/France IRC #Debian (irc.icq.com) signature.pgp Description: Digital signature
[PHP] Re: Suggestions for Web based FileServer/Mailaccess
Hello Richard, It seems no one had understood me right... Am 2007-04-10 21:48:12, schrieb Richard Lynch: Personally, I would use http://php.net/imap_open and friends to add the mailbox, and let the OS and installed IMAP software choose the correct mbox/Maildir option based on the server configuration, rather than try to out-guess them... This is WHAT I already do... But currently I have two Spaces: The one for the E-Mails and one for the files WHich mean, if I ahve a friend called Richard and his Messages goes into the Mailfolder Peoples/Richard and I want to see what I have from him, like Files, Pics or whatever... I have to go to a second place the File Section to look at it. What I want is a fusion of the MailSpace and the FileSpace. Currently I have a black hole and do not know HOW to implement this. In general, EACH Mailfolder can have a FileSpace and visa versa. Greetings Michelle Konzack Systemadministrator Tamay Dogan Network Debian GNU/Linux Consultant -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ # Debian GNU/Linux Consultant # Michelle Konzack Apt. 917 ICQ #328449886 50, rue de Soultz MSN LinuxMichi 0033/6/6192519367100 Strasbourg/France IRC #Debian (irc.icq.com) signature.pgp Description: Digital signature
[PHP] Re: serialize an object
i think I found a bug: http://bugs.php.net/bug.php?id=36172 i used __sleep and __wakeup - don't work without __sleep and __wakeup - it is working :) you don't need this. php serializes your objects for you thats true, thanks :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] CSS vs. Tables OT
snip In fact, I may be going out on a limb here, but I challenge anyone to describe a layout that isn't covered. /snip I want a layout that looks identical in every browser without resorting to something like: switch($browser){ case 'IE':include('ie.css'); case 'Mozilla':include('mozilla.css'); {...} default:throw_hands_up_in_disgust(); ) I don't think thats possible right now, is it? JM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CSS vs. Tables OT
Can we kill this now please? It's not a php issue, is an old and endless argument and is better addressed on a css / design list.
Re: [PHP] Session with microtime
Panquekas wrote: hello, I'm writting a script where I use the function microtime with sessions and I have a problem. This is my code: if( $_SESSION['uperm'] == '1' ){ $t_start = microtime(1); } when you initially log in, it creates this variable. Sounds to me like it is creating the $_SESSION['uperm'] value after you are calling the previous if() {...} do this if ( $_SESSION['uperm'] == '1' ) { $t_start = microtime(1); die('I made it here'); } if it does not die(), then you know that it isn't getting into this first IF statement. also, sounds like you have E_WARNING E_NOTICE turned off. I would suggest that you enable these by placing this at the very top of your script. ( at least for debugging purpose, not in production ) ?php error_reporting(E_ALL); ini_set('display_errors', 'On'); . . . ? this will probably if you a notice not that the variable $t_start is undefined when try and hit the following block of code. () if( $_SESSION['uperm'] == '1' ){ $t_end = microtime(1) - $t_start; $time .= \n . 'PThis page was loaded in ' . number_format($t_end, 3) . ' seconds./P'; } And when I log with any account (admin or user) is echoed to me something like this: This page was loaded in 1,177,003,846.594 seconds. This is too much because the page isn't loaded in this time. And when I refresh the page it appears: This page was loaded in 0.012 seconds. Why is this? I can't explain. And this started to appear when I put the if to check the user permissions. If I turn off the if it'll run normally. Can anyone explain why is that? Thanks in advance. -- Enjoy, Jim Lucas Different eyes see different things. Different hearts beat on different strings. But there are times for you and me when all such things agree. - Rush -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sendmail smrsh symlinks not working against php scripts
However, if I put a hardlink instead of the symlink, all works fine! The permissions of the symlink and the file linekd are all 777. Has anyone already had this problem before, or would anyone have an idea of the cause? smrsh itself may disallow symlinks. Wouldn't surprise me. Why not just use #!/usr/bin/php -q at the top of your PHP script? I cannot do this, because the script itself is not executed. The e-mail I sent from within this script does not arrive when it is failing. But it works well with a hardlink. I didn't expect smrsh to prevent symlinks. When I contact sendmail people, they tell me it is a PHP problem. Would you agree that this is not the case, and merely to have to do with smrsh? Thanks, Daniel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sendmail smrsh symlinks not working against php scripts
smrsh itself may disallow symlinks. Wouldn't surprise me. Why not just use #!/usr/bin/php -q at the top of your PHP script? Something else to my previous answer. Here is the answer of the sendmail guys. Maybe they are still right? Would PHP have a problem to handle symlinked input files? I have the security mode disabled in the php.ini file. Thanks, Daniel This is a poor place to find an answer, because the one thing that stands out is that this is a problem with php, not Sendmail, and this is a Sendmail newsgroup not a php newsgroup. Your dangerously outdated version of php is running and emitting an error (No input file specified.) that doesn't make sense outside of php, but probably indicates special handling done by php when given a symlink instead of a regular file. Looking at the output there, I'd *guess* that you have php set up wrong for this sort of use. I'm not a php expert, so I won't try to guess at a fix. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with Curl and POST
On 4/17/07, mbneto [EMAIL PROTECTED] wrote: Hi Richard, I am using the same script. And it is using the CURLOPT_POST. - mb On 4/16/07, Richard Lynch [EMAIL PROTECTED] wrote: HEAD is just like GET, only it gets just the headers (hence the name) usually to see if the document has changed according to LastModified: before doing a full-blown GET. There shouldn't be a HEAD done before a POST... Are you sure you are doing a CURLOPT_POST and not CURLOPT_GET...? On Mon, April 16, 2007 4:43 pm, mbneto wrote: Hi, I am tring to use curl to access, via POST, a remote 'service'. I've managed to test it fine but when I use real data to feed the curl it gives me strange results. When I check the logs of the remote web server one thing that alarms me is that with test data I see A.B.C.D - - [16/Apr/2007:17:41:53 -0400] POST /service.php HTTP/1.1 200 61 with real data (using the same script) A.B.C.D - - [16/Apr/2007:17:48:55 -0400] HEAD /service.php HTTP/1.1 200 - After reading the user contributed notes I found that it must be related with encoding. But even if I use the suggested code $o=;foreach ($post_data as $k=$v) {$o.= $k=.utf8_encode($v).;} $post_data=substr($o,0,-1); echo $post_data; // Echo your data here to check if this is really what you want to insert. // Add error handling if(!curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data)) { echo curl_error($ch); } I get the same results. Any tips? php 5.0.4 I guess you insert data twice, or something like that. I modified above code, test it. Tijnema -- 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] retrieve POST body?
On 4/19/07, Myron Turner [EMAIL PROTECTED] wrote: André Medeiros wrote: php://stdin perhaps? On 4/18/07, Justin Frim [EMAIL PROTECTED] wrote: André Medeiros wrote: Reading from php://input on a webserver will retrieve the Body of the HTTP Request. Not for me it doesn't. That only seems to work when the form is submitted as application/x-www-form-urlencoded. When the form is submitted as multipart/form-data, php://input is blank. You probably could use this small Perl script via exec: #!/usr/bin/perl if ($ENV{'REQUEST_METHOD'} eq POST) { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); } print $buffer; If you call this script via exec, it can't return the POST data send to the PHP script right? btw, we are here on a PHP list, not PERL :) Tijnema -- _ Myron Turner http://www.room535.org http://www.bstatzero.org http://www.mturner.org/XML_PullParser/ -- 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] PHP Text Messaging
I know vtext.com sends email to phones. Perhaps using the mail function you could just send a message to [EMAIL PROTECTED] and they would get the message. To my knowledge this is a free service and works with all phone providers since they do the message for you. Just a thought. Hope this helps, Brian -Original Message- From: Philip Thompson [mailto:[EMAIL PROTECTED] Sent: Thursday, April 19, 2007 10:28 AM To: php General List Subject: [PHP] PHP Text Messaging Hi. I have attempted to look at the archives for this, but keep getting redirected back to the main PHP site when I click on the archive link. With that said, does anyone know of any good resources for sending text messages using PHP? I have Googled this topic and found a few, but find it hard to judge which ones are good. I have also looked at the SAM package, but wasn't sure how much that is being used by the community. Thanks in advance, ~Philip -- 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] PHP Text Messaging
I actually believe that vText is strictly for Verizon Wireless users, but I tried sending web messages to friends without it and, according to the system, the messages went through. So I guess you could give it a shot. On 4/19/07, Brian Seymour [EMAIL PROTECTED] wrote: I know vtext.com sends email to phones. Perhaps using the mail function you could just send a message to [EMAIL PROTECTED] and they would get the message. To my knowledge this is a free service and works with all phone providers since they do the message for you. Just a thought. Hope this helps, Brian -Original Message- From: Philip Thompson [mailto:[EMAIL PROTECTED] Sent: Thursday, April 19, 2007 10:28 AM To: php General List Subject: [PHP] PHP Text Messaging Hi. I have attempted to look at the archives for this, but keep getting redirected back to the main PHP site when I click on the archive link. With that said, does anyone know of any good resources for sending text messages using PHP? I have Googled this topic and found a few, but find it hard to judge which ones are good. I have also looked at the SAM package, but wasn't sure how much that is being used by the community. Thanks in advance, ~Philip -- 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 -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107
[PHP] Ways to tell if existing setup is SAPI or Shared Object?
What ways are there to tell if PHP is actually built into an Apache 2 installation or if it's installed as a shared object? I've dropped a file containing phpinfo() on the server I'm looking at, hoping the Server API value would give me a clue, but it just says Apache 2.0 Filter, and I don't know if Apache filters are required to be one or the other -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[Fwd: Re: [PHP] Session with microtime]
Panquekas wrote: It's d0ne, thank you very much! No problem, just remember to reply on list next time. It was what you were saying, the $_SESSION['uperm'] wasn't being define in the first place, I moved my login script above that if and it work it out. And thanks for that trick of error reporting, I wasn't using, although I known that, but I didn't remember doing that. that isn't a trick, you would be better off having those lines in any scripts that you run. I actually have my server default to those settings, as do many OPs. I notice that some variables that I use for showing some errors and some to check the mysql querys were having some notices too, it's that normal? (I just define it when I need to show some error or something like that) whenever you go to use a variable, that you are requiring, double check to make sure that it exists with isset() or empty() This will probably point you in the right direction to fixing things. Thanks once again Jim Lucas for your help. Once again, no problem. -- Enjoy, Jim Lucas Different eyes see different things. Different hearts beat on different strings. But there are times for you and me when all such things agree. - Rush -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Ways to tell if existing setup is SAPI or Shared Object?
On Thu, April 19, 2007 4:08 pm, Weston C wrote: What ways are there to tell if PHP is actually built into an Apache 2 installation or if it's installed as a shared object? I've dropped a file containing phpinfo() on the server I'm looking at, hoping the Server API value would give me a clue, but it just says Apache 2.0 Filter, and I don't know if Apache filters are required to be one or the other If I had to take a wild guess, I'd say Filter was a shared object... But I suppose if you compiled it directly into Apache (does anybody do that anymore?) you might still see the same thing... If you can read httpd.conf, and find a LoadModule there with php, then it's shared, I think. The php_sapi_name function and PHP_SAPI constant may be of use if you just want SAPI info in your program, rather than all of phpinfo() They're probably all exactly the same output, though. -- 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] sendmail smrsh symlinks not working against php scripts
On Thu, April 19, 2007 1:23 pm, dan1 wrote: However, if I put a hardlink instead of the symlink, all works fine! The permissions of the symlink and the file linekd are all 777. Has anyone already had this problem before, or would anyone have an idea of the cause? smrsh itself may disallow symlinks. Wouldn't surprise me. Why not just use #!/usr/bin/php -q at the top of your PHP script? I cannot do this, because the script itself is not executed. What exactly do you want to happen then? The e-mail I sent from within this script does not arrive when it is failing. If it's not executed, it would be very difficult for it to send an email from within the script. But it works well with a hardlink. I didn't expect smrsh to prevent symlinks. When I contact sendmail people, they tell me it is a PHP problem. Would you agree that this is not the case, and merely to have to do with smrsh? At this point, I don't have any idea what you're trying to do, much less what is going wrong with it. -- 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] sendmail smrsh symlinks not working against php scripts
On Thu, April 19, 2007 1:33 pm, dan1 wrote: This is a poor place to find an answer, because the one thing that stands out is that this is a problem with php, not Sendmail, and this is a Sendmail newsgroup not a php newsgroup. Your dangerously outdated version of php is running and emitting an error (No input file specified.) that doesn't make sense outside of php, but probably indicates special handling done by php when given a symlink instead of a regular file. No input specified is pretty self explanatory... You ran PHP, but didn't give it a PHP script as input. -- 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] Re: Suggestions for Web based FileServer/Mailaccess
On Thu, April 19, 2007 11:42 am, Michelle Konzack wrote: Hello Richard, It seems no one had understood me right... Am 2007-04-10 21:48:12, schrieb Richard Lynch: Personally, I would use http://php.net/imap_open and friends to add the mailbox, and let the OS and installed IMAP software choose the correct mbox/Maildir option based on the server configuration, rather than try to out-guess them... This is WHAT I already do... But currently I have two Spaces: The one for the E-Mails and one for the files WHich mean, if I ahve a friend called Richard and his Messages goes into the Mailfolder Peoples/Richard and I want to see what I have from him, like Files, Pics or whatever... I have to go to a second place the File Section to look at it. What I want is a fusion of the MailSpace and the FileSpace. Currently I have a black hole and do not know HOW to implement this. In general, EACH Mailfolder can have a FileSpace and visa versa. Where do the Files come from in the first place? Attachments? External source? ... If they were attachments, maybe you'd be better off just leaving them in the Maildir... I suppose you could build a parallel File System to your Maildirs, then within each of those, make a directory by Message-id: header, then put any attachments with the cid: name as the file name. That should make everything unique... -- 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] Session with microtime
On Thu, April 19, 2007 11:32 am, Panquekas wrote: I'm writting a script where I use the function microtime with sessions and I have a problem. This is my code: if( $_SESSION['uperm'] == '1' ){ $t_start = microtime(1); } () if( $_SESSION['uperm'] == '1' ){ $t_end = microtime(1) - $t_start; $time .= \n . 'PThis page was loaded in ' . number_format($t_end, 3) . ' seconds./P'; } And when I log with any account (admin or user) is echoed to me something like this: This page was loaded in 1,177,003,846.594 seconds. This is too much because the page isn't loaded in this time. And when I refresh the page it appears: This page was loaded in 0.012 seconds. Why is this? I can't explain. And this started to appear when I put the if to check the user permissions. If I turn off the if it'll run normally. Can anyone explain why is that? You've messed up and put the session_start() inside the if( )block. Put session_start at the very top of the file, *BEFORE* the $_SESSION variable is used for anything at all. -- 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] Ways to tell if existing setup is SAPI or Shared Object?
On 4/19/07, Richard Lynch [EMAIL PROTECTED] wrote: On Thu, April 19, 2007 4:08 pm, Weston C wrote: What ways are there to tell if PHP is actually built into an Apache 2 installation or if it's installed as a shared object? phpinfo() / Server API value .. just says Apache 2.0 Filter If you can read httpd.conf, and find a LoadModule there with php, then it's shared, I think. I do have access to httpd.conf. I can't find a LoadModule directive for php in it, though. Is that a bad sign? Could they possibly have been stuffed into any of the other lesser-used conf files? The php_sapi_name function and PHP_SAPI constant may be of use if you just want SAPI info in your program, rather than all of phpinfo() They're probably all exactly the same output, though. Seems to give the same result. ... if you compiled it directly into Apache (does anybody do that anymore?) I certainly wouldn't. But I think this is the default Apache2 distribution on RH9, and you just never know with those folks. ;) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Migrating php4 to php5 on a shared host
Install PHP5 on any old box you have laying around and test there first. On Thu, April 19, 2007 9:03 am, Al wrote: I've got 2 sites on a shared host running php4 and I think it's a matter of when, not if, I should move them to one of my host's php5 servers. I don't see anything in the php manual on migrating that indicates my code would be affected. I'm a little concerned about gotchas that would take my sites down while I fix the particulars for php5. Anyone had experience or comments on the subject. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- 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] register_argc_argv directive
On Thu, April 19, 2007 8:37 am, David Giragosian wrote: $argv and $argc came in way handy when I wrote several php-gtk apps a few years ago, which uses the CLI exe version... They are way handy for any CLI. The question I'm kinda wondering is what purpose is served by having a php.ini setting to turn the dang things *OFF*?... -- 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] serialize an object
I'm wondering if the OP is failing to re-define the baseclass when loading in the saved object... But, yes, get rid of the by-hand serializing first, as PHP will serialize it for you. On Thu, April 19, 2007 7:40 am, Zoltán Németh wrote: as far as I know serialize() saves all the properties of the object... and I think you can store objects in session without serializing it since PHP serializes-unserializes it for you automatically - or not? greets Zoltán Németh 2007. 04. 19, csütörtök keltezéssel 13.17-kor Tobias Wurst ezt Ãrta: hi, i use serialize() to save my object in $_SESSION. But i have one Problem: the member-variables from the baseclass are not saved.. :( How can i fix this? thanks in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- 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] how to get var name and value from function?
On Thu, April 19, 2007 3:34 am, Ford, Mike wrote: But, notwithstanding that, how about Example 12.3 at http://php.net/global#language.variables.scope.global? That's good enough for me. Just never noticed it before. Thanks! -- 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] how to get var name and value from function?
On Thu, April 19, 2007 9:21 am, Tijnema ! wrote: Hmm, that's quite ugly, what happens when defining a variable outside, and inside a function. and then get the reference to it? Will the first var be overwritten, and when the function ends, it will refer to the old var again? I can't un-twist your sentence into code, but if you can, you could probably test it and find out faster than we could answer... :-) -- 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] Ways to tell if existing setup is SAPI or Shared Object?
On Apr 19, 2007, at 4:59 PM, Weston C wrote: On 4/19/07, Richard Lynch [EMAIL PROTECTED] wrote: On Thu, April 19, 2007 4:08 pm, Weston C wrote: What ways are there to tell if PHP is actually built into an Apache 2 installation or if it's installed as a shared object? phpinfo() / Server API value .. just says Apache 2.0 Filter If you can read httpd.conf, and find a LoadModule there with php, then it's shared, I think. I do have access to httpd.conf. I can't find a LoadModule directive for php in it, though. Is that a bad sign? Could they possibly have been stuffed into any of the other lesser-used conf files? Fedora, and I'm assuming RedHat and possibly others that use their system layout, will put the loading line in /etc/httpd/conf.d/ php.conf so yes it can be in an external configuration file. Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] retrieve POST body?
On Thu, April 19, 2007 2:50 am, Justin Frim wrote: ... limitations. Form field names must not be permitted to contain periods, spaces, or opening square brackets. Those all get converted to underscores before the keys are created to the $_POST[] array, with no way to determine the original name. And if the form field name has both opening and closing square brackets respectively, weird funky sub-arraying occurs. Anyhow, I'd also need to do a workaround to this Don't be calling my form arrays weird funky! That's one of PHP's greatest features! :-) [lots more stuff deleted] Also, I'll point out that it's only sheer coincidence any ordering you are seeing in $_POST and the POST body. Well, not coincidence, but it's NOT a documented feature. The HTML/HTTP don't even have to provide the INPUTs in order, even though in practice, they all do that. Relying on that order is probably a Bad Idea all around. And, to make you even more miserable, it's not just . and [ that get converted to _ by PHP for the keys... Because of the history of PHP and register_globals, *ANY* character not fitting this PCRE pattern: [a-z_][a-z0-9_]* is gonna get converted... type=image name=image - image_x name=image.x - image_x name=image_x - image_x name=image[x - image_x name=image=x - image_x name=image{x - image_x name=image,x - image_x Of course, those may not be valid HTML names according to one or more HTTP specs you care to pull out... But that don't mean somebody somewhere isn't using them successfully and won't blame you when it breaks :-( -- 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] Ways to tell if existing setup is SAPI or Shared Object?
On Thu, April 19, 2007 4:59 pm, Weston C wrote: On 4/19/07, Richard Lynch [EMAIL PROTECTED] wrote: On Thu, April 19, 2007 4:08 pm, Weston C wrote: What ways are there to tell if PHP is actually built into an Apache 2 installation or if it's installed as a shared object? phpinfo() / Server API value .. just says Apache 2.0 Filter If you can read httpd.conf, and find a LoadModule there with php, then it's shared, I think. I do have access to httpd.conf. I can't find a LoadModule directive for php in it, though. Is that a bad sign? Could they possibly have been stuffed into any of the other lesser-used conf files? Yes. The LoadModule could be anywhere in the various httpd.conf included files. Well, not ANYWHERE, as I don't think it can be only in a virtual host or directory... The php_sapi_name function and PHP_SAPI constant may be of use if you just want SAPI info in your program, rather than all of phpinfo() They're probably all exactly the same output, though. Seems to give the same result. ... if you compiled it directly into Apache (does anybody do that anymore?) I certainly wouldn't. But I think this is the default Apache2 distribution on RH9, and you just never know with those folks. ;) Almost for sure a shared library on default Apache 2 in RedHat 9, if you are just doing up2date or whatever to maintain it. Though I always compiled my apache and php from source on RH9 personally. -- 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] register_argc_argv directive
Richard Lynch wrote: On Thu, April 19, 2007 8:37 am, David Giragosian wrote: $argv and $argc came in way handy when I wrote several php-gtk apps a few years ago, which uses the CLI exe version... They are way handy for any CLI. The question I'm kinda wondering is what purpose is served by having a php.ini setting to turn the dang things *OFF*?... I seem to recall the theory behind it is that it saves some pointless parsing when running a SAPI that won't use them. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] warning message to hide
On Thu, April 19, 2007 2:27 am, Roman Neuhauser wrote: No, I've been using php-recommended.ini for the last several years. It has that error_reporting = E_ALL by default, and that's one of the reasons I've been using it. I don't think your PHP CLI is using the php.ini that you think it's using... Here's what happens without E_NOTICE: [EMAIL PROTECTED] ~ $ php -r 'var_dump($foo);' Notice: Undefined variable: foo in Command line code on line 1 Call Stack: 0.0002 1. {main}() Command line code:0 Dump $_SERVER Dump $_GET Dump $_POST Dump $_COOKIE Dump $_FILES Dump $_ENV Dump $_SESSION Dump $_REQUEST NULL [EMAIL PROTECTED] ~ $ php -v PHP 4.4.4-pl6-gentoo (cli) (built: Feb 9 2007 21:33:47) Copyright (c) 1997-2006 The PHP Group Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies with Xdebug v2.0.0RC1, Copyright (c) 2002, 2003, 2004, 2005, 2006, by Derick Rethans [EMAIL PROTECTED] ~ $ Though, granted, I have some funky call-stack add-on happening here, that all kicks in AFTER the E_NOTICE fires off. Double check what php.ini is getting used by your CLI by doing this: php -i | grep php.ini If the php.ini file at that path doesn't have E_NOTICE on, you ain't got it. -- 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] Json.php
On Thu, April 19, 2007 2:25 am, Roman Neuhauser wrote: I'm at a complete loss then. Richard, what would you advise to someone in such a messy situation? I don't really see why anybody is getting bent out of shape about 'almostatic' methods in PHP, but if they're maybe gonna go away, roll out the patch now... -- 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] warning message to hide
# [EMAIL PROTECTED] / 2007-04-19 17:28:42 -0500: On Thu, April 19, 2007 2:27 am, Roman Neuhauser wrote: No, I've been using php-recommended.ini for the last several years. It has that error_reporting = E_ALL by default, and that's one of the reasons I've been using it. I don't think your PHP CLI is using the php.ini that you think it's using... Here's what happens without E_NOTICE: [EMAIL PROTECTED] ~ $ php -r 'var_dump($foo);' Notice: Undefined variable: foo in Command line code on line 1 [EMAIL PROTECTED] ~ 1060:0 php -r 'echo E_ALL, \n;' 6143 [EMAIL PROTECTED] ~ 1061:0 php -r 'echo error_reporting(), \n; var_dump($foo);' 6143 PHP Notice: Undefined variable: foo in Command line code on line 1 NULL [EMAIL PROTECTED] ~ 1062:0 php -r 'error_reporting(E_ALL ~E_NOTICE); echo error_reporting(), \n; var_dump($foo);' 6135 NULL -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] CSS vs. Tables OT
On Thu, April 19, 2007 1:00 pm, Jim Moseby wrote: snip In fact, I may be going out on a limb here, but I challenge anyone to describe a layout that isn't covered. /snip I want a layout that looks identical in every browser without resorting to something like: switch($browser){ case 'IE':include('ie.css'); case 'Mozilla':include('mozilla.css'); {...} default:throw_hands_up_in_disgust(); ) I don't think thats possible right now, is it? Sure it is, if you don't demand a 3-column full-width footer layout, or worse... :-v Actually, I guess it depends what you mean by identical... Cuz if you mean pixel-perfect identical, and you're using PHP for dynamic content, then, no, you'll never get that even *with* the different CSS for different browsers... -- 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] warning message to hide
On Thu, April 19, 2007 5:47 pm, Roman Neuhauser wrote: # [EMAIL PROTECTED] / 2007-04-19 17:28:42 -0500: On Thu, April 19, 2007 2:27 am, Roman Neuhauser wrote: No, I've been using php-recommended.ini for the last several years. It has that error_reporting = E_ALL by default, and that's one of the reasons I've been using it. I don't think your PHP CLI is using the php.ini that you think it's using... Here's what happens without E_NOTICE: [EMAIL PROTECTED] ~ $ php -r 'var_dump($foo);' Notice: Undefined variable: foo in Command line code on line 1 Sorry. I meant *with* E_NOTICE -- 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] warning message to hide
# [EMAIL PROTECTED] / 2007-04-19 17:57:25 -0500: On Thu, April 19, 2007 5:47 pm, Roman Neuhauser wrote: # [EMAIL PROTECTED] / 2007-04-19 17:28:42 -0500: On Thu, April 19, 2007 2:27 am, Roman Neuhauser wrote: No, I've been using php-recommended.ini for the last several years. It has that error_reporting = E_ALL by default, and that's one of the reasons I've been using it. I don't think your PHP CLI is using the php.ini that you think it's using... Here's what happens without E_NOTICE: [EMAIL PROTECTED] ~ $ php -r 'var_dump($foo);' Notice: Undefined variable: foo in Command line code on line 1 Sorry. I meant *with* E_NOTICE Yeah, that's what I had posted. I think you have mistaken me with Tijnema !: On Thu, April 19, 2007 2:27 am, Roman Neuhauser wrote: : # [EMAIL PROTECTED] / 2007-04-18 23:03:08 -0500: : On Wed, April 18, 2007 2:21 am, Tijnema ! wrote: : Hmm, this is what i get: : ~# php -r 'var_dump($foo);' : NULL : ~# php -r 'var_dump(@$foo);' : NULL : : : PHP6 snapshot from a month ago. : : Your php.ini doesn't have error_reporting cranked up to include E_NOTICE. : : That's your first mistake. :-) :-) :-) : : [Roman's does have that setting changed.] : : No, I've been using php-recommended.ini for the last several years. : It has that error_reporting = E_ALL by default, and that's one of the : reasons I've been using it. IOW, I don't have error_reporting changed, to the contrary: I use the the default value from php.ini-recommended unchanged. -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] retrieve POST body?
Tijnema ! wrote: On 4/19/07, Myron Turner [EMAIL PROTECTED] wrote: André Medeiros wrote: php://stdin perhaps? On 4/18/07, Justin Frim [EMAIL PROTECTED] wrote: André Medeiros wrote: Reading from php://input on a webserver will retrieve the Body of the HTTP Request. Not for me it doesn't. That only seems to work when the form is submitted as application/x-www-form-urlencoded. When the form is submitted as multipart/form-data, php://input is blank. You probably could use this small Perl script via exec: #!/usr/bin/perl if ($ENV{'REQUEST_METHOD'} eq POST) { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); } print $buffer; If you call this script via exec, it can't return the POST data send to the PHP script right? You're right. It doesn't carry across from Perl to PHP. As penance, I worked out how to do it using PHP: form action = post_data.php method=post input type= hidden value = abcdefg name=post_test input type = submit name=submit value=submit_this /form ?php if(isset($_POST['submit'])) { $putdata = fopen(php://input, r); /* Read the data and write it to stdout */ while ($data = fread($putdata, 1024)) echo $data, \n; /* Close the streams */ fclose($fp); fclose($putdata); } ? btw, we are here on a PHP list, not PERL :) Does this mean you wouldn't use exec or system to run anything but PHP scripts? Or just that you wouldn't talk about it here, under penalty of exclusion from PHP heaven? :) -- _ Myron Turner http://www.room535.org http://www.bstatzero.org http://www.mturner.org/XML_PullParser/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: auto page generation
Michelle Konzack wrote: Hello Tim, Am 2007-04-16 19:22:21, schrieb Tim: Also can i reccomend: Web Database Applications with PHP and MySQL Do you know an equivalent book for php5 and PostgreSQL 8.1/8.2? Beginning PHP and PostgreSQL 8: From Novice to Professional (Paperback) might have something you need. (I would send an amazon link but it's about 200 characters :P). -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] retrieve POST body?
Sorry burst your bubble, but your solution isn't a viable one in my case. php://input only works if the form is submitted using application/x-www-form-urlencoded. Take your sample HTML code there and add enctype=multipart/form-data to the form tag, and I'm pretty sure you'll find that php://input contains no data. (Both PHP 5.2.1 running as a CGI on Windows and PHP 5.2.0 running as an Apache module on FreeBSD exhibit this behaviour.) And before anyone asks, it *is* a requirement to accept multipart/form-data submissions because that's the only way you can properly implement a file upload on a web form. Myron Turner wrote: Tijnema ! wrote: On 4/19/07, Myron Turner [EMAIL PROTECTED] wrote: André Medeiros wrote: php://stdin perhaps? On 4/18/07, Justin Frim [EMAIL PROTECTED] wrote: André Medeiros wrote: Reading from php://input on a webserver will retrieve the Body of the HTTP Request. Not for me it doesn't. That only seems to work when the form is submitted as application/x-www-form-urlencoded. When the form is submitted as multipart/form-data, php://input is blank. You probably could use this small Perl script via exec: #!/usr/bin/perl if ($ENV{'REQUEST_METHOD'} eq POST) { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); } print $buffer; If you call this script via exec, it can't return the POST data send to the PHP script right? You're right. It doesn't carry across from Perl to PHP. As penance, I worked out how to do it using PHP: form action = post_data.php method=post input type= hidden value = abcdefg name=post_test input type = submit name=submit value=submit_this /form ?php if(isset($_POST['submit'])) { $putdata = fopen(php://input, r); /* Read the data and write it to stdout */ while ($data = fread($putdata, 1024)) echo $data, \n; /* Close the streams */ fclose($fp); fclose($putdata); } ? btw, we are here on a PHP list, not PERL :) Does this mean you wouldn't use exec or system to run anything but PHP scripts? Or just that you wouldn't talk about it here, under penalty of exclusion from PHP heaven? :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] retrieve POST body?
That's not been my experience. I've tested it with enctype=multipart/form-data, since that's what you asked for, though the enctype wasn't included in my sample code. I've run it on PHP Version = 5.1.6 (Fedora core 4) and PHP 4.3.11 Fedora core 2. Here it is on Fedora 2: http://www.mturner.org/temp/post_data.php The code is http://www.mturner.org/temp/post_data.phps That latter is just a symbolic link to the former. It's possible that there's been a change in 5.2 that changes this behavior, or possibly the way the FreeBSD and Windows handle STDOUT. My little earlier snippet of Perl should work on any system, and so if you know any Perl, an elaboration of that would be the way to go. Justin Frim wrote: Sorry burst your bubble, but your solution isn't a viable one in my case. php://input only works if the form is submitted using application/x-www-form-urlencoded. Take your sample HTML code there and add enctype=multipart/form-data to the form tag, and I'm pretty sure you'll find that php://input contains no data. (Both PHP 5.2.1 running as a CGI on Windows and PHP 5.2.0 running as an Apache module on FreeBSD exhibit this behaviour.) And before anyone asks, it *is* a requirement to accept multipart/form-data submissions because that's the only way you can properly implement a file upload on a web form. -- _ Myron Turner http://www.room535.org http://www.bstatzero.org http://www.mturner.org/XML_PullParser/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] retrieve POST body?
Justin Frim wrote: Sorry burst your bubble, but your solution isn't a viable one in my case. php://input only works if the form is submitted using application/x-www-form-urlencoded. Take your sample HTML code there and add enctype=multipart/form-data to the form tag, and I'm pretty sure you'll find that php://input contains no data. (Both PHP 5.2.1 running as a CGI on Windows and PHP 5.2.0 running as an Apache module on FreeBSD exhibit this behaviour.) And before anyone asks, it *is* a requirement to accept multipart/form-data submissions because that's the only way you can properly implement a file upload on a web form. Good news and bad news. Rasmus reports on IRC: [21:57] Rasmus_ We never buffer the data in file upload mode [21:57] Rasmus_ it is streamed to disk, so no, you can't get it all in a variable like that [21:57] Rasmus_ set a different content-type if you want to do that [21:57] Rasmus_ assuming you have control over the client [21:58] CelloG can you do a file upload without multipart? [21:59] Rasmus_ Well, if you want to pick a POST apart yourself, sure [21:59] Rasmus_ set a mime type PHP doesn't understand and it will be in http_raw_post_data and then you can do whatever you want with it So the answer is sort of. You would have to parse the POST data yourself, but it is technically a possibility. Regards, Greg -- Experience the revolution, buy the PEAR Installer Manifesto http://www.packtpub.com/book/PEAR-installer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] copy file from server to shared network folder
Hi, Friday, April 20, 2007, 2:04:14 PM, you wrote: HH Hi everyone, HH I can't seem to be able to copy a txt file from the server over to a network HH drive. HH Server is apache on winxp and the remote PC is also running XP. HH Remote folder is shared with all read/write rights enabled. HH I also tried executing a bat file where the bat file contains the copy HH command and that didn't work either. HH 2x clicking on the bat file works. HH I tried HH echo exec(c:\\test.bat); HH and also HH echo system (c:\\test.bat); HH and HH exec('c:\Windows\system32\cmd.exe /c START c:\test.bat'); HH and HH exec('c:\\Windows\\system32\\cmd.exe /c START c:\\test.bat'); HH with no success. HH The last 2 items did launch the cmd process. HH Any ideas? Apache won't have rights to access the network, you need to read: http://httpd.apache.org/docs/1.3/win_service.html -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] retrieve POST body?
Myron Turner wrote: That's not been my experience. I've tested it with enctype=multipart/form-data, since that's what you asked for, though the enctype wasn't included in my sample code. I've run it on PHP Version = 5.1.6 (Fedora core 4) and PHP 4.3.11 Fedora core 2. Here it is on Fedora 2: http://www.mturner.org/temp/post_data.php The code is http://www.mturner.org/temp/post_data.phps the enctype attribute should be in the form tag, not the submit input. Put it in form and your php://input will disappear Greg -- Experience the revolution, buy the PEAR Installer Manifesto http://www.packtpub.com/book/PEAR-installer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] retrieve POST body?
Gregory Beaver wrote: [21:58] CelloG can you do a file upload without multipart? [21:59] Rasmus_ Well, if you want to pick a POST apart yourself, sure [21:59] Rasmus_ set a mime type PHP doesn't understand and it will be in http_raw_post_data and then you can do whatever you want with it So the answer is sort of. You would have to parse the POST data yourself, but it is technically a possibility. That was also in the back of my mind when responding. When file uploads first came out and weren't yet handled by the Perl CGI module, we had to learn to parse the input stream ourselves. It's still not clear why that should be necessary at this time. For instance, if it's necessary to pass in CGI parameters at the same time as sending out a file, the parameters can be tacked onto a query string and they will be packed into both the $_POST and the $_GET arrays. -- _ Myron Turner http://www.room535.org http://www.bstatzero.org http://www.mturner.org/XML_PullParser/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] retrieve POST body?
Gregory Beaver wrote: Myron Turner wrote: That's not been my experience. I've tested it with enctype=multipart/form-data, since that's what you asked for, though the enctype wasn't included in my sample code. I've run it on PHP Version = 5.1.6 (Fedora core 4) and PHP 4.3.11 Fedora core 2. Here it is on Fedora 2: http://www.mturner.org/temp/post_data.php The code is http://www.mturner.org/temp/post_data.phps the enctype attribute should be in the form tag, not the submit input. Put it in form and your php://input will disappear That's what happens when your trying to do too many tings at once. Thanks, Myron -- _ Myron Turner http://www.room535.org http://www.bstatzero.org http://www.mturner.org/XML_PullParser/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Ways to tell if existing setup is SAPI or Shared Object?
On 4/19/07, Edward Vermillion [EMAIL PROTECTED] wrote: Fedora, and I'm assuming RedHat and possibly others that use their system layout, will put the loading line in /etc/httpd/conf.d/ php.conf so yes it can be in an external configuration file. That's the exact location, and it's a shared object. Thank you! The other method I thought of was to search for lib4php.so, and if it's found, rename it, restart Apache, and see if/where it complains. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] retrieve POST body?
Interesting... But how will the user-agent know how to pack the data? AFAIK, if you don't specify enctype in the form tag, the user-agent will assume application/x-www-form-urlencoded. I'm assuming that if you put in something that's not recognized (like multipart/x-non-parsed-form-data), the user-agent won't know what it is and will again default to application/x-www-form-urlencoded. So to use the dirty hack suggested by Rasmus in that IRC log, I'd need some way of instructing the user-agent to use multipart/form-data, but then destroy the Content-Type header in the request *before* PHP sees it and snags the body. Gregory Beaver wrote: Good news and bad news. Rasmus reports on IRC: [21:57] Rasmus_ We never buffer the data in file upload mode [21:57] Rasmus_ it is streamed to disk, so no, you can't get it all in a variable like that [21:57] Rasmus_ set a different content-type if you want to do that [21:57] Rasmus_ assuming you have control over the client [21:58] CelloG can you do a file upload without multipart? [21:59] Rasmus_ Well, if you want to pick a POST apart yourself, sure [21:59] Rasmus_ set a mime type PHP doesn't understand and it will be in http_raw_post_data and then you can do whatever you want with it So the answer is sort of. You would have to parse the POST data yourself, but it is technically a possibility. Regards, Greg -- Experience the revolution, buy the PEAR Installer Manifesto http://www.packtpub.com/book/PEAR-installer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] retrieve POST body?
Regarding some discussion a while back about putting in a feature request for obtaining the POST body... I can see the advantage of streaming the POST body directly to disk, because then you don't have to allocate a huge amount of memory for keeping a copy of the POST body in a variable. So maybe (and this is wishful thinking), a feature could be added to PHP where the entire POST body, unaltered, is streamed to a file in the same fasion as those individual temporary files referenced in the $_FILES[] array. Then for HTTP digest authenticated requests with integrity protection, I could just call md5_file() on this special file, and my world would be a whole lot simpler! (And any other script programmers, should they need to access the POST body for whatever reason, can just read the file and parse it however necessary. No gigantic memory overhead involved.) Just a thought. Gregory Beaver wrote: Good news and bad news. Rasmus reports on IRC: [21:57] Rasmus_ We never buffer the data in file upload mode [21:57] Rasmus_ it is streamed to disk, so no, you can't get it all in a variable like that [21:57] Rasmus_ set a different content-type if you want to do that [21:57] Rasmus_ assuming you have control over the client [21:58] CelloG can you do a file upload without multipart? [21:59] Rasmus_ Well, if you want to pick a POST apart yourself, sure [21:59] Rasmus_ set a mime type PHP doesn't understand and it will be in http_raw_post_data and then you can do whatever you want with it So the answer is sort of. You would have to parse the POST data yourself, but it is technically a possibility. Regards, Greg -- Experience the revolution, buy the PEAR Installer Manifesto http://www.packtpub.com/book/PEAR-installer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php