php-general Digest 24 Sep 2006 00:05:39 -0000 Issue 4364

2006-09-23 Thread php-general-digest-help
php-general Digest 24 Sep 2006 00:05:39 - Issue 4364 Topics (messages 242144 through 242162): Re: PHP5 object construct 242144 by: Chris Boget Re: libcurl (cookies across cURL session). . .? 242145 by: Michael Williams Object to array conversion oddity 242146 by:

[PHP] libcurl (cookies across cURL session). . .?

2006-09-23 Thread Michael Williams
Hi all, Is there any way at all by which to persist cookies across cURL sessions? Basically I have a login page that sets cookies and looks for them for logged in status so that the user may use the site to their heart's content. The problem with cURL, however, appears that after the

Re: [PHP] libcurl (cookies across cURL session). . .?

2006-09-23 Thread Robert Cummings
On Sat, 2006-09-23 at 02:10 -0400, Michael Williams wrote: Hi all, Is there any way at all by which to persist cookies across cURL sessions? Basically I have a login page that sets cookies and looks for them for logged in status so that the user may use the site to their heart's

Re: [PHP] libcurl (cookies across cURL session). . .?

2006-09-23 Thread Michael Williams
Robert, Thanks. The thing is that lots of cookies are set regularly. Are you suggesting that every time I receive a Set-Cookie: to 1)parse that line out 2)append it to a file 3) retrieve it when necessary? I'm not terribly familiar with the proper format for a cookie, but I'll look

Re: [PHP] Help converting C to PHP

2006-09-23 Thread Richard Lynch
On Fri, September 22, 2006 7:40 pm, Rory Browne wrote: Fair enough. Prime Number Script Competition ( for Bragging Rights ). I challenge the readers of this list to produce the necessary code to find the lowest prime number higher than a certain inputted number. The script must be web

[PHP] Re: +AFs-OT+AF0- Working with version control

2006-09-23 Thread Colin Guthrie
Richard Lynch wrote: On Thu, September 21, 2006 7:08 pm, Colin Guthrie wrote: I've used CVS a fair amount, no branching, as everybody always said what a bear it was to merge. I keep hearing subversion is easier to branch/merge. Absolutely! I never quite managed to get CVS's branching and

Re: [PHP] File Upload Security and chmod

