From nyphp at websapp.com Fri Aug 1 08:03:15 2003
From: nyphp at websapp.com (Daniel Kushner)
Date: Fri, 1 Aug 2003 08:03:15 -0400
Subject: [nycphp-talk] RE: [nycphp-dev] SESSIONS & COOKIES
In-Reply-To: <001c01c3580c$a9613dc0$c801a8c0@dj>
Message-ID:
If your session is dependent on the status of a cookie, you need to set your
cookie to expire when the browser is closed (i.e. ccokie lifetime = 0). You
can put a timestamp in the session and manualy kill the session if it was
created more than 20 minutes ago.
--Daniel
-----Original Message-----
From: dev-bounces at lists.nyphp.org [mailto:dev-bounces at lists.nyphp.org]On
Behalf Of Donald J. Organ IV
Sent: Friday, August 01, 2003 5:10 AM
To: talk at lists.nyphp.org; NYPHP Development
Subject: [nycphp-dev] SESSIONS & COOKIES
Does anyone know of a way to not only have the session expire when the
cookies do when also when the browser closes, right now I am using:
session_set_cookie_params( 1200,"/","dorgan.serveftp.net");
Now I know that, will make the session expire after 20 minutes but how do
I have the session expire not only after 20 minutes but when the browser is
closed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From shiflett at php.net Fri Aug 1 10:38:48 2003
From: shiflett at php.net (Chris Shiflett)
Date: Fri, 1 Aug 2003 07:38:48 -0700 (PDT)
Subject: [nycphp-talk] Re: [nycphp-dev] SESSIONS & COOKIES
In-Reply-To: <001c01c3580c$a9613dc0$c801a8c0@dj>
Message-ID: <20030801143848.62659.qmail@web14310.mail.yahoo.com>
--- "Donald J. Organ IV" wrote:
> Does anyone know of a way to not only have the session expire when the
> cookies do when also when the browser closes
I'm sure there are creative ways of having a cookie expiration date *and*
terminate the session when the browser closes, but it's much simpler to just
have the cookie expire when the browser closes (by putting no expiration date).
Does this help, or do you really need both?
Chris
=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/
From wfan at encogent.com Fri Aug 1 13:26:00 2003
From: wfan at encogent.com (Wellington Fan)
Date: Fri, 1 Aug 2003 13:26:00 -0400
Subject: [nycphp-talk] Multi part related emails
In-Reply-To: <20030801143848.62659.qmail@web14310.mail.yahoo.com>
Message-ID:
Hello all!
I'm wondering if anyone has experience with multipart-related html emails.
I'd like to send out an html email with embedded images, that do NOT reference
an external img src, but rather another "part" of the email.
For eaxample, the first part is the html code, which references an image
thusly (it's quoted-printable):
*************************************************
*************************************************
as a second part, the image is encoded:
*************************************************
------=_NextPart_000_0000_01C35826.C5C0BC10
Content-Type: image/gif
Content-Transfer-Encoding: base64
Content-Location: file:email2.gif
R0lGODlh8wF3AdUAAP///wAAAP8B/wAA/wD/AP8AAAH///7/AKWlpUNDQzHDw39/f/+5uf96eqam
*************************************************
My questions are:
1. Does anyone know how well supported across email clients
"multipart-related" emails are?
2. Does anyone know of a freely available script for authoring these?
Thanks all!
--
WF
From mjdewitt at alexcommgrp.com Fri Aug 1 13:39:34 2003
From: mjdewitt at alexcommgrp.com (DeWitt, Michael)
Date: Fri, 1 Aug 2003 13:39:34 -0400
Subject: [nycphp-talk] Multi part related emails
Message-ID:
I had this same need and found this bit of code on the web which I modified
a bit to suit my need. I can't remember where I got it, and I would like to
give credit back to the original author, but they didn't put anything into
the comments.
The function should send any kind of file as part of a multi-part email. I
used it for a gif. In testing it, it seemed to work fine. In terms of
compatibility, I did find that one webmail client (IMP) didn't handle the
attachment correctly, but forwarding it to another mail client from IMP was
fine. Outlook 97 handles it fine.
Hope this helps.
Mike
Here it is.
Mail sent! Yay PHP!
";
} else {
echo "Mail could not be sent. Sorry!
";
}
*/
return $ok;
} //end of function
?>
> Hello all!
>
> I'm wondering if anyone has experience with multipart-related html emails.
>
> I'd like to send out an html email with embedded images, that do NOT
> reference
> an external img src, but rather another "part" of the email.
>
> For eaxample, the first part is the html code, which references an image
> thusly (it's quoted-printable):
> *************************************************
>
> *************************************************
>
> as a second part, the image is encoded:
> *************************************************
> ------=_NextPart_000_0000_01C35826.C5C0BC10
> Content-Type: image/gif
> Content-Transfer-Encoding: base64
> Content-Location: file:email2.gif
>
> R0lGODlh8wF3AdUAAP///wAAAP8B/wAA/wD/AP8AAAH///7/AKWlpUNDQzHDw39/f/+5uf96eq
> am
>
> *************************************************
>
> My questions are:
> 1. Does anyone know how well supported across email clients
> "multipart-related" emails are?
>
> 2. Does anyone know of a freely available script for authoring these?
>
> Thanks all!
>
> --
> WF
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
From bpang at bpang.com Fri Aug 1 14:01:54 2003
From: bpang at bpang.com (Brian Pang)
Date: Fri, 01 Aug 2003 14:01:54 -0400
Subject: [nycphp-talk] Multi part related emails
Message-ID:
This looks similar enough to one that I worked up... although mine seems
to have some unknown problem with Lotus Notes (1 client uses that so I
had to go with a PERL module solution for their site instead).
However, I found that the chunk_split() would insert a literal space
every chucklen (default of 76) which was totally screwing everything up.
So I just nixed the chunk_split() and it worked ok, except for Lotus
Notes.. but who cares about that ;)
> I had this same need and found this bit of code on the web which I
modified
> a bit to suit my need. I can't remember where I got it, and I would
like to
> give credit back to the original author, but they didn't put anything into
> the comments.
>
> The function should send any kind of file as part of a multi-part
email. I
> used it for a gif. In testing it, it seemed to work fine. In terms of
> compatibility, I did find that one webmail client (IMP) didn't handle the
> attachment correctly, but forwarding it to another mail client from
IMP was
> fine. Outlook 97 handles it fine.
>
> Hope this helps.
>
> Mike
>
> Here it is.
>
> // Read POST request params into global vars
>
> function mail_attachment
> ($to,$from,$subject,$message,$file_location,$filename) {
>
> /*
> if you want to play with the function, just uncomment what you want from
> this section and shove some values in.
>
> $to = $_POST['to'];
> $from = $_POST['from'];
> $subject = $_POST['subject'];
> $message = $_POST['message'];
>
> $to="someone at somewhere.com";
> $subject="test attachment";
> $message="this is just a test.";
> $file_location="/www/yourserver/somewhere/";
> $filename="yourfile.gif";
> */
>
>
> //File uploads in PHP 4.1 are placed in a special $_FILES array, so we
fetch
> the values we need out of it:
>
> // Obtain file upload vars
> $fileatt = $_FILES['fileatt']['tmp_name'];
> $fileatt_type = $_FILES['fileatt']['type'];
> $fileatt_name = $_FILES['fileatt']['name'];
>
> //For the sake of brevity, we'll assume that the required parameters ($to
> and $from) now have valid values (email addresses) in them. Normally we
> would check their format with regular expressions.
>
> //Next, we use the $from value to begin building the extra headers for the
> email:
>
> $headers = "From: $from";
>
> //Next we check the $fileatt variable, which may or may not contain
the path
> and filename to an uploaded file attachment. We use PHP's is_uploaded_file
> function to find out:
>
> if (file_exists($file_location.$filename)) {
> // Read the file to be attached ('rb' = read binary)
> $file = fopen($file_location.$filename,'rb');
> $data = fread($file,filesize($file_location.$filename));
> fclose($file);
>
> //Having read in the data for the file attachment, we need to set up the
> message headers to send a multipart/mixed message:
>
> // Generate a boundary string
> $semi_rand = md5(time());
> $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
>
> // Add the headers for a file attachment
> $headers .= "\nMIME-Version: 1.0\n" .
> "Content-Type: multipart/mixed;\n" .
> " boundary=\"{$mime_boundary}\"";
>
> //Now for the message body itself. This works just as we saw for the text
> part of a mixed message in the previous section:
>
> // Add a multipart boundary above the plain message
> $message = "This is a multi-part message in MIME format.\n\n" .
> "--{$mime_boundary}\n" .
> "Content-Type: text/plain; charset=\"iso-8859-1\"\n" .
> "Content-Transfer-Encoding: 7bit\n\n" .
> $message . "\n\n";
>
> //Now, to allow for binary file types, we need to use Base64 encoding to
> convert the (possibly binary) file attachment data to a text-only format
> suitable for sending by email. All email programs in popular use support
> Base64 encoding of file attachments, so this is the best way to go.
> Fortunately, PHP provides a function for Base64 encoding:
>
> // Base64 encode the file data
> $data = chunk_split(base64_encode($data));
>
> //We now have everything we need to write the portion of the message that
> contains the file attachment. Here's the code:
>
> // Add file attachment to the message
> $message .= "--{$mime_boundary}\n" .
> "Content-Type: {$fileatt_type};\n" .
> " name=\"{$filename}\"\n" .
> "Content-Disposition: attachment;\n" .
> " filename=\"{$filename}\"\n" .
> "Content-Transfer-Encoding: base64\n\n" .
> $data . "\n\n" .
> "--{$mime_boundary}--\n";
> }
>
> //That completes the modifications necessary to accommodate a file
> attachment. We can now send the message with a quick call to mail:
>
> // Send the message
> $ok = @mail($to, $subject, $message, $headers);
> /*if ($ok) {
> echo "Mail sent! Yay PHP!
";
> } else {
> echo "Mail could not be sent. Sorry!
";
> }
> */
> return $ok;
> } //end of function
> ?>
>
>
>
> > Hello all!
> >
> > I'm wondering if anyone has experience with multipart-related html
emails.
> >
> > I'd like to send out an html email with embedded images, that do NOT
> > reference
> > an external img src, but rather another "part" of the email.
> >
> > For eaxample, the first part is the html code, which references an image
> > thusly (it's quoted-printable):
> > *************************************************
> >
> > *************************************************
> >
> > as a second part, the image is encoded:
> > *************************************************
> > ------=_NextPart_000_0000_01C35826.C5C0BC10
> > Content-Type: image/gif
> > Content-Transfer-Encoding: base64
> > Content-Location: file:email2.gif
> >
> >
R0lGODlh8wF3AdUAAP///wAAAP8B/wAA/wD/AP8AAAH///7/AKWlpUNDQzHDw39/f/+5uf96eq
> > am
> >
> > *************************************************
> >
> > My questions are:
> > 1. Does anyone know how well supported across email clients
> > "multipart-related" emails are?
> >
> > 2. Does anyone know of a freely available script for authoring these?
> >
> > Thanks all!
> >
> > --
> > WF
> >
> > _______________________________________________
> > talk mailing list
> > talk at lists.nyphp.org
> > http://lists.nyphp.org/mailman/listinfo/talk
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>
>
From bpang at bpang.com Fri Aug 1 14:03:27 2003
From: bpang at bpang.com (Brian Pang)
Date: Fri, 01 Aug 2003 14:03:27 -0400
Subject: [nycphp-talk] eating cookies in IE on XP?
Message-ID:
Does anyone know of an issue with (php) cookies in IE on XP (at least I
think it's XP, it's not my machine, it's a remote client's) where if the
cookie's expiration is set to sometime in the past it is still somehow
returns true for
isset($_COOKIE['foo']);
It doesn't happen to me with Mozilla/Linux and I don'to have an XP box
to test with.
I'm guessing that I if I have to, changing the value of the cookie to a
string I can check, like $_COOKIE['foo'] = "EXPIRE", will be a
reasonable workaround.
Thanks....
From wfan at encogent.com Fri Aug 1 14:23:06 2003
From: wfan at encogent.com (Wellington Fan)
Date: Fri, 1 Aug 2003 14:23:06 -0400
Subject: [nycphp-talk] Multi part related emails
In-Reply-To:
Message-ID:
Mike,
Thanks very much! Just after I sent my message to the list I found a great
script for sending complex emails called PHPMailer
Below is the code that I used to send an HTML email with an embedded image.
Note the src value of the image -- it uses a "protocol" called "cid:" which I
must investigate. Seems like that must refer to another "part" in the
multipart message....
********************************************
From = "sender at mydomain.com";
$mail->FromName = "Sample Name";
$mail->Host = "smtp.mydomain.com";
$mail->Mailer = "smtp";
$mail->IsHTML(true);
$mail->AddEmbeddedImage("foo.gif", "my-attach", "foo.gif");
$mail->Body = 'Embedded Image: Here
is an image!';
$mail->AddAddress("recipient at example.com");
if(!$mail->Send()){
echo "Message was not sent";
echo "Mailer Error: " . $mail->ErrorInfo;
}else{
echo "Message has been sent";
}
?>
-----Original Message-----
From: talk-bounces at lists.nyphp.org
[mailto:talk-bounces at lists.nyphp.org]On Behalf Of DeWitt, Michael
Sent: Friday, August 01, 2003 1:40 PM
To: 'NYPHP Talk'
Subject: RE: [nycphp-talk] Multi part related emails
I had this same need and found this bit of code on the web which I modified
a bit to suit my need...
From shiflett at php.net Fri Aug 1 14:28:28 2003
From: shiflett at php.net (Chris Shiflett)
Date: Fri, 1 Aug 2003 11:28:28 -0700 (PDT)
Subject: [nycphp-talk] eating cookies in IE on XP?
In-Reply-To:
Message-ID: <20030801182828.96062.qmail@web14310.mail.yahoo.com>
--- Brian Pang wrote:
> Does anyone know of an issue with (php) cookies in IE on XP
> (at least I think it's XP, it's not my machine, it's a remote
> client's) where if the cookie's expiration is set to sometime
> in the past it is still somehow returns true for
> isset($_COOKIE['foo']);
Do you understand how cookies work? If you answer yes, then I can skip a whole
bunch of questions. :-)
If not, at what point after "setting" the cookie's expiration date to an
expired date are you checking for its existance?
Chris
=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/
From wfan at encogent.com Fri Aug 1 14:29:28 2003
From: wfan at encogent.com (Wellington Fan)
Date: Fri, 1 Aug 2003 14:29:28 -0400
Subject: [nycphp-talk] Multi part related emails
In-Reply-To:
Message-ID:
For the interested parties, the cid: (and mid:) URL schemes are specified
here:
http://www.ietf.org/rfc/rfc2111.txt
Enjoy!
--
WF
From bpang at bpang.com Fri Aug 1 14:31:44 2003
From: bpang at bpang.com (Brian Pang)
Date: Fri, 01 Aug 2003 14:31:44 -0400
Subject: [nycphp-talk] eating cookies in IE on XP?
Message-ID:
yes, I understand how cookies work... I assume you are asking if I know
that the changes won't take effect until the next page load.
I'm checking on subsequent pages after changing the expiration...
> --- Brian Pang wrote:
> > Does anyone know of an issue with (php) cookies in IE on XP
> > (at least I think it's XP, it's not my machine, it's a remote
> > client's) where if the cookie's expiration is set to sometime
> > in the past it is still somehow returns true for
> > isset($_COOKIE['foo']);
>
> Do you understand how cookies work? If you answer yes, then I can skip
a whole
> bunch of questions. :-)
>
> If not, at what point after "setting" the cookie's expiration date to an
> expired date are you checking for its existance?
>
> Chris
>
> =====
> Become a better Web developer with the HTTP Developer's Handbook
> http://httphandbook.org/
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>
>
From bpang at bpang.com Fri Aug 1 14:34:19 2003
From: bpang at bpang.com (Brian Pang)
Date: Fri, 01 Aug 2003 14:34:19 -0400
Subject: [nycphp-talk] eating cookies in IE on XP?
Message-ID:
yes, I understand how cookies work... I assume you are asking if I know
that the changes won't take effect until the next page load.
I'm checking on subsequent pages after changing the expiration...
> --- Brian Pang wrote:
> > Does anyone know of an issue with (php) cookies in IE on XP
> > (at least I think it's XP, it's not my machine, it's a remote
> > client's) where if the cookie's expiration is set to sometime
> > in the past it is still somehow returns true for
> > isset($_COOKIE['foo']);
>
> Do you understand how cookies work? If you answer yes, then I can skip
a whole
> bunch of questions. :-)
>
> If not, at what point after "setting" the cookie's expiration date to an
> expired date are you checking for its existance?
>
> Chris
>
> =====
> Become a better Web developer with the HTTP Developer's Handbook
> http://httphandbook.org/
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>
>
From shiflett at php.net Fri Aug 1 14:46:58 2003
From: shiflett at php.net (Chris Shiflett)
Date: Fri, 1 Aug 2003 11:46:58 -0700 (PDT)
Subject: [nycphp-talk] eating cookies in IE on XP?
In-Reply-To:
Message-ID: <20030801184658.80874.qmail@web14305.mail.yahoo.com>
--- Brian Pang wrote:
> yes, I understand how cookies work... I assume you are asking
> if I know that the changes won't take effect until the next page
> load.
Well, that and a dozen other questions, yes. I didn't want to offend you by
asking a bunch of questions that were not the least bit helpful or insulted
your intelligence. I'm just trying to gauge the question.
Given that, there are a few methods of getting a closer look into what is going
on. If you have ethereal, tcpdump, or something like that, you can snoop the
HTTP transaction(s) in question. Because "setting" a cookie really just means
that you send a Set-Cookie response header in your HTTP response, it is
possible that you are actually setting a different cookie that is immediately
expired rather than modifying the existing cookie. The browser determines
whether the cookie identified in the Set-Cookie header is a new cookie or the
same old one, so that might account for some slight differences with regard to
different browsers, platforms, etc.
Another thing that would be helpful to do would be to examine the cookie store
of the browser. Instead of trying to expire the cookie, change the date you are
sending to be in the future (rather than the past - use the same exact code
otherwise). If the browser is in fact updating the existing cookie like you
want, you should be able to observe the change in expiration. Otherwise, there
should be an additional cookie created (which you wouldn't notice if it was
immediately expired), and you'll know that some of the cookie restrictions
aren't matching up, so the browser considers it a new cookie.
Those are some ideas. Hope that helps.
Chris
=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/
From ttoomey at ydnt.com Fri Aug 1 15:34:05 2003
From: ttoomey at ydnt.com (Tim Toomey)
Date: Fri, 1 Aug 2003 14:34:05 -0500
Subject: [nycphp-talk] automatically parse breaks
Message-ID: <000c01c35863$e1fe4590$7600a8c0@timmerslaptop>
I want to make it so that people here at the company can edit info on our website, and i want to make it so that if they hit the return key within a text field, a new line will be parsed. So that instead of having to learn how to use
and html they will just hit the key and php will know to make a new line.
Does anyone know the code for this?
-timmy
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From shiflett at php.net Fri Aug 1 15:37:16 2003
From: shiflett at php.net (Chris Shiflett)
Date: Fri, 1 Aug 2003 12:37:16 -0700 (PDT)
Subject: [nycphp-talk] automatically parse breaks
In-Reply-To: <000c01c35863$e1fe4590$7600a8c0@timmerslaptop>
Message-ID: <20030801193716.4938.qmail@web14310.mail.yahoo.com>
--- Tim Toomey wrote:
> I want to make it so that people here at the company can edit
> info on our website, and i want to make it so that if they hit
> the return key within a text field, a new line will be parsed.
http://labs.google.com/glossary?q=parse&btnG=Google+Glossary+Search
http://www.php.net/nl2br
Hope that helps.
Chris
=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/
From dorgan at optonline.net Fri Aug 1 17:04:33 2003
From: dorgan at optonline.net (Donald J. Organ IV)
Date: Fri, 01 Aug 2003 17:04:33 -0400
Subject: [nycphp-talk] automatically parse breaks
References: <000c01c35863$e1fe4590$7600a8c0@timmerslaptop>
Message-ID: <001d01c35870$82759030$c801a8c0@dj>
when displaying the information on the site use nl2br(); and then when editing the information in a text box or text area use nl2br() and then htmlspecialchars();
----- Original Message -----
From: Tim Toomey
To: talk at lists.nyphp.org
Sent: Friday, August 01, 2003 3:34 PM
Subject: [nycphp-talk] automatically parse breaks
I want to make it so that people here at the company can edit info on our website, and i want to make it so that if they hit the return key within a text field, a new line will be parsed. So that instead of having to learn how to use
and html they will just hit the key and php will know to make a new line.
Does anyone know the code for this?
-timmy
------------------------------------------------------------------------------
_______________________________________________
talk mailing list
talk at lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From soazine at erols.com Fri Aug 1 23:23:35 2003
From: soazine at erols.com (Phil Powell)
Date: Fri, 1 Aug 2003 23:23:35 -0400
Subject: [nycphp-talk] PHP pages cache in spite of header() - ideas?
References: <000c01c35863$e1fe4590$7600a8c0@timmerslaptop>
<001d01c35870$82759030$c801a8c0@dj>
Message-ID: <00be01c358a5$755b9450$67a76244@philofsoa>
// PREVENT CACHING FIRST BEFORE ANYTHING ELSE!
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
I am using the following commands to force the PHP script to not cache; however, it still does cache. Browser settings were checked and corrected; yet it still caches.
Suggestions?
Phil
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From pat at vote.com Fri Aug 1 23:41:26 2003
From: pat at vote.com (Patrick Hunt)
Date: Fri, 01 Aug 2003 23:41:26 -0400
Subject: [nycphp-talk] PHP pages cache in spite of header() - ideas?
In-Reply-To: <00be01c358a5$755b9450$67a76244@philofsoa>
Message-ID: <20030802034018.5A6DAA85EA@virtu.nyphp.org>
Phil,
I've had EXTREMELY mixed results with the 'replace' parameter of
the header function, so I suspect it's broken in some versions of
PHP. I've had good results with combining all the Cache-Control
directives into one call to header(). I'd also add 'private' to the
list of Cache-Control params.
--Original Message Text---
From: Phil Powell
Date: Fri, 1 Aug 2003 23:23:35 -0400
// PREVENT CACHING FIRST BEFORE ANYTHING ELSE!
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in
the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); //
always modified
header("Cache-Control: no-store, no-cache, must-revalidate"); //
HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
I am using the following commands to force the PHP script to not
cache; however, it still does cache. Browser settings were checked
and corrected; yet it still caches.
Suggestions?
Phil
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From shiflett at php.net Sat Aug 2 01:01:07 2003
From: shiflett at php.net (Chris Shiflett)
Date: Fri, 1 Aug 2003 22:01:07 -0700 (PDT)
Subject: [nycphp-talk] PHP pages cache in spite of header() - ideas?
In-Reply-To: <20030802034018.5A6DAA85EA@virtu.nyphp.org>
Message-ID: <20030802050107.81242.qmail@web14307.mail.yahoo.com>
--- Patrick Hunt wrote:
> I've had EXTREMELY mixed results with the 'replace' parameter of
> the header function, so I suspect it's broken in some versions of
> PHP. I've had good results with combining all the Cache-Control
> directives into one call to header().
I was going to make the same suggestion.
> I'd also add 'private' to the list of Cache-Control params.
Actually, "no-store" is the most extreme anti-caching directive for the
Cache-Control header, so it alone should suffice. I've always coupled it with
"no-cache" just in case some browsers misinterpret one or the other (which some
do).
Try just those two first - no sense in beating a dead horse. :-) Throw in the
"Pragma: no-cache" to prevent caching from HTTP/1.0 agents that don't
understand Cache-Control.
Chris
=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/
From chendry at nyc.rr.com Sat Aug 2 02:58:48 2003
From: chendry at nyc.rr.com (Christopher Hendry)
Date: Sat, 2 Aug 2003 02:58:48 -0400
Subject: [nycphp-talk] PHP pages cache in spite of header() - ideas?
In-Reply-To: <20030802050107.81242.qmail@web14307.mail.yahoo.com>
Message-ID:
I may have a beer or two in me, but isn't cacheing a client (or proxy) side
thing, thus independent of PHP?
I've heard/seen some not so pleasant cacheing stuff from IE, whereas Mozilla
seems to respond to cache-control quite well.
Correct me, please, if I'm off base here.
C
-> -----Original Message-----
-> From: talk-bounces at lists.nyphp.org
-> [mailto:talk-bounces at lists.nyphp.org]On Behalf Of Chris Shiflett
-> Sent: Saturday, August 02, 2003 1:01 AM
-> To: NYPHP Talk; Phil Powell
-> Subject: Re: [nycphp-talk] PHP pages cache in spite of header() - ideas?
->
->
-> --- Patrick Hunt wrote:
-> > I've had EXTREMELY mixed results with the 'replace' parameter of
-> > the header function, so I suspect it's broken in some versions of
-> > PHP. I've had good results with combining all the Cache-Control
-> > directives into one call to header().
->
-> I was going to make the same suggestion.
->
-> > I'd also add 'private' to the list of Cache-Control params.
->
-> Actually, "no-store" is the most extreme anti-caching directive for the
-> Cache-Control header, so it alone should suffice. I've always
-> coupled it with
-> "no-cache" just in case some browsers misinterpret one or the
-> other (which some
-> do).
->
-> Try just those two first - no sense in beating a dead horse. :-)
-> Throw in the
-> "Pragma: no-cache" to prevent caching from HTTP/1.0 agents that don't
-> understand Cache-Control.
->
-> Chris
->
-> =====
-> Become a better Web developer with the HTTP Developer's Handbook
-> http://httphandbook.org/
-> _______________________________________________
-> talk mailing list
-> talk at lists.nyphp.org
-> http://lists.nyphp.org/mailman/listinfo/talk
->
From wfan at encogent.com Sat Aug 2 10:16:51 2003
From: wfan at encogent.com (Wellington Fan)
Date: Sat, 2 Aug 2003 10:16:51 -0400
Subject: [nycphp-talk] PHP pages cache in spite of header() - ideas?
In-Reply-To:
Message-ID:
There are other kinds of caching besides browser (client-side) caching.
This: http://www.mnot.net/cache_docs/#KINDS is an excellent article about all
kinds of caching.
--
Wellington
-----Original Message-----
From: talk-bounces at lists.nyphp.org
[mailto:talk-bounces at lists.nyphp.org]On Behalf Of Christopher Hendry
Sent: Saturday, August 02, 2003 2:59 AM
To: NYPHP Talk
Subject: RE: [nycphp-talk] PHP pages cache in spite of header() - ideas?
I may have a beer or two in me, but isn't cacheing a client (or proxy) side
thing, thus independent of PHP?
From chendry at nyc.rr.com Sat Aug 2 10:59:09 2003
From: chendry at nyc.rr.com (Christopher Hendry)
Date: Sat, 2 Aug 2003 10:59:09 -0400
Subject: [nycphp-talk] PHP pages cache in spite of header() - ideas?
In-Reply-To:
Message-ID:
thanks Wellington -
I should know better than to drunk email the list :)
C
-> -----Original Message-----
-> From: talk-bounces at lists.nyphp.org
-> [mailto:talk-bounces at lists.nyphp.org]On Behalf Of Wellington Fan
-> Sent: Saturday, August 02, 2003 10:17 AM
-> To: NYPHP Talk
-> Subject: RE: [nycphp-talk] PHP pages cache in spite of header() - ideas?
->
->
-> There are other kinds of caching besides browser (client-side) caching.
->
-> This: http://www.mnot.net/cache_docs/#KINDS is an excellent
-> article about all
-> kinds of caching.
->
-> --
-> Wellington
->
->
-> -----Original Message-----
-> From: talk-bounces at lists.nyphp.org
-> [mailto:talk-bounces at lists.nyphp.org]On Behalf Of Christopher Hendry
-> Sent: Saturday, August 02, 2003 2:59 AM
-> To: NYPHP Talk
-> Subject: RE: [nycphp-talk] PHP pages cache in spite of header() - ideas?
->
->
-> I may have a beer or two in me, but isn't cacheing a client (or
-> proxy) side
-> thing, thus independent of PHP?
->
-> _______________________________________________
-> talk mailing list
-> talk at lists.nyphp.org
-> http://lists.nyphp.org/mailman/listinfo/talk
->
From shiflett at php.net Sat Aug 2 12:56:04 2003
From: shiflett at php.net (Chris Shiflett)
Date: Sat, 2 Aug 2003 09:56:04 -0700 (PDT)
Subject: [nycphp-talk] PHP pages cache in spite of header() - ideas?
In-Reply-To:
Message-ID: <20030802165604.12433.qmail@web14305.mail.yahoo.com>
--- Christopher Hendry wrote:
> I may have a beer or two in me
So things should make more sense to you than the rest of us. :-)
> isn't cacheing a client (or proxy) side thing, thus
> independent of PHP?
Any Web agent can cache resources, so caching can be on the client, server, or
any intermediary (such as a proxy). Even with client caching, PHP can play a
significant role, because it allows you to modify the HTTP headers sent in the
response. Whether interpreted correctly or not, the HTTP headers in the
response are what these agents use to determine whether to cache the response.
Pertaining to your comment about the differences between Mozilla and IE, I sent
an email to this list a few months ago where I speculated about one legitimate
reason for such discrepancies. You can read it here:
http://lists.nyphp.org/pipermail/talk/2003-March/002828.html
Hope that helps.
Chris
=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/
From dmintz at panix.com Sat Aug 2 13:04:27 2003
From: dmintz at panix.com (David Mintz)
Date: Sat, 2 Aug 2003 13:04:27 -0400 (EDT)
Subject: [nycphp-talk] array_diff that works both ways ?
In-Reply-To:
References:
Message-ID:
I'm wondering what's the most efficient way to find out if $array1 and
$array2 contain exactly the same elements, without regard to order.
array_diff(array1,array2) "returns an array containing all the values of
array1 that are not present in any of the other arguments." according to
TFM. Assuming
$array1 = array(1,2,3);
$array2 = array(2,3,4);
then array_diff($array1,$array2) would return an array containing 1. I'd
like to get one containing (1,4). I know I could sort them both and then
test them for equality. I just wonder if there's a more efficient
technique or if I'm overlooking some native function that does this.
(FWIW, it's for a home-grown shopping cart kind of thing and the objective
is to detect whether the array of product ids they just POSTed is any
different from its counterpart in $_SESSION, to avoid doing needless
database calls).
Always gratefully,
---
David Mintz
http://davidmintz.org/
Email: See http://dmintzweb.com/whitelist.php first!
Decibels of sound pressure employed by a new "thermoacoustic" refrigerator: 190
Decibels of sound pressure sufficient to ignite a person's hair: 165
-- Harper's Index, February 2003
From jonbaer at jonbaer.net Sat Aug 2 16:23:04 2003
From: jonbaer at jonbaer.net (Jon Baer)
Date: Sat, 2 Aug 2003 13:23:04 -0700
Subject: [nycphp-talk] array_diff that works both ways ?
References:
Message-ID: <000901c35933$e120e760$6500a8c0@THINKPAD>
dont think u need to sort, u could just merge results:
$array1 = array(1,2,3);
$array2 = array(2,3,4);
$array3 = array_merge(array_diff($array1, $array2), array_diff($array2,
$array1));
print_r($array3);
but i think u r right there should be a "array_diff_recursive" method or
something.
- jon
pgp key: http://www.jonbaer.net/jonbaer.asc
fingerprint: F438 A47E C45E 8B27 F68C 1F9B 41DB DB8B 9A0C AF47
----- Original Message -----
From: "David Mintz"
To: ; "NYPHP Talk"
Sent: Saturday, August 02, 2003 10:04 AM
Subject: [nycphp-talk] array_diff that works both ways ?
>
> I'm wondering what's the most efficient way to find out if $array1 and
> $array2 contain exactly the same elements, without regard to order.
> array_diff(array1,array2) "returns an array containing all the values of
> array1 that are not present in any of the other arguments." according to
> TFM. Assuming
>
> $array1 = array(1,2,3);
> $array2 = array(2,3,4);
>
> then array_diff($array1,$array2) would return an array containing 1. I'd
> like to get one containing (1,4). I know I could sort them both and then
> test them for equality. I just wonder if there's a more efficient
> technique or if I'm overlooking some native function that does this.
>
> (FWIW, it's for a home-grown shopping cart kind of thing and the objective
> is to detect whether the array of product ids they just POSTed is any
> different from its counterpart in $_SESSION, to avoid doing needless
> database calls).
>
> Always gratefully,
>
>
> ---
> David Mintz
> http://davidmintz.org/
> Email: See http://dmintzweb.com/whitelist.php first!
>
> Decibels of sound pressure employed by a new "thermoacoustic"
refrigerator: 190
> Decibels of sound pressure sufficient to ignite a person's hair: 165
>
> -- Harper's Index, February 2003
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>
From hans at nyphp.org Sat Aug 2 15:15:50 2003
From: hans at nyphp.org (Hans Zaunere)
Date: Sat, 02 Aug 2003 15:15:50 -0400
Subject: [nycphp-talk] NYPHP: Oracle Developer Days
In-Reply-To:
References:
Message-ID: <3F2C0DE6.80101@nyphp.org>
Hey Tom et al,
tom at supertom.com wrote:
> OK, I am registered and looking forward to it. Where is everyone going to
> meet?
I'll post something exact Wednesday, but we'll be meeting at Penn station somewhere. Anyone have a good meeting spot in or around Penn station? Also, with us Friday will be some New Brunswick old timers, so the trip out should be smooth.
Looking forward to it,
H
From dmintz at panix.com Sat Aug 2 15:34:51 2003
From: dmintz at panix.com (David Mintz)
Date: Sat, 2 Aug 2003 15:34:51 -0400 (EDT)
Subject: [nycphp-talk] array_diff that works both ways ?
In-Reply-To: <000901c35933$e120e760$6500a8c0@THINKPAD>
References:
<000901c35933$e120e760$6500a8c0@THINKPAD>
Message-ID:
On Sat, 2 Aug 2003, Jon Baer wrote:
> dont think u need to sort, u could just merge results:
>
> $array1 = array(1,2,3);
> $array2 = array(2,3,4);
> $array3 = array_merge(array_diff($array1, $array2), array_diff($array2,
> $array1));
> print_r($array3);
>
> but i think u r right there should be a "array_diff_recursive" method or
> something.
that makes sense. I ended up doing this, because all i really need is a
boolean
function isDifferent($array1,$array2) {
return sizeof(array_diff($array1,$array2)) +
sizeof(array_diff($array2,$array1)) > 0 ;
}
and I guess that's sane... Sane Enough, to coin a phrase
thanks!
---
David Mintz
http://davidmintz.org/
Email: See http://dmintzweb.com/whitelist.php first!
Decibels of sound pressure employed by a new "thermoacoustic" refrigerator: 190
Decibels of sound pressure sufficient to ignite a person's hair: 165
-- Harper's Index, February 2003
From jonbaer at jonbaer.net Sat Aug 2 18:43:18 2003
From: jonbaer at jonbaer.net (Jon Baer)
Date: Sat, 2 Aug 2003 15:43:18 -0700
Subject: [nycphp-talk] good articles on mysql subqueries ...
Message-ID: <002001c35947$77de6700$6500a8c0@THINKPAD>
just thought id pass these along ...
http://www.devshed.com/Server_Side/MySQL/MySQL_Subqueries/print_html
http://www.devshed.com/Server_Side/MySQL/MySQL_Subqueries2/print_html
- jon
pgp key: http://www.jonbaer.net/jonbaer.asc
fingerprint: F438 A47E C45E 8B27 F68C 1F9B 41DB DB8B 9A0C AF47
From chendry at nyc.rr.com Sun Aug 3 00:42:55 2003
From: chendry at nyc.rr.com (Christopher Hendry)
Date: Sun, 3 Aug 2003 00:42:55 -0400
Subject: [nycphp-talk] fsockopen and SSL (was POST via PHP)
In-Reply-To: <20030801025943.GC28066@panix.com>
Message-ID:
ok, so my POST needs to go to a secure server, and although fsockopen has
SSL support in PHP 4.3.0+, I have to make this happen in a couple of hosted
environments which are all 4.2.* ...
Before I go and mess about with cURL (which seems a bit hefty) or - dare I
say it - use perl, does anyone have any suggestions for using fsockopen or
another option which would use PHP to send POST data to a secure server?
Thanks.
C
-> -----Original Message-----
-> From: talk-bounces at lists.nyphp.org
-> [mailto:talk-bounces at lists.nyphp.org]On Behalf Of Analysis & Solutions
-> Sent: Thursday, July 31, 2003 11:00 PM
-> To: NYPHP Talk
-> Subject: Re: [nycphp-talk] POST via PHP
->
->
-> Hi Christopher:
->
-> Try the post to host scripts here:
->
-> http://www.php-faq.com/postToHost.html
-> http://dodds.net/~cardinal/sendtohost.txt
->
-> Enjoy,
->
-> --Dan
->
-> --
-> FREE scripts that make web and database programming easier
-> http://www.analysisandsolutions.com/software/
-> T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
-> 4015 7th Ave #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
-> _______________________________________________
-> talk mailing list
-> talk at lists.nyphp.org
-> http://lists.nyphp.org/mailman/listinfo/talk
->
From hans at nyphp.org Sun Aug 3 10:56:43 2003
From: hans at nyphp.org (Hans Zaunere)
Date: Sun, 03 Aug 2003 10:56:43 -0400
Subject: [nycphp-talk] fsockopen and SSL (was POST via PHP)
In-Reply-To:
References:
Message-ID: <3F2D22AB.9080703@nyphp.org>
Christopher Hendry wrote:
> ok, so my POST needs to go to a secure server, and although fsockopen has
> SSL support in PHP 4.3.0+, I have to make this happen in a couple of hosted
> environments which are all 4.2.* ...
>
> Before I go and mess about with cURL (which seems a bit hefty) or - dare I
> say it - use perl, does anyone have any suggestions for using fsockopen or
> another option which would use PHP to send POST data to a secure server?
I'd go with curl, especially if you're stuck with an oldish version of PHP. Perl isn't going to gain you anything and curl is better suited for this type of thing anyway.
H
From stephen at musgrave.org Sun Aug 3 11:50:21 2003
From: stephen at musgrave.org (Stephen Musgrave)
Date: Sun, 03 Aug 2003 11:50:21 -0400
Subject: [nycphp-talk] Removing email addresses from DB from bounced emails
Message-ID:
Ok, so in the fury of development, I have been a bit lazy in managing the
table that holds all of the email addresses for my eNewsletter. I know
there are scripts out there that 'listen' to the inbox and removes the email
address of any bounced messages.
I'm interested to know if there are any recommendations, lessons learned,
advice, etc before I delve into this project.
Thanks,
Stephen
***
*** stephen at musgrave.org
*** http://musgrave.org
*** http://orangeAge.com/nuuk
***
*** "The conscious and intelligent manipulation of the
*** organized habits and opinions of the masses is an
*** important element in democratic society."
***
*** - Edward Bernays
***
From rolan at datawhorehouse.com Sun Aug 3 14:28:31 2003
From: rolan at datawhorehouse.com (Rolan)
Date: Sun, 03 Aug 2003 14:28:31 -0400
Subject: [nycphp-talk] Removing email addresses from DB from bounced emails
In-Reply-To:
References:
Message-ID: <3F2D544F.4010307@datawhorehouse.com>
The email list software, Mailman, can be configured so that it
only sends out emails (newsletter style). Mailman automatically
handles subscribes, unsubscribes, and bounces.
~Rolan
Stephen Musgrave wrote:
>Ok, so in the fury of development, I have been a bit lazy in managing the
>table that holds all of the email addresses for my eNewsletter. I know
>there are scripts out there that 'listen' to the inbox and removes the email
>address of any bounced messages.
>
>I'm interested to know if there are any recommendations, lessons learned,
>advice, etc before I delve into this project.
>
>Thanks,
>
>Stephen
>
> ***
> *** stephen at musgrave.org
> *** http://musgrave.org
> *** http://orangeAge.com/nuuk
> ***
> *** "The conscious and intelligent manipulation of the
> *** organized habits and opinions of the masses is an
> *** important element in democratic society."
> ***
> *** - Edward Bernays
> ***
>
>_______________________________________________
>talk mailing list
>talk at lists.nyphp.org
>http://lists.nyphp.org/mailman/listinfo/talk
>
>
>
From jhorsman at dds.nl Mon Aug 4 07:39:43 2003
From: jhorsman at dds.nl (Jan Horsman)
Date: Mon, 4 Aug 2003 13:39:43 +0200
Subject: [nycphp-talk] Removing email addresses from DB from bounced emails
In-Reply-To:
Message-ID:
You could start with manually gathering bounced messages. Then look for
common used words in these messages (such as bounced, warning, unknows
address). Based on a few rules you can determine wich mails are bounced
e-mails, there is no standarisation on bounced e-mails. To determine to
which account or e-mail address the bounced message belongs, I would put an
unique id in the header of the eNewsletter and store thus id in the
database.
Using this method you can nog filter all bounced messages, but depending on
the rules you used, filter a lot of them.
Succes, Jan
-----Original Message-----
From: talk-bounces at lists.nyphp.org
[mailto:talk-bounces at lists.nyphp.org]On Behalf Of Stephen Musgrave
Sent: zondag 3 augustus 2003 17:50
To: nyPHP - Talk Talk
Subject: [nycphp-talk] Removing email addresses from DB from bounced
emails
Ok, so in the fury of development, I have been a bit lazy in managing the
table that holds all of the email addresses for my eNewsletter. I know
there are scripts out there that 'listen' to the inbox and removes the email
address of any bounced messages.
I'm interested to know if there are any recommendations, lessons learned,
advice, etc before I delve into this project.
Thanks,
Stephen
***
*** stephen at musgrave.org
*** http://musgrave.org
*** http://orangeAge.com/nuuk
***
*** "The conscious and intelligent manipulation of the
*** organized habits and opinions of the masses is an
*** important element in democratic society."
***
*** - Edward Bernays
***
_______________________________________________
talk mailing list
talk at lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk
From psaw at pswebcode.com Mon Aug 4 07:42:15 2003
From: psaw at pswebcode.com (pswebcode, nyc)
Date: Mon, 4 Aug 2003 07:42:15 -0400
Subject: [nycphp-talk] Seeking Basic PHP IM/Threaded Msg Bd Suggestion
Message-ID: <000a01c35a7d$76ac96e0$68e4a144@bronco>
Good Day:
I'm looking for suggestions. I want to give a client:
1) ability to have online IM/chat-style meetings
2) ability to create/post a topic and have associates make suggestions and
updates
Optionally, ability to print history of an IM exchange and/or threaded
topic.
Should be opensource PHP/MySQL project. Flash okay too.
I'm sifting through the collaborative, whiteboard, shout, chat, threaded
message projects out there. Most have way too many bells and whistles like
avatars, private rooms, blacklists...
I'm seeking a basic project for use on controlled, private, business level.
Warmest regards,
Peter Sawczynec, Technology Director
PSWebcode -- Web Development and
Site Architecture
psaw at pswebcode.com
www.pswebcode.com
718.543.3240
From hans at nyphp.org Mon Aug 4 11:27:13 2003
From: hans at nyphp.org (Hans Zaunere)
Date: Mon, 04 Aug 2003 11:27:13 -0400
Subject: [nycphp-talk] Seeking Basic PHP IM/Threaded Msg Bd Suggestion
In-Reply-To: <000a01c35a7d$76ac96e0$68e4a144@bronco>
References: <000a01c35a7d$76ac96e0$68e4a144@bronco>
Message-ID: <3F2E7B51.8060708@nyphp.org>
Hey Peter,
I'm just throwing a couple things out here...
> 1) ability to have online IM/chat-style meetings
Hmm, in AMP? Jabber, or even AIM itself, might be the way to go, especially if it needs to be realtime. Otherwise, perhaps a PHP forum of sorts, but I don't know of a realtime chat system in PHP. Although, you mention Flash, so maybe an AMP backed system with a Flash frontend does exist... would be cool.
> 2) ability to create/post a topic and have associates make suggestions and
> updates
Some flavor of wiki I suppose, although I'm not a big fan either.
H
From nyphp at websapp.com Mon Aug 4 11:30:34 2003
From: nyphp at websapp.com (Daniel Kushner)
Date: Mon, 4 Aug 2003 11:30:34 -0400
Subject: [nycphp-talk] OT Javascript Question
Message-ID:
To all those JS gurus out there (Krook!),
Is there a way to get the HTML source of a page into a javascipt variable
(on the same page)?
Thanks,
Daniel
From shiflett at php.net Mon Aug 4 12:18:22 2003
From: shiflett at php.net (Chris Shiflett)
Date: Mon, 4 Aug 2003 09:18:22 -0700 (PDT)
Subject: [nycphp-talk] Seeking Basic PHP IM/Threaded Msg Bd Suggestion
In-Reply-To: <3F2E7B51.8060708@nyphp.org>
Message-ID: <20030804161822.13211.qmail@web14311.mail.yahoo.com>
--- Hans Zaunere wrote:
> Otherwise, perhaps a PHP forum of sorts, but I don't know of a
> realtime chat system in PHP.
There's IRCG, which uses IRC somehow to provide real-time streaming to
PHP-enabled Web sites. There is a related project called TitanChat that I think
uses IRCG somehow. I know very little about it other than that, but you can
read more about it here:
http://schumann.cx/ircg/
A few years ago, I wrote a simple script to demonstrate how to control the size
of chunks when using chunked transfer encoding. Combined with a persistent
connection, this is how you can make "chat rooms" and the like with PHP. You
can check out my (rather lame, now that I look back at it) example here:
http://shiflett.org/tutorials/php_flush.php
Hope that helps.
Chris
=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/
From David.SextonJr at ubs.com Mon Aug 4 12:33:53 2003
From: David.SextonJr at ubs.com (Sexton, David)
Date: Mon, 4 Aug 2003 12:33:53 -0400
Subject: [nycphp-talk] Seeking Basic PHP IM/Threaded Msg Bd Suggestion
Message-ID: <18D7B8CAA5284F478470828806DB124603789F0F@psle01.xchg.pwj.com>
I can't seem to get this (your flush example) to work on Win32. I've heard
that some versions of IE output 1 byte at a time, but it works fine from
your host with IE6. Anyone know how to get this to work with IIS? Thanks.
-----Original Message-----
From: Chris Shiflett [mailto:shiflett at php.net]
Sent: Monday, August 04, 2003 12:18 PM
To: NYPHP Talk
Subject: Re: [nycphp-talk] Seeking Basic PHP IM/Threaded Msg Bd
Suggestion
--- Hans Zaunere wrote:
> Otherwise, perhaps a PHP forum of sorts, but I don't know of a
> realtime chat system in PHP.
There's IRCG, which uses IRC somehow to provide real-time streaming to
PHP-enabled Web sites. There is a related project called TitanChat that I
think
uses IRCG somehow. I know very little about it other than that, but you can
read more about it here:
http://schumann.cx/ircg/
A few years ago, I wrote a simple script to demonstrate how to control the
size
of chunks when using chunked transfer encoding. Combined with a persistent
connection, this is how you can make "chat rooms" and the like with PHP. You
can check out my (rather lame, now that I look back at it) example here:
http://shiflett.org/tutorials/php_flush.php
Hope that helps.
Chris
=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/
_______________________________________________
talk mailing list
talk at lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk
Please do not transmit orders or instructions regarding a UBS account by
email. The information provided in this email or any attachments is not an
official transaction confirmation or account statement. For your protection,
do not include account numbers, Social Security numbers, credit card
numbers, passwords or other non-public information in your email. Because
the information contained in this message may be privileged, confidential,
proprietary or otherwise protected from disclosure, please notify us
immediately by replying to this message and deleting it from your computer
if you have received this communication in error. Thank you.
UBS Financial Services Inc.
UBS International Inc.
From shiflett at php.net Mon Aug 4 13:05:56 2003
From: shiflett at php.net (Chris Shiflett)
Date: Mon, 4 Aug 2003 10:05:56 -0700 (PDT)
Subject: [nycphp-talk] Seeking Basic PHP IM/Threaded Msg Bd Suggestion
In-Reply-To: <18D7B8CAA5284F478470828806DB124603789F0F@psle01.xchg.pwj.com>
Message-ID: <20030804170556.25103.qmail@web14304.mail.yahoo.com>
--- "Sexton, David" wrote:
> I can't seem to get this (your flush example) to work on Win32.
> I've heard that some versions of IE output 1 byte at a time, but
> it works fine from your host with IE6. Anyone know how to get
> this to work with IIS? Thanks.
So you copy/pasted the code and tried it on IIS? I just want to make sure I
understand what isn't working.
That being the case, there are several things that can make flush() not work
like you want (even with Apache). Basically, any buffering is going to screw it
up, unless you can control the buffering also. For example, with ob_start() and
friends, you can ob_flush() and then flush(), and you're fine. Of course, with
Web server buffering, it's not as easy to force it to flush when you want. With
Web client buffering (like some versions of IE use to make it look like they
render faster), I've heard of some "tricks" you can use like generating a bunch
of whitespace output first.
http://www.php.net/flush has this to say:
"Several servers, especially on Win32, will still buffer the output from your
script until it terminates before transmitting the results to the browser."
So, it looks like you might be out of luck on Win32, but maybe Apache still
works, even on Windows.
Chris
=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/
From David.SextonJr at ubs.com Mon Aug 4 14:03:33 2003
From: David.SextonJr at ubs.com (Sexton, David)
Date: Mon, 4 Aug 2003 14:03:33 -0400
Subject: [nycphp-talk] Seeking Basic PHP IM/Threaded Msg Bd Suggestion
Message-ID: <18D7B8CAA5284F478470828806DB124603789F11@psle01.xchg.pwj.com>
>"Several servers, especially on Win32, will still buffer the output from
your
>script until it terminates before transmitting the results to the browser."
>
>So, it looks like you might be out of luck on Win32, but maybe Apache still
>works, even on Windows.
Yes, unfortunately it does look that way, unless there is a way to
"convince" IIS into behaving differently. I just wanted to make sure I
wasn't overlooking anything from a PHP perspective. Thanks for the insight.
-----Original Message-----
From: Chris Shiflett [mailto:shiflett at php.net]
Sent: Monday, August 04, 2003 1:06 PM
To: Sexton, David; 'NYPHP Talk'
Subject: RE: [nycphp-talk] Seeking Basic PHP IM/Threaded Msg Bd
Suggestion
--- "Sexton, David" wrote:
> I can't seem to get this (your flush example) to work on Win32.
> I've heard that some versions of IE output 1 byte at a time, but
> it works fine from your host with IE6. Anyone know how to get
> this to work with IIS? Thanks.
So you copy/pasted the code and tried it on IIS? I just want to make sure I
understand what isn't working.
That being the case, there are several things that can make flush() not work
like you want (even with Apache). Basically, any buffering is going to screw
it
up, unless you can control the buffering also. For example, with ob_start()
and
friends, you can ob_flush() and then flush(), and you're fine. Of course,
with
Web server buffering, it's not as easy to force it to flush when you want.
With
Web client buffering (like some versions of IE use to make it look like they
render faster), I've heard of some "tricks" you can use like generating a
bunch
of whitespace output first.
http://www.php.net/flush has this to say:
"Several servers, especially on Win32, will still buffer the output from
your
script until it terminates before transmitting the results to the browser."
So, it looks like you might be out of luck on Win32, but maybe Apache still
works, even on Windows.
Chris
=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/
Please do not transmit orders or instructions regarding a UBS account by
email. The information provided in this email or any attachments is not an
official transaction confirmation or account statement. For your protection,
do not include account numbers, Social Security numbers, credit card
numbers, passwords or other non-public information in your email. Because
the information contained in this message may be privileged, confidential,
proprietary or otherwise protected from disclosure, please notify us
immediately by replying to this message and deleting it from your computer
if you have received this communication in error. Thank you.
UBS Financial Services Inc.
UBS International Inc.
From andrew at digitalpulp.com Mon Aug 4 15:58:01 2003
From: andrew at digitalpulp.com (Andrew Yochum)
Date: Mon, 4 Aug 2003 15:58:01 -0400
Subject: [nycphp-talk] OT Javascript Question
In-Reply-To:
References:
Message-ID: <20030804195754.GH1128@localhost.localdomain>
On Mon, Aug 04, 2003 at 11:30:34AM -0400, Daniel Kushner wrote:
> To all those JS gurus out there (Krook!),
>
> Is there a way to get the HTML source of a page into a javascipt variable
> (on the same page)?
Something like this should do it:
try {
// For IE
htmlsource = document.body.innerHTML
} catch (e) {
// For Mozilla et. all
htmlsource = document.body.value
}
>
> Thanks,
> Daniel
--
Andrew Yochum
Digital Pulp, Inc.
212.679.0676x255
andrew at digitalpulp.com
From dkrook at hotmail.com Mon Aug 4 16:04:57 2003
From: dkrook at hotmail.com (D C Krook)
Date: Mon, 04 Aug 2003 16:04:57 -0400
Subject: [nycphp-talk] OT Javascript Question
Message-ID:
Kushner,
I don't think it's possible to simply get the contents of the file, but you
can get the innerText and innerHTML of many elements by tag or id. That
process is pretty finicky too as it requires a cutting edge browser and well
formed HTML.
The easiest way that I can think to approach the problem (depending on
whether you can use PHP or whether your page content is determined before or
after page pre-processing) is to dump the results of a PHP readfile into the
JavaScript variable:
var pageContents = addslashes(readfile($_SERVER['PHP_SELF'])) ?>
If all else fails, this guide is pretty handy for JS DOM element reading:
http://krook.org/jsdom/
>To all those JS gurus out there (Krook!),
>
>Is there a way to get the HTML source of a page into a javascipt variable
>(on the same page)?
>
>Thanks,
>Daniel
_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.
http://join.msn.com/?page=features/virus
From nyphp at websapp.com Mon Aug 4 16:14:04 2003
From: nyphp at websapp.com (Daniel Kushner)
Date: Mon, 4 Aug 2003 16:14:04 -0400
Subject: [nycphp-talk] OT Javascript Question
In-Reply-To:
Message-ID:
> The easiest way that I can think to approach the problem (depending on
> whether you can use PHP or whether your page content is
> determined before or
> after page pre-processing) is to dump the results of a PHP
> readfile into the
> JavaScript variable:
>
> var pageContents = addslashes(readfile($_SERVER['PHP_SELF'])) ?>
Unfortunately this isn't the case. The dynamically created page belongs to a
third party and the maximum they can do is stick in some JavaScript and
Oddcast's VHost. The VHost flash component will send parts of the HTML (that
it is embedded in) to our servers for further processing.
--Daniel
From andrew at digitalpulp.com Mon Aug 4 16:21:36 2003
From: andrew at digitalpulp.com (Andrew Yochum)
Date: Mon, 4 Aug 2003 16:21:36 -0400
Subject: [nycphp-talk] OT Javascript Question
In-Reply-To:
References:
Message-ID: <20030804202128.GJ1128@localhost.localdomain>
On Mon, Aug 04, 2003 at 04:04:57PM -0400, D C Krook wrote:
> Kushner,
>
> I don't think it's possible to simply get the contents of the file, but you
> can get the innerText and innerHTML of many elements by tag or id. That
> process is pretty finicky too as it requires a cutting edge browser and
> well formed HTML.
>
> The easiest way that I can think to approach the problem (depending on
> whether you can use PHP or whether your page content is determined before
> or after page pre-processing) is to dump the results of a PHP readfile into
> the JavaScript variable:
>
> var pageContents = addslashes(readfile($_SERVER['PHP_SELF'])) ?>
Beware of the recursion problem this introduces... you could easily bring a
server to its knees if that isn't corrected.
> If all else fails, this guide is pretty handy for JS DOM element reading:
>
> http://krook.org/jsdom/
>
>
>
>
>
> >To all those JS gurus out there (Krook!),
> >
> >Is there a way to get the HTML source of a page into a javascipt variable
> >(on the same page)?
> >
> >Thanks,
> >Daniel
--
Andrew Yochum
Digital Pulp, Inc.
212.679.0676x255
andrew at digitalpulp.com
From chendry at nyc.rr.com Mon Aug 4 16:54:54 2003
From: chendry at nyc.rr.com (Christopher Hendry)
Date: Mon, 4 Aug 2003 16:54:54 -0400
Subject: [nycphp-talk] OT Javascript Question
In-Reply-To:
Message-ID:
->
-> If all else fails, this guide is pretty handy for JS DOM element reading:
->
-> http://krook.org/jsdom/
->
Thank you Krook! I've been looking for something like this for a while (and
never felt like doing it myself)...
This will save me much digging time.
- Chendry
From danielc at analysisandsolutions.com Mon Aug 4 20:02:47 2003
From: danielc at analysisandsolutions.com (Analysis & Solutions)
Date: Mon, 4 Aug 2003 20:02:47 -0400
Subject: [nycphp-talk] php lowlights from SecurityFocus Newsletter #208
Message-ID: <20030805000247.GA26136@panix.com>
e107 Website System HTML Injection Vulnerability
http://www.securityfocus.com/bid/8279
PBLang Bulletin Board System HTML Injection Vulnerability
http://www.securityfocus.com/bid/8284
PBLang Bulletin Board System IMG Tag HTML Injection Vulnerability
http://www.securityfocus.com/bid/8286
Gallery Search Engine Cross-Site Scripting Vulnerability
http://www.securityfocus.com/bid/8288
Enjoy, and code correctly,
--Dan
--
FREE scripts that make web and database programming easier
http://www.analysisandsolutions.com/software/
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7th Ave #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
From webapprentice at onemain.com Mon Aug 4 23:05:38 2003
From: webapprentice at onemain.com (Webapprentice)
Date: Mon, 04 Aug 2003 23:05:38 -0400
Subject: [nycphp-talk] OT Javascript Question
In-Reply-To:
References:
Message-ID: <3F2F1F02.1090101@onemain.com>
Wow, javadoc-based documentation of Javascript DOM!
I am in awe....
Christopher Hendry wrote:
> ->
> -> If all else fails, this guide is pretty handy for JS DOM element reading:
> ->
> -> http://krook.org/jsdom/
> ->
>
> Thank you Krook! I've been looking for something like this for a while (and
> never felt like doing it myself)...
>
> This will save me much digging time.
>
> - Chendry
>
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>
From dkrook at hotmail.com Mon Aug 4 23:39:39 2003
From: dkrook at hotmail.com (D C Krook)
Date: Mon, 04 Aug 2003 23:39:39 -0400
Subject: [nycphp-talk] OT Javascript Question
Message-ID:
Heh, I wish I had written it myself.
It's actually something I discovered packaged along with Parasoft's WebKing
tool. I found it a pretty handy reference so I posted it on my development
server for easy reference.
>Wow, javadoc-based documentation of Javascript DOM!
>
>I am in awe....
_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail
From chendry at nyc.rr.com Mon Aug 4 23:49:16 2003
From: chendry at nyc.rr.com (Christopher Hendry)
Date: Mon, 4 Aug 2003 23:49:16 -0400
Subject: [nycphp-talk] OT Javascript Question
In-Reply-To:
Message-ID:
dang, give Krook a little credit and he's all over the place...
:)
- 'night all
-> -----Original Message-----
-> From: talk-bounces at lists.nyphp.org
-> [mailto:talk-bounces at lists.nyphp.org]On Behalf Of D C Krook
-> Sent: Monday, August 04, 2003 11:40 PM
-> To: talk at lists.nyphp.org
-> Subject: Re: [nycphp-talk] OT Javascript Question
->
->
-> Heh, I wish I had written it myself.
->
-> It's actually something I discovered packaged along with
-> Parasoft's WebKing
-> tool. I found it a pretty handy reference so I posted it on my
-> development
-> server for easy reference.
->
->
-> >Wow, javadoc-based documentation of Javascript DOM!
-> >
-> >I am in awe....
->
-> _________________________________________________________________
-> The new MSN 8: advanced junk mail protection and 2 months FREE*
-> http://join.msn.com/?page=features/junkmail
->
-> _______________________________________________
-> talk mailing list
-> talk at lists.nyphp.org
-> http://lists.nyphp.org/mailman/listinfo/talk
From webmaster at localnotion.com Tue Aug 5 08:29:39 2003
From: webmaster at localnotion.com (webmaster at localnotion.com)
Date: Tue, 5 Aug 2003 12:29:39 +0000
Subject: [nycphp-talk] p_connect
Message-ID: <1060086579.79aefe0455fa4@webmail.localnotion.com>
Anyone know why you wouldn't use p_connect to make a connection to a database?
It seems like it would be better than regular connect in every case.
Or at least does anyone know of any problems with it?
Matt Terenzio
From nyphp at websapp.com Tue Aug 5 08:40:04 2003
From: nyphp at websapp.com (Daniel Kushner)
Date: Tue, 5 Aug 2003 08:40:04 -0400
Subject: [nycphp-talk] p_connect
In-Reply-To: <1060086579.79aefe0455fa4@webmail.localnotion.com>
Message-ID:
Hi Matt,
The main reason would be if you have more Web processes than Database
connections. There just wouldn't be enough to go around :(
-Daniel
> -----Original Message-----
> From: talk-bounces at lists.nyphp.org
> [mailto:talk-bounces at lists.nyphp.org]On Behalf Of
> webmaster at localnotion.com
> Sent: Tuesday, August 05, 2003 8:30 AM
> To: talk at lists.nyphp.org
> Subject: [nycphp-talk] p_connect
>
>
> Anyone know why you wouldn't use p_connect to make a connection
> to a database?
> It seems like it would be better than regular connect in every case.
>
> Or at least does anyone know of any problems with it?
>
> Matt Terenzio
>
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>
From hans at nyphp.org Tue Aug 5 09:14:00 2003
From: hans at nyphp.org (Hans Zaunere)
Date: Tue, 05 Aug 2003 09:14:00 -0400
Subject: [nycphp-talk] p_connect
In-Reply-To:
References:
Message-ID: <3F2FAD98.8030008@nyphp.org>
Daniel Kushner wrote:
> Hi Matt,
>
> The main reason would be if you have more Web processes than Database
> connections. There just wouldn't be enough to go around :(
>>
>>Anyone know why you wouldn't use p_connect to make a connection
>>to a database?
>>It seems like it would be better than regular connect in every case.
>>
>>Or at least does anyone know of any problems with it?
It depends on the DB for the most part. PHP's integration with some APIs, like OCI8 isn't 100% from what I've seen, and you can get stale connections or other odd behavior. On Oracle, this is important, since creating and tearing down connections are extremely expensive. With MySQL, connections open and close very quickly, and I've found it rare to see much benefit from persistent connections.
H
From nyphp at jimbishop.org Tue Aug 5 09:16:12 2003
From: nyphp at jimbishop.org (jim.bishop)
Date: Tue, 5 Aug 2003 06:16:12 -0700 (PDT)
Subject: [nycphp-talk] [OffTopic] database design question
In-Reply-To: <1060086579.79aefe0455fa4@webmail.localnotion.com>
References: <1060086579.79aefe0455fa4@webmail.localnotion.com>
Message-ID:
I'm designing a new user database for a personal project, and I was toying
with a different method of storing the data than I have used before.
Usually I create tables with logical column names that reference the data
in the column.
For Example:
---------------
| User |
---------------
| id |
| first_name |
| last_name |
| email |
...
---------------
But this becomes cumbersome when you have to add fields to the table. I
have designed a new table structure that looks like this:
---------------
| User |
---------------
| uid |
---------------
-----------------
| UserAttribute |
-----------------
| attribute_id |
| uid_fk | * foreign key to user table
| attribute |
| value |
-----------------
Okay. So I've built many user databases before and never employed the
system below. Has anyone else? Besides the requisit JOIN that has to be
called with every SELECT, what is the downsides to using this kind of
architecture?
From hans at nyphp.org Tue Aug 5 09:37:22 2003
From: hans at nyphp.org (Hans Zaunere)
Date: Tue, 05 Aug 2003 09:37:22 -0400
Subject: [nycphp-talk] mysql_insert_id Strangeness
Message-ID: <3F2FB312.9030606@nyphp.org>
Bonjour,
I've got a strange situation here, and I'm hoping it's something I'm overlooking, rather than a bug.
The setup:
MySQL 4.0.13-max-log
PHP 4.3.2 running as a DSO under Apache 1.3.28
FreeBSD 4.8-STABLE
MySQL is the mysql.com binary package; everything else is compiled from source
The table:
CREATE TABLE `links` (
`linkid` int(10) unsigned NOT NULL auto_increment,
`link` varchar(255) NOT NULL default '',
PRIMARY KEY (`linkid`),
UNIQUE KEY `link` (`link`)
) TYPE=MyISAM;
The code:
$link ) {
$tmp = mysql_escape_string($link);
mysql_query("INSERT INTO xxx.links (linkid,link)
VALUES (NULL,'$tmp')", $MYDB);
$R_linkid = mysql_insert_id($MYDB);
if( !$R_linkid ) {
$result = mysql_query("SELECT linkid FROM xxx.links WHERE link='$tmp'", $MYDB);
echo 'Selected '.mysql_num_rows($result).' rows.
';
$R_linkid = (int) mysql_result($result,0,0);
}
echo "Array key: $key
Link: $link
Linkid: $R_linkid
";
}
The output:
Array key: 0
Link: http://hans.zaunere.com
Linkid: 1
Array key: 1
Link: http://zaunere.com
Linkid: 2
Array key: 2
Link: http://hans.zaunere.com
Linkid: 2
Array key: 3
Link: http://nyphp.org
Linkid: 3
Array key: 4
Link: http://lists.nyphp.org
Linkid: 4
Array key: 5
Link: http://nyphp.org
Linkid: 4
The problem:
It seems that mysql_insert_id() returns the inserted ID from the previous 'successful' INSERT query, rather than it getting reset to 0 since the immedieately previous INSERT fails to produce an AUTO_INCREMENT ID (as it's documented). I sure hope I'm missing something; otherwise this bug is burning me in ways I have yet to discover.
Thanks,
H
From rsd at electronink.com Tue Aug 5 09:38:47 2003
From: rsd at electronink.com (Russ Demarest)
Date: Tue, 5 Aug 2003 09:38:47 -0400
Subject: [nycphp-talk] [OffTopic] database design question
In-Reply-To:
Message-ID: <24189DB0-C74A-11D7-BC4F-000A957E8754@electronink.com>
I believe the best way to normalize your tables is to apply the concept
of wether the information is related to that ID and is not going to
change or need to be archived. For example the users first and last
name and username/password and date of birth, etc are only related to
this user and there is no reason to have additional tables, Addresses
on the other hand can change and history can be important depending on
your project so a separate table for them is appropriate.
Your structure is good for random data that will change or be added
later but for specific data that is unique to that ID and not going to
change your prior table structure is the most efficient and easiest to
code. Having over normalized (still up for debate) previous databases
the data is nice and makes sense but writing extensive joins down the
road become gruesome. I would recommend a blend of these two techniques.
Planning out your database with a nice entity diagram will make your
life much easier and you should have the fields defined pretty well
before you create your first table. Of course this is the old boring
way but elliminates mistakes that will haunt you down the road.
Hope this helps.
On Tuesday, August 5, 2003, at 09:16 AM, jim.bishop wrote:
>
> I'm designing a new user database for a personal project, and I was
> toying
> with a different method of storing the data than I have used before.
> Usually I create tables with logical column names that reference the
> data
> in the column.
>
> For Example:
>
> ---------------
> | User |
> ---------------
> | id |
> | first_name |
> | last_name |
> | email |
>
> ...
> ---------------
>
> But this becomes cumbersome when you have to add fields to the table.
> I
> have designed a new table structure that looks like this:
>
>
> ---------------
> | User |
> ---------------
> | uid |
> ---------------
>
> -----------------
> | UserAttribute |
> -----------------
> | attribute_id |
> | uid_fk | * foreign key to user table
> | attribute |
> | value |
> -----------------
>
> Okay. So I've built many user databases before and never employed the
> system below. Has anyone else? Besides the requisit JOIN that has to
> be
> called with every SELECT, what is the downsides to using this kind of
> architecture?
>
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>
From rsd at electronink.com Tue Aug 5 09:45:15 2003
From: rsd at electronink.com (Russ Demarest)
Date: Tue, 5 Aug 2003 09:45:15 -0400
Subject: [nycphp-talk] mysql_insert_id Strangeness
In-Reply-To: <3F2FB312.9030606@nyphp.org>
Message-ID: <0AF323D0-C74B-11D7-BC4F-000A957E8754@electronink.com>
There are a couple strange things, I am not accustom to.
Why do you define the link column as NOT NULL and then default to ''?
Is this not the equivalent of a contradiction? I doubt this is related.
Maybe I am old school or something but I normally set my mysql_query()
equal to something like so
$sql = "INSERT into table blah blah";
$res = mysql_query($sql) or die("Error insert");
$new_id = mysql_insert_id($res); # The $res is not needed, it default
to the last result set returned.
This is a little different than you have it. Maybe try it and see what
happens.
Good Luck
On Tuesday, August 5, 2003, at 09:37 AM, Hans Zaunere wrote:
>
> Bonjour,
>
>
> I've got a strange situation here, and I'm hoping it's something I'm
> overlooking, rather than a bug.
>
>
> The setup:
>
> MySQL 4.0.13-max-log
> PHP 4.3.2 running as a DSO under Apache 1.3.28
> FreeBSD 4.8-STABLE
> MySQL is the mysql.com binary package; everything else is compiled
> from source
>
>
> The table:
> CREATE TABLE `links` (
> `linkid` int(10) unsigned NOT NULL auto_increment,
> `link` varchar(255) NOT NULL default '',
> PRIMARY KEY (`linkid`),
> UNIQUE KEY `link` (`link`)
> ) TYPE=MyISAM;
>
>
> The code:
>
> $MYDB = mysql_connect('localhost','xxx','xxx');
>
>
> $links = array('http://hans.zaunere.com',
> 'http://zaunere.com',
> 'http://hans.zaunere.com',
> 'http://nyphp.org',
> 'http://lists.nyphp.org',
> 'http://nyphp.org'
> );
>
>
> foreach( $links as $key => $link ) {
>
> $tmp = mysql_escape_string($link);
>
> mysql_query("INSERT INTO xxx.links (linkid,link)
> VALUES (NULL,'$tmp')", $MYDB);
>
> $R_linkid = mysql_insert_id($MYDB);
>
> if( !$R_linkid ) {
> $result = mysql_query("SELECT linkid FROM xxx.links WHERE
> link='$tmp'", $MYDB);
> echo 'Selected '.mysql_num_rows($result).' rows.
';
> $R_linkid = (int) mysql_result($result,0,0);
> }
>
> echo "Array key: $key
Link: $link
Linkid: $R_linkid
>
";
> }
>
>
>
> The output:
>
> Array key: 0 Link: http://hans.zaunere.com Linkid: 1
> Array key: 1 Link: http://zaunere.com Linkid: 2
> Array key: 2 Link: http://hans.zaunere.com Linkid: 2
> Array key: 3 Link: http://nyphp.org Linkid: 3
> Array key: 4 Link: http://lists.nyphp.org Linkid: 4
> Array key: 5 Link: http://nyphp.org Linkid: 4
>
> The problem:
>
> It seems that mysql_insert_id() returns the inserted ID from the
> previous 'successful' INSERT query, rather than it getting reset to 0
> since the immedieately previous INSERT fails to produce an
> AUTO_INCREMENT ID (as it's documented). I sure hope I'm missing
> something; otherwise this bug is burning me in ways I have yet to
> discover.
>
> Thanks,
>
> H
>
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>
From nyphp at jimbishop.org Tue Aug 5 09:47:58 2003
From: nyphp at jimbishop.org (jim.bishop)
Date: Tue, 5 Aug 2003 06:47:58 -0700 (PDT)
Subject: [nycphp-talk] [OffTopic] database design question
In-Reply-To: <24189DB0-C74A-11D7-BC4F-000A957E8754@electronink.com>
References: <24189DB0-C74A-11D7-BC4F-000A957E8754@electronink.com>
Message-ID:
> I believe the best way to normalize your tables is to apply the concept
> of wether the information is related to that ID and is not going to
> change or need to be archived. For example the users first and last name
> and username/password and date of birth, etc are only related to this
> user and there is no reason to have additional tables, Addresses on the
> other hand can change and history can be important depending on your
> project so a separate table for them is appropriate.
i had been thinking of that as well. i think you're right about the JOIN
nightmare to follow. i just wanted someone else to tell me that it would
be a nightmare, so i wasn't not trying it because it seemed too abastract.
thanks!
>
> Your structure is good for random data that will change or be added
> later but for specific data that is unique to that ID and not going to
> change your prior table structure is the most efficient and easiest to
> code. Having over normalized (still up for debate) previous databases
> the data is nice and makes sense but writing extensive joins down the
> road become gruesome. I would recommend a blend of these two techniques.
>
> Planning out your database with a nice entity diagram will make your
> life much easier and you should have the fields defined pretty well
> before you create your first table. Of course this is the old boring
> way but elliminates mistakes that will haunt you down the road.
>
> Hope this helps.
>
> On Tuesday, August 5, 2003, at 09:16 AM, jim.bishop wrote:
>
> >
> > I'm designing a new user database for a personal project, and I was
> > toying
> > with a different method of storing the data than I have used before.
> > Usually I create tables with logical column names that reference the
> > data
> > in the column.
> >
> > For Example:
> >
> > ---------------
> > | User |
> > ---------------
> > | id |
> > | first_name |
> > | last_name |
> > | email |
> >
> > ...
> > ---------------
> >
> > But this becomes cumbersome when you have to add fields to the table.
> > I
> > have designed a new table structure that looks like this:
> >
> >
> > ---------------
> > | User |
> > ---------------
> > | uid |
> > ---------------
> >
> > -----------------
> > | UserAttribute |
> > -----------------
> > | attribute_id |
> > | uid_fk | * foreign key to user table
> > | attribute |
> > | value |
> > -----------------
> >
> > Okay. So I've built many user databases before and never employed the
> > system below. Has anyone else? Besides the requisit JOIN that has to
> > be
> > called with every SELECT, what is the downsides to using this kind of
> > architecture?
> >
> >
> > _______________________________________________
> > talk mailing list
> > talk at lists.nyphp.org
> > http://lists.nyphp.org/mailman/listinfo/talk
> >
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>
-------------------------------------------------------
-------------------------------------------------------
-> the syntax of cummings, the absurdity of faulkner <-
|| jimbishop.org || jim.bishop || i heart n y ||
-------------------------------------------------------
-------------------------------------------------------
From hans at nyphp.org Tue Aug 5 09:59:08 2003
From: hans at nyphp.org (Hans Zaunere)
Date: Tue, 05 Aug 2003 09:59:08 -0400
Subject: [nycphp-talk] [OffTopic] database design question
In-Reply-To:
References: <1060086579.79aefe0455fa4@webmail.localnotion.com>
Message-ID: <3F2FB82C.8060302@nyphp.org>
jim.bishop wrote:
> I'm designing a new user database for a personal project, and I was toying
> with a different method of storing the data than I have used before.
> Usually I create tables with logical column names that reference the data
> in the column.
>
> For Example:
>
> ---------------
> | User |
> ---------------
> | id |
> | first_name |
> | last_name |
> | email |
>
> ...
> ---------------
>
> But this becomes cumbersome when you have to add fields to the table. I
> have designed a new table structure that looks like this:
>
>
> ---------------
> | User |
> ---------------
> | uid |
> ---------------
>
> -----------------
> | UserAttribute |
> -----------------
> | attribute_id |
> | uid_fk | * foreign key to user table
> | attribute |
> | value |
> -----------------
>
> Okay. So I've built many user databases before and never employed the
> system below. Has anyone else? Besides the requisit JOIN that has to be
> called with every SELECT, what is the downsides to using this kind of
> architecture?
I've done the "normalize to the point of abnormality" and personally don't find it worth; especially in this type of situation. Normalization can be cumbersome in its own way and every environment (and developer) warrants a balance between the two.
H
From bpang at bpang.com Tue Aug 5 09:59:48 2003
From: bpang at bpang.com (Brian Pang)
Date: Tue, 05 Aug 2003 09:59:48 -0400
Subject: [nycphp-talk] p_connect
Message-ID:
I've always used mysql_pconnect and haven't had any problems with it,
perhaps because, as you say, it works very quickly. I guess I copped the
pconnect style from original db connect scripts when I was first
learning and, since it wasn't broke, never thought about it again.
off the subject... maybe I should just DL my own copy of the PHP manual,
but is it me or is the php.net site really slow right now?
>
>
> Daniel Kushner wrote:
> > Hi Matt,
> >
> > The main reason would be if you have more Web processes than Database
> > connections. There just wouldn't be enough to go around :(
> >>
> >>Anyone know why you wouldn't use p_connect to make a connection
> >>to a database?
> >>It seems like it would be better than regular connect in every case.
> >>
> >>Or at least does anyone know of any problems with it?
>
> It depends on the DB for the most part. PHP's integration with some
APIs, like OCI8 isn't 100% from what I've seen, and you can get stale
connections or other odd behavior. On Oracle, this is important, since
creating and tearing down connections are extremely expensive. With
MySQL, connections open and close very quickly, and I've found it rare
to see much benefit from persistent connections.
>
> H
>
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>
>
From hans at nyphp.org Tue Aug 5 10:08:22 2003
From: hans at nyphp.org (Hans Zaunere)
Date: Tue, 05 Aug 2003 10:08:22 -0400
Subject: [nycphp-talk] mysql_insert_id Strangeness
In-Reply-To: <0AF323D0-C74B-11D7-BC4F-000A957E8754@electronink.com>
References: <0AF323D0-C74B-11D7-BC4F-000A957E8754@electronink.com>
Message-ID: <3F2FBA56.1080808@nyphp.org>
Russ Demarest wrote:
> There are a couple strange things, I am not accustom to.
>
> Why do you define the link column as NOT NULL and then default to ''? Is
> this not the equivalent of a contradiction? I doubt this is related.
Defaulting to '' means it'll default to the empty string, which is different from a NULL column. You're right as in this case it probably isn't related, but I'm not a fan of NULL columns :)
> Maybe I am old school or something but I normally set my mysql_query()
> equal to something like so
>
> $sql = "INSERT into table blah blah";
> $res = mysql_query($sql) or die("Error insert");
> $new_id = mysql_insert_id($res); # The $res is not needed, it
> default to the last result set returned.
Hmm, I'd take another look here. For INSERT statements, mysql_query() will only return TRUE or FALSE; not a result resource. Furthermore, mysql_insert_id() takes a link resource; not a result resource. Nevertheless, still no joy in trying the code.
Thanks,
H
>
> This is a little different than you have it. Maybe try it and see what
> happens.
>
> Good Luck
>
> On Tuesday, August 5, 2003, at 09:37 AM, Hans Zaunere wrote:
>
>>
>> Bonjour,
>>
>>
>> I've got a strange situation here, and I'm hoping it's something I'm
>> overlooking, rather than a bug.
>>
>>
>> The setup:
>>
>> MySQL 4.0.13-max-log
>> PHP 4.3.2 running as a DSO under Apache 1.3.28
>> FreeBSD 4.8-STABLE
>> MySQL is the mysql.com binary package; everything else is compiled
>> from source
>>
>>
>> The table:
>> CREATE TABLE `links` (
>> `linkid` int(10) unsigned NOT NULL auto_increment,
>> `link` varchar(255) NOT NULL default '',
>> PRIMARY KEY (`linkid`),
>> UNIQUE KEY `link` (`link`)
>> ) TYPE=MyISAM;
>>
>>
>> The code:
>>
>> > $MYDB = mysql_connect('localhost','xxx','xxx');
>>
>>
>> $links = array('http://hans.zaunere.com',
>> 'http://zaunere.com',
>> 'http://hans.zaunere.com',
>> 'http://nyphp.org',
>> 'http://lists.nyphp.org',
>> 'http://nyphp.org'
>> );
>>
>>
>> foreach( $links as $key => $link ) {
>>
>> $tmp = mysql_escape_string($link);
>>
>> mysql_query("INSERT INTO xxx.links (linkid,link)
>> VALUES (NULL,'$tmp')", $MYDB);
>>
>> $R_linkid = mysql_insert_id($MYDB);
>>
>> if( !$R_linkid ) {
>> $result = mysql_query("SELECT linkid FROM xxx.links WHERE
>> link='$tmp'", $MYDB);
>> echo 'Selected '.mysql_num_rows($result).' rows.
';
>> $R_linkid = (int) mysql_result($result,0,0);
>> }
>>
>> echo "Array key: $key
Link: $link
Linkid: $R_linkid
>>
";
>> }
>>
>>
>>
>> The output:
>>
>> Array key: 0 Link: http://hans.zaunere.com Linkid: 1
>> Array key: 1 Link: http://zaunere.com Linkid: 2
>> Array key: 2 Link: http://hans.zaunere.com Linkid: 2
>> Array key: 3 Link: http://nyphp.org Linkid: 3
>> Array key: 4 Link: http://lists.nyphp.org Linkid: 4
>> Array key: 5 Link: http://nyphp.org Linkid: 4
>>
>> The problem:
>>
>> It seems that mysql_insert_id() returns the inserted ID from the
>> previous 'successful' INSERT query, rather than it getting reset to 0
>> since the immedieately previous INSERT fails to produce an
>> AUTO_INCREMENT ID (as it's documented). I sure hope I'm missing
>> something; otherwise this bug is burning me in ways I have yet to
>> discover.
>>
>> Thanks,
>>
>> H
>>
>>
>> _______________________________________________
>> talk mailing list
>> talk at lists.nyphp.org
>> http://lists.nyphp.org/mailman/listinfo/talk
>>
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
From hans at nyphp.org Tue Aug 5 10:09:57 2003
From: hans at nyphp.org (Hans Zaunere)
Date: Tue, 05 Aug 2003 10:09:57 -0400
Subject: [nycphp-talk] p_connect
In-Reply-To:
References:
Message-ID: <3F2FBAB5.10101@nyphp.org>
Brian Pang wrote:
> I've always used mysql_pconnect and haven't had any problems with it,
> perhaps because, as you say, it works very quickly. I guess I copped the
> pconnect style from original db connect scripts when I was first
> learning and, since it wasn't broke, never thought about it again.
>
>
> off the subject... maybe I should just DL my own copy of the PHP manual,
> but is it me or is the php.net site really slow right now?
Yeah, it's always slow :)
http://us2.php.net/ is always pretty snappy for me.
H
>
>
>>
>>Daniel Kushner wrote:
>>
>>>Hi Matt,
>>>
>>>The main reason would be if you have more Web processes than Database
>>>connections. There just wouldn't be enough to go around :(
>>>
>>>>Anyone know why you wouldn't use p_connect to make a connection
>>>>to a database?
>>>>It seems like it would be better than regular connect in every case.
>>>>
>>>>Or at least does anyone know of any problems with it?
>>
>>It depends on the DB for the most part. PHP's integration with some
>
> APIs, like OCI8 isn't 100% from what I've seen, and you can get stale
> connections or other odd behavior. On Oracle, this is important, since
> creating and tearing down connections are extremely expensive. With
> MySQL, connections open and close very quickly, and I've found it rare
> to see much benefit from persistent connections.
>
>>H
>>
>>
>>_______________________________________________
>>talk mailing list
>>talk at lists.nyphp.org
>>http://lists.nyphp.org/mailman/listinfo/talk
>>
>>
>
>
>
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
From bpang at bpang.com Tue Aug 5 10:11:49 2003
From: bpang at bpang.com (Brian Pang)
Date: Tue, 05 Aug 2003 10:11:49 -0400
Subject: [nycphp-talk] mysql_insert_id Strangeness
Message-ID:
I usually send 0 to the primary key
using the mysql client, are you able to replicate the problem? meaning,
do you get the right mysql_insert_id when performing inserts in the
mysql client
from the mysql manual:
"mysql_insert_id() is updated after INSERT and UPDATE statements that
generate an AUTO_INCREMENT value or that set a column value to
LAST_INSERT_ID(expr). See section 6.3.6.2 Miscellaneous Functions.
Also note that the value of the SQL LAST_INSERT_ID() function always
contains the most recently generated AUTO_INCREMENT value, and is not
reset between queries because the value of that function is maintained
in the server."
They say it doesn't get reset [to zero?]
still can't get into the php.net site to look at the php manual :( so I
can't cross check exactly what php's mysql_insert_id() is doing or for
an alternative
>
>
> Russ Demarest wrote:
>
> > There are a couple strange things, I am not accustom to.
> >
> > Why do you define the link column as NOT NULL and then default to
''? Is
> > this not the equivalent of a contradiction? I doubt this is related.
>
> Defaulting to '' means it'll default to the empty string, which is
different from a NULL column. You're right as in this case it probably
isn't related, but I'm not a fan of NULL columns :)
>
> > Maybe I am old school or something but I normally set my mysql_query()
> > equal to something like so
> >
> > $sql = "INSERT into table blah blah";
> > $res = mysql_query($sql) or die("Error insert");
> > $new_id = mysql_insert_id($res); # The $res is not needed, it
> > default to the last result set returned.
>
> Hmm, I'd take another look here. For INSERT statements, mysql_query()
will only return TRUE or FALSE; not a result resource. Furthermore,
mysql_insert_id() takes a link resource; not a result resource.
Nevertheless, still no joy in trying the code.
>
> Thanks,
>
> H
>
>
> >
> > This is a little different than you have it. Maybe try it and see what
> > happens.
> >
> > Good Luck
> >
> > On Tuesday, August 5, 2003, at 09:37 AM, Hans Zaunere wrote:
> >
> >>
> >> Bonjour,
> >>
> >>
> >> I've got a strange situation here, and I'm hoping it's something I'm
> >> overlooking, rather than a bug.
> >>
> >>
> >> The setup:
> >>
> >> MySQL 4.0.13-max-log
> >> PHP 4.3.2 running as a DSO under Apache 1.3.28
> >> FreeBSD 4.8-STABLE
> >> MySQL is the mysql.com binary package; everything else is compiled
> >> from source
> >>
> >>
> >> The table:
> >> CREATE TABLE `links` (
> >> `linkid` int(10) unsigned NOT NULL auto_increment,
> >> `link` varchar(255) NOT NULL default '',
> >> PRIMARY KEY (`linkid`),
> >> UNIQUE KEY `link` (`link`)
> >> ) TYPE=MyISAM;
> >>
> >>
> >> The code:
> >>
> >> >> $MYDB = mysql_connect('localhost','xxx','xxx');
> >>
> >>
> >> $links = array('http://hans.zaunere.com',
> >> 'http://zaunere.com',
> >> 'http://hans.zaunere.com',
> >> 'http://nyphp.org',
> >> 'http://lists.nyphp.org',
> >> 'http://nyphp.org'
> >> );
> >>
> >>
> >> foreach( $links as $key => $link ) {
> >>
> >> $tmp = mysql_escape_string($link);
> >>
> >> mysql_query("INSERT INTO xxx.links (linkid,link)
> >> VALUES (NULL,'$tmp')", $MYDB);
> >>
> >> $R_linkid = mysql_insert_id($MYDB);
> >>
> >> if( !$R_linkid ) {
> >> $result = mysql_query("SELECT linkid FROM xxx.links WHERE
> >> link='$tmp'", $MYDB);
> >> echo 'Selected '.mysql_num_rows($result).' rows.
';
> >> $R_linkid = (int) mysql_result($result,0,0);
> >> }
> >>
> >> echo "Array key: $key
Link: $link
Linkid: $R_linkid
> >>
";
> >> }
> >>
> >>
> >>
> >> The output:
> >>
> >> Array key: 0 Link: http://hans.zaunere.com Linkid: 1
> >> Array key: 1 Link: http://zaunere.com Linkid: 2
> >> Array key: 2 Link: http://hans.zaunere.com Linkid: 2
> >> Array key: 3 Link: http://nyphp.org Linkid: 3
> >> Array key: 4 Link: http://lists.nyphp.org Linkid: 4
> >> Array key: 5 Link: http://nyphp.org Linkid: 4
> >>
> >> The problem:
> >>
> >> It seems that mysql_insert_id() returns the inserted ID from the
> >> previous 'successful' INSERT query, rather than it getting reset to 0
> >> since the immedieately previous INSERT fails to produce an
> >> AUTO_INCREMENT ID (as it's documented). I sure hope I'm missing
> >> something; otherwise this bug is burning me in ways I have yet to
> >> discover.
> >>
> >> Thanks,
> >>
> >> H
> >>
> >>
> >> _______________________________________________
> >> talk mailing list
> >> talk at lists.nyphp.org
> >> http://lists.nyphp.org/mailman/listinfo/talk
> >>
> >
> > _______________________________________________
> > talk mailing list
> > talk at lists.nyphp.org
> > http://lists.nyphp.org/mailman/listinfo/talk
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>
>
From nyphp at NewAgeWeb.com Tue Aug 5 10:15:34 2003
From: nyphp at NewAgeWeb.com (Jerry Kapron)
Date: Tue, 05 Aug 2003 10:15:34 -0400
Subject: [nycphp-talk] mysql_insert_id Strangeness
Message-ID: <007f01c35b5c$0a1d0a20$de01a8c0@duron.lan.newageweb.com>
Russ Demarest wrote:
>$sql = "INSERT into table blah blah";
>$res = mysql_query($sql) or die("Error insert");
>$new_id = mysql_insert_id($res); # The $res is not needed, it default
>to the last result set returned.
Russ,
That's wrong. The optional parameter that mysql_insert_id() takes should be the database connection identifier and NOT the result resource returned by the mysql_query() function.
Jerry
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From cahoyos at us.ibm.com Tue Aug 5 11:20:26 2003
From: cahoyos at us.ibm.com (Carlos A Hoyos)
Date: Tue, 5 Aug 2003 11:20:26 -0400
Subject: [nycphp-talk] mysql_insert_id Strangeness
In-Reply-To: <3F2FB312.9030606@nyphp.org>
Message-ID:
It's just ambiguous in the documentation, but mysql_insert_id() doesn't
default to 0 for this insert fail.
It's safer to check the return value of mysql_query in this case (will
return false if insertion fails).
Looking at the source code (file php-4.3.2/ext/mysql/php_mysql.c), the
insert_id value gets set under the "get_info:" label in the
mysql_read_query_result function, there's no variable reset on error, so
what you describe is the expected behavior (codewise).
Using LAST_INSERT_ID() in SQL can also be misleading, as it gets calculated
before insertion (and thus key validation), so it might increase even if
the query fails.
Carlos
Hans Zaunere
To: talk at lists.nyphp.org
Sent by: cc:
talk-bounces at list Subject: [nycphp-talk] mysql_insert_id Strangeness
s.nyphp.org
08/05/2003 09:37
AM
Please respond to
NYPHP Talk
Bonjour,
I've got a strange situation here, and I'm hoping it's something I'm
overlooking, rather than a bug.
The setup:
MySQL 4.0.13-max-log
PHP 4.3.2 running as a DSO under Apache 1.3.28
FreeBSD 4.8-STABLE
MySQL is the mysql.com binary package; everything else is compiled from
source
The table:
CREATE TABLE `links` (
`linkid` int(10) unsigned NOT NULL auto_increment,
`link` varchar(255) NOT NULL default '',
PRIMARY KEY (`linkid`),
UNIQUE KEY `link` (`link`)
) TYPE=MyISAM;
The code:
$link ) {
$tmp = mysql_escape_string($link);
mysql_query("INSERT INTO xxx.links (linkid,link)
VALUES (NULL,'$tmp')", $MYDB);
$R_linkid = mysql_insert_id($MYDB);
if( !$R_linkid ) {
$result = mysql_query("SELECT linkid FROM xxx.links WHERE
link='$tmp'", $MYDB);
echo 'Selected '.mysql_num_rows($result).' rows.
';
$R_linkid = (int) mysql_result($result,0,0);
}
echo "Array key: $key
Link: $link
Linkid: $R_linkid
";
}
The output:
Array key: 0
Link: http://hans.zaunere.com
Linkid: 1
Array key: 1
Link: http://zaunere.com
Linkid: 2
Array key: 2
Link: http://hans.zaunere.com
Linkid: 2
Array key: 3
Link: http://nyphp.org
Linkid: 3
Array key: 4
Link: http://lists.nyphp.org
Linkid: 4
Array key: 5
Link: http://nyphp.org
Linkid: 4
The problem:
It seems that mysql_insert_id() returns the inserted ID from the previous
'successful' INSERT query, rather than it getting reset to 0 since the
immedieately previous INSERT fails to produce an AUTO_INCREMENT ID (as it's
documented). I sure hope I'm missing something; otherwise this bug is
burning me in ways I have yet to discover.
Thanks,
H
_______________________________________________
talk mailing list
talk at lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk
From hans at nyphp.org Tue Aug 5 12:29:09 2003
From: hans at nyphp.org (Hans Zaunere)
Date: Tue, 05 Aug 2003 12:29:09 -0400
Subject: [nycphp-talk] mysql_insert_id Strangeness
In-Reply-To:
References:
Message-ID: <3F2FDB55.3070002@nyphp.org>
> using the mysql client, are you able to replicate the problem? meaning,
> do you get the right mysql_insert_id when performing inserts in the
> mysql client
An illustrative C program (below) shows the same behavior, so it doesn't seem to be anything with PHP.
And even the MySQL documentation says something different than the behavior, from: http://www.mysql.com/doc/en/mysql_insert_id.html
"Note that mysql_insert_id() returns 0 if the previous query does not generate an AUTO_INCREMENT value..."
As Carlos pointed out, this is a gross documentation ambiguity. The statement above is false according to the actual behavior, since an INSERT that fails because of a UNIQUE index doesn't generate an AUTO_INCREMENT value, yet mysql_insert_id() doesn't return 0. This seems like a new quirk, although I could be wrong.
I'm going to bounce this off the mysql guys and see what they say.
H
#include
#include
#include
#include
#include "mysql/mysql.h"
MYSQL mysql;
MYSQL_RES *mysql_result;
MYSQL_ROW mysql_row;
char *links[6] = {"http://hans.zaunere.com",
"http://zaunere.com",
"http://hans.zaunere.com",
"http://nyphp.org",
"http://lists.nyphp.org",
"http://nyphp.org"};
int main(void) {
int i,R_linkid;
char insert_string[255];
mysql_init(&mysql);
mysql_real_connect(&mysql,"localhost","ptips","ptips--",NULL,0,NULL,0);
for( i = 0; i < 6; ++i ) {
printf("\nLink %d: %s\n", i,links[i]);
sprintf(insert_string, "INSERT INTO ptips.links (linkid,link)
VALUES(NULL,'%s')",links[i]);
mysql_real_query(&mysql,insert_string,sizeof(insert_string));
R_linkid = mysql_insert_id(&mysql);
printf("\nR_linkid: %d\n",R_linkid);
}
}
From bpang at bpang.com Tue Aug 5 12:26:33 2003
From: bpang at bpang.com (Brian Pang)
Date: Tue, 05 Aug 2003 12:26:33 -0400
Subject: [nycphp-talk] mysql_insert_id Strangeness
Message-ID:
ok, the C code is good for comparison and isolating where the problem
might be, or at least not with PHP...
good luck
>
> > using the mysql client, are you able to replicate the problem? meaning,
> > do you get the right mysql_insert_id when performing inserts in the
> > mysql client
>
> An illustrative C program (below) shows the same behavior, so it
doesn't seem to be anything with PHP.
>
> And even the MySQL documentation says something different than the
behavior, from: http://www.mysql.com/doc/en/mysql_insert_id.html
>
> "Note that mysql_insert_id() returns 0 if the previous query does not
generate an AUTO_INCREMENT value..."
>
> As Carlos pointed out, this is a gross documentation ambiguity. The
statement above is false according to the actual behavior, since an
INSERT that fails because of a UNIQUE index doesn't generate an
AUTO_INCREMENT value, yet mysql_insert_id() doesn't return 0. This
seems like a new quirk, although I could be wrong.
>
> I'm going to bounce this off the mysql guys and see what they say.
>
> H
>
>
>
>
>
> #include
> #include
> #include
> #include
> #include "mysql/mysql.h"
>
> MYSQL mysql;
> MYSQL_RES *mysql_result;
> MYSQL_ROW mysql_row;
>
> char *links[6] = {"http://hans.zaunere.com",
> "http://zaunere.com",
> "http://hans.zaunere.com",
> "http://nyphp.org",
> "http://lists.nyphp.org",
> "http://nyphp.org"};
>
>
> int main(void) {
>
> int i,R_linkid;
> char insert_string[255];
>
> mysql_init(&mysql);
>
> mysql_real_connect(&mysql,"localhost","ptips","ptips--",NULL,0,NULL,0);
>
> for( i = 0; i < 6; ++i ) {
> printf("\nLink %d: %s\n", i,links[i]);
> sprintf(insert_string, "INSERT INTO ptips.links (linkid,link)
> VALUES(NULL,'%s')",links[i]);
>
> mysql_real_query(&mysql,insert_string,sizeof(insert_string));
>
> R_linkid = mysql_insert_id(&mysql);
>
> printf("\nR_linkid: %d\n",R_linkid);
> }
>
> }
>
>
>
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>
>
From joshmccormack at travelersdiary.com Tue Aug 5 13:18:11 2003
From: joshmccormack at travelersdiary.com (joshmccormack at travelersdiary.com)
Date: Tue, 5 Aug 2003 12:18:11 -0500 (CDT)
Subject: [nycphp-talk] mysql_fetch_array question (was off-topic database...)
In-Reply-To:
Message-ID:
On the subject of PHP, SQL, joins and the like, I encountered something a bit weird and wanted to see what all of you had to say on it.
This is from the manual:
"mysql_fetch_array() is an extended version of mysql_fetch_row(). In
addition to storing the data in the numeric indices of the result array,
it also stores the data in associative indices, using the field names as
keys.
If two or more columns of the result have the same field names, the
last column will take precedence. To access the other column(s) of the
same name, you must use the numeric index of the column or make an alias
for the column. For aliased columns, you cannot access the contents with
the original column name (by using 'field' in this example)."
so I have address fields, for example, that overwrite eachother. I
either have to make up wacky names for the database columns, or I have
to write out AS names for each (so using Select * is out). Now why
wouldn't they throw in an option so your results have table names in
front? So client.zip, owner.zip, etc. could all coexist? Doesn't that
seem reasonable?
Josh
On Tue, 5 Aug 2003, jim.bishop wrote:
> > I believe the best way to normalize your tables is to apply the concept
> > of wether the information is related to that ID and is not going to
> > change or need to be archived. For example the users first and last name
> > and username/password and date of birth, etc are only related to this
> > user and there is no reason to have additional tables, Addresses on the
> > other hand can change and history can be important depending on your
> > project so a separate table for them is appropriate.
>
>
> i had been thinking of that as well. i think you're right about the JOIN
> nightmare to follow. i just wanted someone else to tell me that it would
> be a nightmare, so i wasn't not trying it because it seemed too abastract.
>
> thanks!
>
>
>
> >
> > Your structure is good for random data that will change or be added
> > later but for specific data that is unique to that ID and not going to
> > change your prior table structure is the most efficient and easiest to
> > code. Having over normalized (still up for debate) previous databases
> > the data is nice and makes sense but writing extensive joins down the
> > road become gruesome. I would recommend a blend of these two techniques.
> >
> > Planning out your database with a nice entity diagram will make your
> > life much easier and you should have the fields defined pretty well
> > before you create your first table. Of course this is the old boring
> > way but elliminates mistakes that will haunt you down the road.
> >
> > Hope this helps.
> >
> > On Tuesday, August 5, 2003, at 09:16 AM, jim.bishop wrote:
> >
> > >
> > > I'm designing a new user database for a personal project, and I was
> > > toying
> > > with a different method of storing the data than I have used before.
> > > Usually I create tables with logical column names that reference the
> > > data
> > > in the column.
> > >
> > > For Example:
> > >
> > > ---------------
> > > | User |
> > > ---------------
> > > | id |
> > > | first_name |
> > > | last_name |
> > > | email |
> > >
> > > ...
> > > ---------------
> > >
> > > But this becomes cumbersome when you have to add fields to the table.
> > > I
> > > have designed a new table structure that looks like this:
> > >
> > >
> > > ---------------
> > > | User |
> > > ---------------
> > > | uid |
> > > ---------------
> > >
> > > -----------------
> > > | UserAttribute |
> > > -----------------
> > > | attribute_id |
> > > | uid_fk | * foreign key to user table
> > > | attribute |
> > > | value |
> > > -----------------
> > >
> > > Okay. So I've built many user databases before and never employed the
> > > system below. Has anyone else? Besides the requisit JOIN that has to
> > > be
> > > called with every SELECT, what is the downsides to using this kind of
> > > architecture?
> > >
> > >
> > > _______________________________________________
> > > talk mailing list
> > > talk at lists.nyphp.org
> > > http://lists.nyphp.org/mailman/listinfo/talk
> > >
> >
> > _______________________________________________
> > talk mailing list
> > talk at lists.nyphp.org
> > http://lists.nyphp.org/mailman/listinfo/talk
> >
>
>
>
>
> -------------------------------------------------------
> -------------------------------------------------------
> -> the syntax of cummings, the absurdity of faulkner <-
> || jimbishop.org || jim.bishop || i heart n y ||
> -------------------------------------------------------
> -------------------------------------------------------
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>
From shiflett at php.net Tue Aug 5 13:33:32 2003
From: shiflett at php.net (Chris Shiflett)
Date: Tue, 5 Aug 2003 10:33:32 -0700 (PDT)
Subject: [nycphp-talk] mysql_fetch_array question (was off-topic
database...)
In-Reply-To:
Message-ID: <20030805173332.186.qmail@web14305.mail.yahoo.com>
--- joshmccormack at travelersdiary.com wrote:
> so I have address fields, for example, that overwrite eachother. I
> either have to make up wacky names for the database columns, or I have
> to write out AS names for each (so using Select * is out). Now why
> wouldn't they throw in an option so your results have table names in
> front? So client.zip, owner.zip, etc. could all coexist? Doesn't that
> seem reasonable?
I suppose. I bet most people in your situation either use "wacky" names such as
client_zip and owner_zip, or they alias them in the query. I see no benefit in
$foo['client.zip'] instead of $foo['client_zip'] myself. Plus, you can always
just use the enumerated array instead of the associative one.
Hope that helps.
Chris
=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/
From soazine at erols.com Tue Aug 5 13:42:02 2003
From: soazine at erols.com (Phil Powell)
Date: Tue, 5 Aug 2003 13:42:02 -0400
Subject: [nycphp-talk] PHP and PayPal
Message-ID: <008501c35b78$e0d6c300$67a76244@philofsoa>
This might have been asked here before, but I was curious, what parameters would I need in order to set up a link to allow people to contribute to a PayPal account?
I was not sure but I thought the account had to be at least Business for it to be set up, but is that true? Can General accounts also have that kind of access, and does PHP have anything built-in to handle PayPal?
Thanx
Phil
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From Ed at ComSimplicity.com Tue Aug 5 13:45:37 2003
From: Ed at ComSimplicity.com (Ed McCarroll)
Date: Tue, 5 Aug 2003 10:45:37 -0700
Subject: [nycphp-talk] [OffTopic] database design question
In-Reply-To:
Message-ID:
IMHO, you'd be causing more trouble than you'd be solving. Think
about the kind of join required to do the equivalent of:
SELECT * FROM User WHERE last_name = "Smith" AND zip_code = "90210";
(assuming last_name and zip_code are moved into UserAttribute)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Ed McCarroll MailTo:Ed at ComSimplicity.com
ComSimplicity (310) 838-4330
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
From bpang at bpang.com Tue Aug 5 13:45:54 2003
From: bpang at bpang.com (Brian Pang)
Date: Tue, 05 Aug 2003 13:45:54 -0400
Subject: [nycphp-talk] mysql_fetch_array question (was off-topic
database...)
Message-ID:
Here are the basics of my way of dealing with this... I use this all the
time, so hopefully peer review won't expose some serious flaw! :)
(besides you often end up defining a bunch of variables you don't
actually need, but, you're smart, you can figure out how to change that)
$fooFields = array("foo.id", "foo.bar");
$barFields = array("bar.id", "bar.foo");
$result = mysql_query("select * from foo, bar");
$fields = array_merge($fooFields, $barFields);
while ($content = mysql_fetch_array($result)) {
for ($f = 0; $f < count($fields); $f++) {
${str_replace(".", "__", $fields[$f])} = $content[$f];
}
echo("
foo.id: $foo__id
foo.bar: $foo__bar
bar.id: $bar__id
foo.id: $bar__foo
}
I dunno if you would consider the double-underscore to be wacky variable
names or not. For me, since I use it so frequently, it works well and I
always know which table the data is coming from.
You can, of course, change the table/column separator to whatever you
like. I found __ to be unique enough to not conflict with anything else.
The "automation" of it is also really handy when dealing with lots of
fields.
enjoy
> On the subject of PHP, SQL, joins and the like, I encountered
something a bit weird and wanted to see what all of you had to say on it.
>
> This is from the manual:
>
> "mysql_fetch_array() is an extended version of mysql_fetch_row(). In
> addition to storing the data in the numeric indices of the result array,
> it also stores the data in associative indices, using the field names as
> keys.
>
> If two or more columns of the result have the same field names, the
> last column will take precedence. To access the other column(s) of the
> same name, you must use the numeric index of the column or make an alias
> for the column. For aliased columns, you cannot access the contents with
> the original column name (by using 'field' in this example)."
>
>
>
>
> so I have address fields, for example, that overwrite eachother. I
> either have to make up wacky names for the database columns, or I have
> to write out AS names for each (so using Select * is out). Now why
> wouldn't they throw in an option so your results have table names in
> front? So client.zip, owner.zip, etc. could all coexist? Doesn't that
> seem reasonable?
>
>
> Josh
>
>
>
> On Tue, 5 Aug 2003, jim.bishop wrote:
>
> > > I believe the best way to normalize your tables is to apply the
concept
> > > of wether the information is related to that ID and is not going to
> > > change or need to be archived. For example the users first and
last name
> > > and username/password and date of birth, etc are only related to this
> > > user and there is no reason to have additional tables, Addresses
on the
> > > other hand can change and history can be important depending on your
> > > project so a separate table for them is appropriate.
> >
> >
> > i had been thinking of that as well. i think you're right about the
JOIN
> > nightmare to follow. i just wanted someone else to tell me that it
would
> > be a nightmare, so i wasn't not trying it because it seemed too
abastract.
> >
> > thanks!
> >
> >
> >
> > >
> > > Your structure is good for random data that will change or be added
> > > later but for specific data that is unique to that ID and not going to
> > > change your prior table structure is the most efficient and easiest to
> > > code. Having over normalized (still up for debate) previous databases
> > > the data is nice and makes sense but writing extensive joins down the
> > > road become gruesome. I would recommend a blend of these two
techniques.
> > >
> > > Planning out your database with a nice entity diagram will make your
> > > life much easier and you should have the fields defined pretty well
> > > before you create your first table. Of course this is the old boring
> > > way but elliminates mistakes that will haunt you down the road.
> > >
> > > Hope this helps.
> > >
> > > On Tuesday, August 5, 2003, at 09:16 AM, jim.bishop wrote:
> > >
> > > >
> > > > I'm designing a new user database for a personal project, and I was
> > > > toying
> > > > with a different method of storing the data than I have used before.
> > > > Usually I create tables with logical column names that reference the
> > > > data
> > > > in the column.
> > > >
> > > > For Example:
> > > >
> > > > ---------------
> > > > | User |
> > > > ---------------
> > > > | id |
> > > > | first_name |
> > > > | last_name |
> > > > | email |
> > > >
> > > > ...
> > > > ---------------
> > > >
> > > > But this becomes cumbersome when you have to add fields to the
table.
> > > > I
> > > > have designed a new table structure that looks like this:
> > > >
> > > >
> > > > ---------------
> > > > | User |
> > > > ---------------
> > > > | uid |
> > > > ---------------
> > > >
> > > > -----------------
> > > > | UserAttribute |
> > > > -----------------
> > > > | attribute_id |
> > > > | uid_fk | * foreign key to user table
> > > > | attribute |
> > > > | value |
> > > > -----------------
> > > >
> > > > Okay. So I've built many user databases before and never
employed the
> > > > system below. Has anyone else? Besides the requisit JOIN that
has to
> > > > be
> > > > called with every SELECT, what is the downsides to using this
kind of
> > > > architecture?
> > > >
> > > >
> > > > _______________________________________________
> > > > talk mailing list
> > > > talk at lists.nyphp.org
> > > > http://lists.nyphp.org/mailman/listinfo/talk
> > > >
> > >
> > > _______________________________________________
> > > talk mailing list
> > > talk at lists.nyphp.org
> > > http://lists.nyphp.org/mailman/listinfo/talk
> > >
> >
> >
> >
> >
> > -------------------------------------------------------
> > -------------------------------------------------------
> > -> the syntax of cummings, the absurdity of faulkner <-
> > || jimbishop.org || jim.bishop || i heart n y ||
> > -------------------------------------------------------
> > -------------------------------------------------------
> > _______________________________________________
> > talk mailing list
> > talk at lists.nyphp.org
> > http://lists.nyphp.org/mailman/listinfo/talk
> >
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>
>
From csnyder at chxo.com Tue Aug 5 13:47:12 2003
From: csnyder at chxo.com (Chris Snyder)
Date: Tue, 05 Aug 2003 13:47:12 -0400
Subject: [nycphp-talk] PHP and PayPal
In-Reply-To: <008501c35b78$e0d6c300$67a76244@philofsoa>
References: <008501c35b78$e0d6c300$67a76244@philofsoa>
Message-ID: <3F2FEDA0.4010002@chxo.com>
An HTML attachment was scrubbed...
URL:
From danielc at analysisandsolutions.com Tue Aug 5 14:02:34 2003
From: danielc at analysisandsolutions.com (Analysis & Solutions)
Date: Tue, 5 Aug 2003 14:02:34 -0400
Subject: [nycphp-talk] to rewrite or not to rewrite URLs...
In-Reply-To:
References: <20030718040053.GA28919@panix.com>
<002301c34d53$e8fd3b00$6500a8c0@THINKPAD>
Message-ID: <20030805180233.GA2133@panix.com>
Hi Folks:
On Fri, Jul 18, 2003 at 02:53:35PM -0400, David Mintz wrote:
>
> Do you guys use URL rewriting to ensure that the session id is propagated
> from page to page even if the user refuses your cookie?
Yes. It guarantees access to your resources. I don't even bother with
cookies, because managing them differs slightly from browser to browser.
Even if users accept one cookie from you, there's no guarantee they'll
continue to do so, thus, it's difficult to manage sessions reliably with
them.
> I've read somewhere that it can cause 'confusion' or 'problems' if the
> user bookmarks a URL with a session id in the query string, and tries to
> access the page after the session is over, but those readings did not say
> whether you should really worry about it or what the worst case scenario
> is.
This can happen with cookie based sessions too if the cookie hasn't
expired or been deleted by the next time the user arrives.
It's not a problem if you structure your system effectively. The way to
handle situations like these is to have your session system keep track of
the last time the session was used. If it's longer than your timeout,
kill the old session and start a new one... and if the current page
requires authorization, don't show them the stuff.
I just whipped up a new session manager which takes advantage of PHP's
transparent session id propagation, plus some other handy tricks. It's
available on my website:
http://www.analysisandsolutions.com/software/session-simple/
I'd love to get some peer review on the program, so please check it out.
Enjoy,
--Dan
--
FREE scripts that make web and database programming easier
http://www.analysisandsolutions.com/software/
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7th Ave #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
From winston at xylophage.com Tue Aug 5 14:40:01 2003
From: winston at xylophage.com (Winston Churchill-Joell)
Date: Tue, 5 Aug 2003 14:40:01 -0400
Subject: [nycphp-talk] Hypothetical caching question
Message-ID: <38A2E050-C774-11D7-87D5-003065569500@xylophage.com>
I'm running a templated PHP-driven site and it dawned no me the other
day that my template's modified date is almost a year old. Of course,
some of the files that get included are modified almost daily.
So, does PHP modify the HTTP headers to reflect the "last modified"
dates of any files included, or am I reaching here?
From nestorflorez at earthlink.net Tue Aug 5 14:49:37 2003
From: nestorflorez at earthlink.net (Nestor Florez)
Date: Tue, 5 Aug 2003 11:49:37 -0700 (GMT)
Subject: [nycphp-talk] PHP and PayPal
Message-ID: <5739312.1060109545360.JavaMail.nobody@grover.psp.pas.earthlink.net>
paypal provides some php or perl code that you can add to your site.
I was working on something simmilar at one point and I was pull away from the project (I do not remember much now!). We would keep track of the user that came into our site before we send them to paypal. We add the user to the DB and put up a flag about the user. When paypal send us information on payment we would autmatically remnove the flag from the db as he had paid.
It gets tricky because once the user is sent to paypal, paypal just returns a couple of field info. YOu got to look at the php paypal code. A couple of the fields that paypal returned to us we used to identiy the client in our DB
Good luck,
Nestor :-)
-------Original Message-------
From: Chris Snyder
Sent: 08/05/03 10:47 AM
To: NYPHP Talk
Subject: Re: [nycphp-talk] PHP and PayPal
>
> _______________________________________________
talk mailing list
talk at lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From jonbaer at jonbaer.net Tue Aug 5 18:00:16 2003
From: jonbaer at jonbaer.net (Jon Baer)
Date: Tue, 5 Aug 2003 15:00:16 -0700
Subject: [nycphp-talk] PHP and PayPal
References: <008501c35b78$e0d6c300$67a76244@philofsoa>
<3F2FEDA0.4010002@chxo.com>
Message-ID: <014e01c35b9c$f4141b10$6500a8c0@THINKPAD>
the way u talk to paypal is through their IPN notifications ...
http://www.paypal.com/cgi-bin/webscr?cmd=p/pdn/ipn-codesamples-pop-outside#php
- jon
pgp key: http://www.jonbaer.net/jonbaer.asc
fingerprint: F438 A47E C45E 8B27 F68C 1F9B 41DB DB8B 9A0C AF47
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From danielc at analysisandsolutions.com Tue Aug 5 15:00:52 2003
From: danielc at analysisandsolutions.com (Analysis & Solutions)
Date: Tue, 5 Aug 2003 15:00:52 -0400
Subject: [nycphp-talk] Hypothetical caching question
In-Reply-To: <38A2E050-C774-11D7-87D5-003065569500@xylophage.com>
References: <38A2E050-C774-11D7-87D5-003065569500@xylophage.com>
Message-ID: <20030805190052.GA8887@panix.com>
On Tue, Aug 05, 2003 at 02:40:01PM -0400, Winston Churchill-Joell wrote:
> So, does PHP modify the HTTP headers to reflect the "last modified"
> dates of any files included, or am I reaching here?
Why don't you tell us. Most browsers have a feature that lets you examine
the present page's information. In that list of info is the last modified
field. So, whip up some tests and tell us what you find.
--Dan
--
FREE scripts that make web and database programming easier
http://www.analysisandsolutions.com/software/
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7th Ave #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
From danielc at analysisandsolutions.com Tue Aug 5 15:09:26 2003
From: danielc at analysisandsolutions.com (Analysis & Solutions)
Date: Tue, 5 Aug 2003 15:09:26 -0400
Subject: [nycphp-talk] mysql_insert_id Strangeness
In-Reply-To: <0AF323D0-C74B-11D7-BC4F-000A957E8754@electronink.com>
References: <3F2FB312.9030606@nyphp.org>
<0AF323D0-C74B-11D7-BC4F-000A957E8754@electronink.com>
Message-ID: <20030805190925.GB8887@panix.com>
Folks:
On Tue, Aug 05, 2003 at 09:45:15AM -0400, Russ Demarest wrote:
>
> Why do you define the link column as NOT NULL and then default to ''?
> Is this not the equivalent of a contradiction? I doubt this is related.
Doing so saves one byte per record and it saves time when doing queries
since you only have to check for WHERE Field='' rather than having to also
do a WHERE Field IS NULL.
... snipity, snip, snip. the friendly way to post...
Enjoy,
--Dan
--
FREE scripts that make web and database programming easier
http://www.analysisandsolutions.com/software/
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7th Ave #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
From kenrbnsn at rbnsn.com Tue Aug 5 15:09:37 2003
From: kenrbnsn at rbnsn.com (Ken Robinson)
Date: Tue, 05 Aug 2003 15:09:37 -0400
Subject: [nycphp-talk] PHP and PayPal
In-Reply-To: <014e01c35b9c$f4141b10$6500a8c0@THINKPAD>
References: <008501c35b78$e0d6c300$67a76244@philofsoa>
<3F2FEDA0.4010002@chxo.com>
Message-ID: <5.2.1.1.2.20030805150510.05b51e70@mail.rbnsn.com>
At 03:00 PM 8/5/2003 -0700, you wrote:
>the way u talk to paypal is through their IPN notifications ...
>
>http://www.paypal.com/cgi-bin/webscr?cmd=p/pdn/ipn-codesamples-pop-outside#php
>
>- jon
You don't need to use IPN. I have a site that uses PayPal to purchase gift
certificates. On the page where the "Paypal" button is, I store the
variables I will need in Session variable and set the "Paypal Success URL"
to my success PHP page. When Paypal invokes my page, I get everything I
need from the Session variables. Works very well.
Ken Robinson
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From jonbaer at jonbaer.net Tue Aug 5 18:20:12 2003
From: jonbaer at jonbaer.net (Jon Baer)
Date: Tue, 5 Aug 2003 15:20:12 -0700
Subject: [nycphp-talk] PHP and PayPal
References: <008501c35b78$e0d6c300$67a76244@philofsoa><3F2FEDA0.4010002@chxo.com>
<5.2.1.1.2.20030805150510.05b51e70@mail.rbnsn.com>
Message-ID: <016a01c35b9f$bd68de40$6500a8c0@THINKPAD>
i think its primarily used in the cases of where someone might not have come in off a website (thus no success url) ... but to allow all notifications anyway since u can provide it in ur account settings ...
- jon
pgp key: http://www.jonbaer.net/jonbaer.asc
fingerprint: F438 A47E C45E 8B27 F68C 1F9B 41DB DB8B 9A0C AF47
----- Original Message -----
From: Ken Robinson
To: NYPHP Talk
Sent: Tuesday, August 05, 2003 12:09 PM
Subject: Re: [nycphp-talk] PHP and PayPal
At 03:00 PM 8/5/2003 -0700, you wrote:
the way u talk to paypal is through their IPN notifications ...
http://www.paypal.com/cgi-bin/webscr?cmd=p/pdn/ipn-codesamples-pop-outside#php
- jon
You don't need to use IPN. I have a site that uses PayPal to purchase gift certificates. On the page where the "Paypal" button is, I store the variables I will need in Session variable and set the "Paypal Success URL" to my success PHP page. When Paypal invokes my page, I get everything I need from the Session variables. Works very well.
Ken Robinson
------------------------------------------------------------------------------
_______________________________________________
talk mailing list
talk at lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From soazine at erols.com Tue Aug 5 15:42:44 2003
From: soazine at erols.com (Phil Powell)
Date: Tue, 5 Aug 2003 15:42:44 -0400
Subject: [nycphp-talk] PHP and PayPal
References: <008501c35b78$e0d6c300$67a76244@philofsoa><3F2FEDA0.4010002@chxo.com>
<5.2.1.1.2.20030805150510.05b51e70@mail.rbnsn.com>
Message-ID: <015b01c35b89$bd9e4820$67a76244@philofsoa>
Thanx I was not sure if you needed a specific type of account for that, though..
Phil
----- Original Message -----
From: Ken Robinson
To: NYPHP Talk
Sent: Tuesday, August 05, 2003 3:09 PM
Subject: Re: [nycphp-talk] PHP and PayPal
At 03:00 PM 8/5/2003 -0700, you wrote:
the way u talk to paypal is through their IPN notifications ...
http://www.paypal.com/cgi-bin/webscr?cmd=p/pdn/ipn-codesamples-pop-outside#php
- jon
You don't need to use IPN. I have a site that uses PayPal to purchase gift certificates. On the page where the "Paypal" button is, I store the variables I will need in Session variable and set the "Paypal Success URL" to my success PHP page. When Paypal invokes my page, I get everything I need from the Session variables. Works very well.
Ken Robinson
------------------------------------------------------------------------------
_______________________________________________
talk mailing list
talk at lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From hans at nyphp.org Tue Aug 5 16:08:38 2003
From: hans at nyphp.org (Hans Zaunere)
Date: Tue, 05 Aug 2003 16:08:38 -0400
Subject: [nycphp-talk] [Fwd: Invitation to participate in Apache J2EE efforts]
Message-ID: <3F300EC6.9090201@nyphp.org>
I know this is a PHP list, but hey; it's Apache!
-------- Original Message --------
Subject: Invitation to participate in Apache J2EE efforts
Date: Tue, 5 Aug 2003 08:58:25 -0700
From: Greg Stein
As you may have heard by now, the Apache Software Foundation has initiated a
project to develop an open source, Apache-licensed implementation of the
J2EE specification. In addition, the project is committed to certifying the
implementation as J2EE compliant. This is an ambitious goal and will present
a formidable challenge for the people involved, given the wide range of
technologies covered by the specification.
The project (tentatively named "Apache Geronimo") builds upon the many Java
projects at the Apache Software Foundation. In addition, the project is
bringing together leading members of the Castor, JBoss, MX4J and OpenEJB
communities. We would like to extend an open invitation to everyone involved
in the J2EE space, both commercial entities and talented individuals, to
join the community and build a world-class J2EE implementation.
The Apache Software Foundation is in a unique position to build a J2EE
compliant platform. Our non-profit, charity status, and our relationship
with Sun Microsystems, provides the Foundation with access to the J2EE TCKs,
making it possible to achieve certification. In addition, our flexible and
unrestrictive licensing makes it possible for a wide variety of participants
to assist in the development of Apache Geronimo, and to build their own
solutions upon the platform.
Apache Geronimo has been launched within the Apache Incubator. You can find
more information about the Incubator at http://incubator.apache.org/. To
find out more about this project or if you would like to become involved,
please send email to the incubator mailing list: general at incubator.apache.org
On behalf of the Apache Geronimo Team,
Greg Stein,
Chairman of the Apache Software Foundation
--
gstein at apache.org ... ASF Chairman ... http://www.apache.org/
From jonbaer at jonbaer.net Tue Aug 5 19:33:55 2003
From: jonbaer at jonbaer.net (Jon Baer)
Date: Tue, 5 Aug 2003 16:33:55 -0700
Subject: [nycphp-talk] [Fwd: Invitation to participate in Apache J2EE
efforts]
References: <3F300EC6.9090201@nyphp.org>
Message-ID: <01a801c35baa$091d50f0$6500a8c0@THINKPAD>
this is probably one of the bigger reasons for my switch to php, the fact
that there is no rather expensive certification procedure for any apps u do
build, much of the dictation on items u wanted to build into an enterprise
app had to wait for finalization from sun (a rather long time for some apis)
and then go through the j2ee process.
id really wonder how all the other companies which did have to license j2ee
to the max feel about this ... (http://java.sun.com/j2ee/compatibility.html)
not to mention the fact that php folks would not have to send a nice letter
:-)
http://java.sun.com/j2ee/vendorltr.html
i still think java is a solid well rounded robust language, but im not sure
i agree w/ the j2ee process.
- jon
pgp key: http://www.jonbaer.net/jonbaer.asc
fingerprint: F438 A47E C45E 8B27 F68C 1F9B 41DB DB8B 9A0C AF47
----- Original Message -----
From: "Hans Zaunere"
To:
Sent: Tuesday, August 05, 2003 1:08 PM
Subject: [nycphp-talk] [Fwd: Invitation to participate in Apache J2EE
efforts]
>
> I know this is a PHP list, but hey; it's Apache!
>
>
> -------- Original Message --------
> Subject: Invitation to participate in Apache J2EE efforts
> Date: Tue, 5 Aug 2003 08:58:25 -0700
> From: Greg Stein
>
>
> As you may have heard by now, the Apache Software Foundation has initiated
a
> project to develop an open source, Apache-licensed implementation of the
> J2EE specification. In addition, the project is committed to certifying
the
> implementation as J2EE compliant. This is an ambitious goal and will
present
> a formidable challenge for the people involved, given the wide range of
> technologies covered by the specification.
>
> The project (tentatively named "Apache Geronimo") builds upon the many
Java
> projects at the Apache Software Foundation. In addition, the project is
> bringing together leading members of the Castor, JBoss, MX4J and OpenEJB
> communities. We would like to extend an open invitation to everyone
involved
> in the J2EE space, both commercial entities and talented individuals, to
> join the community and build a world-class J2EE implementation.
>
> The Apache Software Foundation is in a unique position to build a J2EE
> compliant platform. Our non-profit, charity status, and our relationship
> with Sun Microsystems, provides the Foundation with access to the J2EE
TCKs,
> making it possible to achieve certification. In addition, our flexible and
> unrestrictive licensing makes it possible for a wide variety of
participants
> to assist in the development of Apache Geronimo, and to build their own
> solutions upon the platform.
>
> Apache Geronimo has been launched within the Apache Incubator. You can
find
> more information about the Incubator at http://incubator.apache.org/. To
> find out more about this project or if you would like to become involved,
> please send email to the incubator mailing list:
general at incubator.apache.org
>
>
> On behalf of the Apache Geronimo Team,
>
> Greg Stein,
> Chairman of the Apache Software Foundation
>
> --
> gstein at apache.org ... ASF Chairman ... http://www.apache.org/
>
>
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>
From nestorflorez at earthlink.net Tue Aug 5 16:32:20 2003
From: nestorflorez at earthlink.net (Nestor Florez)
Date: Tue, 5 Aug 2003 13:32:20 -0700 (GMT)
Subject: [nycphp-talk] PHP and PayPal
Message-ID: <3300800.1060115705362.JavaMail.nobody@grover.psp.pas.earthlink.net>
Phil,
I though paypal only allowed you pass them 2 special variables.
How do you manage to pass all of your session variables to your success page. When you give control to the paypal page and paypal does not keep track of session variables, when it returns to your sucess page?
I am just curious, I am not working on this stuff any more.
Thanks,
Nestor :-)
Original message attached.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From danielc at analysisandsolutions.com Tue Aug 5 17:08:44 2003
From: danielc at analysisandsolutions.com (Analysis & Solutions)
Date: Tue, 5 Aug 2003 17:08:44 -0400
Subject: [nycphp-talk] mysql_insert_id Strangeness
In-Reply-To:
References: <3F2FB312.9030606@nyphp.org>
Message-ID: <20030805210843.GA22136@panix.com>
Hey Folks:
On Tue, Aug 05, 2003 at 11:20:26AM -0400, Carlos A Hoyos wrote:
>
> It's safer to check the return value of mysql_query in this case (will
> return false if insertion fails).
Yep. When mysql_query() fails, I check the value of mysql_errno(). Error
numbers 1022 and 1062 have to do with duplicate keys on (if I recall
correctly) primary keys and duplicate keys (or if I recall incorrectly,
insert vs update queries).
switch ( @mysql_errno($Connection) ) {
case 1022:
case 1062:
# Couldn't insert/update record due to duplicate key.
break;
default:
# Some other database error. Trap it.
echo @mysql_error($this->SQLConnection);
exit;
}
... snipping out old, irrelevant parts... the friendly way to post...
--Dan
--
FREE scripts that make web and database programming easier
http://www.analysisandsolutions.com/software/
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7th Ave #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
From dan at mx2pro.com Tue Aug 5 17:13:03 2003
From: dan at mx2pro.com (Dan Horning)
Date: Tue, 5 Aug 2003 17:13:03 -0400
Subject: [nycphp-talk] PHP and PayPal
In-Reply-To: <015b01c35b89$bd9e4820$67a76244@philofsoa>
Message-ID: <000e01c35b96$5d09c810$6f62ca42@dwchome>
You don't need to use IPN. I have a site that uses PayPal to purchase
gift certificates. On the page where the "Paypal" button is, I store the
variables I will need in Session variable and set the "Paypal Success
URL" to my success PHP page. When Paypal invokes my page, I get
everything I need from the Session variables. Works very well.
Ken Robinson
Show me your site ... And I could steal a ton from you... Unless you
check the paypal IPN .. You don't really have any real way to verify
that an order has been aproved or declined...
Make sence everyone..???
(unless you want to check every single order personally....)
-dan
From hans at nyphp.org Tue Aug 5 17:28:24 2003
From: hans at nyphp.org (Hans Zaunere)
Date: Tue, 05 Aug 2003 17:28:24 -0400
Subject: [nycphp-talk] mysql_insert_id Strangeness
In-Reply-To: <20030805210843.GA22136@panix.com>
References: <3F2FB312.9030606@nyphp.org>
<20030805210843.GA22136@panix.com>
Message-ID: <3F302178.3030706@nyphp.org>
Analysis & Solutions wrote:
> Hey Folks:
>
> On Tue, Aug 05, 2003 at 11:20:26AM -0400, Carlos A Hoyos wrote:
>
>>It's safer to check the return value of mysql_query in this case (will
>>return false if insertion fails).
True. But doing a type-strict comparision on the query itself, seems, well strange somehow.
> Yep. When mysql_query() fails, I check the value of mysql_errno(). Error
> numbers 1022 and 1062 have to do with duplicate keys on (if I recall
> correctly) primary keys and duplicate keys (or if I recall incorrectly,
> insert vs update queries).
Absolutely; I'll use mysql_errno() when I really need to keep things in line, but I'm almost positive the mysql_insert_id() trick works (or worked). Especially since it's documented that way.
Oh well. Still fishing on mysql's lists,
H
From hans at nyphp.org Tue Aug 5 17:31:47 2003
From: hans at nyphp.org (Hans Zaunere)
Date: Tue, 05 Aug 2003 17:31:47 -0400
Subject: [nycphp-talk] [Fwd: Invitation to participate in Apache
J2EE efforts]
In-Reply-To: <01a801c35baa$091d50f0$6500a8c0@THINKPAD>
References: <3F300EC6.9090201@nyphp.org>
<01a801c35baa$091d50f0$6500a8c0@THINKPAD>
Message-ID: <3F302243.8080704@nyphp.org>
Jon Baer wrote:
> this is probably one of the bigger reasons for my switch to php, the fact
> that there is no rather expensive certification procedure for any apps u do
> build, much of the dictation on items u wanted to build into an enterprise
> app had to wait for finalization from sun (a rather long time for some apis)
> and then go through the j2ee process.
You bring up a good point Jon. While the approval process can be tedious, especially for the developers and tech folk, it fares well with the "higher ups." Just like the Intel Inside, Windows logos, and now the RedHat logo, they love to see some branding - something that says "we certify this will work, and if it doesn't, it may cost you more money but we'll fix it".
Maybe we should startup the NYPHP p2ee approval process :)
H
From dmintz at panix.com Tue Aug 5 17:38:02 2003
From: dmintz at panix.com (David Mintz)
Date: Tue, 5 Aug 2003 17:38:02 -0400 (EDT)
Subject: [nycphp-talk] to rewrite or not to rewrite URLs...
In-Reply-To: <20030805180233.GA2133@panix.com>
References: <20030718040053.GA28919@panix.com>
<002301c34d53$e8fd3b00$6500a8c0@THINKPAD>
<20030805180233.GA2133@panix.com>
Message-ID:
Now you got me thinking again (damn!). I have in place right now a sort of
poor-man's de facto session time-out. I am using a private directory to
save sessions (and wrapping the script to run as me in cgi mode, and
setting file permission restrictively, because it's a shared server and
there are security considerations). Old serialized session files
accumulate indefinitely unless I do something. So I have a daily cron
job/shell script that deletes all the session files whose last access
times are greater than x. I figure this is better than nothing. OTOH I
will give your code a look.
Interesting, two of our gurus (Hans and you) take different approaches to
this. How about a debate, guys?
On Tue, 5 Aug 2003, Analysis & Solutions wrote:
> Hi Folks:
>
> On Fri, Jul 18, 2003 at 02:53:35PM -0400, David Mintz wrote:
> >
> > Do you guys use URL rewriting to ensure that the session id is propagated
> > from page to page even if the user refuses your cookie?
>
> Yes. It guarantees access to your resources. I don't even bother with
> cookies, because managing them differs slightly from browser to browser.
> Even if users accept one cookie from you, there's no guarantee they'll
> continue to do so, thus, it's difficult to manage sessions reliably with
> them.
>
>
> > I've read somewhere that it can cause 'confusion' or 'problems' if the
> > user bookmarks a URL with a session id in the query string, and tries to
> > access the page after the session is over, but those readings did not say
> > whether you should really worry about it or what the worst case scenario
> > is.
>
> This can happen with cookie based sessions too if the cookie hasn't
> expired or been deleted by the next time the user arrives.
>
> It's not a problem if you structure your system effectively. The way to
> handle situations like these is to have your session system keep track of
> the last time the session was used. If it's longer than your timeout,
> kill the old session and start a new one... and if the current page
> requires authorization, don't show them the stuff.
>
> I just whipped up a new session manager which takes advantage of PHP's
> transparent session id propagation, plus some other handy tricks. It's
> available on my website:
> http://www.analysisandsolutions.com/software/session-simple/
>
> I'd love to get some peer review on the program, so please check it out.
>
> Enjoy,
>
> --Dan
>
> --
> FREE scripts that make web and database programming easier
> http://www.analysisandsolutions.com/software/
> T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
> 4015 7th Ave #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>
---
David Mintz
http://davidmintz.org/
Email: See http://dmintzweb.com/whitelist.php first!
Decibels of sound pressure employed by a new "thermoacoustic" refrigerator: 190
Decibels of sound pressure sufficient to ignite a person's hair: 165
-- Harper's Index, February 2003
From winston at xylophage.com Tue Aug 5 17:53:35 2003
From: winston at xylophage.com (Winston Churchill-Joell)
Date: Tue, 5 Aug 2003 17:53:35 -0400
Subject: [nycphp-talk] Hypothetical caching question
In-Reply-To: <20030805190052.GA8887@panix.com>
Message-ID: <43A5717E-C78F-11D7-87D5-003065569500@xylophage.com>
Well, if anyone else is interested in the answer to this question, this
is what I've found so far:
http://us3.php.net/source.php?url=/index.php
I haven't poked around in all of the inc files that they also link to,
but this does reveal that the authors go to some trouble to make sure
the "real" modified date is showing up.
Thought this was interesting enough to share with the group.
Cheers,
Winston
On Tuesday, August 5, 2003, at 03:00 PM, Analysis & Solutions wrote:
> On Tue, Aug 05, 2003 at 02:40:01PM -0400, Winston Churchill-Joell
> wrote:
>
>> So, does PHP modify the HTTP headers to reflect the "last modified"
>> dates of any files included, or am I reaching here?
>
> Why don't you tell us. Most browsers have a feature that lets you
> examine
> the present page's information. In that list of info is the last
> modified
> field. So, whip up some tests and tell us what you find.
>
> --Dan
>
> --
> FREE scripts that make web and database programming easier
> http://www.analysisandsolutions.com/software/
> T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
> 4015 7th Ave #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>
From hans at nyphp.org Wed Aug 6 09:45:06 2003
From: hans at nyphp.org (Hans Zaunere)
Date: Wed, 06 Aug 2003 09:45:06 -0400
Subject: [nycphp-talk] Ready, Set, Google!
Message-ID: <3F310662.3000305@nyphp.org>
Good morning,
Over the last couple of days I've been playing with trying to provide some search capabilities to the mailing lists, noteably Talk. Day after day valuable information and URLs are passed around and, for the most part, lost into history.
I tried a couple of things, not finishing any of them, until I finally took the easy way out. Warning: These are all very rough :)
-- http://lists.nyphp.org/ptips/ scrapes URLs from each NYPHP-Talk message and throws it into a table. There's of course many improvements that could be made, but it's kind of interesting to see the links people have referred to in the past. Also, clicking the X will deactive that link (for instance, if you find a shopping.yahoo.com or hotmail.com in the listing).
-- http://lists.nyphp.org/search.php is a full text index of all NYPHP-Talk's mail message. Yes, it's very rough (I forgot to include the subject of the message in the result listing) but it has potential.
-- http://nyphp.org/google.php is the easy way out. It's your basic google search of our entire site, including the mailing list archives. The only drawback is it's not very current. The searches are always right on (afterall, it's google) but you'll probably have to wait a few weeks to see things get updated. That said, I made it the primary means for searching our sites, until we get something better online.
So I just thought I'd throw these out there and I'm happy to hear any feedback as to what improvements could be made, what features/functionality people would find useful, etc.
Thanks,
H
From andrew at digitalpulp.com Wed Aug 6 09:40:47 2003
From: andrew at digitalpulp.com (Andrew Yochum)
Date: Wed, 6 Aug 2003 09:40:47 -0400
Subject: [nycphp-talk] [FWD: [ANNOUNCE] plPHP beta released]
Message-ID: <20030806134040.GE22595@thighmaster.digitalpulp.com>
Just passing this along.
----- Forwarded message from rrussell at commandprompt.com -----
Date: Tue, 5 Aug 2003 22:26:24 -0700 (PDT)
From: rrussell at commandprompt.com
To: pgsql-announce at postgresql.org
Subject: [ANNOUNCE] plPHP beta released
User-Agent: SquirrelMail/1.4.0
Importance: Normal
Precedence: bulk
Command Prompt, Inc. (those who brought you Practical PostgreSQL from
O'Reilly) has released plPHP to the Open Source community under the PHP
license.
PlPHP is great for PHP coders who want to develop PostgreSQL functions in
php code.
Take a look here:
http://www.commandprompt.com/entry.lxp?lxpe=260
-Robby Russell
Programmer
Command Prompt, Inc.
http://www.commandprompt.com/
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faqs/FAQ.html
----- End forwarded message -----
--
Andrew Yochum
Digital Pulp, Inc.
212.679.0676x255
andrew at digitalpulp.com
From jlacey at ix.netcom.com Wed Aug 6 09:43:54 2003
From: jlacey at ix.netcom.com (John Lacey)
Date: Wed, 06 Aug 2003 07:43:54 -0600
Subject: [nycphp-talk] Ready, Set, Google!
In-Reply-To: <3F310662.3000305@nyphp.org>
References: <3F310662.3000305@nyphp.org>
Message-ID: <3F31061A.6070708@ix.netcom.com>
Hans Zaunere wrote:
>
> Good morning,
>
> Over the last couple of days I've been playing with trying to provide
> some search capabilities to the mailing lists, noteably Talk. Day
> after day valuable information and URLs are passed around and, for the
> most part, lost into history.
wow Hans, I was *just* thinking of this the other day in terms of
"task/problem" type training. There is a wealth of info in the lists,
even tho I've been signed up for only a short time, and I wanted to
bring some of the issues that are brought up to include these types of
problems in my PHP/MySQL training curriculum.
thanks,
John
>
>
> I tried a couple of things, not finishing any of them, until I finally
> took the easy way out. Warning: These are all very rough :)
>
> -- http://lists.nyphp.org/ptips/ scrapes URLs from each NYPHP-Talk
> message and throws it into a table. There's of course many
> improvements that could be made, but it's kind of interesting to see
> the links people have referred to in the past. Also, clicking the X
> will deactive that link (for instance, if you find a
> shopping.yahoo.com or hotmail.com in the listing).
>
> -- http://lists.nyphp.org/search.php is a full text index of all
> NYPHP-Talk's mail message. Yes, it's very rough (I forgot to include
> the subject of the message in the result listing) but it has potential.
>
> -- http://nyphp.org/google.php is the easy way out. It's your basic
> google search of our entire site, including the mailing list
> archives. The only drawback is it's not very current. The searches
> are always right on (afterall, it's google) but you'll probably have
> to wait a few weeks to see things get updated. That said, I made it
> the primary means for searching our sites, until we get something
> better online.
>
>
> So I just thought I'd throw these out there and I'm happy to hear any
> feedback as to what improvements could be made, what
> features/functionality people would find useful, etc.
>
> Thanks,
>
> H
>
>
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>
From jonbaer at jonbaer.net Wed Aug 6 13:23:24 2003
From: jonbaer at jonbaer.net (Jon Baer)
Date: Wed, 6 Aug 2003 10:23:24 -0700
Subject: [nycphp-talk] Ready, Set, Google!
References: <3F310662.3000305@nyphp.org>
Message-ID: <003401c35c3f$715e5b10$6500a8c0@THINKPAD>
ok what would be extremely cool is to make ptips integrated *with* a mailing
list. i attempted this a long time ago w/ alicemail in which ud setup
something like dummy at nyphp.org and have it attempt to help out a user by
attaching urls/info @ the bottom of emails/responses (in terms of faqs).
the hardest part about it i found is visible in ur tests (the
signatures/keys/urls which pertain to nothing in the topic).
does "x"ing a link out remove it from all pertaining links?
very cool hans.
- jon
pgp key: http://www.jonbaer.net/jonbaer.asc
fingerprint: F438 A47E C45E 8B27 F68C 1F9B 41DB DB8B 9A0C AF47
----- Original Message -----
From: "Hans Zaunere"
To:
Sent: Wednesday, August 06, 2003 6:45 AM
Subject: [nycphp-talk] Ready, Set, Google!
>
> Good morning,
>
> Over the last couple of days I've been playing with trying to provide some
search capabilities to the mailing lists, noteably Talk. Day after day
valuable information and URLs are passed around and, for the most part, lost
into history.
>
> I tried a couple of things, not finishing any of them, until I finally
took the easy way out. Warning: These are all very rough :)
>
> -- http://lists.nyphp.org/ptips/ scrapes URLs from each NYPHP-Talk message
and throws it into a table. There's of course many improvements that could
be made, but it's kind of interesting to see the links people have referred
to in the past. Also, clicking the X will deactive that link (for instance,
if you find a shopping.yahoo.com or hotmail.com in the listing).
>
> -- http://lists.nyphp.org/search.php is a full text index of all
NYPHP-Talk's mail message. Yes, it's very rough (I forgot to include the
subject of the message in the result listing) but it has potential.
>
> -- http://nyphp.org/google.php is the easy way out. It's your basic
google search of our entire site, including the mailing list archives. The
only drawback is it's not very current. The searches are always right on
(afterall, it's google) but you'll probably have to wait a few weeks to see
things get updated. That said, I made it the primary means for searching
our sites, until we get something better online.
>
>
> So I just thought I'd throw these out there and I'm happy to hear any
feedback as to what improvements could be made, what features/functionality
people would find useful, etc.
>
> Thanks,
>
> H
>
>
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>
From jonbaer at jonbaer.net Wed Aug 6 14:11:26 2003
From: jonbaer at jonbaer.net (Jon Baer)
Date: Wed, 6 Aug 2003 11:11:26 -0700
Subject: [nycphp-talk] Humor for the day ...
Message-ID: <00a101c35c46$27397950$6500a8c0@THINKPAD>
http://www.cnn.com/2003/TECH/internet/08/06/chimp.program.ap/index.html
-snip-
DES MOINES, Iowa (AP) -- A Web site that spoofs the computer programming
industry by offering chimpanzees and baboons to work for as little as 50
cents an hour has taken its monkey business too far, according to the Iowa
Primate Learning Sanctuary.
-snip-
scary to think of a monkey programming and understanding regular
expressions.
- jon
pgp key: http://www.jonbaer.net/jonbaer.asc
fingerprint: F438 A47E C45E 8B27 F68C 1F9B 41DB DB8B 9A0C AF47
From David.SextonJr at ubs.com Wed Aug 6 12:38:53 2003
From: David.SextonJr at ubs.com (Sexton, David)
Date: Wed, 6 Aug 2003 12:38:53 -0400
Subject: [nycphp-talk] PHP and framesets
Message-ID: <18D7B8CAA5284F478470828806DB124603789F16@psle01.xchg.pwj.com>
This seems simple enough, but maybe it isn't that simple... Does anyone know
of a way to have PHP return the top level document's location? Basically I
have a script that references PHP_SELF... if you throw it into a frameset,
it naturally returns the frame source URL, not the frameset's.
Please do not transmit orders or instructions regarding a UBS account by
email. The information provided in this email or any attachments is not an
official transaction confirmation or account statement. For your protection,
do not include account numbers, Social Security numbers, credit card
numbers, passwords or other non-public information in your email. Because
the information contained in this message may be privileged, confidential,
proprietary or otherwise protected from disclosure, please notify us
immediately by replying to this message and deleting it from your computer
if you have received this communication in error. Thank you.
UBS Financial Services Inc.
UBS International Inc.
From hans at nyphp.org Wed Aug 6 12:54:16 2003
From: hans at nyphp.org (Hans Zaunere)
Date: Wed, 06 Aug 2003 12:54:16 -0400
Subject: [nycphp-talk] PHP and framesets
In-Reply-To: <18D7B8CAA5284F478470828806DB124603789F16@psle01.xchg.pwj.com>
References: <18D7B8CAA5284F478470828806DB124603789F16@psle01.xchg.pwj.com>
Message-ID: <3F3132B8.2070202@nyphp.org>
Sexton, David wrote:
> This seems simple enough, but maybe it isn't that simple... Does anyone know
> of a way to have PHP return the top level document's location? Basically I
> have a script that references PHP_SELF... if you throw it into a frameset,
> it naturally returns the frame source URL, not the frameset's.
As far as I know, a frameset is a client-side thing, so PHP wouldn't know anything about it natively. You could, perhaps, have some kind of Javascript callback to a php script, but I don't really know how you'd do it in JS :)
H
From markert at optonline.net Wed Aug 6 12:52:27 2003
From: markert at optonline.net (John W. Markert)
Date: Wed, 06 Aug 2003 12:52:27 -0400
Subject: [nycphp-talk] Ready, Set, Google!
References: <3F310662.3000305@nyphp.org>
Message-ID: <003501c35c3b$1ee9f1e0$0200a8c0@dads>
I will be testing the full text search capabilities of MySQL in the near
future and want to explore how Boolean searches and result relevance could
be implemented. Should you need a collaborator, I would be interested in
making the NYPHP-talk searchable. I am interested in how you implemented
your test search; could I see the code for how you implemented this search?
----- Original Message -----
From: "Hans Zaunere"
To:
Sent: Wednesday, August 06, 2003 9:45 AM
Subject: [nycphp-talk] Ready, Set, Google!
>
> Good morning,
>
> Over the last couple of days I've been playing with trying to provide some
search capabilities to the mailing lists, noteably Talk. Day after day
valuable information and URLs are passed around and, for the most part, lost
into history.
>
> I tried a couple of things, not finishing any of them, until I finally
took the easy way out. Warning: These are all very rough :)
>
> -- http://lists.nyphp.org/ptips/ scrapes URLs from each NYPHP-Talk message
and throws it into a table. There's of course many improvements that could
be made, but it's kind of interesting to see the links people have referred
to in the past. Also, clicking the X will deactive that link (for instance,
if you find a shopping.yahoo.com or hotmail.com in the listing).
>
> -- http://lists.nyphp.org/search.php is a full text index of all
NYPHP-Talk's mail message. Yes, it's very rough (I forgot to include the
subject of the message in the result listing) but it has potential.
>
> -- http://nyphp.org/google.php is the easy way out. It's your basic
google search of our entire site, including the mailing list archives. The
only drawback is it's not very current. The searches are always right on
(afterall, it's google) but you'll probably have to wait a few weeks to see
things get updated. That said, I made it the primary means for searching
our sites, until we get something better online.
>
>
> So I just thought I'd throw these out there and I'm happy to hear any
feedback as to what improvements could be made, what features/functionality
people would find useful, etc.
>
> Thanks,
>
> H
>
>
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
From hans at nyphp.org Wed Aug 6 13:03:04 2003
From: hans at nyphp.org (Hans Zaunere)
Date: Wed, 06 Aug 2003 13:03:04 -0400
Subject: [nycphp-talk] Ready, Set, Google!
In-Reply-To: <003401c35c3f$715e5b10$6500a8c0@THINKPAD>
References: <3F310662.3000305@nyphp.org>
<003401c35c3f$715e5b10$6500a8c0@THINKPAD>
Message-ID: <3F3134C8.4030107@nyphp.org>
Jon Baer wrote:
> ok what would be extremely cool is to make ptips integrated *with* a mailing
> list. i attempted this a long time ago w/ alicemail in which ud setup
> something like dummy at nyphp.org and have it attempt to help out a user by
> attaching urls/info @ the bottom of emails/responses (in terms of faqs).
> the hardest part about it i found is visible in ur tests (the
> signatures/keys/urls which pertain to nothing in the topic).
There's a couple of things along these lines I've been kicking around, including what you mention above. Without trying to write an AI engine, I suppose you could just search for keywords against some type of fulltext/keyword database.
My ineveitable goal is to have a phpTips database, thus the name /ptips/ in my original post. evolt.org has something similar, but it could use some improvement. It basically works by placing tags in your messages when you see something useful, or write something useful yourself; or a combination. For example:
> does "x"ing a link out remove it from all pertaining links?
Yeah, the link won't show up, but it won't remove the whole message (ie, if a message has more than one link).
Something like that. Then there'd be a full text searchable DB of all these things, which would also link back to the original message. It wouldn't be very hard to write, and I'd be happy to do it; if people promise to use it :)
H
From chendry at nyc.rr.com Wed Aug 6 12:57:46 2003
From: chendry at nyc.rr.com (Christopher Hendry)
Date: Wed, 6 Aug 2003 12:57:46 -0400
Subject: [nycphp-talk] PHP and framesets
In-Reply-To: <3F3132B8.2070202@nyphp.org>
Message-ID:
yeah - what Hans said.
I've had plenty of success dropping PHP into javascript, ie:
One possible solution, though convoluted, would be to have the frameset drop
a cookie with the _top URL and then in the subsequent frame PHP could read
from the same cookie and get the URL. Otherwise, I often use hidden forms
on the client side and document.submit() the values back into a PHP script -
when I need info from the client-side in the server-side.
I'd love to hear other solutions...
C
-> -----Original Message-----
-> From: talk-bounces at lists.nyphp.org
-> [mailto:talk-bounces at lists.nyphp.org]On Behalf Of Hans Zaunere
-> Sent: Wednesday, August 06, 2003 12:54 PM
-> To: NYPHP Talk
-> Subject: Re: [nycphp-talk] PHP and framesets
->
->
->
->
-> Sexton, David wrote:
->
-> > This seems simple enough, but maybe it isn't that simple...
-> Does anyone know
-> > of a way to have PHP return the top level document's location?
-> Basically I
-> > have a script that references PHP_SELF... if you throw it into
-> a frameset,
-> > it naturally returns the frame source URL, not the frameset's.
->
-> As far as I know, a frameset is a client-side thing, so PHP
-> wouldn't know anything about it natively. You could, perhaps,
-> have some kind of Javascript callback to a php script, but I
-> don't really know how you'd do it in JS :)
->
-> H
->
->
-> _______________________________________________
-> talk mailing list
-> talk at lists.nyphp.org
-> http://lists.nyphp.org/mailman/listinfo/talk
->
From dkrook at hotmail.com Wed Aug 6 13:00:23 2003
From: dkrook at hotmail.com (D C Krook)
Date: Wed, 06 Aug 2003 13:00:23 -0400
Subject: [nycphp-talk] PHP and framesets
Message-ID:
Hans is right, PHP wouldn't know that it is in a frameset. Only the client
knows that, which is after the PHP is executed.
You can throw around the parent frame's PHP_SELF with something like this:
In the parent frameset declaration page:
-----------------------------------------
-----------------------------------------
And in the child, e.g., "top.php":
-----------------------------------------
-----------------------------------------
>>This seems simple enough, but maybe it isn't that simple... Does anyone
>>know
>>of a way to have PHP return the top level document's location? Basically I
>>have a script that references PHP_SELF... if you throw it into a frameset,
>>it naturally returns the frame source URL, not the frameset's.
>
>As far as I know, a frameset is a client-side thing, so PHP wouldn't know
>anything about it natively. You could, perhaps, have some kind of
>Javascript callback to a php script, but I don't really know how you'd do
>it in JS :)
>
>H
_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail
From hans at nyphp.org Wed Aug 6 13:11:01 2003
From: hans at nyphp.org (Hans Zaunere)
Date: Wed, 06 Aug 2003 13:11:01 -0400
Subject: [nycphp-talk] Ready, Set, Google!
In-Reply-To: <003501c35c3b$1ee9f1e0$0200a8c0@dads>
References: <3F310662.3000305@nyphp.org> <003501c35c3b$1ee9f1e0$0200a8c0@dads>
Message-ID: <3F3136A5.7090207@nyphp.org>
John W. Markert wrote:
> I will be testing the full text search capabilities of MySQL in the near
> future and want to explore how Boolean searches and result relevance could
> be implemented. Should you need a collaborator, I would be interested in
> making the NYPHP-talk searchable. I am interested in how you implemented
> your test search; could I see the code for how you implemented this search?
Sure, see attached, although it's contrived, dirty and without even boolean. pre.search.php seeds the DB from the HTML archive files, and search.php is the end-user interface. To take this further, we'd probably want to add booleans and tune the fulltext engine a bit, although the initial test results seemed to produce some reasonable results.
http://www.mysql.com/doc/en/Fulltext_Fine-tuning.html
H
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From danielc at analysisandsolutions.com Wed Aug 6 13:11:01 2003
From: danielc at analysisandsolutions.com (Analysis & Solutions)
Date: Wed, 6 Aug 2003 13:11:01 -0400
Subject: [nycphp-talk] PHP and framesets
In-Reply-To: <18D7B8CAA5284F478470828806DB124603789F16@psle01.xchg.pwj.com>
References: <18D7B8CAA5284F478470828806DB124603789F16@psle01.xchg.pwj.com>
Message-ID: <20030806171101.GA2536@panix.com>
David:
On Wed, Aug 06, 2003 at 12:38:53PM -0400, Sexton, David wrote:
> of a way to have PHP return the top level document's location? Basically I
> have a script that references PHP_SELF... if you throw it into a frameset,
> it naturally returns the frame source URL, not the frameset's.
Total guesses... How about checking $_SERVER['HTTP_REFERER'] in the
frame? Or, put a query string onto the frameset's call to the frame,
which you can then read in the frame.
See you,
--Dan
--
FREE scripts that make web and database programming easier
http://www.analysisandsolutions.com/software/
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7th Ave #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
From nyphp at jimbishop.org Wed Aug 6 13:18:17 2003
From: nyphp at jimbishop.org (jim.bishop)
Date: Wed, 6 Aug 2003 10:18:17 -0700 (PDT)
Subject: [nycphp-talk] Personalization, Ratings, Suggestions
In-Reply-To: <20030806171101.GA2536@panix.com>
References: <18D7B8CAA5284F478470828806DB124603789F16@psle01.xchg.pwj.com>
<20030806171101.GA2536@panix.com>
Message-ID:
I'm building a system that takes user purchases and turns that information
into a suggested purchases list for other users. I know Amazon, B&N,
everyone and their dog does it.
Does anyone know of open source packages, online documentation, or howtos
that might help point me in the right direction? I see several for
purchase products, but I am more interested in doing it myself for the
experience.
Starting from scratch, I figure I'm going to need a database that tracks
user purchases and then software to "score" those purchases for other
users. It's the scoring portion that I'm finding a little daunting.
Anyone? Anyone?
From dkrook at hotmail.com Wed Aug 6 13:22:15 2003
From: dkrook at hotmail.com (D C Krook)
Date: Wed, 06 Aug 2003 13:22:15 -0400
Subject: [nycphp-talk] PHP and framesets
Message-ID:
Dan,
That's a pretty clever way to do it and seems to work perfectly.
>Or, put a query string onto the frameset's call to the frame,
>which you can then read in the frame.
_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail
From coling at macmicro.com Wed Aug 6 13:25:43 2003
From: coling at macmicro.com (Colin Goldberg)
Date: Wed, 06 Aug 2003 13:25:43 -0400
Subject: [nycphp-talk] Personalization, Ratings, Suggestions
In-Reply-To:
References: <20030806171101.GA2536@panix.com>
<18D7B8CAA5284F478470828806DB124603789F16@psle01.xchg.pwj.com>
<20030806171101.GA2536@panix.com>
Message-ID: <5.2.1.1.0.20030806132155.02d388b0@mail.macmicro.com>
You might want to take a look at "Case Based Reasoning" - in which, once
some "cases" have been stored and verified, later "cases" are compared
against them. It's been a long time since I looked at this, but if you get
stuck, let me know and I will try to find resources.
Colin Goldberg
coling at macmicro.com
At 10:18 AM 8/6/03 -0700, you wrote:
>I'm building a system that takes user purchases and turns that information
>into a suggested purchases list for other users. I know Amazon, B&N,
>everyone and their dog does it.
>
>Does anyone know of open source packages, online documentation, or howtos
>that might help point me in the right direction? I see several for
>purchase products, but I am more interested in doing it myself for the
>experience.
>
>Starting from scratch, I figure I'm going to need a database that tracks
>user purchases and then software to "score" those purchases for other
>users. It's the scoring portion that I'm finding a little daunting.
>
>Anyone? Anyone?
>
>
>_______________________________________________
>talk mailing list
>talk at lists.nyphp.org
>http://lists.nyphp.org/mailman/listinfo/talk
From MLynn at exchange.ml.com Wed Aug 6 13:26:58 2003
From: MLynn at exchange.ml.com (Lynn, Michael (IDS DM&DS))
Date: Wed, 6 Aug 2003 13:26:58 -0400
Subject: [nycphp-talk] Personalization, Ratings, Suggestions
Message-ID:
http://www.oscommerce.com/about/features
OS Commerce does most of what you're after... plus its PHP! ;-)
-----Original Message-----
From: jim.bishop [mailto:nyphp at jimbishop.org]
Sent: Wednesday, August 06, 2003 1:18 PM
To: NYPHP Talk
Subject: [nycphp-talk] Personalization, Ratings, Suggestions
I'm building a system that takes user purchases and turns that information
into a suggested purchases list for other users. I know Amazon, B&N,
everyone and their dog does it.
Does anyone know of open source packages, online documentation, or howtos
that might help point me in the right direction? I see several for
purchase products, but I am more interested in doing it myself for the
experience.
Starting from scratch, I figure I'm going to need a database that tracks
user purchases and then software to "score" those purchases for other
users. It's the scoring portion that I'm finding a little daunting.
Anyone? Anyone?
_______________________________________________
talk mailing list
talk at lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk
From csnyder at chxo.com Wed Aug 6 13:27:25 2003
From: csnyder at chxo.com (Chris Snyder)
Date: Wed, 06 Aug 2003 13:27:25 -0400
Subject: [nycphp-talk] Personalization, Ratings, Suggestions
In-Reply-To:
References: <18D7B8CAA5284F478470828806DB124603789F16@psle01.xchg.pwj.com> <20030806171101.GA2536@panix.com>
Message-ID: <3F313A7D.7070303@chxo.com>
jim.bishop wrote:
>Does anyone know of open source packages, online documentation, or howtos
>that might help point me in the right direction?
>
You might try contacting the oscommerce mailing list to see if someone
is already working on it for their PHP-based
catalog/shopping-cart/order-tracking solution.
http://www.oscommerce.com/community
Seems like a feature they'd definitely want to have.
chris.
From David.SextonJr at ubs.com Wed Aug 6 14:37:02 2003
From: David.SextonJr at ubs.com (Sexton, David)
Date: Wed, 6 Aug 2003 14:37:02 -0400
Subject: [nycphp-talk] PHP and framesets
Message-ID: <18D7B8CAA5284F478470828806DB124603789F17@psle01.xchg.pwj.com>
Thanks for the suggestions everybody. It looks like passing a value (e.g.
the frameset URI) around is the only way to accomplish this, but at least I
now know I'm not overlooking anything obvious.
Thanks again.
-----Original Message-----
From: D C Krook [mailto:dkrook at hotmail.com]
Sent: Wednesday, August 06, 2003 1:22 PM
To: talk at lists.nyphp.org
Subject: Re: [nycphp-talk] PHP and framesets
Dan,
That's a pretty clever way to do it and seems to work perfectly.
>Or, put a query string onto the frameset's call to the frame,
>which you can then read in the frame.
_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail
_______________________________________________
talk mailing list
talk at lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk
Please do not transmit orders or instructions regarding a UBS account by
email. The information provided in this email or any attachments is not an
official transaction confirmation or account statement. For your protection,
do not include account numbers, Social Security numbers, credit card
numbers, passwords or other non-public information in your email. Because
the information contained in this message may be privileged, confidential,
proprietary or otherwise protected from disclosure, please notify us
immediately by replying to this message and deleting it from your computer
if you have received this communication in error. Thank you.
UBS Financial Services Inc.
UBS International Inc.
From rdumas at cmj.com Wed Aug 6 14:57:15 2003
From: rdumas at cmj.com (Robert Dumas)
Date: Wed, 6 Aug 2003 14:57:15 -0400
Subject: [nycphp-talk] Ready, Set, Google!
Message-ID: <2ADC7BED20C3D711BFF100508B8FA3E307FB7F@webproxy.uat.dbinsight.com>
i think the old #lost weblog (which died just a couple of months ago) did
this, only in IRC. If you can get hold of ryano (good luck), maybe he can
pass on a bit of code.
--RD
-----Original Message-----
From: John Lacey [mailto:jlacey at ix.netcom.com]
Sent: Wednesday, August 06, 2003 9:44 AM
To: NYPHP Talk
Subject: Re: [nycphp-talk] Ready, Set, Google!
Hans Zaunere wrote:
>
> Good morning,
>
> Over the last couple of days I've been playing with trying to provide
> some search capabilities to the mailing lists, noteably Talk. Day
> after day valuable information and URLs are passed around and, for the
> most part, lost into history.
wow Hans, I was *just* thinking of this the other day in terms of
"task/problem" type training. There is a wealth of info in the lists,
even tho I've been signed up for only a short time, and I wanted to
bring some of the issues that are brought up to include these types of
problems in my PHP/MySQL training curriculum.
thanks,
John
>
>
> I tried a couple of things, not finishing any of them, until I finally
> took the easy way out. Warning: These are all very rough :)
>
> -- http://lists.nyphp.org/ptips/ scrapes URLs from each NYPHP-Talk
> message and throws it into a table. There's of course many
> improvements that could be made, but it's kind of interesting to see
> the links people have referred to in the past. Also, clicking the X
> will deactive that link (for instance, if you find a
> shopping.yahoo.com or hotmail.com in the listing).
>
> -- http://lists.nyphp.org/search.php is a full text index of all
> NYPHP-Talk's mail message. Yes, it's very rough (I forgot to include
> the subject of the message in the result listing) but it has potential.
>
> -- http://nyphp.org/google.php is the easy way out. It's your basic
> google search of our entire site, including the mailing list
> archives. The only drawback is it's not very current. The searches
> are always right on (afterall, it's google) but you'll probably have
> to wait a few weeks to see things get updated. That said, I made it
> the primary means for searching our sites, until we get something
> better online.
>
>
> So I just thought I'd throw these out there and I'm happy to hear any
> feedback as to what improvements could be made, what
> features/functionality people would find useful, etc.
>
> Thanks,
>
> H
>
>
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>
_______________________________________________
talk mailing list
talk at lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From ttoomey at ydnt.com Wed Aug 6 14:29:46 2003
From: ttoomey at ydnt.com (Tim Toomey)
Date: Wed, 6 Aug 2003 13:29:46 -0500
Subject: [nycphp-talk] Personalization, Ratings, Suggestions
References: <18D7B8CAA5284F478470828806DB124603789F16@psle01.xchg.pwj.com><20030806171101.GA2536@panix.com>
Message-ID: <002b01c35c48$b9eca400$7600a8c0@timmerslaptop>
You definetely should check out OScommerce, and if you're not going to use
that check out some of the contributions on "customers who bought this also
bought" type things. Works just like amazon's shopping cart.
-Timmy
----- Original Message -----
From: "jim.bishop"
To: "NYPHP Talk"
Sent: Wednesday, August 06, 2003 12:18 PM
Subject: [nycphp-talk] Personalization, Ratings, Suggestions
> I'm building a system that takes user purchases and turns that information
> into a suggested purchases list for other users. I know Amazon, B&N,
> everyone and their dog does it.
>
> Does anyone know of open source packages, online documentation, or howtos
> that might help point me in the right direction? I see several for
> purchase products, but I am more interested in doing it myself for the
> experience.
>
> Starting from scratch, I figure I'm going to need a database that tracks
> user purchases and then software to "score" those purchases for other
> users. It's the scoring portion that I'm finding a little daunting.
>
> Anyone? Anyone?
>
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>
From soazine at erols.com Wed Aug 6 18:48:18 2003
From: soazine at erols.com (Phil Powell)
Date: Wed, 6 Aug 2003 18:48:18 -0400
Subject: [nycphp-talk] PHP and PayPal
References: <000e01c35b96$5d09c810$6f62ca42@dwchome>
Message-ID: <061601c35c6c$d46db9d0$67a76244@philofsoa>
I am still not having any luck getting it to work on my site so that someone
could donate via PayPal... here is the source code I'm using, maybe that's
the problem:
Phil
----- Original Message -----
From: "Dan Horning"
To: "'NYPHP Talk'"
Sent: Tuesday, August 05, 2003 5:13 PM
Subject: RE: [nycphp-talk] PHP and PayPal
> You don't need to use IPN. I have a site that uses PayPal to purchase
> gift certificates. On the page where the "Paypal" button is, I store the
> variables I will need in Session variable and set the "Paypal Success
> URL" to my success PHP page. When Paypal invokes my page, I get
> everything I need from the Session variables. Works very well.
>
> Ken Robinson
>
>
> Show me your site ... And I could steal a ton from you... Unless you
> check the paypal IPN .. You don't really have any real way to verify
> that an order has been aproved or declined...
>
> Make sence everyone..???
> (unless you want to check every single order personally....)
> -dan
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
From andrew at digitalpulp.com Thu Aug 7 09:42:12 2003
From: andrew at digitalpulp.com (Andrew Yochum)
Date: Thu, 7 Aug 2003 09:42:12 -0400
Subject: [nycphp-talk] Personalization, Ratings, Suggestions
In-Reply-To:
References: <18D7B8CAA5284F478470828806DB124603789F16@psle01.xchg.pwj.com>
<20030806171101.GA2536@panix.com>
Message-ID: <20030807134204.GF22595@thighmaster.digitalpulp.com>
On Wed, Aug 06, 2003 at 10:18:17AM -0700, jim.bishop wrote:
> I'm building a system that takes user purchases and turns that information
> into a suggested purchases list for other users. I know Amazon, B&N,
> everyone and their dog does it.
>
> Does anyone know of open source packages, online documentation, or howtos
> that might help point me in the right direction? I see several for
> purchase products, but I am more interested in doing it myself for the
> experience.
There was an article in Dr. Dobbs journal sometime in the Fall on
personalization that you might check out. I believe it was called "Adaptive
Resonance Theory"... a fancy name for just what you want to do.
> Starting from scratch, I figure I'm going to need a database that tracks
> user purchases and then software to "score" those purchases for other
> users. It's the scoring portion that I'm finding a little daunting.
I've had good success with doing all of the computation in the database,
leaving nothing for PHP to do but display the results. I use a combination of
aggregate (SUM & COUNT) functions with a CASE statement for the weighting to
give me a scoring and then order the result by that.
> Anyone? Anyone?
>
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
--
Andrew Yochum
Digital Pulp, Inc.
212.679.0676x255
andrew at digitalpulp.com
From crisscott at netzero.com Thu Aug 7 10:56:03 2003
From: crisscott at netzero.com (crisscott at netzero.com)
Date: Thu, 7 Aug 2003 14:56:03 GMT
Subject: [nycphp-talk] Forcing page refresh
Message-ID: <20030807.075610.16315.1104826@webmail02.lax.untd.com>
I am trying to figure out if it is possible to force a page refresh for all users viewing a page at the same time. I want all users to see a new page when one user submits info via a form. I am picturing something along the lines of:
if(submit)
{
write_to_file($POST[new info]);
foreach($ip_addr in $ip_addr_list)
{
fsockopen($ip);
fputs(headers to refresh page);
fclose();
}
}
else
{
echo read_from_file();
}
My question is, can I send headers to an ip address and expect the web browser to refresh even though the user at that address hasn't done anything?
From jonbaer at jonbaer.net Thu Aug 7 11:18:14 2003
From: jonbaer at jonbaer.net (Jon Baer)
Date: Thu, 7 Aug 2003 08:18:14 -0700
Subject: [nycphp-talk] Forcing page refresh
References: <20030807.075610.16315.1104826@webmail02.lax.untd.com>
Message-ID: <003b01c35cf7$1f87d920$6500a8c0@THINKPAD>
you could probably get away using a hidden frame on each of the viewers
client and occasionally polling a queue on the server ... let the submit
write the text to the queue/text/db file and then let the viewers poll it
for changes and if changes are made using javascript to reload the
corresponding window ...
i did this once w/ a java applet but i think u can get away w/ a simple php
script ...
- jon
pgp key: http://www.jonbaer.net/jonbaer.asc
fingerprint: F438 A47E C45E 8B27 F68C 1F9B 41DB DB8B 9A0C AF47
----- Original Message -----
From:
To:
Sent: Thursday, August 07, 2003 7:56 AM
Subject: [nycphp-talk] Forcing page refresh
>
> I am trying to figure out if it is possible to force a page refresh for
all users viewing a page at the same time. I want all users to see a new
page when one user submits info via a form. I am picturing something along
the lines of:
>
> if(submit)
> {
> write_to_file($POST[new info]);
> foreach($ip_addr in $ip_addr_list)
> {
> fsockopen($ip);
> fputs(headers to refresh page);
> fclose();
> }
> }
> else
> {
> echo read_from_file();
> }
>
> My question is, can I send headers to an ip address and expect the web
browser to refresh even though the user at that address hasn't done
anything?
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>
From jsiegel1 at optonline.net Thu Aug 7 11:31:36 2003
From: jsiegel1 at optonline.net (Jeff)
Date: Thu, 07 Aug 2003 11:31:36 -0400
Subject: [nycphp-talk] Smarty template problem - creating directories
Message-ID: <005001c35cf8$fde47b00$6501a8c0@EZDSDELL>
Hope someone has some experience with Smarty. I'm getting the following
error message. Note the double forward slashes. Any know how to solve
this one?
Warning: Smarty error: problem creating directory
"/tmp/disk/home/webmaster/Files/WWW/tff_pref/templates/templates_c//%%-1
1/%%-1167457344"
Jeff
From shiflett at php.net Thu Aug 7 11:32:15 2003
From: shiflett at php.net (Chris Shiflett)
Date: Thu, 7 Aug 2003 08:32:15 -0700 (PDT)
Subject: [nycphp-talk] Forcing page refresh
In-Reply-To: <20030807.075610.16315.1104826@webmail02.lax.untd.com>
Message-ID: <20030807153215.43312.qmail@web14311.mail.yahoo.com>
--- crisscott at netzero.com wrote:
> I am trying to figure out if it is possible to force a page refresh
> for all users viewing a page at the same time.
Not exactly, but you can have pages that represent states in a state machine.
1. Regular page - has a Refresh header to refresh itself every 30 seconds
2. New Page - has a Refresh header to refresh itself every 30 seconds
When you want everyone to see the new page, you change the URL in the Refresh
header in state 1 to point to state 2.
I'm sure there are better examples of a state machine, but that just came to
mind. Keep in mind that this is not completely reliable and that you're
generating a lot of unnecessary traffic (and load) on your Web server to do
something that seems very unimportant.
> I want all users to see a new page when one user submits info via a form.
Can you explain what you're trying to do? Surely there is a better path to
take.
> I am picturing something along the lines of:
>
> if(submit)
> {
> write_to_file($POST[new info]);
> foreach($ip_addr in $ip_addr_207.18.113.234?list)
> {
> fsockopen($ip);
> fputs(headers to refresh page);
> fclose();
> }
> }
> else
> {
> echo read_from_file();
> }
>
> My question is, can I send headers to an ip address and expect the web
> browser to refresh even though the user at that address hasn't done
> anything?
Nope. Imagine how awful that would be. Web browsers are HTTP clients, not
servers.
Hope that helps.
Chris
=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/
From andrew at digitalpulp.com Thu Aug 7 11:34:20 2003
From: andrew at digitalpulp.com (Andrew Yochum)
Date: Thu, 7 Aug 2003 11:34:20 -0400
Subject: [nycphp-talk] Smarty template problem - creating directories
In-Reply-To: <005001c35cf8$fde47b00$6501a8c0@EZDSDELL>
References: <005001c35cf8$fde47b00$6501a8c0@EZDSDELL>
Message-ID: <20030807153420.GI22595@thighmaster.digitalpulp.com>
On Thu, Aug 07, 2003 at 11:31:36AM -0400, Jeff wrote:
> Hope someone has some experience with Smarty. I'm getting the following
> error message. Note the double forward slashes. Any know how to solve
> this one?
>
> Warning: Smarty error: problem creating directory
> "/tmp/disk/home/webmaster/Files/WWW/tff_pref/templates/templates_c//%%-1
> 1/%%-1167457344"
The double slashes should be fine, I think. You probably have an unnecessary
trailing / in a config file somewhere.
Have you checked the permissions on the containing directory? Does the user
the script is running as have permission to write to it?
--
Andrew Yochum
Digital Pulp, Inc.
212.679.0676x255
andrew at digitalpulp.com
From crisscott at netzero.com Thu Aug 7 11:48:28 2003
From: crisscott at netzero.com (crisscott at netzero.com)
Date: Thu, 7 Aug 2003 15:48:28 GMT
Subject: [nycphp-talk] Forcing page refresh
Message-ID: <20030807.084851.16315.1105753@webmail02.lax.untd.com>
I am trying to figure out if there is a good way to make an instant messaging/chat program in php. I don't want to create all of that traffic with unnecessary refreshes. There is no point in updating the page if nobody has anything to say. At the same time, I don't want users to have to wait 30 seconds between messages. If I could get the users browser to refresh on my command that would pervent all of the unnecessary traffic. I figure that any reasonably secure browser would ignore any headers it wasn't expecting, but is there a way to make the browser sit and wait for my command? Or am I trying to do something browser developers spend all day trying to prevent?
From shiflett at php.net Thu Aug 7 12:04:42 2003
From: shiflett at php.net (Chris Shiflett)
Date: Thu, 7 Aug 2003 09:04:42 -0700 (PDT)
Subject: [nycphp-talk] Forcing page refresh
In-Reply-To: <20030807.084851.16315.1105753@webmail02.lax.untd.com>
Message-ID: <20030807160442.58618.qmail@web14304.mail.yahoo.com>
--- crisscott at netzero.com wrote:
> I am trying to figure out if there is a good way to make an
> instant messaging/chat program in php.
This is very different. You see, you don't need a new page; you just need a new
message added to the existing page.
This can be done using a chunked transfer encoding. So long as your Web server
(and your users' Web clients) does not buffer, the flush() function can be used
to output the next "chunk" to the user.
I wrote a (very poor) example of this a few years ago. This is the second time
I've mentioned it on a mailing list recently, so I'm feeling pressure to write
a simple chat-room example now. :-) Anyway, you can have a look and see if it
helps explain anything:
http://shiflett.org/tutorials/php_flush.php
Hope that helps.
Chris
=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/
From David.SextonJr at ubs.com Thu Aug 7 12:05:21 2003
From: David.SextonJr at ubs.com (Sexton, David)
Date: Thu, 7 Aug 2003 12:05:21 -0400
Subject: [nycphp-talk] Forcing page refresh
Message-ID: <18D7B8CAA5284F478470828806DB124603789F19@psle01.xchg.pwj.com>
The only thing I can think of using a standard web browser is to setting the
timeout to 0 (set_time_limit (0);) and using some combination of flush/sleep
functions to continuously poll and update the display frame... I have no
idea how it would behave or if it would slam your server with all the
concurrent connections, but an applet sounds like a better solution for
something like this.
-----Original Message-----
From: crisscott at netzero.com [mailto:crisscott at netzero.com]
Sent: Thursday, August 07, 2003 11:48 AM
To: shiflett at php.net; talk at lists.nyphp.org
Subject: Re: [nycphp-talk] Forcing page refresh
I am trying to figure out if there is a good way to make an instant
messaging/chat program in php. I don't want to create all of that traffic
with unnecessary refreshes. There is no point in updating the page if
nobody has anything to say. At the same time, I don't want users to have to
wait 30 seconds between messages. If I could get the users browser to
refresh on my command that would pervent all of the unnecessary traffic. I
figure that any reasonably secure browser would ignore any headers it wasn't
expecting, but is there a way to make the browser sit and wait for my
command? Or am I trying to do something browser developers spend all day
trying to prevent?
_______________________________________________
talk mailing list
talk at lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk
Please do not transmit orders or instructions regarding a UBS account by
email. The information provided in this email or any attachments is not an
official transaction confirmation or account statement. For your protection,
do not include account numbers, Social Security numbers, credit card
numbers, passwords or other non-public information in your email. Because
the information contained in this message may be privileged, confidential,
proprietary or otherwise protected from disclosure, please notify us
immediately by replying to this message and deleting it from your computer
if you have received this communication in error. Thank you.
UBS Financial Services Inc.
UBS International Inc.
From soazine at erols.com Thu Aug 7 12:16:20 2003
From: soazine at erols.com (Phil Powell)
Date: Thu, 7 Aug 2003 12:16:20 -0400
Subject: [nycphp-talk] How can PHP extract a pattern from a string into
another string?
Message-ID: <025101c35cff$3cff5c50$67a76244@philofsoa>
Once again I have to go with my native "language", TCL:
regexp {^a=([^\n]+)\n$} $stuff {} myExtractedStuff
How can PHP do the same thing? I want to extract a specific pattern match from a body into another variable. What does that in PHP, the manual does not make it clear to me?
Thanx
Phil
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From keremtuzemen at hotmail.com Thu Aug 7 12:29:26 2003
From: keremtuzemen at hotmail.com (Kerem Tuzemen)
Date: Thu, 7 Aug 2003 12:29:26 -0400
Subject: [nycphp-talk] Smarty template problem - creating directories
References: <005001c35cf8$fde47b00$6501a8c0@EZDSDELL>
<20030807153420.GI22595@thighmaster.digitalpulp.com>
Message-ID:
Jeff,
You have templates_c directory (used for caching templates) created, right?
If not, create it in the same folder that your templates directory exists.
This one is explained in the installation part of Smarty manual.
okt
----- Original Message -----
From: "Andrew Yochum"
To: "Jeff"
Cc: "'NYPHP Talk'"
Sent: Thursday, August 07, 2003 11:34 AM
Subject: Re: [nycphp-talk] Smarty template problem - creating directories
> On Thu, Aug 07, 2003 at 11:31:36AM -0400, Jeff wrote:
> > Hope someone has some experience with Smarty. I'm getting the following
> > error message. Note the double forward slashes. Any know how to solve
> > this one?
> >
> > Warning: Smarty error: problem creating directory
> > "/tmp/disk/home/webmaster/Files/WWW/tff_pref/templates/templates_c//%%-1
> > 1/%%-1167457344"
>
> The double slashes should be fine, I think. You probably have an
unnecessary
> trailing / in a config file somewhere.
>
> Have you checked the permissions on the containing directory? Does the
user
> the script is running as have permission to write to it?
>
> --
> Andrew Yochum
> Digital Pulp, Inc.
> 212.679.0676x255
> andrew at digitalpulp.com
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>
From dmintz at panix.com Thu Aug 7 12:36:34 2003
From: dmintz at panix.com (David Mintz)
Date: Thu, 7 Aug 2003 12:36:34 -0400 (EDT)
Subject: [nycphp-talk] How can PHP extract a pattern from a string into
another string?
In-Reply-To: <025101c35cff$3cff5c50$67a76244@philofsoa>
References: <025101c35cff$3cff5c50$67a76244@philofsoa>
Message-ID:
Have you had a look at
http://www.php.net/manual/en/function.preg-match.php ? Note example 3 in
particular.
On Thu, 7 Aug 2003, Phil Powell wrote:
> Once again I have to go with my native "language", TCL:
>
> regexp {^a=([^\n]+)\n$} $stuff {} myExtractedStuff
>
> How can PHP do the same thing? I want to extract a specific pattern match from a body into another variable. What does that in PHP, the manual does not make it clear to me?
>
> Thanx
> Phil
>
---
David Mintz
http://davidmintz.org/
Email: See http://dmintzweb.com/whitelist.php first!
Decibels of sound pressure employed by a new "thermoacoustic" refrigerator: 190
Decibels of sound pressure sufficient to ignite a person's hair: 165
-- Harper's Index, February 2003
From soazine at erols.com Thu Aug 7 12:51:41 2003
From: soazine at erols.com (Phil Powell)
Date: Thu, 7 Aug 2003 12:51:41 -0400
Subject: [nycphp-talk] How can PHP extract a pattern from a string
intoanother string?
References: <025101c35cff$3cff5c50$67a76244@philofsoa>
Message-ID: <026501c35d04$2d09dfa0$67a76244@philofsoa>
I noted, however, it wasn't intuitive to me until I read further about
$matches.
Thanx, I dare not ask what you thought of my inquiry.
Phil
----- Original Message -----
From: "David Mintz"
To: "NYPHP Talk"
Sent: Thursday, August 07, 2003 12:36 PM
Subject: Re: [nycphp-talk] How can PHP extract a pattern from a string
intoanother string?
>
> Have you had a look at
> http://www.php.net/manual/en/function.preg-match.php ? Note example 3 in
> particular.
>
> On Thu, 7 Aug 2003, Phil Powell wrote:
>
> > Once again I have to go with my native "language", TCL:
> >
> > regexp {^a=([^\n]+)\n$} $stuff {} myExtractedStuff
> >
> > How can PHP do the same thing? I want to extract a specific pattern
match from a body into another variable. What does that in PHP, the manual
does not make it clear to me?
> >
> > Thanx
> > Phil
> >
>
>
> ---
> David Mintz
> http://davidmintz.org/
> Email: See http://dmintzweb.com/whitelist.php first!
>
> Decibels of sound pressure employed by a new "thermoacoustic"
refrigerator: 190
> Decibels of sound pressure sufficient to ignite a person's hair: 165
>
> -- Harper's Index, February 2003
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
From hans at nyphp.org Thu Aug 7 13:04:02 2003
From: hans at nyphp.org (Hans Zaunere)
Date: Thu, 07 Aug 2003 13:04:02 -0400
Subject: [nycphp-talk] Oracle Developer Days Details
Message-ID: <3F328682.4030307@nyphp.org>
[I might have messed up the first time - apologies if this is a double-post]
Tomorrow's the big day!
Here's the plan for tomorrow morning:
-- Meet at Penn Station at 6:30am to catch the 7:03 train to New Brunswick (Northeast Corridor Line)
-- After trying to figure out a good place to meet, I'll say the corner of 7th Ave and 33rd Street (this is corner across from the huge Farley post office, right?). It's actually shockingly difficult to find a good map: http://www.citidex.com/map/penn.html. If I'm in the wrong here, please tell me!
So how do we find each other? It should be early enough in the morning that there won't be *too* many people around, but we'll try to speak loudly about computers and PHP. And, my cell number is 646 242 4101.
If you are planning on coming, please send a quick note to rsvp at nyphp.org so we know who to wait for, etc.
See everyone tomorrow!
Hans
From pl at eskimo.com Thu Aug 7 13:05:57 2003
From: pl at eskimo.com (Peter Lehrer)
Date: Thu, 7 Aug 2003 13:05:57 -0400
Subject: [nycphp-talk] Oracle Developer Days Details
References: <3F328682.4030307@nyphp.org>
Message-ID: <009c01c35d06$2e7c7080$ac5aba8c@default>
Why don't we just meet in Penn Station itself under the big train schedule
board. BTW, I think the post office is on 8th Ave.
Peter Lehrer
----- Original Message -----
From: "Hans Zaunere"
To:
Sent: Thursday, August 07, 2003 1:04 PM
Subject: [nycphp-talk] Oracle Developer Days Details
>
> [I might have messed up the first time - apologies if this is a
double-post]
>
>
> Tomorrow's the big day!
>
> Here's the plan for tomorrow morning:
>
> -- Meet at Penn Station at 6:30am to catch the 7:03 train to New Brunswick
(Northeast Corridor Line)
> -- After trying to figure out a good place to meet, I'll say the corner
of 7th Ave and 33rd Street (this is corner across from the huge Farley post
office, right?). It's actually shockingly difficult to find a good map:
http://www.citidex.com/map/penn.html. If I'm in the wrong here, please tell
me!
>
>
> So how do we find each other? It should be early enough in the morning
that there won't be *too* many people around, but we'll try to speak loudly
about computers and PHP. And, my cell number is 646 242 4101.
>
> If you are planning on coming, please send a quick note to rsvp at nyphp.org
so we know who to wait for, etc.
>
> See everyone tomorrow!
>
> Hans
>
>
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>
From shiflett at php.net Thu Aug 7 13:13:58 2003
From: shiflett at php.net (Chris Shiflett)
Date: Thu, 7 Aug 2003 10:13:58 -0700 (PDT)
Subject: [nycphp-talk] Re: [nycphp-dev] Oracle Developer Days Details
In-Reply-To: <3F32855D.4030402@nyphp.org>
Message-ID: <20030807171358.58619.qmail@web14311.mail.yahoo.com>
--- Hans Zaunere wrote:
> -- After trying to figure out a good place to meet, I'll say the
> corner of 7th Ave and 33rd Street (this is corner across from the
> huge Farley post office, right?).
Well, the Post Office is between 8th and 9th, so not exactly. That's basically
the NE corner of Madison Square Garden, if I'm not mistaken.
Chris
P.S. I'm not going - just responding since I live right there
=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/
From hans at nyphp.org Thu Aug 7 13:20:45 2003
From: hans at nyphp.org (Hans Zaunere)
Date: Thu, 07 Aug 2003 13:20:45 -0400
Subject: [nycphp-talk] Oracle Developer Days Details
In-Reply-To: <20030807171358.58619.qmail@web14311.mail.yahoo.com>
References: <20030807171358.58619.qmail@web14311.mail.yahoo.com>
Message-ID: <3F328A6D.3080802@nyphp.org>
Chris Shiflett wrote:
> --- Hans Zaunere wrote:
>
>>-- After trying to figure out a good place to meet, I'll say the
>>corner of 7th Ave and 33rd Street (this is corner across from the
>>huge Farley post office, right?).
>
>
> Well, the Post Office is between 8th and 9th, so not exactly. That's basically
> the NE corner of Madison Square Garden, if I'm not mistaken.
Hmm, well so much for me picking a good meeting spot. Yeah, NE corner is where I planned, but I could have sworn that would be 7th Avenue.
Anyway, I'm actually on my way to an area somewhat close to there, so I'll pin it down (a digital camera would certainly be handy right about now :)
H
From jsiegel1 at optonline.net Thu Aug 7 13:33:58 2003
From: jsiegel1 at optonline.net (Jeff)
Date: Thu, 07 Aug 2003 13:33:58 -0400
Subject: [nycphp-talk] Smarty template problem - creating directories
In-Reply-To:
Message-ID: <006e01c35d0a$15841660$6501a8c0@EZDSDELL>
I'm waiting to hear back from the client to verify that the subdir
exists.
Jeff
-----Original Message-----
From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org]
On Behalf Of Kerem Tuzemen
Sent: Thursday, August 07, 2003 11:29 AM
To: NYPHP Talk
Subject: Re: [nycphp-talk] Smarty template problem - creating directories
Jeff,
You have templates_c directory (used for caching templates) created,
right?
If not, create it in the same folder that your templates directory
exists.
This one is explained in the installation part of Smarty manual.
okt
----- Original Message -----
From: "Andrew Yochum"
To: "Jeff"
Cc: "'NYPHP Talk'"
Sent: Thursday, August 07, 2003 11:34 AM
Subject: Re: [nycphp-talk] Smarty template problem - creating directories
> On Thu, Aug 07, 2003 at 11:31:36AM -0400, Jeff wrote:
> > Hope someone has some experience with Smarty. I'm getting the
following
> > error message. Note the double forward slashes. Any know how to
solve
> > this one?
> >
> > Warning: Smarty error: problem creating directory
> >
"/tmp/disk/home/webmaster/Files/WWW/tff_pref/templates/templates_c//%%-1
> > 1/%%-1167457344"
>
> The double slashes should be fine, I think. You probably have an
unnecessary
> trailing / in a config file somewhere.
>
> Have you checked the permissions on the containing directory? Does
the
user
> the script is running as have permission to write to it?
>
> --
> Andrew Yochum
> Digital Pulp, Inc.
> 212.679.0676x255
> andrew at digitalpulp.com
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>
_______________________________________________
talk mailing list
talk at lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk
From jonbaer at jonbaer.net Thu Aug 7 14:17:11 2003
From: jonbaer at jonbaer.net (Jon Baer)
Date: Thu, 7 Aug 2003 11:17:11 -0700
Subject: [nycphp-talk] providing patches for php apps ...
Message-ID: <004e01c35d10$1f6c5880$6500a8c0@THINKPAD>
greetings ...
im just curious how everyone might apply patches to php apps (for example if
u took a pretty old open php app and adjusted a few files, .php, .sql) and u
wanted to just provide the patch file, is there a common way to do this?
diff ~/dev/file.1php ~/tmp/file1.php > patch
patch < patch
is the sufficient/common?
- jon
pgp key: http://www.jonbaer.net/jonbaer.asc
fingerprint: F438 A47E C45E 8B27 F68C 1F9B 41DB DB8B 9A0C AF47
From jonbaer at jonbaer.net Thu Aug 7 14:21:58 2003
From: jonbaer at jonbaer.net (Jon Baer)
Date: Thu, 7 Aug 2003 11:21:58 -0700
Subject: [nycphp-talk] bare minimum for cli apps ...
Message-ID: <005401c35d10$ca2e07a0$6500a8c0@THINKPAD>
does anyone know if there is a packager or a method for creating bare
minimum (w/ a few libs like php_socket, php_wpcap, etc) distro of php or
what the dependencies r for php.exe to run a few script files? is just
.exe, php4ts.dll, .ini, and a few .dlls ok or does anything need to be
registered in order for cli to work ...
- jon
pgp key: http://www.jonbaer.net/jonbaer.asc
fingerprint: F438 A47E C45E 8B27 F68C 1F9B 41DB DB8B 9A0C AF47
From shiflett at php.net Thu Aug 7 14:23:41 2003
From: shiflett at php.net (Chris Shiflett)
Date: Thu, 7 Aug 2003 11:23:41 -0700 (PDT)
Subject: [nycphp-talk] Oracle Developer Days Details
In-Reply-To: <3F328A6D.3080802@nyphp.org>
Message-ID: <20030807182341.31363.qmail@web14310.mail.yahoo.com>
--- Hans Zaunere wrote:
> Hmm, well so much for me picking a good meeting spot. Yeah, NE
> corner is where I planned, but I could have sworn that would be
> 7th Avenue.
You're right about that, just not about it being across the street from the big
Post Office building.
> Anyway, I'm actually on my way to an area somewhat close to there,
> so I'll pin it down (a digital camera would certainly be handy right
> about now :)
I've got a camera, and that's basically where I live, so I can take some
pictures if you want (or you can drop by and borrow the camera).
Chris
=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/
From shiflett at php.net Thu Aug 7 14:25:48 2003
From: shiflett at php.net (Chris Shiflett)
Date: Thu, 7 Aug 2003 11:25:48 -0700 (PDT)
Subject: [nycphp-talk] Fwd: Undelivered Mail Returned to Sender
Message-ID: <20030807182548.31680.qmail@web14310.mail.yahoo.com>
--- crisscott at netzero.com wrote:
> That is helpful. I obviously wasn't looking at this from the right
> angle. But like David mentioned, I would think that having lots
> users sleeping and polling would cause some strain on the server.
Well, it wouldn't cause much strain at all, since it's only having to send a
little chunk every time someone sends a message.
What it does do is tie up connections. Most people who do this consider the
Web server to be a chat server and dedicate it to that purpose (or, at least
dedicate some Web server to the purpose, perhaps listening on an alternate
port). Because the strain is very little, you can increase your maximum
number of child processes/threads/whatever a ton without increasing your load
too much (this tuning requires a bit of experience with tuning Web servers, but
trial an error is also very educational). You just need to be able to support a
connection for every user in a chat.
Hope that helps.
Chris
=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/
From jsiegel1 at optonline.net Thu Aug 7 15:11:10 2003
From: jsiegel1 at optonline.net (Jeff)
Date: Thu, 07 Aug 2003 15:11:10 -0400
Subject: [nycphp-talk] Smarty template problem - creating directories
In-Reply-To:
Message-ID: <007e01c35d17$a9b70240$6501a8c0@EZDSDELL>
The problem, it turned out, was permissions.
-----Original Message-----
From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org]
On Behalf Of Kerem Tuzemen
Sent: Thursday, August 07, 2003 11:29 AM
To: NYPHP Talk
Subject: Re: [nycphp-talk] Smarty template problem - creating directories
Jeff,
You have templates_c directory (used for caching templates) created,
right?
If not, create it in the same folder that your templates directory
exists.
This one is explained in the installation part of Smarty manual.
okt
----- Original Message -----
From: "Andrew Yochum"
To: "Jeff"
Cc: "'NYPHP Talk'"
Sent: Thursday, August 07, 2003 11:34 AM
Subject: Re: [nycphp-talk] Smarty template problem - creating directories
> On Thu, Aug 07, 2003 at 11:31:36AM -0400, Jeff wrote:
> > Hope someone has some experience with Smarty. I'm getting the
following
> > error message. Note the double forward slashes. Any know how to
solve
> > this one?
> >
> > Warning: Smarty error: problem creating directory
> >
"/tmp/disk/home/webmaster/Files/WWW/tff_pref/templates/templates_c//%%-1
> > 1/%%-1167457344"
>
> The double slashes should be fine, I think. You probably have an
unnecessary
> trailing / in a config file somewhere.
>
> Have you checked the permissions on the containing directory? Does
the
user
> the script is running as have permission to write to it?
>
> --
> Andrew Yochum
> Digital Pulp, Inc.
> 212.679.0676x255
> andrew at digitalpulp.com
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>
_______________________________________________
talk mailing list
talk at lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk
From hans at nyphp.org Thu Aug 7 15:31:08 2003
From: hans at nyphp.org (Hans Zaunere)
Date: Thu, 07 Aug 2003 15:31:08 -0400
Subject: [nycphp-talk] Oracle Developer Days Details
In-Reply-To: <20030807182341.31363.qmail@web14310.mail.yahoo.com>
References: <20030807182341.31363.qmail@web14310.mail.yahoo.com>
Message-ID: <3F32A8FC.4030105@nyphp.org>
Chris Shiflett wrote:
> --- Hans Zaunere wrote:
>
>>Hmm, well so much for me picking a good meeting spot. Yeah, NE
>>corner is where I planned, but I could have sworn that would be
>>7th Avenue.
>
>
> You're right about that, just not about it being across the street from the big
> Post Office building.
Yeah, I have now seen it firsthand :)
--- We'll be meeting at 33rd and 8th Avenue. (NOT 7th)
>>Anyway, I'm actually on my way to an area somewhat close to there,
>>so I'll pin it down (a digital camera would certainly be handy right
>>about now :)
>
> I've got a camera, and that's basically where I live, so I can take some
> pictures if you want (or you can drop by and borrow the camera).
If you get a chance to take a picture of that corner that be great, but I don't think it should be a problem either way. I picked this particular corner because it's fairly small and generally easy to see everyone who is standing around.
See everyone tomorrow (at 33rd and 8th at 6:30am)
H
From tom at supertom.com Thu Aug 7 15:42:40 2003
From: tom at supertom.com (tom at supertom.com)
Date: Thu, 07 Aug 2003 15:42:40 -0400
Subject: [nycphp-talk] Oracle Developer Days Details
In-Reply-To: <3F32A8FC.4030105@nyphp.org>
Message-ID:
Ok, 8th and 33rd it is. See you then.
Tom
www.liphp.org
-----Original Message-----
From: talk-bounces at lists.nyphp.org
[mailto:talk-bounces at lists.nyphp.org]On Behalf Of Hans Zaunere
Sent: Thursday, August 07, 2003 3:31 PM
To: NYPHP Talk
Subject: Re: [nycphp-talk] Oracle Developer Days Details
Chris Shiflett wrote:
> --- Hans Zaunere wrote:
>
>>Hmm, well so much for me picking a good meeting spot. Yeah, NE
>>corner is where I planned, but I could have sworn that would be
>>7th Avenue.
>
>
> You're right about that, just not about it being across the street from
the big
> Post Office building.
Yeah, I have now seen it firsthand :)
--- We'll be meeting at 33rd and 8th Avenue. (NOT 7th)
>>Anyway, I'm actually on my way to an area somewhat close to there,
>>so I'll pin it down (a digital camera would certainly be handy right
>>about now :)
>
> I've got a camera, and that's basically where I live, so I can take some
> pictures if you want (or you can drop by and borrow the camera).
If you get a chance to take a picture of that corner that be great, but I
don't think it should be a problem either way. I picked this particular
corner because it's fairly small and generally easy to see everyone who is
standing around.
See everyone tomorrow (at 33rd and 8th at 6:30am)
H
_______________________________________________
talk mailing list
talk at lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk
From kenrbnsn at rbnsn.com Thu Aug 7 15:52:08 2003
From: kenrbnsn at rbnsn.com (Ken Robinson)
Date: Thu, 07 Aug 2003 15:52:08 -0400
Subject: [nycphp-talk] Oracle Developer Days Details
In-Reply-To: <3F32A8FC.4030105@nyphp.org>
References: <20030807182341.31363.qmail@web14310.mail.yahoo.com>
<20030807182341.31363.qmail@web14310.mail.yahoo.com>
Message-ID: <6.0.0.14.2.20030807154640.065d5f00@mail.rbnsn.com>
Some FYI's from someone who's not going, but lives in NJ, takes NJ Transit
and frequents New Brunswick...
Make sure you but your train tickets before getting on the train. If you
don't you will be charged a $5 surcharge.
The Hyatt is a 2 (longish) block walk North on Albany Street from the train
station in New Brunswick. If you get to the river, you've walked too far...
Ken Robinson
From chendry at nyc.rr.com Thu Aug 7 20:12:11 2003
From: chendry at nyc.rr.com (Christopher Hendry)
Date: Thu, 7 Aug 2003 20:12:11 -0400
Subject: [nycphp-talk] Oracle Developer Days Details
In-Reply-To: <3F32A8FC.4030105@nyphp.org>
Message-ID:
yippie! I haven't seen 6:30 in years...
-> -----Original Message-----
-> From: talk-bounces at lists.nyphp.org
-> [mailto:talk-bounces at lists.nyphp.org]On Behalf Of Hans Zaunere
-> Sent: Thursday, August 07, 2003 3:31 PM
-> To: NYPHP Talk
-> Subject: Re: [nycphp-talk] Oracle Developer Days Details
->
->
->
->
-> Chris Shiflett wrote:
->
-> > --- Hans Zaunere wrote:
-> >
-> >>Hmm, well so much for me picking a good meeting spot. Yeah, NE
-> >>corner is where I planned, but I could have sworn that would be
-> >>7th Avenue.
-> >
-> >
-> > You're right about that, just not about it being across the
-> street from the big
-> > Post Office building.
->
-> Yeah, I have now seen it firsthand :)
->
-> --- We'll be meeting at 33rd and 8th Avenue. (NOT 7th)
->
->
-> >>Anyway, I'm actually on my way to an area somewhat close to there,
-> >>so I'll pin it down (a digital camera would certainly be handy right
-> >>about now :)
-> >
-> > I've got a camera, and that's basically where I live, so I can
-> take some
-> > pictures if you want (or you can drop by and borrow the camera).
->
-> If you get a chance to take a picture of that corner that be
-> great, but I don't think it should be a problem either way. I
-> picked this particular corner because it's fairly small and
-> generally easy to see everyone who is standing around.
->
-> See everyone tomorrow (at 33rd and 8th at 6:30am)
->
-> H
->
-> _______________________________________________
-> talk mailing list
-> talk at lists.nyphp.org
-> http://lists.nyphp.org/mailman/listinfo/talk
->
From velez at sinu.com Thu Aug 7 20:48:13 2003
From: velez at sinu.com (Larry Velez)
Date: Thu, 7 Aug 2003 20:48:13 -0400
Subject: [nycphp-talk] Re: IM App
In-Reply-To: <20030807182548.31680.qmail@web14310.mail.yahoo.com>
Message-ID: <000501c35d46$bf6e0be0$0e0ea8c0@therealm>
We built a dedicated chat app for a client's website once. We used Jabber and a Java client for the front end. It worked great.
Although they hardly ever had anyone in the chat rooms to really test the system under load. I know this is not a PHP solution but
I don't think PHP is well suited for a real-time application like IM.
| Larry Velez | http://sinu.com |
-----Original Message-----
From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On Behalf Of Chris Shiflett
Sent: Thursday, August 07, 2003 2:26 PM
To: talk at lists.nyphp.org
Subject: [nycphp-talk] Fwd: Undelivered Mail Returned to Sender
--- crisscott at netzero.com wrote:
> That is helpful. I obviously wasn't looking at this from the right
> angle. But like David mentioned, I would think that having lots users
> sleeping and polling would cause some strain on the server.
Well, it wouldn't cause much strain at all, since it's only having to send a little chunk every time someone sends a message.
What it does do is tie up connections. Most people who do this consider the Web server to be a chat server and dedicate it to that
purpose (or, at least dedicate some Web server to the purpose, perhaps listening on an alternate port). Because the strain is very
little, you can increase your maximum number of child processes/threads/whatever a ton without increasing your load too much (this
tuning requires a bit of experience with tuning Web servers, but trial an error is also very educational). You just need to be able
to support a connection for every user in a chat.
Hope that helps.
Chris
=====
Become a better Web developer with the HTTP Developer's Handbook http://httphandbook.org/
_______________________________________________
talk mailing list
talk at lists.nyphp.org http://lists.nyphp.org/mailman/listinfo/talk
From dmintz at panix.com Fri Aug 8 07:33:08 2003
From: dmintz at panix.com (David Mintz)
Date: Fri, 8 Aug 2003 07:33:08 -0400 (EDT)
Subject: [nycphp-talk] empty string as array key ?
In-Reply-To: <000501c35d46$bf6e0be0$0e0ea8c0@therealm>
References: <000501c35d46$bf6e0be0$0e0ea8c0@therealm>
Message-ID:
I just found out that this is legal
$minutes = array(''=>" ","00"=>"00","30"=>"30"); //etc
Is this -- the fact that you can get away with using an
empty string as an array key -- a bug or a feature (or neither)?
I wonder if I can count on this behavior in other PHP versions (mine is
4.3.2 on RH) In this instance it's quite helpful in solving my problem
with sticky dropdowns and the Smarty html_options function ... a problem
too boring and complicated to explain unless someone's interested.
Thanks.
---
David Mintz
http://davidmintz.org/
Email: See http://dmintzweb.com/whitelist.php first!
From adam at trachtenberg.com Fri Aug 8 10:21:52 2003
From: adam at trachtenberg.com (Adam Maccabee Trachtenberg)
Date: Fri, 8 Aug 2003 10:21:52 -0400 (EDT)
Subject: [nycphp-talk] empty string as array key ?
In-Reply-To:
Message-ID:
On Fri, 8 Aug 2003, David Mintz wrote:
> I just found out that this is legal
>
> $minutes = array(''=>" ","00"=>"00","30"=>"30"); //etc
>
> Is this -- the fact that you can get away with using an
> empty string as an array key -- a bug or a feature (or neither)?
I believe it is a feature. The empty string is a valid string and
differentiable from NULL. In fact, if you are creative enough, you can
name variables (or array elements) all sorts of stupid names:
${"\n"} = 'return';
$a = compact("\n");
print_r($a);
Array
(
[
] => return
)
-adam
--
adam at trachtenberg.com
author of o'reilly's php cookbook
avoid the holiday rush, buy your copy today!
From csnyder at chxo.com Fri Aug 8 10:23:08 2003
From: csnyder at chxo.com (Chris Snyder)
Date: Fri, 08 Aug 2003 10:23:08 -0400
Subject: [nycphp-talk] request for comment: pWhiteboard
Message-ID: <3F33B24C.5060002@chxo.com>
If anyone is curious about a php-based html whiteboard (a single-page
Wiki, really) with built-in wysiwyg editing, check out
http://chxo.com/pWhiteboard/index.html -- and feel free to edit the
demo page. Mozilla 1.4 / IE 5.5 required.
If you build or maintain a content management system or blogging tool, I
recommend checking out htmlArea -- it's in a buggy alpha state at the
moment, but it works well enough. Just being able to copy-and-paste from
other websites is a godsend. It's free under a BSD-ish license.
http://www.interactivetools.com/products/htmlarea/
Now if only it worked in Safari...
From csnyder at chxo.com Fri Aug 8 10:33:41 2003
From: csnyder at chxo.com (Chris Snyder)
Date: Fri, 08 Aug 2003 10:33:41 -0400
Subject: [nycphp-talk] empty string as array key ?
In-Reply-To:
References:
Message-ID: <3F33B4C5.3070507@chxo.com>
Adam Maccabee Trachtenberg wrote:
> In fact, if you are creative enough, you can
>
>name variables (or array elements) all sorts of stupid names:
>
An mp3 id3v2 tag decoder I worked on was quite fond of producing object
attributes with unrenderable names from binary data.
From dmintz at panix.com Fri Aug 8 17:12:12 2003
From: dmintz at panix.com (David Mintz)
Date: Fri, 8 Aug 2003 17:12:12 -0400 (EDT)
Subject: [nycphp-talk] cookbook: gpg (was Re: empty string as array key)
In-Reply-To:
References:
Message-ID:
On Fri, 8 Aug 2003, Adam Maccabee Trachtenberg wrote:
> adam at trachtenberg.com
> author of o'reilly's php cookbook
> avoid the holiday rush, buy your copy today!
oh -- ~that~ Adam Maccabee Trachtenberg! Love that Cookbook!.
Now let me ask you (or anybody) a question about 14:11 a/k/a Encrypting
Email with GPG.
If you're an ordinary user on a shared server, what is the best strategy
for GPG-encrypting data? I have figured out (stolen) one way to do it, but
it requires wrapping the script with php-cgiwrap and doing something like
$encrypted = shell_exec( "echo 'secret stuff'|/usr/bin/gpg
--no-secmem-warning --homedir /my/.gnupg -ear recipient at example.com");
It doesn't work when run as nobody, I presume because nobody doesn't have
permission to get into my .gnupg directory. Perhaps php-cgiwrap is the
answer... ?
btw thanks to all for the discussion re my last Q.
---
David Mintz
http://davidmintz.org/
Email: See http://dmintzweb.com/whitelist.php first!
From soazine at erols.com Fri Aug 8 19:58:13 2003
From: soazine at erols.com (Phil Powell)
Date: Fri, 8 Aug 2003 19:58:13 -0400
Subject: [nycphp-talk] open_basedir() error in PHP script
Message-ID: <024401c35e08$efa76460$67a76244@philofsoa>
Warning: open_basedir restriction in effect. File is in wrong directory in Unknown on line 0
Warning: Failed opening '/users/ppowell/web/cma/index.php' for inclusion (include_path='.:/usr/local/lib/php') in Unknown on line 0
I get this error upon opening a PHP script I wrote; however, upon refreshing my browser, the error goes away and usually does not appear again. The page is not supposed to cache and I have caching turned off on my script:
// PREVENT CACHING FIRST BEFORE ANYTHING ELSE!
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
// HTTP/1.1
header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
header("Pragma: no-cache"); // HTTP/1.0
....
?>
I have no idea why this happens but I can tell you that this script /cma/index.php will go to a TCL CGI script which will go back to /cma/index.php eventually upon form completion or linkage or some user action.
Phil
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From psaw at pswebcode.com Fri Aug 8 20:32:44 2003
From: psaw at pswebcode.com (pswebcode, nyc)
Date: Fri, 8 Aug 2003 20:32:44 -0400
Subject: [nycphp-talk] open_basedir() error in PHP script
In-Reply-To: <024401c35e08$efa76460$67a76244@philofsoa>
Message-ID: <000d01c35e0d$c2149360$68e4a144@bronco>
Here is a descrip of what the php.ini setting for open_basedir does:
Limit the files that can be opened by PHP to the specified directory-tree,
including the file itself. This directive is NOT affected by whether Safe
Mode is turned On or Off.
When a script tries to open a file with, for example, fopen() or gzopen(),
the location of the file is checked. When the file is outside the specified
directory-tree, PHP will refuse to open it. All symbolic links are resolved,
so it's not possible to avoid this restriction with a symlink.
The special value . indicates that the directory in which the script is
stored will be used as base-directory.
Under Windows, separate the directories with a semicolon. On all other
systems, separate the directories with a colon. As an Apache module,
open_basedir paths from parent directories are now automatically inherited.
The restriction specified with open_basedir is actually a prefix, not a
directory name. This means that "open_basedir = /dir/incl" also allows
access to "/dir/include" and "/dir/incls" if they exist. When you want to
restrict access to only the specified directory, end with a slash. For
example: "open_basedir = /dir/incl/"
Note: Support for multiple directories was added in 3.0.7.
The default is to allow all files to be opened.
Run info.php in your site to check for your php.ini settings. You are
dealing with a "safe mode" file restriction. Works with all these types of
settings as below:
safe_mode "0" PHP_INI_SYSTEM
safe_mode_gid "0" PHP_INI_SYSTEM
safe_mode_include_dir NULL PHP_INI_SYSTEM
safe_mode_exec_dir "" PHP_INI_SYSTEM
safe_mode_allowed_env_vars PHP_ PHP_INI_SYSTEM
safe_mode_protected_env_vars LD_LIBRARY_PATH PHP_INI_SYSTEM
open_basedir NULL PHP_INI_SYSTEM
disable_functions "" PHP_INI_SYSTEM
disable_classes "" PHP_INI_SYSTEM
PSaw
-----Original Message-----
From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On
Behalf Of Phil Powell
Sent: Friday, August 08, 2003 7:58 PM
To: NYPHP Talk
Subject: [nycphp-talk] open_basedir() error in PHP script
Warning: open_basedir restriction in effect. File is in wrong directory in
Unknown on line 0
Warning: Failed opening '/users/ppowell/web/cma/index.php' for inclusion
(include_path='.:/usr/local/lib/php') in Unknown on line 0
I get this error upon opening a PHP script I wrote; however, upon refreshing
my browser, the error goes away and usually does not appear again. The page
is not supposed to cache and I have caching turned off on my script:
// PREVENT CACHING FIRST BEFORE ANYTHING ELSE!
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always
modified
// HTTP/1.1
header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0");
header("Pragma: no-cache"); // HTTP/1.0
....
?>
I have no idea why this happens but I can tell you that this script
/cma/index.php will go to a TCL CGI script which will go back to
/cma/index.php eventually upon form completion or linkage or some user
action.
Phil
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From soazine at erols.com Fri Aug 8 22:53:19 2003
From: soazine at erols.com (Phil Powell)
Date: Fri, 8 Aug 2003 22:53:19 -0400
Subject: [nycphp-talk] open_basedir() error in PHP script
References: <000d01c35e0d$c2149360$68e4a144@bronco>
Message-ID: <02e101c35e21$63fc32b0$67a76244@philofsoa>
MessageWhat kind of solution would I have if the machine this is occurring is a remote one and not my own? What do you recommend I do since I do not have any ownership over the box itself?
Phil
----- Original Message -----
From: pswebcode, nyc
To: 'NYPHP Talk'
Sent: Friday, August 08, 2003 8:32 PM
Subject: RE: [nycphp-talk] open_basedir() error in PHP script
Here is a descrip of what the php.ini setting for open_basedir does:
Limit the files that can be opened by PHP to the specified directory-tree, including the file itself. This directive is NOT affected by whether Safe Mode is turned On or Off.
When a script tries to open a file with, for example, fopen() or gzopen(), the location of the file is checked. When the file is outside the specified directory-tree, PHP will refuse to open it. All symbolic links are resolved, so it's not possible to avoid this restriction with a symlink.
The special value . indicates that the directory in which the script is stored will be used as base-directory.
Under Windows, separate the directories with a semicolon. On all other systems, separate the directories with a colon. As an Apache module, open_basedir paths from parent directories are now automatically inherited.
The restriction specified with open_basedir is actually a prefix, not a directory name. This means that "open_basedir = /dir/incl" also allows access to "/dir/include" and "/dir/incls" if they exist. When you want to restrict access to only the specified directory, end with a slash. For example: "open_basedir = /dir/incl/"
Note: Support for multiple directories was added in 3.0.7.
The default is to allow all files to be opened.
Run info.php in your site to check for your php.ini settings. You are dealing with a "safe mode" file restriction. Works with all these types of settings as below:
safe_mode "0" PHP_INI_SYSTEM
safe_mode_gid "0" PHP_INI_SYSTEM
safe_mode_include_dir NULL PHP_INI_SYSTEM
safe_mode_exec_dir "" PHP_INI_SYSTEM
safe_mode_allowed_env_vars PHP_ PHP_INI_SYSTEM
safe_mode_protected_env_vars LD_LIBRARY_PATH PHP_INI_SYSTEM
open_basedir NULL PHP_INI_SYSTEM
disable_functions "" PHP_INI_SYSTEM
disable_classes "" PHP_INI_SYSTEM
PSaw
-----Original Message-----
From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On Behalf Of Phil Powell
Sent: Friday, August 08, 2003 7:58 PM
To: NYPHP Talk
Subject: [nycphp-talk] open_basedir() error in PHP script
Warning: open_basedir restriction in effect. File is in wrong directory in Unknown on line 0
Warning: Failed opening '/users/ppowell/web/cma/index.php' for inclusion (include_path='.:/usr/local/lib/php') in Unknown on line 0
I get this error upon opening a PHP script I wrote; however, upon refreshing my browser, the error goes away and usually does not appear again. The page is not supposed to cache and I have caching turned off on my script:
// PREVENT CACHING FIRST BEFORE ANYTHING ELSE!
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
// HTTP/1.1
header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
header("Pragma: no-cache"); // HTTP/1.0
....
?>
I have no idea why this happens but I can tell you that this script /cma/index.php will go to a TCL CGI script which will go back to /cma/index.php eventually upon form completion or linkage or some user action.
Phil
------------------------------------------------------------------------------
_______________________________________________
talk mailing list
talk at lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From webapprentice at onemain.com Sat Aug 9 00:42:55 2003
From: webapprentice at onemain.com (Webapprentice)
Date: Sat, 09 Aug 2003 00:42:55 -0400
Subject: [nycphp-talk] OT: Javascript question
In-Reply-To:
References:
Message-ID: <3F347BCF.2010307@onemain.com>
Hi,
Could somebody tell me where I can ask this question and get some answers?
I have inherited a small Javascript app that stores pagination
(next/previous pagination) data via cookies. The parent window sets 2
cookies and then opens another window. The child window is supposed to
read the cookies to get the default pagination.
//Parent page snippet
var newWindow = '';
newWindow.open("newPage.html");
newWindow.focus();
newWindow.opener = self;
newWindow.document.cookies = "start=ss";
newWindow.document.cookies = "end=ss";
//----------------------------
//Child page snippet:
var ck = document.cookie;
var pos = ck.indexOf("start=");
// etc.
The strange thing is that this works in IE6, but not in NS7.
When I check NS7 and check the cookies in the preferences, the start and
end cookies are there.
The length of document.cookies is much shorter in NS7 than in IE6. When
I print what is in document.cookies, IE6 shows me the 2 cookies, while
NS7 does not.
How do I make these cookies work in IE5, IE6, NS6, and NS7?
Thank you,
Stephen
From dmintz at panix.com Sat Aug 9 01:45:38 2003
From: dmintz at panix.com (David Mintz)
Date: Sat, 9 Aug 2003 01:45:38 -0400 (EDT)
Subject: [nycphp-talk] open_basedir() error in PHP script
In-Reply-To: <02e101c35e21$63fc32b0$67a76244@philofsoa>
References: <000d01c35e0d$c2149360$68e4a144@bronco>
<02e101c35e21$63fc32b0$67a76244@philofsoa>
Message-ID:
On Fri, 8 Aug 2003, Phil Powell wrote:
> MessageWhat kind of solution would I have if the machine this is
> occurring is a remote one and not my own? What do you recommend I do
> since I do not have any ownership over the box itself?
It looks like we can't override safe_mode with ini_set(). Maybe you can
run php in CGI mode and use your own config file?
Maybe someone else can give you a better idea -- just thought I'd give it
a shot.
---
David Mintz
http://davidmintz.org/
Email: See http://dmintzweb.com/whitelist.php first!
>
> Phil
> ----- Original Message -----
> From: pswebcode, nyc
> To: 'NYPHP Talk'
> Sent: Friday, August 08, 2003 8:32 PM
> Subject: RE: [nycphp-talk] open_basedir() error in PHP script
>
>
> Here is a descrip of what the php.ini setting for open_basedir does:
>
> Limit the files that can be opened by PHP to the specified directory-tree, including the file itself. This directive is NOT affected by whether Safe Mode is turned On or Off.
> When a script tries to open a file with, for example, fopen() or gzopen(), the location of the file is checked. When the file is outside the specified directory-tree, PHP will refuse to open it. All symbolic links are resolved, so it's not possible to avoid this restriction with a symlink.
> The special value . indicates that the directory in which the script is stored will be used as base-directory.
> Under Windows, separate the directories with a semicolon. On all other systems, separate the directories with a colon. As an Apache module, open_basedir paths from parent directories are now automatically inherited.
> The restriction specified with open_basedir is actually a prefix, not a directory name. This means that "open_basedir = /dir/incl" also allows access to "/dir/include" and "/dir/incls" if they exist. When you want to restrict access to only the specified directory, end with a slash. For example: "open_basedir = /dir/incl/"
> Note: Support for multiple directories was added in 3.0.7.
> The default is to allow all files to be opened.
>
> Run info.php in your site to check for your php.ini settings. You are dealing with a "safe mode" file restriction. Works with all these types of settings as below:
>
> safe_mode "0" PHP_INI_SYSTEM
> safe_mode_gid "0" PHP_INI_SYSTEM
> safe_mode_include_dir NULL PHP_INI_SYSTEM
> safe_mode_exec_dir "" PHP_INI_SYSTEM
> safe_mode_allowed_env_vars PHP_ PHP_INI_SYSTEM
> safe_mode_protected_env_vars LD_LIBRARY_PATH PHP_INI_SYSTEM
> open_basedir NULL PHP_INI_SYSTEM
> disable_functions "" PHP_INI_SYSTEM
> disable_classes "" PHP_INI_SYSTEM
>
> PSaw
> -----Original Message-----
> From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On Behalf Of Phil Powell
> Sent: Friday, August 08, 2003 7:58 PM
> To: NYPHP Talk
> Subject: [nycphp-talk] open_basedir() error in PHP script
>
>
> Warning: open_basedir restriction in effect. File is in wrong directory in Unknown on line 0
>
> Warning: Failed opening '/users/ppowell/web/cma/index.php' for inclusion (include_path='.:/usr/local/lib/php') in Unknown on line 0
>
>
> I get this error upon opening a PHP script I wrote; however, upon refreshing my browser, the error goes away and usually does not appear again. The page is not supposed to cache and I have caching turned off on my script:
>
>
>
> // PREVENT CACHING FIRST BEFORE ANYTHING ELSE!
> header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
> header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
> // HTTP/1.1
> header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
> header("Pragma: no-cache"); // HTTP/1.0
> ....
>
> ?>
>
> I have no idea why this happens but I can tell you that this script /cma/index.php will go to a TCL CGI script which will go back to /cma/index.php eventually upon form completion or linkage or some user action.
>
> Phil
>
>
> ------------------------------------------------------------------------------
>
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>
---
David Mintz
http://davidmintz.org/
Email: See http://dmintzweb.com/whitelist.php first!
Decibels of sound pressure employed by a new "thermoacoustic" refrigerator: 190
Decibels of sound pressure sufficient to ignite a person's hair: 165
-- Harper's Index, February 2003
From soazine at erols.com Sat Aug 9 02:33:15 2003
From: soazine at erols.com (Phil Powell)
Date: Sat, 9 Aug 2003 02:33:15 -0400
Subject: [nycphp-talk] Sorting 2-dimensional arrays at 2:00 am - UGH!
Message-ID: <039601c35e40$1d8f6300$67a76244@philofsoa>
$fbArray[$j] = array($feedbackCategoryArray[$i]['attributes']['NAME'] => $feedbackCategoryArray[$i]['attributes']['DISPLAYNAME']);
I can't begin to fathom in my befuddled mind how to sort this array $fbArray into alphabetical order according to $feedbackCategoryArray[$i]['attributes']['NAME'] - I am utterly lost, can someone explain in detail how I would do it and why.
Thanx
Phil
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From nyphp at enobrev.com Sat Aug 9 17:22:18 2003
From: nyphp at enobrev.com (Mark Armendariz)
Date: Sat, 9 Aug 2003 17:22:18 -0400
Subject: [nycphp-talk] Re: IM App
In-Reply-To: <000501c35d46$bf6e0be0$0e0ea8c0@therealm>
Message-ID: <00e401c35ebc$53ca3810$e1951d18@enobrev>
A few months ago, I created a php based socket server app (based in part
on http://www.php-tools.de/site.php socket server class). For the front
end, I used flash via xml_sockets. Now in order to add IM-ability to
the chat app, I basically set allow the user to click on a user who is
logged on which will send an "IM" command to the server via the socket,
which in turn sends it to that user via their socket connection. Then
Using javascript from Flash it open up a new browser window with a new
room with the two members in it for both clients.
Most everything is held in php arrays and the class is continually open
on the server (with a while (1) { // socket commands }). The only issue
I had was that my hosts's server wouldn't allow the app to run
constantly, so the socket connections would close after 20 minutes. Now
that they just gave me my own server, I may be able to keep it running
at all times.
I've also done something similar with perl before that, which worked
well, but I've never liked maintaining perl because I'm not strong
enough with it.
I've found that the traffic and processees involved are incredibly
minimal, but it's only been for a group of 30 of us at a time. The app
also adds all messages to a mysql database for archiving, and besides
the time limit which I'll be working around now, I've had no problems.
Good luck!
Mark
-----Original Message-----
From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org]
On Behalf Of Larry Velez
Sent: Thursday, August 07, 2003 8:48 PM
To: 'NYPHP Talk'
Subject: RE: [nycphp-talk] Re: IM App
We built a dedicated chat app for a client's website once. We used
Jabber and a Java client for the front end. It worked great.
Although they hardly ever had anyone in the chat rooms to really test
the system under load. I know this is not a PHP solution but
I don't think PHP is well suited for a real-time application like IM.
| Larry Velez | http://sinu.com |
-----Original Message-----
From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org]
On Behalf Of Chris Shiflett
Sent: Thursday, August 07, 2003 2:26 PM
To: talk at lists.nyphp.org
Subject: [nycphp-talk] Fwd: Undelivered Mail Returned to Sender
--- crisscott at netzero.com wrote:
> That is helpful. I obviously wasn't looking at this from the right
> angle. But like David mentioned, I would think that having lots users
> sleeping and polling would cause some strain on the server.
Well, it wouldn't cause much strain at all, since it's only having to
send a little chunk every time someone sends a message.
What it does do is tie up connections. Most people who do this consider
the Web server to be a chat server and dedicate it to that purpose (or,
at least dedicate some Web server to the purpose, perhaps listening on
an alternate port). Because the strain is very little, you can increase
your maximum number of child processes/threads/whatever a ton without
increasing your load too much (this tuning requires a bit of experience
with tuning Web servers, but trial an error is also very educational).
You just need to be able to support a connection for every user in a
chat.
Hope that helps.
Chris
=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/ _______________________________________________
talk mailing list
talk at lists.nyphp.org http://lists.nyphp.org/mailman/listinfo/talk
_______________________________________________
talk mailing list
talk at lists.nyphp.org http://lists.nyphp.org/mailman/listinfo/talk
From jonbaer at jonbaer.net Sat Aug 9 21:53:09 2003
From: jonbaer at jonbaer.net (Jon Baer)
Date: Sat, 9 Aug 2003 18:53:09 -0700
Subject: [nycphp-talk] low level libpcap w/ php
Message-ID: <007401c35ee2$26b594c0$6500a8c0@THINKPAD>
i had been fiddling w/ winpcap to get an extension running in php for a
php-based wlan mapping application and then found out that the extension
already existed so i thought id pass along the link ...
http://alcane.dune2.info/phpcap/example.php
pretty cool stuff ... enjoy.
- jon
pgp key: http://www.jonbaer.net/jonbaer.asc
fingerprint: F438 A47E C45E 8B27 F68C 1F9B 41DB DB8B 9A0C AF47
From sklar at sklar.com Mon Aug 11 09:12:56 2003
From: sklar at sklar.com (David Sklar)
Date: Mon, 11 Aug 2003 09:12:56 -0400
Subject: [nycphp-talk] cookbook: gpg (was Re: empty string as array key)
Message-ID:
> If you're an ordinary user on a shared server, what is the best
> strategy for GPG-encrypting data? I have figured out (stolen) one way
> to do it, but it requires wrapping the script with php-cgiwrap and
> doing something like
>
> $encrypted = shell_exec( "echo 'secret stuff'|/usr/bin/gpg
> --no-secmem-warning --homedir /my/.gnupg -ear recipient at example.com");
>
> It doesn't work when run as nobody, I presume because nobody doesn't
> have permission to get into my .gnupg directory. Perhaps php-cgiwrap
> is the answer... ?
gpg has to run as a user that has access to your secret key ring.
Doing gpg encryption with a passphrase-protected key on a shared server has
many risks: can anyone else on the server (through misadministration or a
hole in pages on your site) alter any of your cgi-wrapped scripts and do
their own encryption/decryption/steal your key? Separately, putting your
passphrase in a file readable by other users is no better than just having a
passphraseless key.
What are you trying to encrypt?
David
From psaw at pswebcode.com Mon Aug 11 09:39:10 2003
From: psaw at pswebcode.com (pswebcode, nyc)
Date: Mon, 11 Aug 2003 09:39:10 -0400
Subject: [nycphp-talk] Apcahe and Virtual Hosts Directives Maximum
Message-ID: <001101c3600d$f22072c0$68e4a144@bronco>
I've got a server setting where there are about 40 different domain names
pointed to a single instance of apache
I'm wondering if anyone has any experience with how many VirtualHosts
directives
are reasonable within the httpd.conf file before apache may experience a
performance hit.
Or is this processing very trivial? Do I have any reason to be concerned on
this issue?
Warmest regards,
Peter Sawczynec, Technology Director
PSWebcode -- Web Development and
Site Architecture
psaw at pswebcode.com
www.pswebcode.com
718.543.3240
From dmintz at panix.com Mon Aug 11 10:13:52 2003
From: dmintz at panix.com (David Mintz)
Date: Mon, 11 Aug 2003 10:13:52 -0400 (EDT)
Subject: [nycphp-talk] cookbook: gpg
In-Reply-To:
References:
Message-ID:
On Mon, 11 Aug 2003, David Sklar wrote:
> gpg has to run as a user that has access to your secret key ring.
>
> Doing gpg encryption with a passphrase-protected key on a shared server has
> many risks: can anyone else on the server (through misadministration or a
> hole in pages on your site) alter any of your cgi-wrapped scripts and do
> their own encryption/decryption/steal your key? Separately, putting your
> passphrase in a file readable by other users is no better than just having a
> passphraseless key.
>
> What are you trying to encrypt?
Last question first: credit card information, which will then be emailed
and/or written to a database.
As for the first question, well... maybe I'm confused. When I run the
snippet
$encrypted = shell_exec( "echo 'secret stuff'|/usr/bin/gpg
--no-secmem-warning --homedir /my/.gnupg -ear recipient at example.com");
from the command line or as a wrapped script, it does not require a
passphrase in order to encrypt. Since gpg needs the user's secret key in
order to encrypt and sign, a copy of that secret key has to live on the
server -- is there any way around that? The permissions are as restrictive
as possible and I guess the key is as safe/vulnerable as anything else in
the house that's similarly chmoded.
The private key for decrypting is not going to be anywhere near the
server, nor will my secret key passphrase.
So how, if at all, does one safely gpg-encrypt on a shared server?
Thanks,
---
David Mintz
http://davidmintz.org/
Email: See http://dmintzweb.com/whitelist.php first!
From hans at nyphp.org Mon Aug 11 12:35:12 2003
From: hans at nyphp.org (Hans Zaunere)
Date: Mon, 11 Aug 2003 12:35:12 -0400
Subject: [nycphp-talk] open_basedir() error in PHP script
In-Reply-To: <02e101c35e21$63fc32b0$67a76244@philofsoa>
References: <000d01c35e0d$c2149360$68e4a144@bronco>
<02e101c35e21$63fc32b0$67a76244@philofsoa>
Message-ID: <3F37C5C0.3080202@nyphp.org>
Phil Powell wrote:
> What kind of solution would I have if the machine this is occurring is a
> remote one and not my own? What do you recommend I do since I do not
> have any ownership over the box itself?
There's no solution. open_basedir is a preventive security measure, and was set for a reason. You'll need to talk to the sysadmin to get something worked out.
H
From hans at nyphp.org Mon Aug 11 12:42:14 2003
From: hans at nyphp.org (Hans Zaunere)
Date: Mon, 11 Aug 2003 12:42:14 -0400
Subject: [nycphp-talk] Sorting 2-dimensional arrays at 2:00 am - UGH!
In-Reply-To: <039601c35e40$1d8f6300$67a76244@philofsoa>
References: <039601c35e40$1d8f6300$67a76244@philofsoa>
Message-ID: <3F37C766.2080403@nyphp.org>
Phil Powell wrote:
> $fbArray[$j] = array($feedbackCategoryArray[$i]['attributes']['NAME'] =>
> $feedbackCategoryArray[$i]['attributes']['DISPLAYNAME']);
>
> I can't begin to fathom in my befuddled mind how to sort this array
> $fbArray into alphabetical order according to
> $feedbackCategoryArray[$i]['attributes']['NAME']
I'll throw this function out there as an example:
function __sortOn( $metadata,$sort_flags,$reverse = FALSE ) {
if( !isset($this->Listing[0][$metadata]) )
return FALSE;
$metakeys = array();
foreach( $this->Listing as $key => $sorton )
$metakeys[$key] = $sorton[$metadata];
if( $reverse )
arsort($metakeys,$sort_flags);
else
asort($metakeys,$sort_flags);
$tmp = array();
foreach( $metakeys as $key => $metakey )
$tmp[] = $this->Listing[$key];
$this->Listing = $tmp;
return TRUE;
}
> - I am utterly lost,
> can someone explain in detail how I would do it and why.
I have no idea why, but I'd consider rethinking your data structures a bit :)
H
From hans at nyphp.org Mon Aug 11 12:47:06 2003
From: hans at nyphp.org (Hans Zaunere)
Date: Mon, 11 Aug 2003 12:47:06 -0400
Subject: [nycphp-talk] Apcahe and Virtual Hosts Directives Maximum
In-Reply-To: <001101c3600d$f22072c0$68e4a144@bronco>
References: <001101c3600d$f22072c0$68e4a144@bronco>
Message-ID: <3F37C88A.60800@nyphp.org>
pswebcode, nyc wrote:
> I've got a server setting where there are about 40 different domain names
> pointed to a single instance of apache
>
> I'm wondering if anyone has any experience with how many VirtualHosts
> directives
> are reasonable within the httpd.conf file before apache may experience a
> performance hit.
Hundreds... or more.
> Or is this processing very trivial? Do I have any reason to be concerned on
> this issue?
Negative. There's even a module to make working with large numbers of vhosts easier:
http://httpd.apache.org/docs/vhosts/mass.html
H
From soazine at erols.com Mon Aug 11 12:46:24 2003
From: soazine at erols.com (Phil Powell)
Date: Mon, 11 Aug 2003 12:46:24 -0400
Subject: [nycphp-talk] Sorting 2-dimensional arrays at 2:00 am - UGH!
References: <039601c35e40$1d8f6300$67a76244@philofsoa>
<3F37C766.2080403@nyphp.org>
Message-ID: <000701c36028$19f71f50$67a76244@philofsoa>
Oh yeah I got it BTW, at 4:00am
And rethinking my data structures is never an option; I'll just make it even
more complicated by doing so! In fact, PHP is the saving grace behind the
idea of sorting data that is parsed from an XML file into a TCL
1-dimensional list. Otherwise, it would never be done at all.
I have this data that consists of feedback information, when users enter
feedback from my site. The feedback XML row will consist of:
firstname
lastname
email
url
categoryID (feedback category ID maps to feedbackCategories.xml which has
like 1 => "trivia" or 2 => "articles"...)
timeStamp
showEntry (a boolean switch to "delete" this entry upon choice)
I use TCL to parse the XML file (long story, trust me) and it converts it to
a 1-dimensional list. However, I would need to sort this one-dimensional
list as follows:
1) sort first by ascending category_id
2) sort each separated category_id by descending timestamp order
So, long in short, this is what I came up with:
// FUNCTION TO BE USED IN uksort() TO RETURN A REVERSE-CASE-INSENSITIVE
BOOLEAN FOR REVERSE SORTING
function strrevcasecmp($a, $b) {
if (strcasecmp($a, $b) == 0) return 0;
return (strcasecmp($a, $b) > 0) ? -1 : 1;
}
...// reparse the original feedback.xml file instead of using the TCL list
(the TCL script will have updated the existing XML file if need be prior to
calling this PHP script)
// SORT THE OUTER ARRAY FIRST IN CATEGORY_ID ASC AND THEN EACH INNER ARRAY
BY TIME DESC
// BE SURE TO SUPPRESS WARNINGS IF NO DATA IS FOUND IN fbArray
@ksort($fbArray);
if (sizeof($fbArray) > 0) {
foreach ($fbArray as $key => $val) {
@uksort($val, "strrevcasecmp");
$fbArray[$key] = $val;
}
}
And there you have it, an overcomplicated solution, once again, possibly an
extremely simpler solution out there that I simply can't fathom. :(
Phil
----- Original Message -----
From: "Hans Zaunere"
To: "NYPHP Talk"
Sent: Monday, August 11, 2003 12:42 PM
Subject: Re: [nycphp-talk] Sorting 2-dimensional arrays at 2:00 am - UGH!
>
>
> Phil Powell wrote:
>
> > $fbArray[$j] = array($feedbackCategoryArray[$i]['attributes']['NAME'] =>
> > $feedbackCategoryArray[$i]['attributes']['DISPLAYNAME']);
> >
> > I can't begin to fathom in my befuddled mind how to sort this array
> > $fbArray into alphabetical order according to
> > $feedbackCategoryArray[$i]['attributes']['NAME']
>
> I'll throw this function out there as an example:
>
> function __sortOn( $metadata,$sort_flags,$reverse = FALSE ) {
>
> if( !isset($this->Listing[0][$metadata]) )
> return FALSE;
>
> $metakeys = array();
> foreach( $this->Listing as $key => $sorton )
> $metakeys[$key] = $sorton[$metadata];
>
> if( $reverse )
> arsort($metakeys,$sort_flags);
> else
> asort($metakeys,$sort_flags);
>
> $tmp = array();
> foreach( $metakeys as $key => $metakey )
> $tmp[] = $this->Listing[$key];
>
> $this->Listing = $tmp;
>
> return TRUE;
> }
>
> > - I am utterly lost,
> > can someone explain in detail how I would do it and why.
>
> I have no idea why, but I'd consider rethinking your data structures a bit
:)
>
> H
>
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
From hans at nyphp.org Mon Aug 11 12:58:33 2003
From: hans at nyphp.org (Hans Zaunere)
Date: Mon, 11 Aug 2003 12:58:33 -0400
Subject: [nycphp-talk] providing patches for php apps ...
In-Reply-To: <004e01c35d10$1f6c5880$6500a8c0@THINKPAD>
References: <004e01c35d10$1f6c5880$6500a8c0@THINKPAD>
Message-ID: <3F37CB39.9080902@nyphp.org>
Jon Baer wrote:
> greetings ...
>
> im just curious how everyone might apply patches to php apps (for example if
> u took a pretty old open php app and adjusted a few files, .php, .sql) and u
> wanted to just provide the patch file, is there a common way to do this?
>
> diff ~/dev/file.1php ~/tmp/file1.php > patch
> patch < patch
>
> is the sufficient/common?
Probably, although unified diffs are typically a little better because it'll provide some context. Nothing that I'm aware would be any different from C source to PHP source, etc. I'm always a fan of FreeBSD docs:
http://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/slow-patch.html
>
> - jon
>
> pgp key: http://www.jonbaer.net/jonbaer.asc
> fingerprint: F438 A47E C45E 8B27 F68C 1F9B 41DB DB8B 9A0C AF47
>
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
From hans at nyphp.org Mon Aug 11 13:05:53 2003
From: hans at nyphp.org (Hans Zaunere)
Date: Mon, 11 Aug 2003 13:05:53 -0400
Subject: [nycphp-talk] request for comment: pWhiteboard
In-Reply-To: <3F33B24C.5060002@chxo.com>
References: <3F33B24C.5060002@chxo.com>
Message-ID: <3F37CCF1.8010809@nyphp.org>
Chris Snyder wrote:
> If anyone is curious about a php-based html whiteboard (a single-page
> Wiki, really) with built-in wysiwyg editing, check out
> http://chxo.com/pWhiteboard/index.html -- and feel free to edit the
> demo page. Mozilla 1.4 / IE 5.5 required.
I'm pretty shocked, honestly, how well the html editor worked (tested in Mozilla). Maybe we can get an installation at dev. :)
H
From danielc at analysisandsolutions.com Mon Aug 11 13:19:56 2003
From: danielc at analysisandsolutions.com (Analysis & Solutions)
Date: Mon, 11 Aug 2003 13:19:56 -0400
Subject: [nycphp-talk] cookbook: gpg
In-Reply-To:
References:
Message-ID: <20030811171955.GA5141@panix.com>
On Mon, Aug 11, 2003 at 10:13:52AM -0400, David Mintz wrote:
>
> $encrypted = shell_exec( "echo 'secret stuff'|/usr/bin/gpg
> --no-secmem-warning --homedir /my/.gnupg -ear recipient at example.com");
>
> from the command line or as a wrapped script, it does not require a
> passphrase in order to encrypt. Since gpg needs the user's secret key in
> order to encrypt and sign, a copy of that secret key has to live on the
> server -- is there any way around that?
I think you're on the right track. Encrypting data for a designated user
doesn't require a password. Here's something I in a PHP shell script on
my office computer to encrypt backups:
exec('c:/progra~1/gnupg/gpg.exe -e -r usr at addr.com file.');
Such procedures use the public key ring, right? As long as you set the
file permissions so only you can write to it... and you know how to
compose secure web applications -- meaning in this case scripts that don't
allow user input to pick the name of the files they're going to write to,
then everything is fine.
In regards to your last question, I don't believe the secret keyring has
to exist on the server. So, if you want to tighten things up further, you
can make a separate public key file just for this purpose, chmod it to 444
and then use a flag in your gpg call (--keyring, I believe) to use that
special keyring.
Enjoy,
--Dan
--
FREE scripts that make web and database programming easier
http://www.analysisandsolutions.com/software/
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7th Ave #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
From rolan at datawhorehouse.com Mon Aug 11 13:41:13 2003
From: rolan at datawhorehouse.com (Rolan)
Date: Mon, 11 Aug 2003 13:41:13 -0400
Subject: [nycphp-talk] cookbook: gpg
In-Reply-To:
References:
Message-ID: <3F37D539.8030309@datawhorehouse.com>
This is what I've been using for a while. It's probably dirty and unorthodox
but since I am the only user on the system, I'm not that worried about other
users snooping on the /tmp dir.
Feel free to clean this up, anyone...
~Rolan
function gpgdecrypt($data) {
$pgp="/usr/local/bin/gpg"; # change to location of your gpg
$username="login of gpg key owner";
srand((double)microtime()*1000000);
$unique_str = md5(rand(0,9999999));
$file="/tmp/".$unique_str;
$fp=fopen($file,"w");
fputs($fp,$data);
fclose($fp);
$command = "$pgp -quiet --no-secmem-warning -d $file";
$oldhome = getEnv("HOME");
putenv("HOME=/home/$username");
$result = exec($command, $decrypted, $errorcode);
unlink($file);
putenv("HOME=$oldhome");
$message = implode("\n", $decrypted);
return ($message);
}
?>
function gpgencrypt($data) {
$username = "owner of pgp private key";
$publicuser = "owner of pgp public key";
$pgp="/usr/local/bin/gpg"; # change to location of your gpg
srand((double)microtime()*1000000);
$unique_str = md5(rand(0,9999999));
$file="/tmp/".$unique_str;
$fp=fopen($file,"w");
fputs($fp,$data);
fclose($fp);
$command = "cat $file | $pgp --always-trust --batch
--no-secmem-warning -e -r $publicuser --output $file"."b";
$oldhome = getEnv("HOME");
putenv("HOME=/home/$username");
$result = exec($command, $encrypted, $errorcode);
$fp=fopen("$file"."b","r");
$message=fread($fp,9999999);
fclose($fp);
unlink($file);
unlink($file."b");
putenv("HOME=$oldhome");
return ($message);
}
David Mintz wrote:
>On Mon, 11 Aug 2003, David Sklar wrote:
>
>
>
>>gpg has to run as a user that has access to your secret key ring.
>>
>>Doing gpg encryption with a passphrase-protected key on a shared server has
>>many risks: can anyone else on the server (through misadministration or a
>>hole in pages on your site) alter any of your cgi-wrapped scripts and do
>>their own encryption/decryption/steal your key? Separately, putting your
>>passphrase in a file readable by other users is no better than just having a
>>passphraseless key.
>>
>>What are you trying to encrypt?
>>
>>
>
>
>Last question first: credit card information, which will then be emailed
>and/or written to a database.
>
>As for the first question, well... maybe I'm confused. When I run the
>snippet
>
>
>$encrypted = shell_exec( "echo 'secret stuff'|/usr/bin/gpg
>--no-secmem-warning --homedir /my/.gnupg -ear recipient at example.com");
>
>from the command line or as a wrapped script, it does not require a
>passphrase in order to encrypt. Since gpg needs the user's secret key in
>order to encrypt and sign, a copy of that secret key has to live on the
>server -- is there any way around that? The permissions are as restrictive
>as possible and I guess the key is as safe/vulnerable as anything else in
>the house that's similarly chmoded.
>
>The private key for decrypting is not going to be anywhere near the
>server, nor will my secret key passphrase.
>
>So how, if at all, does one safely gpg-encrypt on a shared server?
>
>Thanks,
>
>---
>David Mintz
>http://davidmintz.org/
>Email: See http://dmintzweb.com/whitelist.php first!
>_______________________________________________
>talk mailing list
>talk at lists.nyphp.org
>http://lists.nyphp.org/mailman/listinfo/talk
>
>
>
From danielc at analysisandsolutions.com Mon Aug 11 13:49:19 2003
From: danielc at analysisandsolutions.com (Analysis & Solutions)
Date: Mon, 11 Aug 2003 13:49:19 -0400
Subject: [nycphp-talk] libxml in PHP 5
Message-ID: <20030811174918.GB5141@panix.com>
Hey Folks:
I'm starting to use PHP 5 on my development machine. The primary XML
parser is changing from expat to libxml. I was curious about the change,
so sought documentation of the new libxml stuff on the PHP site but
haven't been able to find any.
I know there are folks on this list involved with PHP 5's development.
Perhaps someone can steer me toward such documentation and/or answer a
question.
I was thinking that the new XML parser would necessitate scripts use
different function calls. Or will the main functions and behavior remain
the same, but only the library be changed?
If the functions will indeed be different, is there some place to find
docs about these new procedures? They don't have to be great, just give
me an idea of how to start hacking something simple.
Thanks,
--Dan
--
FREE scripts that make web and database programming easier
http://www.analysisandsolutions.com/software/
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7th Ave #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
From sklar at sklar.com Mon Aug 11 15:01:52 2003
From: sklar at sklar.com (David Sklar)
Date: Mon, 11 Aug 2003 15:01:52 -0400
Subject: [nycphp-talk] cookbook: gpg
In-Reply-To: <20030811171955.GA5141@panix.com>
Message-ID:
>> $encrypted = shell_exec( "echo 'secret stuff'|/usr/bin/gpg
>> --no-secmem-warning --homedir /my/.gnupg -ear
>> recipient at example.com");
>>
>> from the command line or as a wrapped script, it does not require a
>> passphrase in order to encrypt. Since gpg needs the user's secret
>> key in order to encrypt and sign, a copy of that secret key has to
>> live on the server -- is there any way around that?
>
> I think you're on the right track. Encrypting data for a designated
> user doesn't require a password. Here's something I in a PHP shell
> script on my office computer to encrypt backups:
>
> exec('c:/progra~1/gnupg/gpg.exe -e -r usr at addr.com file.');
>
> Such procedures use the public key ring, right?
To encrypt only, yes, you just need the public key of the recipient. To
encrypt and sign, you need the private key of the signer as well.
So if you're just encrypting the credit card data with a public key and
storing it in a place where the corresponding private key isn't, then you
should be protected against someone retrieving the encrypted data and then
decrypting it.
You aren't protected against someone injecting false data that's correctly
encrypted into the system (via a hole in your app). This may not be such a
big concern.
David
From fb at intldef.org Mon Aug 11 17:57:30 2003
From: fb at intldef.org (FB`)
Date: Mon, 11 Aug 2003 17:57:30 -0400
Subject: [nycphp-talk] strange regex problem
References:
<20030811171955.GA5141@panix.com>
Message-ID: <012801c36053$901d3090$1901a8c0@ybsweb>
I have an apparently valid regular expression,
^.*([^<]*).*$
that works well in one site, but causes the server hosting a different site
to grind its teeth to nubs on it - consistently exceeding max ex time...
the full line goes like this:
$text_a_title =
eregi_replace("^.*([^<]+).*$","\\1",$str);
if i bypass this line, everything else works swimmingly...
any suggestions?
(taking a title from an html file)
TIA
FB`
From sklar at sklar.com Mon Aug 11 18:34:39 2003
From: sklar at sklar.com (David Sklar)
Date: Mon, 11 Aug 2003 18:34:39 -0400
Subject: [nycphp-talk] strange regex problem
In-Reply-To: <012801c36053$901d3090$1901a8c0@ybsweb>
Message-ID:
If you just want the title out of the document, try this:
if (preg_match('@(.*?)@i',$str, $matches)) {
$title = $matches[1];
} else {
print "There's no title";
}
David
On Monday, August 11, 2003 5:58 PM, wrote:
> I have an apparently valid regular expression,
> ^.*([^<]*).*$
> that works well in one site, but causes the server hosting a
> different site to grind its teeth to nubs on it - consistently
> exceeding max ex time...
>
> the full line goes like this:
> $text_a_title =
> eregi_replace("^.*([^<]+).*$","\\1",$str);
>
> if i bypass this line, everything else works swimmingly...
>
>
> any suggestions?
> (taking a title from an html file)
>
>
> TIA
>
> FB`
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
From fb at intldef.org Mon Aug 11 18:57:24 2003
From: fb at intldef.org (FB`)
Date: Mon, 11 Aug 2003 18:57:24 -0400
Subject: [nycphp-talk] strange regex problem
References:
Message-ID: <013e01c3605b$edf51c20$1901a8c0@ybsweb>
Thanks!
That works nicely.
Any thoughts on what would make previous regex so nasty?
FB`
----- Original Message -----
From: "David Sklar"
To: "NYPHP Talk"
Sent: Monday, August 11, 2003 6:34 PM
Subject: RE: [nycphp-talk] strange regex problem
> If you just want the title out of the document, try this:
>
> if (preg_match('@(.*?)@i',$str, $matches)) {
> $title = $matches[1];
> } else {
> print "There's no title";
> }
>
> David
>
>
> On Monday, August 11, 2003 5:58 PM, wrote:
>
> > I have an apparently valid regular expression,
> > ^.*([^<]*).*$
> > that works well in one site, but causes the server hosting a
> > different site to grind its teeth to nubs on it - consistently
> > exceeding max ex time...
> >
> > the full line goes like this:
> > $text_a_title =
> > eregi_replace("^.*([^<]+).*$","\\1",$str);
> >
> > if i bypass this line, everything else works swimmingly...
> >
> >
> > any suggestions?
> > (taking a title from an html file)
> >
> >
> > TIA
> >
> > FB`
> >
> > _______________________________________________
> > talk mailing list
> > talk at lists.nyphp.org
> > http://lists.nyphp.org/mailman/listinfo/talk
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
From sklar at sklar.com Mon Aug 11 19:03:44 2003
From: sklar at sklar.com (David Sklar)
Date: Mon, 11 Aug 2003 19:03:44 -0400
Subject: [nycphp-talk] strange regex problem
In-Reply-To: <013e01c3605b$edf51c20$1901a8c0@ybsweb>
Message-ID:
A few things make this nasty:
^.*([^<]*).*$
With the anchors and the leading and trailing .*'s, you are matching against
the entire document. Plus, since * is greedy by default, the initial .* (I
think) has to match the entire document, then backtrack to the last
tag in the doc. Then, the trailing .* has to do some matching after the
tag is found, matching that doesn't affect what gets captured at
all.
David
On Monday, August 11, 2003 6:57 PM, wrote:
> Thanks!
>
> That works nicely.
>
> Any thoughts on what would make previous regex so nasty?
>
> FB`
>
> ----- Original Message -----
> From: "David Sklar"
> To: "NYPHP Talk"
> Sent: Monday, August 11, 2003 6:34 PM
> Subject: RE: [nycphp-talk] strange regex problem
>
>
>> If you just want the title out of the document, try this:
>>
>> if (preg_match('@(.*?)@i',$str, $matches)) {
>> $title = $matches[1]; } else {
>> print "There's no title";
>> }
>>
>> David
>>
>>
>> On Monday, August 11, 2003 5:58 PM, wrote:
>>
>>> I have an apparently valid regular expression,
>>> ^.*([^<]*).*$
>>> that works well in one site, but causes the server hosting a
>>> different site to grind its teeth to nubs on it - consistently
>>> exceeding max ex time...
>>>
>>> the full line goes like this:
>>> $text_a_title =
>>> eregi_replace("^.*([^<]+).*$","\\1",$str);
>>>
>>> if i bypass this line, everything else works swimmingly...
>>>
>>>
>>> any suggestions?
>>> (taking a title from an html file)
>>>
>>>
>>> TIA
>>>
>>> FB`
>>>
>>> _______________________________________________
>>> talk mailing list
>>> talk at lists.nyphp.org
>>> http://lists.nyphp.org/mailman/listinfo/talk
>> _______________________________________________
>> talk mailing list
>> talk at lists.nyphp.org
>> http://lists.nyphp.org/mailman/listinfo/talk
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
From pl at eskimo.com Mon Aug 11 21:40:46 2003
From: pl at eskimo.com (Peter Lehrer)
Date: Mon, 11 Aug 2003 21:40:46 -0400
Subject: [nycphp-talk] off topic - upgrading cpu
Message-ID: <000f01c36072$c5c583e0$d2220f9d@default>
I just upgraded the cpu on my Pentium I from a 133 mhz to a 200 mhz mmx. Do
I need to get a bigger heat sink and fan for it?
Thanks for you help.
--peter lehrer
From pl at eskimo.com Mon Aug 11 21:55:14 2003
From: pl at eskimo.com (Peter Lehrer)
Date: Mon, 11 Aug 2003 21:55:14 -0400
Subject: [nycphp-talk] Wednesday,
August 13 - Intro to TCP/IP by Joshua Birnbaum
Message-ID: <004201c36074$c8b6c580$d2220f9d@default>
**** Intro to TCP/IP by Joshua Birnbaum ****
Wednesday 13 August 6:30 PM
The IBM Building
590 Madison Ave.
57th St. and Madison Ave.
(You must RSVP, See "Security Procedures" Below)
We are pleased to announce that this Wednesday August 13th, Joshua
Birnbaum will be presenting an Introduction to TCP/IP. (See details below
for this meeting.)
TCP/IP, since it's beginnings in the late 1960's, has gone on to become
the predominant way that computers communicate over networks.
Based on open standards, TCP/IP has allowed for the flourishing of the
Internet as well as the ushering in of a communications revolution.
This GNUbies meeting will discuss the history of TCP/IP, how it became
as popular as it is and how it functions as a part of any operating
system that uses it.
We we will examine TCP/IP's design and organization and how these factors
have contributed to it's flexibility and adoption over time.
Speaker BIO:
Joshua Birnbaum is the President and founder of No-Org, Inc.,
(www.noorg.org) a New York based consultancy specializing in
system administration, computer security and networking.
Mr. Birnbaum began his system administration career in 1994
within the advertising industry and, since becoming a consult-
in 1998, has had the opportunity to work in several other
industries.
Most recently, Mr. Birnbaum has started to release Open Source
software. ifchk (short for network interface check), a computer
and network security tool, was released in mid July of 2003.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Meeting Details:
Date:
Wednesday August 13, 2003
6:30-7:00
General Questions and Answers
7:00 Pesentation by Joshua Birnbaum
"Introduction to TCP/IP"
at
The IBM Building
590 Madison Ave
(57th St. and Madison Ave.)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
As always, the most up-to-date information can be found on o
http://www.gnubies.org or http://www.eskimo.com/~lo/linux
As always, we are grateful to IBM for their generous offer of space for
our meetings
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Security Procedures:
To attend the meeting you need to bring a photo ID and provide us with
your full name (as it appears in the photo ID) in advance. You can use
the mailto on the web page at http://www.gnubies.org, reply to this email
if you received it directly, or send email to lo+ibm0308 at eskimo.com with
the Subject of August 2003 Gnubies Meeting and with your name in the
message.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We look forward to seeing you at the meeting.
Gnubies
The GNU/Linux/Free OS Beginners' Group
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From danielc at analysisandsolutions.com Tue Aug 12 01:05:34 2003
From: danielc at analysisandsolutions.com (Analysis & Solutions)
Date: Tue, 12 Aug 2003 01:05:34 -0400
Subject: [nycphp-talk] php related boo boos in SecurityFocus Newsletter #209
Message-ID: <20030812050534.GA4304@panix.com>
Hey Y'all:
Another week, another set of PHP related vulnerabilities.
Invision Board Overlapping IBF Formatting Tag HTML Injection...
http://www.securityfocus.com/bid/8335
Macromedia Dreamweaver MX PHP User Authentication Suite Cros...
http://www.securityfocus.com/bid/8339
vBulletin Register.PHP HTML Injection Vulnerability
http://www.securityfocus.com/bid/8354
Enjoy,
--Dan
--
FREE scripts that make web and database programming easier
http://www.analysisandsolutions.com/software/
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7th Ave #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
From csnyder at chxo.com Tue Aug 12 01:12:45 2003
From: csnyder at chxo.com (Chris Snyder)
Date: Tue, 12 Aug 2003 01:12:45 -0400
Subject: [nycphp-talk] request for comment: pWhiteboard
In-Reply-To: <3F37CCF1.8010809@nyphp.org>
References: <3F33B24C.5060002@chxo.com> <3F37CCF1.8010809@nyphp.org>
Message-ID: <3F38774D.40002@chxo.com>
Hans Zaunere wrote:
> Maybe we can get an installation at dev. :)
>
Sure nuff: http://dev.nyphp.org/pwhiteboard.php
From hans at nyphp.org Tue Aug 12 09:15:46 2003
From: hans at nyphp.org (Hans Zaunere)
Date: Tue, 12 Aug 2003 09:15:46 -0400
Subject: [nycphp-talk] off topic - upgrading cpu
In-Reply-To: <000f01c36072$c5c583e0$d2220f9d@default>
References: <000f01c36072$c5c583e0$d2220f9d@default>
Message-ID: <3F38E882.6070301@nyphp.org>
Peter Lehrer wrote:
> I just upgraded the cpu on my Pentium I from a 133 mhz to a 200 mhz mmx. Do
> I need to get a bigger heat sink and fan for it?
If the box is well ventilated as a whole, probably not. But, if the system was running hot to begin with, the upgrade may put it over the top. That said, it's probably fine to let it ride with the current heat sink and fan, but just keep an eye on it.
H
From jsiegel1 at optonline.net Tue Aug 12 09:26:55 2003
From: jsiegel1 at optonline.net (Jeff)
Date: Tue, 12 Aug 2003 09:26:55 -0400
Subject: [nycphp-talk] Bullet proofing "rmdir" command
Message-ID: <000c01c360d5$66f3f370$6501a8c0@EZDSDELL>
I have a specific subdirectory on my site where users can upload images
files associated with some text stored in a database. The question
concerns deleting those uploaded images. Deleting the record is the easy
part...even deleting the images and subdirectory is easy. However, my
concern is what precautions should I take to make sure that the wrong
subdir (or the whole site!!) doesn't get blown away. In the code below
I'm using file_exists to delete the images and subdir but is there
anything else that I should do to bullet proof the procedure?
//Note: $sSubDir is the subdirectory path stored in the corresponding
MySQL record.
//Delete images
for($i=0;$i<5;$i++){
$sImageName = $sSubDir . "image$i.jpg";
if(file_exists($sImageName)){
unlink($sImageName);
}
}
//Delete subdir
if(file_exists($sSubDir)){
rmdir($sSubDir);
}
Jeff
From psaw at pswebcode.com Tue Aug 12 09:41:29 2003
From: psaw at pswebcode.com (pswebcode, nyc)
Date: Tue, 12 Aug 2003 09:41:29 -0400
Subject: [nycphp-talk] Bullet proofing "rmdir" command
In-Reply-To: <000c01c360d5$66f3f370$6501a8c0@EZDSDELL>
Message-ID: <000401c360d7$7118ed40$68e4a144@bronco>
//Delete subdir
if(file_exists($sSubDir) && $sSubDir!="." && $sSubDir != ".."){
rmdir($sSubDir);
}
...better.
-----Original Message-----
From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On
Behalf Of Jeff
Sent: Tuesday, August 12, 2003 9:27 AM
To: 'NYPHP Talk'
Subject: [nycphp-talk] Bullet proofing "rmdir" command
I have a specific subdirectory on my site where users can upload images
files associated with some text stored in a database. The question concerns
deleting those uploaded images. Deleting the record is the easy part...even
deleting the images and subdirectory is easy. However, my concern is what
precautions should I take to make sure that the wrong subdir (or the whole
site!!) doesn't get blown away. In the code below I'm using file_exists to
delete the images and subdir but is there anything else that I should do to
bullet proof the procedure?
//Note: $sSubDir is the subdirectory path stored in the corresponding MySQL
record.
//Delete images
for($i=0;$i<5;$i++){
$sImageName = $sSubDir . "image$i.jpg";
if(file_exists($sImageName)){
unlink($sImageName);
}
}
//Delete subdir
if(file_exists($sSubDir)){
rmdir($sSubDir);
}
Jeff
_______________________________________________
talk mailing list
talk at lists.nyphp.org http://lists.nyphp.org/mailman/listinfo/talk
From jsiegel1 at optonline.net Tue Aug 12 09:44:39 2003
From: jsiegel1 at optonline.net (Jeff)
Date: Tue, 12 Aug 2003 09:44:39 -0400
Subject: [nycphp-talk] Bullet proofing "rmdir" command
In-Reply-To: <000401c360d7$7118ed40$68e4a144@bronco>
Message-ID: <000d01c360d7$e10433d0$6501a8c0@EZDSDELL>
Great! Thanks!
-----Original Message-----
From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org]
On Behalf Of pswebcode, nyc
Sent: Tuesday, August 12, 2003 8:41 AM
To: 'NYPHP Talk'
Subject: RE: [nycphp-talk] Bullet proofing "rmdir" command
//Delete subdir
if(file_exists($sSubDir) && $sSubDir!="." && $sSubDir != ".."){
rmdir($sSubDir);
}
...better.
-----Original Message-----
From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org]
On
Behalf Of Jeff
Sent: Tuesday, August 12, 2003 9:27 AM
To: 'NYPHP Talk'
Subject: [nycphp-talk] Bullet proofing "rmdir" command
I have a specific subdirectory on my site where users can upload images
files associated with some text stored in a database. The question
concerns
deleting those uploaded images. Deleting the record is the easy
part...even
deleting the images and subdirectory is easy. However, my concern is
what
precautions should I take to make sure that the wrong subdir (or the
whole
site!!) doesn't get blown away. In the code below I'm using file_exists
to
delete the images and subdir but is there anything else that I should do
to
bullet proof the procedure?
//Note: $sSubDir is the subdirectory path stored in the corresponding
MySQL
record.
//Delete images
for($i=0;$i<5;$i++){
$sImageName = $sSubDir . "image$i.jpg";
if(file_exists($sImageName)){
unlink($sImageName);
}
}
//Delete subdir
if(file_exists($sSubDir)){
rmdir($sSubDir);
}
Jeff
_______________________________________________
talk mailing list
talk at lists.nyphp.org http://lists.nyphp.org/mailman/listinfo/talk
_______________________________________________
talk mailing list
talk at lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk
From sklar at sklar.com Tue Aug 12 09:56:50 2003
From: sklar at sklar.com (David Sklar)
Date: Tue, 12 Aug 2003 09:56:50 -0400
Subject: [nycphp-talk] Bullet proofing "rmdir" command
In-Reply-To: <000d01c360d7$e10433d0$6501a8c0@EZDSDELL>
Message-ID:
Where is $sSubDir set? If it's set by users, then before either call to
rmdir() you should canonicalize the pathname with realpath() and then make
sure that the canonicalized pathname has the correct prefix.
For example:
// The directory under which image-storage subdirectories can be created
$sImagePrefix = '/www/some/place/images';
$sSubDir = realpath($sSubDir);
if ($sSubDir && ($sImagePrefix == dirname($sImageName)) {
for ($i = 0; $i < 5; $i++) {
$sImageName = $sSubDir . "image$i.jpg";
if (file_exists($sImageName)) { unlink($sImageName); }
}
unlink($sSubDir);
}
realpath() returns false if the canonicalized pathname doesn't exist.
David
On Tuesday, August 12, 2003 9:45 AM, wrote:
> Great! Thanks!
>
> -----Original Message-----
> From: talk-bounces at lists.nyphp.org
> [mailto:talk-bounces at lists.nyphp.org] On Behalf Of pswebcode, nyc
> Sent: Tuesday, August 12, 2003 8:41 AM To: 'NYPHP Talk'
> Subject: RE: [nycphp-talk] Bullet proofing "rmdir" command
>
>
> //Delete subdir
> if(file_exists($sSubDir) && $sSubDir!="." && $sSubDir != ".."){
> rmdir($sSubDir); }
>
> ...better.
>
> -----Original Message-----
> From: talk-bounces at lists.nyphp.org
> [mailto:talk-bounces at lists.nyphp.org] On Behalf Of Jeff
> Sent: Tuesday, August 12, 2003 9:27 AM
> To: 'NYPHP Talk'
> Subject: [nycphp-talk] Bullet proofing "rmdir" command
>
>
> I have a specific subdirectory on my site where users can upload
> images files associated with some text stored in a database. The
> question concerns deleting those uploaded images. Deleting the record
> is the easy part...even deleting the images and subdirectory is easy.
> However, my concern is what precautions should I take to make sure
> that the wrong subdir (or the whole site!!) doesn't get blown away.
> In the code below I'm using file_exists to delete the images and
> subdir but is there anything else that I should do to bullet proof
> the procedure?
>
> //Note: $sSubDir is the subdirectory path stored in the corresponding
> MySQL record.
>
> //Delete images
> for($i=0;$i<5;$i++){
> $sImageName = $sSubDir . "image$i.jpg";
> if(file_exists($sImageName)){
> unlink($sImageName);
> }
> }
> //Delete subdir
> if(file_exists($sSubDir)){
> rmdir($sSubDir);
> }
>
> Jeff
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org http://lists.nyphp.org/mailman/listinfo/talk
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
From pl at eskimo.com Tue Aug 12 09:53:27 2003
From: pl at eskimo.com (Peter Lehrer)
Date: Tue, 12 Aug 2003 09:53:27 -0400
Subject: [nycphp-talk] off topic - upgrading cpu
References: <000f01c36072$c5c583e0$d2220f9d@default>
<3F38E882.6070301@nyphp.org>
Message-ID: <004601c360d9$1d9e7700$8a230f9d@default>
It was not running hot to begin with, but the heatsink is very hot now. I
have the case of with an outside fan blowing on it in addition to the fan
attached to heatsink.
Peter
----- Original Message -----
From: "Hans Zaunere"
To: "NYPHP Talk"
Sent: Tuesday, August 12, 2003 9:15 AM
Subject: Re: [nycphp-talk] off topic - upgrading cpu
>
>
> Peter Lehrer wrote:
> > I just upgraded the cpu on my Pentium I from a 133 mhz to a 200 mhz mmx.
Do
> > I need to get a bigger heat sink and fan for it?
>
> If the box is well ventilated as a whole, probably not. But, if the
system was running hot to begin with, the upgrade may put it over the top.
That said, it's probably fine to let it ride with the current heat sink and
fan, but just keep an eye on it.
>
> H
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>
From pl at eskimo.com Tue Aug 12 09:57:19 2003
From: pl at eskimo.com (Peter Lehrer)
Date: Tue, 12 Aug 2003 09:57:19 -0400
Subject: [nycphp-talk] request for comment: pWhiteboard
References: <3F33B24C.5060002@chxo.com> <3F37CCF1.8010809@nyphp.org>
<3F38774D.40002@chxo.com>
Message-ID: <004d01c360d9$a72fc000$8a230f9d@default>
I tried editing it, but I couldn't type anything in.
Peter Lehrer
----- Original Message -----
From: "Chris Snyder"
To: "NYPHP Talk"
Sent: Tuesday, August 12, 2003 1:12 AM
Subject: Re: [nycphp-talk] request for comment: pWhiteboard
> Hans Zaunere wrote:
>
> > Maybe we can get an installation at dev. :)
> >
> Sure nuff: http://dev.nyphp.org/pwhiteboard.php
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>
From hans at nyphp.org Tue Aug 12 10:18:32 2003
From: hans at nyphp.org (Hans Zaunere)
Date: Tue, 12 Aug 2003 10:18:32 -0400
Subject: [nycphp-talk] Bullet proofing "rmdir" command
In-Reply-To: <000c01c360d5$66f3f370$6501a8c0@EZDSDELL>
References: <000c01c360d5$66f3f370$6501a8c0@EZDSDELL>
Message-ID: <3F38F738.7070706@nyphp.org>
Jeff wrote:
> I have a specific subdirectory on my site where users can upload images
> files associated with some text stored in a database. The question
> concerns deleting those uploaded images. Deleting the record is the easy
> part...even deleting the images and subdirectory is easy. However, my
> concern is what precautions should I take to make sure that the wrong
> subdir (or the whole site!!) doesn't get blown away. In the code below
> I'm using file_exists to delete the images and subdir but is there
> anything else that I should do to bullet proof the procedure?
>
> //Note: $sSubDir is the subdirectory path stored in the corresponding
> MySQL record.
is_dir()/is_file() is good for this, since it'll check the inode type and ensure a real path (which may, however, be relative to the current working dir).
for( $i = 0; $i < 5; ++$i ) {
$sImageName = "{$sSubDir}image{$i}.jpg";
if( is_file($sImageName) )
unlink($sImageName);
}
if( is_dir($sSubDir) )
rmdir($sSubDir);
H
From jsiegel1 at optonline.net Tue Aug 12 10:28:57 2003
From: jsiegel1 at optonline.net (Jeff)
Date: Tue, 12 Aug 2003 10:28:57 -0400
Subject: [nycphp-talk] Bullet proofing "rmdir" command
In-Reply-To: <3F38F738.7070706@nyphp.org>
Message-ID: <001101c360de$1117e250$6501a8c0@EZDSDELL>
Hans,
See my comment to David Sklar. I think this handles the
issue...especially since I'm not using relative dirs.
Jeff
-----Original Message-----
From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org]
On Behalf Of Hans Zaunere
Sent: Tuesday, August 12, 2003 9:19 AM
To: NYPHP Talk
Subject: Re: [nycphp-talk] Bullet proofing "rmdir" command
Jeff wrote:
> I have a specific subdirectory on my site where users can upload
images
> files associated with some text stored in a database. The question
> concerns deleting those uploaded images. Deleting the record is the
easy
> part...even deleting the images and subdirectory is easy. However, my
> concern is what precautions should I take to make sure that the wrong
> subdir (or the whole site!!) doesn't get blown away. In the code below
> I'm using file_exists to delete the images and subdir but is there
> anything else that I should do to bullet proof the procedure?
>
> //Note: $sSubDir is the subdirectory path stored in the corresponding
> MySQL record.
is_dir()/is_file() is good for this, since it'll check the inode type
and ensure a real path (which may, however, be relative to the current
working dir).
for( $i = 0; $i < 5; ++$i ) {
$sImageName = "{$sSubDir}image{$i}.jpg";
if( is_file($sImageName) )
unlink($sImageName);
}
if( is_dir($sSubDir) )
rmdir($sSubDir);
H
_______________________________________________
talk mailing list
talk at lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk
From jsiegel1 at optonline.net Tue Aug 12 10:28:57 2003
From: jsiegel1 at optonline.net (Jeff)
Date: Tue, 12 Aug 2003 10:28:57 -0400
Subject: [nycphp-talk] Bullet proofing "rmdir" command
In-Reply-To:
Message-ID: <001801c360de$134374e0$6501a8c0@EZDSDELL>
Just to expand a bit, I use a constant for the full path:
define('DEST_PATH','/var/www/html/car_images/') and then create $sSubDir
by concatenating this path with the value in the table which is simply
the subdirectory name, such as "b67783a0ceadaa20bdc17a513d113a42"
Jeff
-----Original Message-----
From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org]
On Behalf Of David Sklar
Sent: Tuesday, August 12, 2003 8:57 AM
To: NYPHP Talk
Subject: RE: [nycphp-talk] Bullet proofing "rmdir" command
Where is $sSubDir set? If it's set by users, then before either call to
rmdir() you should canonicalize the pathname with realpath() and then
make
sure that the canonicalized pathname has the correct prefix.
For example:
// The directory under which image-storage subdirectories can be created
$sImagePrefix = '/www/some/place/images';
$sSubDir = realpath($sSubDir);
if ($sSubDir && ($sImagePrefix == dirname($sImageName)) {
for ($i = 0; $i < 5; $i++) {
$sImageName = $sSubDir . "image$i.jpg";
if (file_exists($sImageName)) { unlink($sImageName); }
}
unlink($sSubDir);
}
realpath() returns false if the canonicalized pathname doesn't exist.
David
On Tuesday, August 12, 2003 9:45 AM, wrote:
> Great! Thanks!
>
> -----Original Message-----
> From: talk-bounces at lists.nyphp.org
> [mailto:talk-bounces at lists.nyphp.org] On Behalf Of pswebcode, nyc
> Sent: Tuesday, August 12, 2003 8:41 AM To: 'NYPHP Talk'
> Subject: RE: [nycphp-talk] Bullet proofing "rmdir" command
>
>
> //Delete subdir
> if(file_exists($sSubDir) && $sSubDir!="." && $sSubDir != ".."){
> rmdir($sSubDir); }
>
> ...better.
>
> -----Original Message-----
> From: talk-bounces at lists.nyphp.org
> [mailto:talk-bounces at lists.nyphp.org] On Behalf Of Jeff
> Sent: Tuesday, August 12, 2003 9:27 AM
> To: 'NYPHP Talk'
> Subject: [nycphp-talk] Bullet proofing "rmdir" command
>
>
> I have a specific subdirectory on my site where users can upload
> images files associated with some text stored in a database. The
> question concerns deleting those uploaded images. Deleting the record
> is the easy part...even deleting the images and subdirectory is easy.
> However, my concern is what precautions should I take to make sure
> that the wrong subdir (or the whole site!!) doesn't get blown away.
> In the code below I'm using file_exists to delete the images and
> subdir but is there anything else that I should do to bullet proof
> the procedure?
>
> //Note: $sSubDir is the subdirectory path stored in the corresponding
> MySQL record.
>
> //Delete images
> for($i=0;$i<5;$i++){
> $sImageName = $sSubDir . "image$i.jpg";
> if(file_exists($sImageName)){
> unlink($sImageName);
> }
> }
> //Delete subdir
> if(file_exists($sSubDir)){
> rmdir($sSubDir);
> }
>
> Jeff
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org http://lists.nyphp.org/mailman/listinfo/talk
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
_______________________________________________
talk mailing list
talk at lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk
From danielc at analysisandsolutions.com Tue Aug 12 11:11:13 2003
From: danielc at analysisandsolutions.com (Analysis & Solutions)
Date: Tue, 12 Aug 2003 11:11:13 -0400
Subject: [nycphp-talk] Bullet proofing "rmdir" command
In-Reply-To: <001801c360de$134374e0$6501a8c0@EZDSDELL>
References:
<001801c360de$134374e0$6501a8c0@EZDSDELL>
Message-ID: <20030812151113.GA16227@panix.com>
Hey Jeff:
On Tue, Aug 12, 2003 at 10:28:57AM -0400, Jeff wrote:
> Just to expand a bit, I use a constant for the full path:
If you're using a constant for the path, then all you need to do is make
sure the user input subdirectory name matches an expected pattern. So,
for example, check to see that $sSubDir has only letters and numbers in
it. This keeps a jerk from putting in dots and/or slashes to move to
undesirable locations. This doesn't obviate the need for is_dir() and
file_exists() checks, though.
I guess one hitch with all of the approaches discussed so far is they seem
to be able to allow one users to delete another user's photos. Thus, you
might want to include some unique user id in the file/directory naming
convention.
... snipitty, snip, snip, because, friends don't let friends waste
disk space or bandwidth...
--Dan
--
FREE scripts that make web and database programming easier
http://www.analysisandsolutions.com/software/
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7th Ave #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
From jsiegel1 at optonline.net Tue Aug 12 11:30:17 2003
From: jsiegel1 at optonline.net (Jeff)
Date: Tue, 12 Aug 2003 11:30:17 -0400
Subject: [nycphp-talk] Bullet proofing "rmdir" command
In-Reply-To: <20030812151113.GA16227@panix.com>
Message-ID: <001d01c360e6$a2acbd00$6501a8c0@EZDSDELL>
The subdirectory name should, theoretically, take care of uniqueness.
Here's how I generate the subdir name when someone is uploading pics for
the very first time:
$sTime = microtime();
$iDir = md5($sTime);
At no time does the user touch the subdir name (that is...it is not
editable). It is generated automatically and stored in the database. The
only time it is visible, however, is on the "public" side of the site
when someone views the images and looks at the html source.
Jeff
-----Original Message-----
From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org]
On Behalf Of Analysis & Solutions
Sent: Tuesday, August 12, 2003 10:11 AM
To: NYPHP Talk
Subject: Re: [nycphp-talk] Bullet proofing "rmdir" command
Hey Jeff:
On Tue, Aug 12, 2003 at 10:28:57AM -0400, Jeff wrote:
> Just to expand a bit, I use a constant for the full path:
If you're using a constant for the path, then all you need to do is make
sure the user input subdirectory name matches an expected pattern. So,
for example, check to see that $sSubDir has only letters and numbers in
it. This keeps a jerk from putting in dots and/or slashes to move to
undesirable locations. This doesn't obviate the need for is_dir() and
file_exists() checks, though.
I guess one hitch with all of the approaches discussed so far is they
seem
to be able to allow one users to delete another user's photos. Thus,
you
might want to include some unique user id in the file/directory naming
convention.
... snipitty, snip, snip, because, friends don't let friends waste
disk space or bandwidth...
--Dan
--
FREE scripts that make web and database programming easier
http://www.analysisandsolutions.com/software/
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7th Ave #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
_______________________________________________
talk mailing list
talk at lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk
From danielc at analysisandsolutions.com Tue Aug 12 11:39:23 2003
From: danielc at analysisandsolutions.com (Analysis & Solutions)
Date: Tue, 12 Aug 2003 11:39:23 -0400
Subject: [nycphp-talk] Bullet proofing "rmdir" command
In-Reply-To: <001d01c360e6$a2acbd00$6501a8c0@EZDSDELL>
References: <20030812151113.GA16227@panix.com>
<001d01c360e6$a2acbd00$6501a8c0@EZDSDELL>
Message-ID: <20030812153923.GA18992@panix.com>
Hey Jeff:
On Tue, Aug 12, 2003 at 11:30:17AM -0400, Jeff wrote:
> At no time does the user touch the subdir name (that is...it is not
> editable).
Good.
So, when you're allowing users to delete directories, what is the input
they're providing? The name of a subdirectory of under the hash named
dir, which is itself a subdirectory of your graphics directory? If so,
great. Then, as mentioned before, all you need to do is check the user
input contains only letters and numbers.
Enjoy,
--Dan
... snip ...
--
FREE scripts that make web and database programming easier
http://www.analysisandsolutions.com/software/
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7th Ave #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
From jsiegel1 at optonline.net Tue Aug 12 12:00:48 2003
From: jsiegel1 at optonline.net (Jeff)
Date: Tue, 12 Aug 2003 12:00:48 -0400
Subject: [nycphp-talk] Bullet proofing "rmdir" command
In-Reply-To: <20030812153923.GA18992@panix.com>
Message-ID: <002501c360ea$e71b5dd0$6501a8c0@EZDSDELL>
Dan,
The subdirectory only gets deleted when a user clicks on the "Delete"
link. The code handles the rest. At no time does the user know the name
of the image subdirectory. All they know is that they are deleting a
record. And as an added safety precaution, though I'm using $_GET to
pass values around (like record ID numbers), the url says something like
"http://mydomain.com/mypage.php?code=YToxOntzOjU6IkRMX0lEIjtzOjM6IjEzNCI
7fQ== with the latter being base 64 encoded and serialized.
Jeff
-----Original Message-----
From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org]
On Behalf Of Analysis & Solutions
Sent: Tuesday, August 12, 2003 10:39 AM
To: NYPHP Talk
Subject: Re: [nycphp-talk] Bullet proofing "rmdir" command
Hey Jeff:
On Tue, Aug 12, 2003 at 11:30:17AM -0400, Jeff wrote:
> At no time does the user touch the subdir name (that is...it is not
> editable).
Good.
So, when you're allowing users to delete directories, what is the input
they're providing? The name of a subdirectory of under the hash named
dir, which is itself a subdirectory of your graphics directory? If so,
great. Then, as mentioned before, all you need to do is check the user
input contains only letters and numbers.
Enjoy,
--Dan
... snip ...
--
FREE scripts that make web and database programming easier
http://www.analysisandsolutions.com/software/
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7th Ave #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
_______________________________________________
talk mailing list
talk at lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk
From nestorflorez at earthlink.net Tue Aug 12 12:05:09 2003
From: nestorflorez at earthlink.net (Nestor Florez)
Date: Tue, 12 Aug 2003 09:05:09 -0700 (GMT)
Subject: [nycphp-talk] MDX + PHP
Message-ID: <6457332.1060704472898.JavaMail.nobody@skeeter.psp.pas.earthlink.net>
Hello people,
Has any of you ever done any MDX + PHP programming?
Apparantly this entails accessing MSSQL datacube, which I do not have much of a clue, but I was wondering if anyone has ever done anything with MDX using PHP.
Can you point me to the write place to read info on PHP and MDX?
A guy at work took a class and now they are convince that we should do this using ASP...OH NO!!!!!! The teacher an MS cronie said that PHP would have problems using MDX.
Thanks,
Nestor :-)
From henry at beewh.com Tue Aug 12 11:53:33 2003
From: henry at beewh.com (Henry Ponce)
Date: Tue, 12 Aug 2003 12:53:33 -0300
Subject: [nycphp-talk] Wednesday,
August 13 - Intro to TCP/IP by Joshua Birnbaum
In-Reply-To: <004201c36074$c8b6c580$d2220f9d@default>
References: <004201c36074$c8b6c580$d2220f9d@default>
Message-ID: <200308121253.33803.henry@beewh.com>
I confirm my assistance.
My full name is Henry Ponce.
Thank you....
From adam at trachtenberg.com Tue Aug 12 14:46:15 2003
From: adam at trachtenberg.com (Adam Maccabee Trachtenberg)
Date: Tue, 12 Aug 2003 14:46:15 -0400 (EDT)
Subject: [nycphp-talk] libxml in PHP 5
In-Reply-To: <20030811174918.GB5141@panix.com>
Message-ID:
On Mon, 11 Aug 2003, Analysis & Solutions wrote:
> I was thinking that the new XML parser would necessitate scripts use
> different function calls. Or will the main functions and behavior remain
> the same, but only the library be changed?
The plan is to make the libxml switch seamless and not require any
changes in your XML code.
> If the functions will indeed be different, is there some place to find
> docs about these new procedures? They don't have to be great, just give
> me an idea of how to start hacking something simple.
PHP 5 will also have the SimpleXML extension. I believe the C code in
the CVS is also the documentation. (Source code: The ultimate documentation.)
-adam
PS: Sterling is actually banging the drum on lots of this. He'll know
more than I.
--
adam at trachtenberg.com
author of o'reilly's php cookbook
avoid the holiday rush, buy your copy today!
From dkrook at hotmail.com Tue Aug 12 15:24:26 2003
From: dkrook at hotmail.com (D C Krook)
Date: Tue, 12 Aug 2003 15:24:26 -0400
Subject: [nycphp-talk] Localizing Time Zones
Message-ID:
We've been looking for a good way to customize a web-based work flow tool so
that each user who logs in sees the time stamp of events in his own time
zone, not that of the server.
For example, a developer in India who is given a task can see when it was
assigned by the project manager in New York displayed in Bangalore time.
Similarly the PM would see when the work was done relative to New York time.
Both users would see GMT as a frame of reference as well.
To implement this functionality, we've taken a look at Adam and David's PHP
Cookbook where they address this very problem (Chapter 3, Calculating Time
with Time Zones).
Their solution involves the temporary change of the TZ environment variable:
"Calling putenv( ) before mktime( ) fools the system functions mktime( )
uses into thinking they're in a different time zone. After the call to
mktime( ),
the correct time zone has to be restored."
function pc_mktime($tz,$hr,$min,$sec,$mon,$day,$yr) {
putenv("TZ=$tz");
$a = mktime($hr,$min,$sec,$mon,$day,$yr);
putenv('TZ=EST5EDT'); // change EST5EDT to your server's time zone!
return $a;
}
This seems to be the solution we're after, but we're concerned about whether
this is thread safe, particularly in the context of a heavy load server with
lots of users redefining the TZ environment variable simultaneously.
The documentation of putenv() says the the environment variable will revert
to its original value after the request, and we understand that explicitly
resetting it as in the function above will offer a little better protection,
but should we still worry that one user's putenv will clash with another's?
If so, what is a better solution to time zone localization?
Thanks in advance,
-Dan
==========================================
Daniel Christer Krook
http://krook.net/ || http://krook.info/
http://civet.net/ || http://dev.krook.org/
_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail
From sklar at sklar.com Tue Aug 12 15:49:27 2003
From: sklar at sklar.com (David Sklar)
Date: Tue, 12 Aug 2003 15:49:27 -0400
Subject: [nycphp-talk] Localizing Time Zones
In-Reply-To:
Message-ID:
> This seems to be the solution we're after, but we're concerned about
> whether this is thread safe, particularly in the context of a heavy
> load server with lots of users redefining the TZ environment variable
> simultaneously.
My (Linux 2.4.20) "man putenv" says, in part:
The putenv() function is not required to be reentrant, and the one
in
libc4, libc5 and glibc2.0 is not, but the glibc2.1 version is.
(PHP's putenv() function calls the underlying putenv() system call.)
What OS and web server are you using?
David
From shiflett at php.net Tue Aug 12 16:05:33 2003
From: shiflett at php.net (Chris Shiflett)
Date: Tue, 12 Aug 2003 13:05:33 -0700 (PDT)
Subject: [nycphp-talk] Localizing Time Zones
In-Reply-To:
Message-ID: <20030812200533.48677.qmail@web14303.mail.yahoo.com>
--- D C Krook wrote:
> We've been looking for a good way to customize a web-based work
> flow tool so that each user who logs in sees the time stamp of
> events in his own time zone, not that of the server.
I take a slightly different approach than what you mention. I can't say that
I've ever given it a lot of thought, but this is what I do. I begin with some
default variables for the application:
$date_format = 'D, d M Y H:i:s';
$gmt_offset = -4;
If the user logs in, these values are overwritten with the user's session, so
you can let your users choose their preferred date format and time zone.
Then I just do something like this to get a ready-to-display date into a
variable:
$curr_date = gmdate($date_format, time() + $gmt_offset * 3600);
Of course, this demonstrates a date relative to the current time, but this can
be applied to any timestamp.
Hope that helps.
Chris
=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/
From dkrook at hotmail.com Tue Aug 12 16:08:17 2003
From: dkrook at hotmail.com (D C Krook)
Date: Tue, 12 Aug 2003 16:08:17 -0400
Subject: [nycphp-talk] Localizing Time Zones
Message-ID:
David,
We're running Apache 1.3.27 with PHP as a DSO on Red Hat 7.3 (2.4.20-18.7)
>(PHP's putenv() function calls the underlying putenv() system call.)
>
>What OS and web server are you using?
>
>David
_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE*
http://join.msn.com/?page=features/virus
From hans at nyphp.org Tue Aug 12 16:33:04 2003
From: hans at nyphp.org (Hans Zaunere)
Date: Tue, 12 Aug 2003 16:33:04 -0400
Subject: [nycphp-talk] Localizing Time Zones
In-Reply-To:
References:
Message-ID: <3F394F00.6060203@nyphp.org>
D C Krook wrote:
> We've been looking for a good way to customize a web-based work flow
> tool so that each user who logs in sees the time stamp of events in his
> own time zone, not that of the server.
>
> For example, a developer in India who is given a task can see when it
> was assigned by the project manager in New York displayed in Bangalore
> time. Similarly the PM would see when the work was done relative to New
> York time. Both users would see GMT as a frame of reference as well.
>
> To implement this functionality, we've taken a look at Adam and David's
> PHP Cookbook where they address this very problem (Chapter 3,
> Calculating Time with Time Zones).
>
> Their solution involves the temporary change of the TZ environment
> variable:
>
> "Calling putenv( ) before mktime( ) fools the system functions mktime( )
> uses into thinking they're in a different time zone. After the call to
> mktime( ),
> the correct time zone has to be restored."
>
> function pc_mktime($tz,$hr,$min,$sec,$mon,$day,$yr) {
> putenv("TZ=$tz");
> $a = mktime($hr,$min,$sec,$mon,$day,$yr);
> putenv('TZ=EST5EDT'); // change EST5EDT to your server's time zone!
> return $a;
> }
This would work, but also remember that UNIX timestamps aren't timezone aware themselves. Timezones only come into effect when you convert from the timestamp to a human readable date and time.
http://www.gnu.org/manual/glibc-2.2.5/html_node/Simple-Calendar-Time.html#Simple%20Calendar%20Time
in which case:
http://us4.php.net/manual/en/function.strftime.php
http://us4.php.net/manual/en/function.setlocale.php
might come in handy at some point.
> This seems to be the solution we're after, but we're concerned about
> whether this is thread safe, particularly in the context of a heavy load
> server with lots of users redefining the TZ environment variable
> simultaneously.
Anywho, do you really mean thread-safe? Unless you're running PHP under a threaded MPM in Apache 2, or IIS or something else, you won't need to worry about threads. Each Apache child is a full process, and thus has it's own environment (ie, it's own instance of the TZ environment variable) so you should be fine.
H
From sklar at sklar.com Tue Aug 12 16:28:53 2003
From: sklar at sklar.com (David Sklar)
Date: Tue, 12 Aug 2003 16:28:53 -0400
Subject: [nycphp-talk] Localizing Time Zones
In-Reply-To:
Message-ID:
> D C Krook wrote:
>
> We're running Apache 1.3.27 with PHP as a DSO on Red Hat 7.3
> (2.4.20-18.7)
In this configuration, each apache child is a single-threaded process, so
you shouldn't have any threads-stepping-on-each-other problems. A given
child process (with its own environment) only handles one request at a time.
> Chris Shiflett wrote:
>
> I take a slightly different approach than what you mention. I can't
> say that I've ever given it a lot of thought, but this is what I do.
> I begin with some default variables for the application:
>
> $date_format = 'D, d M Y H:i:s';
> $gmt_offset = -4;
>
> If the user logs in, these values are overwritten with the user's
> session, so you can let your users choose their preferred date format
> and time zone.
>
> Then I just do something like this to get a ready-to-display date
> into a variable:
>
> $curr_date = gmdate($date_format, time() + $gmt_offset * 3600);
>
> Of course, this demonstrates a date relative to the current time, but
> this can be applied to any timestamp.
This works great most of the time, but it gets tripped up by Daylight Saving
Time because some users' GMT offsets change during DST. If you keep track of
the DST observance of a user, then you can adjust the GMT offset when
necessary. However, that "when necessary" can be tricky to figure out. If
you're just handling North American users, then you can switch users DST
status around the time when the server's DST status switches.
To be accurate around the time that DST status switches, however, you need
to adjust the user's DST status switch by the offset between the user's time
zone and the server's time zone. DST switches happen at a given hour in
local time, so at 2am PST, when things jump to 3am PDT (except, for example,
in Dawson Creek, BC, which doesn't observe DST) it's 6am EDT, because the
jump from 2am EST to 3am EDT happened three hours earlier, at 2am EST, which
is 11pm PST.
Other places in the world may switch between standard and summer time at
different times of the year. Some countries occasionally adjust their time
settings to make the Olympics run more smoothly. (see:
http://support.microsoft.com/default.aspx?scid=kb;en-us;257178).
The zoneinfo database knows about all these hinky time zone and DST issues,
which is what makes putenv() and strftime() a breeze. If you don't want to
use environment variables, though, I suppose you could store a zoneinfo zone
for a given user and then calculate the GMT offset for that user by parsing
the appropriate zoneinfo file and finding the DST setting and GMT offsets
that correspond to a particular UTC time. zdump(8) and tzfile(5) would be
helpful for that.
David
From bpang at bpang.com Tue Aug 12 16:43:37 2003
From: bpang at bpang.com (Brian Pang)
Date: Tue, 12 Aug 2003 16:43:37 -0400
Subject: [nycphp-talk] OT: click thru count?
Message-ID:
Sorry for the off-topic post, but this list is so full of knowledgeable
people, I couldn't resist...
pardon me while I first wipe off my nose ;)
I am have a "debate" with an external webmaster about the number of
click-thrus a banner on his site is generating to one of my sites.
He says his logs show over 5,000 click-thrus for a particular month.
My logs show a total of 20 references from his site (yes, I know, not
all browsers send the HTTP_REFERER).
The links on his site are nothing special. No link to a redirecting
script that may increment a counter or anything like that. Just plain
ol' http://www.foo.com (actually, it's a nasty double link, the href
points to an advertiser's site, and an onClick spawns a new window to my
site, but still nothing that I see that might register in his logs).
My suspicion is that his logs are displaying the number of times the
banner image was loaded, not the click-thru count. -OR- He also
mentioned the "Exit" pages statistic and is suggesting that every exit
page was a click-thru to my site.
In the case of the exit pages, I don't think he understands what an
"exit page" really is.
My question, at long last, Is there anything that would show in his logs
that a user clicked the banner to an external link?
Thanks much
From oprusak at trafficmac.com Tue Aug 12 16:44:08 2003
From: oprusak at trafficmac.com (Ophir Prusak)
Date: Tue, 12 Aug 2003 16:44:08 -0400
Subject: [nycphp-talk] Database code solutions
References:
Message-ID: <00f501c36112$7a9c38f0$9601a8c0@sparta>
Hi All,
Executive summary:
I'm wondering if anyone here has any recommendations for a solution to
creating database related code.
Background:
I'm currently writing some code for a project and I realize that %80 of my
time is spent on database related code.
This is bad. At the end of the day, manipulation of data in a database is
the same more or less for any project. It comes down to "CRUD" (Creation,
Reading, Updating, Deleting). There must be a better way.
I'm looking for something that will reduce my development time on database
related code.
I know there are several packages, classes, etc that will help with this,
but I don't have time to research all the possibilities and was hoping to
hear from nyphp members their experiences and recommendations (or
non-recommendations).
I'm looking for any solution, commercial or open source.
I looked into phplens which seems to be in the direction of what I'm looking
for.
We're already using smarty so that's an added plus.
Thanx
Ophir
From csnyder at chxo.com Tue Aug 12 16:52:57 2003
From: csnyder at chxo.com (Chris Snyder)
Date: Tue, 12 Aug 2003 16:52:57 -0400
Subject: [nycphp-talk] OT: click thru count?
In-Reply-To:
References:
Message-ID: <3F3953A9.7030705@chxo.com>
Brian Pang wrote:
>My question, at long last, Is there anything that would show in his logs
>that a user clicked the banner to an external link?
>
>
Only if the click sends the browser to a redirection script on his site,
or at the ad server site (which sends him logs).
There could also be some kind of javascript onclick event that tracks it.
But I think your hunch is right-- if you've only got 20 instances of an
HTTP_REFERER from his site in your logs, there's probably only been 20
clicks, and certainly not 5000.
chris.
From bpang at bpang.com Tue Aug 12 16:56:19 2003
From: bpang at bpang.com (Brian Pang)
Date: Tue, 12 Aug 2003 16:56:19 -0400
Subject: [nycphp-talk] OT: click thru count?
Message-ID:
Thanks, Chris...
Just needed to make sure I wasn't going crazy or that the way that logs
work didn't change overnight ;)
his site, http://www.maxracks.com
the banner is the "Crunch" banner at the bottom
my site is http://www.maxcards.com
(cool offer and written all in php)
> Brian Pang wrote:
>
> >My question, at long last, Is there anything that would show in his logs
> >that a user clicked the banner to an external link?
> >
> >
> Only if the click sends the browser to a redirection script on his site,
> or at the ad server site (which sends him logs).
> There could also be some kind of javascript onclick event that tracks it.
>
> But I think your hunch is right-- if you've only got 20 instances of an
> HTTP_REFERER from his site in your logs, there's probably only been 20
> clicks, and certainly not 5000.
>
> chris.
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>
>
From csnyder at chxo.com Tue Aug 12 16:57:05 2003
From: csnyder at chxo.com (Chris Snyder)
Date: Tue, 12 Aug 2003 16:57:05 -0400
Subject: [nycphp-talk] Database code solutions
In-Reply-To: <00f501c36112$7a9c38f0$9601a8c0@sparta>
References:
<00f501c36112$7a9c38f0$9601a8c0@sparta>
Message-ID: <3F3954A1.2050808@chxo.com>
I'm sure there are some great classes out there for this, but if you've
already written the code so many times, why not write your own class or
functions that duplicate what you already do? Even if you are still
writing out the SQL for each query, you can consolidate a lot of the
code around it and save an awful lot of time.
chris.
Ophir Prusak wrote:
>I'm currently writing some code for a project and I realize that %80 of my
>time is spent on database related code.
>This is bad. At the end of the day, manipulation of data in a database is
>the same more or less for any project. It comes down to "CRUD" (Creation,
>Reading, Updating, Deleting). There must be a better way.
>
>
>
From dmintz at panix.com Tue Aug 12 17:29:24 2003
From: dmintz at panix.com (David Mintz)
Date: Tue, 12 Aug 2003 17:29:24 -0400 (EDT)
Subject: [nycphp-talk] cookbook: gpg
In-Reply-To:
References:
Message-ID:
On Mon, 11 Aug 2003, David Sklar wrote:
>
> To encrypt only, yes, you just need the public key of the recipient. To
> encrypt and sign, you need the private key of the signer as well.
>
> So if you're just encrypting the credit card data with a public key and
> storing it in a place where the corresponding private key isn't, then you
> should be protected against someone retrieving the encrypted data and then
> decrypting it.
>
> You aren't protected against someone injecting false data that's correctly
> encrypted into the system (via a hole in your app). This may not be such a
> big concern.
Thanks.
I'd love to see a snippet showing how user nobody encrypts data without
signing or requiring any secret key. That seems to be where I'm stuck. GPG
needs access to the public keyring containing the recipients public key,
right? If that's under my home directory then I have to open up the
permissions on it so 'nobody' can get in there, no?
---
David Mintz
http://davidmintz.org/
Email: See http://dmintzweb.com/whitelist.php first!
From sklar at sklar.com Tue Aug 12 17:59:51 2003
From: sklar at sklar.com (David Sklar)
Date: Tue, 12 Aug 2003 17:59:51 -0400
Subject: [nycphp-talk] cookbook: gpg
In-Reply-To:
Message-ID:
> I'd love to see a snippet showing how user nobody encrypts data
> without signing or requiring any secret key. That seems to be where
> I'm stuck. GPG needs access to the public keyring containing the
> recipients public key, right? If that's under my home directory then
> I have to open up the permissions on it so 'nobody' can get in there,
> no?
To sign without encrypting, pass -e without -s to gpg: "gpg -er foo at bar.com"
encrypts for foo at bar.com (and requires only foo at bar.com's public key);
"gpg -ser foo at bar.com" encrypts for foo at bar.com and also signs with the
default local user (and requires that user's private key).
GPG does need access to the public keyring with the recipient's public key.
Since it's a public keyring, it doesn't really matter if the world can see
it. Put the keys in a separate keyring, make that file world-readable
(perhaps putting it outside your home directory), and tell gpg about it
with --keyring.
David
From dkrook at hotmail.com Tue Aug 12 18:04:52 2003
From: dkrook at hotmail.com (D C Krook)
Date: Tue, 12 Aug 2003 18:04:52 -0400
Subject: [nycphp-talk] Localizing Time Zones
Message-ID:
Hans, Chris, David,
Thanks for all the tips. I think the fact that the Apache child process
runs with its own instance of env variables is just the confirmation we were
looking for, and we'll keep the other approaches to the problem in mind.
Thanks again,
-Dan
_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail
From suzerain at suzerain.com Tue Aug 12 18:10:35 2003
From: suzerain at suzerain.com (Marc Antony Vose)
Date: Tue, 12 Aug 2003 18:10:35 -0400
Subject: [nycphp-talk] pausing a script...or something
In-Reply-To: <3F394F00.6060203@nyphp.org>
References:
<3F394F00.6060203@nyphp.org>
Message-ID:
Hi there.
I've got a script that's calling another PHP script which creates a
TAR archive of some files, then it copies it somewhere, and extracts
it.
Simple enough.
The thing is, the TAR archive is around 178 MB, so it's kinda on the big side.
So, I have a simple question.
Currently, I am building the command to tar the files, and calling it
like this:
$cmd = "php -q /some/other/directory/maketar,php &";
if( system($cmd) === false){
die( "was not able to call the TAR building script");
}
else{
// do other stuff, like copy it and extract it
}
So, my question is...is the above if then construct sufficient to
make the calling script wait for the PHP script it is making use of
before it goes on and attempts to copy the created file.
I'm asking this because, to me, it doesn't seem to be, and I want to
figure out the "proper" way I can make the script wait for the
completion of the other script.
--
Marc Antony Vose
http://www.suzerain.com/
Into every tidy scheme for arranging the pattern of human life, it is
necessary to inject a certain dose of anarchism.
-- Bertrand Russell
From bpang at bpang.com Tue Aug 12 20:18:19 2003
From: bpang at bpang.com (Brian Pang)
Date: Tue, 12 Aug 2003 20:18:19 -0400
Subject: [nycphp-talk] pausing a script...or something
Message-ID:
Try removing the ampersand, &, in your $cmd string.
> Hi there.
>
> I've got a script that's calling another PHP script which creates a
> TAR archive of some files, then it copies it somewhere, and extracts
> it.
>
> Simple enough.
>
> The thing is, the TAR archive is around 178 MB, so it's kinda on the
big side.
>
> So, I have a simple question.
>
> Currently, I am building the command to tar the files, and calling it
> like this:
>
> $cmd = "php -q /some/other/directory/maketar,php &";
> if( system($cmd) === false){
> die( "was not able to call the TAR building script");
> }
> else{
> // do other stuff, like copy it and extract it
> }
>
> So, my question is...is the above if then construct sufficient to
> make the calling script wait for the PHP script it is making use of
> before it goes on and attempts to copy the created file.
>
> I'm asking this because, to me, it doesn't seem to be, and I want to
> figure out the "proper" way I can make the script wait for the
> completion of the other script.
>
> --
> Marc Antony Vose
> http://www.suzerain.com/
>
> Into every tidy scheme for arranging the pattern of human life, it is
> necessary to inject a certain dose of anarchism.
> -- Bertrand Russell
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>
>
From sterling at bumblebury.com Wed Aug 13 06:32:41 2003
From: sterling at bumblebury.com (Sterling Hughes)
Date: Wed, 13 Aug 2003 10:32:41 -0000
Subject: [nycphp-talk] libxml in PHP 5
In-Reply-To:
References:
Message-ID: <1060762608.583.13.camel@hasele>
Am Die, 2003-08-12 um 14.46 schrieb Adam Maccabee Trachtenberg:
> On Mon, 11 Aug 2003, Analysis & Solutions wrote:
>
> > I was thinking that the new XML parser would necessitate scripts use
> > different function calls. Or will the main functions and behavior remain
> > the same, but only the library be changed?
>
> The plan is to make the libxml switch seamless and not require any
> changes in your XML code.
Yes, and kinda. The SAX extension (ext/xml) will remain the same.
Code that uses the DOM extension will need to be rewritten. The DOM
extension has always been experimental, and never really worked. Now it
will, and it will be 100% DOM 2 (and mostly DOM 3) compliant. The API
for the XSLT extension is also completely changed.
>
> > If the functions will indeed be different, is there some place to find
> > docs about these new procedures? They don't have to be great, just give
> > me an idea of how to start hacking something simple.
>
> PHP 5 will also have the SimpleXML extension. I believe the C code in
> the CVS is also the documentation. (Source code: The ultimate documentation.)
book.xml