2006-09-23 Thread Børge Holen
On Saturday 23 September 2006 01:27, you wrote: Hi Borge, host/users/myDomain is the actual directory (and it's the root directory), and I do not have access to higher directories. So basically I do not have access to directories higher than my root directory, which is unfortunate. Also,

Re: [PHP] reading urlencoded data from POST

2006-09-23 Thread Marek 'MMx' Ludha
Accessing $HTTP_RAW_POST_DATA is similar to reading php://input which I mentioned in my previous email. I am not quite sure what is $_POST useful for. It is intended for reading urlencoded data which it does only in special cases (no \0 or \5C chars) and everyone has to parse it himself. Did I

Re: [PHP] Help converting C to PHP

2006-09-23 Thread Rory Browne
Whoops - sorry replied directly to Richard instead of to the list. Submission process is simply to post to the list. It's probably a good idea ( and acceptable ) to just post an SHA1(MD5 for this purpose is compromised) hash of your code before the deadline, and submit your actual code shortly

Re: [PHP] libcurl (cookies across cURL session). . .?

2006-09-23 Thread Tom Atkinson
Use cURL's own cookie handling features. curl_setopt($ch, CURLOPT_COOKIEJAR, '/tmp/cookies.txt'); curl_setopt($ch, CURLOPT_COOKIEFILE, '/tmp/cookies.txt'); That will store the cookies in the file and read them from there next time. /tmp may or may not be a suitable location. Michael Williams

Re: [PHP] PHP5 object construct

2006-09-23 Thread Chris Boget
ok, so if we were talking Java, perhaps you are looking for information that allows you to build 'accessor' and 'mutator' methods? If so, then your example should work (syntax aside). Here's another 'test' example that I just whipped up and tested that shows you can use any method name you wish.

Re: [PHP] libcurl (cookies across cURL session). . .?

2006-09-23 Thread Michael Williams
Tom, I tried writing to a local file(./cache/cookiejar), but to no avail. I'll give /tmp a try to see if that location makes any difference. Permissions aside, I should be able to write where I wish, correct? Thanks, Mike On Sep 23, 2006, at 7:43 AM, [EMAIL PROTECTED] wrote: From:

[PHP] Object to array conversion oddity

2006-09-23 Thread Marcus Bointon
A simple class like this: class Myclass() { public $field1 = ''; private $field2 = ''; public function __sleep() { return array('field1', 'field2'); } } $myclass = new Myclass; If I var_dump this, I get: object(Myclass)#6 (2) { [field1]= string(0) [field2:private]= string(0) } If

Re: [PHP] Object to array conversion oddity

2006-09-23 Thread Ray Hauge
On Saturday 23 September 2006 09:40, Marcus Bointon wrote: A simple class like this: class Myclass() { public $field1 = ''; private $field2 = ''; public function __sleep() { return array('field1', 'field2'); } } $myclass = new Myclass; If I var_dump this, I get: object(Myclass)#6

Re: [PHP] File Upload Security and chmod

2006-09-23 Thread tedd
At 7:19 PM -0600 9/22/06, Andy Hultgren wrote: For whatever reason when I ftp in using WinFtp I don't see public_html (it's hidden, don't know why; if I make a directory called .public_html it gets created and then disappears), but I can see my file structure from my host's website and so I know

Re: [PHP] Object to array conversion oddity

2006-09-23 Thread Marcus Bointon
On 23 Sep 2006, at 15:51, Ray Hauge wrote: To me it looks like they append the name of the class to any private variables. I would guess that it does this to make sure you know what you're doing and using the private variable like that. I'm just guessing at that point though. Well, I

Re: [PHP] Object to array conversion oddity

2006-09-23 Thread Marcus Bointon
Here's a more accurate example: ?php class Myclass { public $field1 = ''; private $field2 = ''; protected $field3 = ''; } $myclass = new Myclass; var_dump($myclass); var_dump((array)$myclass); ? This produces: object(Myclass)#1 (3) { [field1]= string(0)

Re: [PHP] Object to array conversion oddity

2006-09-23 Thread Ray Hauge
On Saturday 23 September 2006 10:04, Marcus Bointon wrote: On 23 Sep 2006, at 15:51, Ray Hauge wrote: To me it looks like they append the name of the class to any private variables. I would guess that it does this to make sure you know what you're doing and using the private variable

Re: [PHP] Object to array conversion oddity

2006-09-23 Thread Marcus Bointon
On 23 Sep 2006, at 16:37, Ray Hauge wrote: Could you do something like this? $private = Myclass $protected = *; No, because if I have a property called 'Myclassfield1', after casting to an array I can't tell if it's private property called 'field1' or a public property called

Re: [PHP] Object to array conversion oddity

2006-09-23 Thread Robert Cummings
On Sat, 2006-09-23 at 16:04 +0100, Marcus Bointon wrote: On 23 Sep 2006, at 15:51, Ray Hauge wrote: To me it looks like they append the name of the class to any private variables. I would guess that it does this to make sure you know what you're doing and using the private variable

Re: [PHP] Object to array conversion oddity

2006-09-23 Thread Robert Cummings
On Sat, 2006-09-23 at 11:46 -0400, Robert Cummings wrote: On Sat, 2006-09-23 at 16:04 +0100, Marcus Bointon wrote: On 23 Sep 2006, at 15:51, Ray Hauge wrote: To me it looks like they append the name of the class to any private variables. I would guess that it does this to make sure

Re: [PHP] Object to array conversion oddity

2006-09-23 Thread Marcus Bointon
On 23 Sep 2006, at 16:46, Robert Cummings wrote: And the likelihood of you having a property called Myclassfield1 is? Sure, but don't you think that coding should at least try to be driven by logic rather than luck? I'm also not denying that it's not too hard to work around (with a

Re: [PHP] Object to array conversion oddity

2006-09-23 Thread Ray Hauge
On Saturday 23 September 2006 11:41, Marcus Bointon wrote: On 23 Sep 2006, at 16:46, Robert Cummings wrote: And the likelihood of you having a property called Myclassfield1 is? Sure, but don't you think that coding should at least try to be driven by logic rather than luck? I'm also not

Re: [PHP] Object to array conversion oddity

2006-09-23 Thread Jon Anderson
Marcus Bointon wrote: Sure, but don't you think that coding should at least try to be driven by logic rather than luck? I'm also not denying that it's not too hard to work around (with a function not dissimilar to what you suggested), but I'd really prefer it if it just did what it says on the

Re: [PHP] php/css and .htaccess [SOLVED]

2006-09-23 Thread J?rgen Wind
tedd wrote: At 10:37 AM -0500 9/21/06, David Giragosian wrote: On 9/21/06, tedd mailto:[EMAIL PROTECTED][EMAIL PROTECTED] wrote: -snip- Now, this header coupled with the above .htaccess allows php code to be embedded within a css file AND work for all popular browsers, including

Re: [PHP] Object to array conversion oddity

2006-09-23 Thread Marcus Bointon
On 23 Sep 2006, at 18:54, Jon Anderson wrote: If you just want an array of properties, add this to your class... That's exactly the kind of thing I was on about. Since reflection gives access to all this information, why bother trying to squeeze the same info into an array-shaped

Re: [PHP] Object to array conversion oddity

2006-09-23 Thread Marcus Bointon
I've written a function that does a conversion that matches the docs, based on the other info I've mentioned: /** * Clean up the name munging that PHP applies while casting from object to array * The resulting array looks like what the documentation says that (array)$object delivers, but

Re[2]: [PHP] symlink

2006-09-23 Thread Tom Rogers
Hi, Saturday, September 23, 2006, 10:37:20 AM, you wrote: RL On Mon, September 18, 2006 4:53 pm, Ross wrote: Can someone explain how and why you would use a symlink in php? RL A symlink is the Un*x version of a Windows shortcut or the Mac's RL alias RL The difference being that a symlink

Re: [PHP] Object to array conversion oddity

2006-09-23 Thread Robert Cummings
On Sat, 2006-09-23 at 17:41 +0100, Marcus Bointon wrote: On 23 Sep 2006, at 16:46, Robert Cummings wrote: And the likelihood of you having a property called Myclassfield1 is? Sure, but don't you think that coding should at least try to be driven by logic rather than luck? I'm also not

Re: [PHP] Object to array conversion oddity

2006-09-23 Thread Robert Cummings
On Sat, 2006-09-23 at 22:35 +0100, Marcus Bointon wrote: I've written a function that does a conversion that matches the docs, based on the other info I've mentioned: /** * Clean up the name munging that PHP applies while casting from object to array * The resulting array looks like

[PHP] Re: php/css and .htaccess [SOLVED]

2006-09-23 Thread Richard Lynch
On Sat, September 23, 2006 10:06 am, tedd wrote: I am sure that with a little browser sniffing via php and taking Browser-sniffing is the unreliable part. compliant (hack-less) code, one could get the code to adapt to the browser. In other words, this would present an option for all css

Re: [PHP] reading urlencoded data from POST

2006-09-23 Thread Richard Lynch
$_POST is useful for FORM data -- it urldecodes the data, and assumes it's something somebody would actually type into a FORM. This would be what 99.9% of websites need and want. $HTTP_RAW_POST_DATA gives you ALL the raw encoded data to parse as you see fit. This covers the rest of the needs.