[PHP] safely using input for mail

2004-09-12 Thread David T-G
Hi, all --

I'd like some sanity checks on safely using input for sending mail.  I'm
developing a feature where one can click a 'mail this page' link, fill in
the sender's and the recipient[s]'s addresses, and add comments in the
body (eg Hey, Bill, what do you think of this chair?) and then generate
the email.  I want to watch out for gotchas.

At the moment, I am running escapeshellcmd() on the From:, To:, Subject:,
url, and body fields, and limiting the recipient field to 255 chars
(enough for about half a dozen addresses, I figure) to prevent being used
for massmailing (though I haven't yet figured out how to keep from being
called repeatedly, but at least that's just as hard for the spammer as
his own bandwidth limits).  Unfortunately, escapeshellcmd() also escapes
the ? and s in the URL and breaks it; I think it will have to go away.
I'm also ready to believe that I've overlooked half a dozen other things.

How would you guys tackle this?


TIA  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp952nCnHrGX.pgp
Description: PGP signature


Re: [PHP] safely using input for mail

2004-09-12 Thread David T-G
John, et al --

[Been a while!  How ya been?]

...and then John Holmes said...
% 
% David T-G wrote:
% 
% I'd like some sanity checks on safely using input for sending mail.  I'm
...
% At the moment, I am running escapeshellcmd() on the From:, To:, Subject:,
...
% his own bandwidth limits).  Unfortunately, escapeshellcmd() also escapes
% the ? and s in the URL and breaks it; I think it will have to go away.
% I'm also ready to believe that I've overlooked half a dozen other things.
% 
% How would you guys tackle this?
% 
% This isn't what escapeshellcmd() is for; not sure why you chose that one.

Noobness, I suppose :-)  I wanted to avoid having problematic commands
fed in to break my script; perhaps that's only a DB-type exploit (though
an answer that simple doesn't seem likely).


% 
% Are you sending this as an HTML or Text email? Either way, you control 
% the body of the email (the page that's being sent), so you don't really 
% have to worry about that.

Just text.


% 
% If you're sending an HTML mail, then use htmlentities() on the text 
% before putting it in the email. If you're sending a text email, then you 
% can strip_tags() from it.

Ah; OK.


% 
% The biggest thing to look our for is mail header injection. If you're 

Indeed.  I figured as much, but escapeshellcmd() is as far as I got.


% taking any user input and putting it into the headers (from, to, 
% subject, etc), then newlines need to be stripped. You're allowing the 

Ahh...  That makes sense.  Thanks.


% user to set the To: address, I assume (the recipients). If you're 
% sticking that $to varable from the user directly into mail(), you could 
% be vulnerable (same if you create a From: header or use user input in 
% the subject).

Yep.


% 
% For example, say you're collecting my email address for the From: header.
% 
% $headers .= From: {$_POST['email']}\r\n;
...
% So strip newlines from user input or reject input if it contains newlines.
% 
% str_replace(array(\r,\n,'',$text)

For the archives, you need  here a closing ) on your array :-)


% 
% Is one way to do it.
% 
% If I left anything out, I'm sure Chris will jump on it. :)

Good; thanks to all in advance!


% 
% -- 
% 
% ---John Holmes...


HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgpKH5GWtNSzL.pgp
Description: PGP signature


Re: [PHP] Re: web page output as we go

2004-07-04 Thread David T-G
Jason, et al --

...and then Jason Barnett said...
% 
% Is there any way I can tell the web browser to start trickling the data
% onto the page?
% 
% As Torsten so kindly pointed out to me before, your friend is the 
% flush() function:
% http://www.php.net/flush

Aha!  It looks like it's just my browser, since even flush() didn't help
me but when I started poking around under Win (ugh!) both Mozilla and IE
scrolled the data down the screen.

The manual seems to frown upon using flush(), so I'll experiment with it
some more, but I suspect that Linux/LYNX simply won't do this for me and
that's no big deal since few of our customers use it.


% 
% Jason


Thanks for the pointing :-)

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgpsz8lKlPcZV.pgp
Description: PGP signature


[PHP] web page output as we go

2004-07-03 Thread David T-G
Hi, all --

It's been a while.  I've been busy and have missed the list.  It's good
to have a [legitimate] excuse to read again :-)

I have a script which churns away and spits out the name of each file as
it processes.  The docs say that any print or echo statements get written
immediately and thus exists output buffering for headers and sessions --
but -- but in the web browser instead of seeing content start to flow in
(to give me an indicator of how things are going) the page simply remains
blank until it suddenly shows me the completed list.

Is there any way I can tell the web browser to start trickling the data
onto the page?


TIA  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp1j5balw2OU.pgp
Description: PGP signature


[PHP] php as CGI and $_POST

2004-06-04 Thread David T-G
Hi, all --

I am working up a CGI script to take advantage of Apache's suEXEC so that
the web server can manipulate files as the site owner.  I have already
managed a simple

  $f = fopen(/path/to/docroot/testfile,'w') ;
  fwrite($f,hi!\n) ;
  fclose($f) ;

and know that it works as intended, but now I seem completely unable to
get any $_POST (or even $_GET) data into the script.  I suspect, from
reading the manual and noting the warnings, that any GET data will be
ignored, and that's fine, but I know that I can provide that without even
messing about with a form that I might somehow be screwing up, so I
thought I'd try it...

My code is as simple as

  #!/usr/local/bin/php
  ?php
print Content-type: text/html\n\n ;
print _POST IS . ; print_r($_POST) ; print .br\n ;
print _GET IS . ; print_r($_GET) ; print .br\n ;
print Enter your password:br\n ;
print form method='post'\n ;
print input type='password' name='pass'\n ;
print br\ninput type='submit' value='ENTER'\n ;
print /form\n ;
exit ;
  ?

but I only get

  _POST IS .Array ( ) .
  _GET IS .Array ( ) .
  Enter your password:
  
  ENTER

even after submitting.  Switching to

  form method='get'

doesn't help anything.

So how on earth does one get data into a CGI PHP script?


TIA  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgpi7TjlJ0mJ7.pgp
Description: PGP signature


Re: [PHP] php as CGI and $_POST

2004-06-04 Thread David T-G
Curt, et al --

...and then Curt Zirzow said...
% 
% * Thus wrote David T-G ([EMAIL PROTECTED]):
%  
%  My code is as simple as
%  
%#!/usr/local/bin/php
% 
% What does '/usr/local/bin/php -v' show?

Doesn't seem to scary to me:

  bash-2.05a$ /usr/local/bin/php -v
  PHP 4.3.4 (cli) (built: Jan  6 2004 15:27:52)
  Copyright (c) 1997-2003 The PHP Group
  Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies


% 
% 
% Curt


TIA  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp1qcksBNrfz.pgp
Description: PGP signature


Re: [PHP] script location

2004-06-04 Thread David T-G
Gabe --

...and then Gabe said...
% 
% Does anyone know of a simple/efficient way to determine the path to a 
% script on the URL?

Gee, it sounds like you want the dirname() of the SCRIPT_URL.  You're on
the right track :-)


HTH  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgpVpgXKhM7hi.pgp
Description: PGP signature


Re: [PHP] php as CGI and $_POST

2004-06-04 Thread David T-G
Peter --

...and then Peter Risdon said...
% 
% David T-G wrote:
% 
%  bash-2.05a$ /usr/local/bin/php -v
%  PHP 4.3.4 (cli) (built: Jan  6 2004 15:27:52)
% 
% You probably need the cgi version - not the command line one you 
% actually have.

Ooohhh...  Ouch.  So there are *three* possible PHP compiles:
module, CGI, and CLI?

OK.  To save us the cost of rebuilding at this host, is there any way to
pass args to the CLI version of the script running as a CGI?


Thanks  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgphoH93CTsi6.pgp
Description: PGP signature


Re: [PHP] php as CGI and $_POST

2004-06-04 Thread David T-G
Curt, et al --

...and then Curt Zirzow said...
% 
% * Thus wrote David T-G ([EMAIL PROTECTED]):
%  
%bash-2.05a$ /usr/local/bin/php -v
%PHP 4.3.4 (cli) (built: Jan  6 2004 15:27:52)
% 
% that cli should be cgi.
% 
% I'm assuming you compiled php with something like:
%configure --with-apxs=/yada/apxs [other options]

Yep.  And with CLI enabled, too.


% 
% What you need to do is recompile php with configure like:
%configure --[other options]

Gotcha.  Thanks for the pointers.


% 
% Then make will build a cgi binary in sapi/cgi/php, relative to your build
% directory.  If you want both versions (cgi and cli) you'll have to
% manually place the cgi version of php somewhere else than
% /usr/local/bin or name it something php_cgi. And then reference
% that file in you php script.

I found where our support crew had built the current version not quite
six months ago, and that a lovely buildme file with our approximately 8
billion --with* params in it, so I just copied the tree, pulled apxs out,
rebuilt, and copied the CGI php somewhere as you suggest.  And now I have
post data; yippee :-)

Thanks also for your other response.  Finding the build tree was
definitely the easier route :-)


HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgpJXoqkHNGmw.pgp
Description: PGP signature


[PHP] changing http to https

2004-05-12 Thread David T-G
Hi, all --

We have lovely variables like $_SERVER['SCRIPT_URI'] so that we don't
have to hard-code the site or script name into our files, and that's
great; it even includes the SID for me if cookies are off.  I'd like to
be able to point someone to https://sitename/script.php to log in
securely, but I see no way of changing the request method or port number
or such.  So far all I've dreamed up is to either manually build

  https://{$_SERVER['HTTP_HOST']}{$_SERVER['SCRIPT_NAME']}

or perhaps

  str_replace('http','https',$_SERVER['SCRIPT_URI'])

which both seem kinda kludgey.

Any better ideas?


TIA  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


[PHP] SOLVED Re: [PHP] using cookies

2004-05-10 Thread David T-G
Hi, all --

...and then David T-G said...
% 
% I guess I need a primer on cookie usage.  I've read the manual regarding
[snip]

All has become clear, or at least only murky :-)

I was having trouble wrapping my head around how to start cookies (a la
sessions) and then check to see if I had a cookie on the browser machine
to log in a user automatically, since setcookie() looked to be the only
way to do anything and that wipes anything that may be there.

Richard was kind enough to clarify that the browser will automatically
send the cookie, even without asking, the next time the visitor comes to
the site, so I can immediately check $_COOKIE['mycookie'] without having
to call setcookie() to instantiate things.

Now to put it all into practice, but I see my cookie in the browser cache
file and it gets setn back to me when I return.  Yay! :-)


HTH  Thanks again  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] Re: using cookies

2004-05-09 Thread David T-G
Aidan (and Richard and others) --

...and then Aidan Lister said...
% 
% Hi,

Hi!


% 
% Richards email was kinda wierd, so I'll reply to your email directly

Thanks :-)  And, while I appreciated it, I didn't get a lot from it.

Of course, this one basically says just read the manual, so I'm not
getting a *whole* lot from it, either!


% 
...
% Okay, simple:
% 
% ?php
% if (isset($_COOKIE['yourcookie'])) { // they have the login cookie, so do
% what you called log them in, whatever that means }
% else { // they are not logged in, so include your login page }
% ?

Aha!  Perhaps I was unclear.  I'm sorry; it was late :-)

When the surfer returns to the page tomorrow or next week or in a month,
I want to see that I have stored his acct info in a cookie on his machine
so that I can automatically log him in rather than requiring that he type
his name and pass again.  There is a remember me type of checkbox on
the login page so that he can tell me to save the info for next time.

*That* is what I can't seem to grasp...  If I set the cookie, then I'm
stepping on the old value and so I can't automatically log him in (or
at least as I understand it, and I certainly haven't seen anything in
$_COOKIE to make me think otherwise).

Perhaps now I've given everyone better info on which to base a response :-)


TIA again  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


[PHP] using cookies

2004-05-08 Thread David T-G
Hi, all --

I guess I need a primer on cookie usage.  I've read the manual regarding
setcookie and have gone back to look at everything having to do with
cookies on this list in the past few months (it seems that I'm not the
only one with some troubles, but most of them appear to have been having
sent some HTML output before trying to set a cookie).

I want to check to see if the user has my cookie to then log him in
automatically, and if he doesn't then I show the login screen and he logs
in and then I set the cookie if the box is checked.

Of course, $_COOKIE is set, so I have to check for my cookie name.  Even
something as simple as

  $_COOKIE['test'] = 'tested';

followed by a load of the page and a print doesn't show it.

Do I only call setcookie if the cookie isn't set, or do i call it every
time I load the page to initialize it?  Once I set it, how do I read it?
Does anyone have any pointers to a basic tutorial?


TIA  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] PHP Website Architecture

2004-05-07 Thread David T-G
Ryan, et al --

...and then Ryan A said...
% 
% 
% On 5/7/2004 5:47:47 PM, Jay Blanchard ([EMAIL PROTECTED])
% wrote:
[snip]

Did you realize that you quoted Jay's quote of Paul's original note but
then snipped off Jay's comment? :-)


...
% If you are thinking only of performance this wont matter at all, but
% sometimes for the sake of simplicity and easier management of code it is
% good to split files for different tasks.

Agreed.


% Nearly all programs can be written in *one* very large .php file but just
% thinking of going back in to make changes 3 months down the road would be a
% nightmare.

Now, now...  If you structure your code effectively it's no harder to
edit one large file than it is to edit a bunch of smaller files.  I agree
that sometimes breaking up is a good thing, but I haven't the slightest
problem working in the single main (and large) script for our gallery
engine, amongst other projects, and as an added bonus I don't have to
remember in which file to search, months later, when I'm tracking a bug
(er, reconsidered feature, since there are no bugs in my code! ;-)


% 
% HTH.
% 
% Cheers,
% -Ryan


HTH  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] please remove this user

2004-05-07 Thread David T-G
Curt, et al --

...and then Curt Zirzow said...
% 
...
% messages. The best thing to do is report them to their provider.

I've been sending these (initially forwarded with a this mailbox is an
autoresponder that generates this message on the list preamble and then
just redirected) to root/abuse/postmaster at credit suisse and astral,
and now also to the domain contacts (interestingly enough, both look to
have registered through ipowerweb although the owners appear quite
unrelated) for a few weeks now.

Perhaps it's time to start calling ipowerweb at 888/511-4678 to encourage
them to help these clients fix their broken configurations (be they on an
ipower virtual server or within a corporate network).  Then, again, astral
is due to expire late next month; perhaps it really will!

Hey, I guess I'll have two more messages to fire off in about a minute :-)


HTH  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] Graphical calendar

2004-05-07 Thread David T-G
Todd --

...and then Todd Cary said...
% 
% I need to bring up a calendar so the user can determine what day of the 
...
% Is there a simple graphical calendar where the use can pick a month and 
% see the days of the week?

I don't know (though that makes sense), but you could always rip the
calendar code out of any of those mainstream apps.  I use Craig Knudsen's
WebCalendar (http://www.k5n.us/webcalendar.php) and it has preview
calendars for last month and next month that would probably do a great
job for you.


% 
% Todd


HTH  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] gifs, icons etc

2004-05-06 Thread David T-G
Brent, et al --

...and then Brent Clark said...
% 
% Hi all

Hi!


% 
% I would like to know if any body has a url for free some icons and, or small
% pics that can be used in a site \ page
% development.

They're not entirely free, but they're available for personal use as well
as in your own development (or for a fee if used commercially).  Surf
over to Dotty's Diner at

  http://www.dottysdiner.com/

and see all of the backgrounds she has available, plus more in her ring.

Disclaimer: I had never heard of Dotty until my wife stumbled over her
images, am in no way related to her, and receive no compensation for
telling anyone about her work.  Nyah nyah :-)


HTH  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] Re: strip comments from HTML?

2004-05-06 Thread David T-G
Petr, et al --

...and then Petr U. said...
% 
% On Thu, 6 May 2004 11:57:45 -0400
% David T-G [EMAIL PROTECTED] wrote:
% 
%   Am I missing something painfully obvious?
% 
% From http://www.php.net/manual/en/pcre.pattern.syntax.php 
% 
% However, if a quantifier is followed by a question mark, then it ceases to be
% greedy, and instead matches the minimum number of times possible, so the
% pattern /\*.*?\*/  does the right thing with the C comments.

Gee, I guess I was :-)  Thanks!


% 
% --
% Petr U.


HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] Re: strip comments from HTML?

2004-05-06 Thread David T-G
Michael, et al --

...and then Michael Sims said...
% 
% David T-G wrote:
% 
%  Am I missing something painfully obvious?
% 
% www.perldoc.com appears to be unavailable at the moment, but if you have perldoc
% installed, here's an excerpt from the perlre man page:

I do, but I looked in the php manual and didn't see this behavior.
[Petr, as you'll note, has rectified that matter.]  I know that some
of the PHP PCRE implementation strays from Perl's, so I just stuck
with that.


Thanks  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] I need to hire someone to secure script

2004-05-06 Thread David T-G
Doug --

...and then doug_hastings said...
% 
% Hello,
% I wrote a script for my site which has been compromised repeatedly. I would
% like to hire someone to fix it for me. The script is about 120 lines,
...
% Thanks,

I would be more than happy to be of service if you are still in need.
Please feel free to drop me a line to discuss it if you wish.


% 
% Sorry if this not an appropriate request in a forum like this.

That's an age-old problem, and I think it's as good here as anywhere :-)


% 
% Doug


HTH  HAND  Good luck!

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] setting php_admin_value

2004-05-06 Thread David T-G
Tim --

You have started a new thread by taking an existing message and replying
to it while merely changing the Subject: line.

That is bad, because it breaks threading.  When you reply to a message,
your mail client generates a References: header that tells everyone to
which posting(s) your posting refers.  A good mail client uses this
information to build a thread tree of the postings so that it is easy
to see just how they relate to each other.

With your posting style you successfully torpedoed this useful feature;
your posting shows up within an existing thread even though it is
completely unrelated.

Always do a fresh post when you want to start a new thread.  That means
that you do not select any sort of Reply when you start your message.
You can save the list address in your address book (or equivalent) for
convenience.

...and then Tim Traver said...
% 
% Hi all,
% 
% ok, I am writing an apache module that dynamically figures out virtual host 
% variables for data locations for my users.

Interesting.  Where does it get its info?  Probably from a database or
config file or such?  [Just to make sure I have the picture right...  The
other option would be from Apache, but I think you're saying that you're
setting apache vars rather than reading them.]


% 
% I need to be able to set the php_admin_values for each request so that 
% those values get passed through to php and take effect for each request.
% 
% Normally, this would be static inside the apache conf file using the 
% php_admin_value directive.

Right.  The PHP manual backs that up, too:

  There are two differences between the Admin values and the non admin
  values:
  
* Admin values (or flags) can only appear in the server-wide Apache
  configuration files (e.g., httpd.conf).
* Standard values (or flags) cannot control certain PHP directives,
  for example: safe mode (if you could override safe mode settings
  in .htaccess files, it would defeat safe mode's purpose). In
  contrast, Admin values can modify the value of any PHP directive.

So no setting these from the PHP side.


% 
% Does anyone here know how I could set these variables dynamically ? Do I 
% have to load the apache configuration tables and change it manually ? or 
% can I set a particular environment variable that gets read by php ?

The only thing that occurs to me -- and it would be none too easy to
secure, mind you -- is having your script write to some /path/to/file
which is included by the main httpd.conf file and then reload httpd.
Very ugly.

Since you're writing a module, though, you could probably look into the
mod_php4 source and see how it gets its settings; surely the httpd.conf
file structure, after parsing, is just a data structure that is read as
needed, and you could thus probably intercept that call.


% 
% Thanks,
% 
% Tim.


HTH  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] strip comments from HTML?

2004-05-06 Thread David T-G
Justin --

...and then Justin French said...
% 
% Hi,

Hi!


% 
% This isn't working:
% $text = preg_replace('/!--(.*)--/','',$text);
% 
% Can someone advise what characters I need to escape, or whatever to get 
% it going?

Well, what do you want it to do?  On my system that properly replaces the
entire commented string with nothing.  An example which puts something
else there instead:

  ?php

  $text = body\nh1Hi/h1\n!-- foo --/body\n ;
  $text = preg_replace('/!--(.*)--/','blah',$text) ;
  print text is .$text.\n;

  ?

This yields

  text is .body
  h1Hi/h1
  blah/body
  .

as expected.

Note that since you're just replacing the entire comment with '' you
needn't bother with the () around whatever may be in the middle, too.


% 
% TIA
% 
% ---
% Justin French
% http://indent.com.au


HTH  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgpVphnFfsLba.pgp
Description: PGP signature


Re: [PHP] strip comments from HTML?

2004-05-06 Thread David T-G
Marius, et al --

...and then Marius Dascalu said...
% 
% --- Justin French [EMAIL PROTECTED] wrote:
%  
%  This isn't working:
%  $text = preg_replace('/!--(.*)--/','',$text);
...
% 
% Hi, 

Hello!


% 
% You must escape - (minus sign) because is a
% meta-character for regular expressions. See 

What?  No.


% http://www.php.net/manual/en/pcre.pattern.syntax.php.

From that same link:

  Part of a pattern that is in square brackets is called a character  
  class. In a character class the only meta-characters are:   
   
  \
 general escape character  
   
  ^
 negate the class, but only if the first character 
   
  -
 indicates character range 
   
  ]
 terminates the character class

So you only have to worry about a minus if you're in a [a-z] range, and
even then you can put a minus in without having to resort to backslashes.


% Your line of code might be:
% 
% CODE
% $text = preg_replace('/!\-\-(.*)\-\-/','',$text);
% /CODE

Then, again, it might not ;-)


% 
% This line of code, if you are parsing HTML file row by
% row, strips only one line comments. Comments spanned
% on multiple lines are unaffected.

Agreed.  Let's leave that to the student to work out, shall we? :-)


%  
% HTH
% 
% Marius


HTH  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgpAVyM41dMQO.pgp
Description: PGP signature


Re: [PHP] converting movies

2004-05-06 Thread David T-G
Arthur --

You have started a new thread by taking an existing message and replying
to it while merely changing the Subject: line.

That is bad, because it breaks threading.  When you reply to a message,
your mail client generates a References: header that tells everyone to
which posting(s) your posting refers.  A good mail client uses this
information to build a thread tree of the postings so that it is easy
to see just how they relate to each other.

With your posting style you successfully torpedoed this useful feature;
your posting shows up within an existing thread even though it is
completely unrelated.

Always do a fresh post when you want to start a new thread.  That means
that you do not select any sort of Reply when you start your message.
You can save the list address in your address book (or equivalent) for
convenience.

...and then Arthur Radulescu said...
% 
% Hello!

Hi!


% 
% Does anyone know how I can convert movies from a format to another or how I
% could get a screenshot of the movie (the first scene) using PHP or at least
% something running on a linux system.

I would use ImageMagick.


% 
% 
% Thanks,
% Arthur


HTH  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgphnzzbZxrrf.pgp
Description: PGP signature


Re: [PHP] Re: strip comments from HTML?

2004-05-06 Thread David T-G
Rob, et al --

...and then Rob Ellis said...
% 
...
% you can make the .* less greedy...
% 
%   $text = preg_replace('/!--.*?--/', '', $text);

How does that make it ungreedy?  The only thing I see relating question
marks and greediness is that a question mark makes part of a regexp with
a /U modifier (otherwise not greedy) back into a greedy portion.

Am I missing something painfully obvious?


% 
% - rob


TIA  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgpR4LqMxbiLk.pgp
Description: PGP signature


[PHP] dollar sign ASCII code

2004-04-30 Thread David T-G
Hi, all --

I have a comment field where I allow users to enter the picture comments
and then I later display them.  I thought I was converting everything as
needed (I inherited the code), but using a dollar sign breaks things (I'm
sure PHP is trying to interpret it).

The proper fix, I know, is to go and properly convert that dollar sign,
too; we will, but of course we have to test the new code before we roll
it out -- and we have to pin down why it isn't doing it now in the first
place.  The quick fix, though, is to tell him to use the proper HTML
escape sequence for it, like #039; for an apostrophe or amp; for an
ampersand.

Does anyone have the code for a dollar sign?


TIA  HANN

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


[PHP] substrings

2004-04-25 Thread David T-G
Hi, all --

I must be having a brain fart as well as going blind because I can't find
in the manual how to do this.

Given a string like #AABBCC or #112233 how do I get the

  2nd-3rd
  4th-5th
  6th-7th

position substrings so I can break out the red, green, and blue values?
All of the regular expressions seem to hinge on matching a separator, and
the closest thing seems to be a

  preg_match(.(..)(..)(..),$color,$colors) ;
  $r = $colors[1] ;
  $g = $colors[2] ;
  $b = $colors[3] ;

but it just seems like I should be able to return a list like

  ($r,$g,$b) = fn(operands,$color) ;

or so.


TIA  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


[PHP] substr == SOLVED (was Re: [PHP] substrings)

2004-04-25 Thread David T-G
Richard, et al --

...and then Richard Harb said...
% 
% $color = '#aabbcc';
% 
% if (strlen($color) == 7) {
%echo ' r: ' . substr($color, 1, 2);
[snip]

D'oh!  I knew it should be substr but I could never find it!  I was up to
page 1098 or such and muddling through all of the PCRE doc when I gave up
and asked for help :-)


Thanks  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] Freelance PHP Bids

2004-04-22 Thread David T-G
Navid --

...and then [EMAIL PROTECTED] said...
% 
% Hello,

Hi!


% 
% There is a person asking me where she can find a website developer that will
% create an e-commerce solution for her. I don't feel I'm ready to help her
% out in that area yet, but I still want her to be able to have other choices.

Good for you.


% 
% I remember there was a main website where freelance programmers and clients
% come together and bid on projects with different levels of experiences and
% prices, but I don't remember where that is now. Can anyone direct me to a
% website such as that? Any help would be appreciated. Thank you.

The ones of which I know are scriptlance, elance, and guru; perhaps
hotscripts has a job posting forum as well.  This list is also a good
place to go; you certainly have the right audience.

I have found scriptlance prices to be so cheap -- people willing to write
code for $10, though I don't know anything about the quality you get --
that I don't go there anymore, and I'm not up to paying a hefty chunk to
be an elance member -- at least not until I hear some serious success
stories from those who already do -- and guru, formerly itmoonlighter,
has never come to fruition for me, so I'm quite interested in any results
you get.  Please let us know.


% 
% Navid


HTH  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] Why NNTP is not default protocol for php groups

2004-04-22 Thread David T-G
Hi --

...and then T. H. Grejc said...
% 
% Justin Patrin wrote:
% The threading works just fine. The problem is that users have ignorant 
% mail software that don't set the thread headers correctly. Even 
% newsgroup client software might do this. This is *not* the server's 
% fault in any way, shape, or form.
% 
% Sure it's not servers fault, knowing that news.php.net is not *real* 
% news server. It is mailing list mirror. News server dont make threads 
% based on subject like mailing list, but based on message header field.

Suppose for a moment that this list turned into a newsgroup instead of a
mailing list.  What would those same people causing problems on the
existing list use to access the news server?  Outhouse.  And so what
would happen to the headers and the threading?  The same thing.

The problem is endemic to the users, and so the only solution must be
applied there.  Changing over to a new server won't matter at all.


% 
% News servers are cheaper, faster, easier to use, more accessible, easier 
% to archive than mailing lists. That's why I dont see the point of 
% mailing list being primary to php.net.

Because mailing lists are good.  Mailing lists give the recipients more
control and, in this day and age of easy connectivity, make more sense
than replicating a news store everywhere.  I'm sorry if that doesn't
serve your needs well, and I am glad there is a mail-to-news gateway
which should provide a news server for you, but such a thing sure doesn't
serve me (as an example) -- since I only get to read in chunks, I'd miss
countless posts because they'd expire off of the news server before I got
there, whereas when they're safely locked up in my mailbox I can get them
any time I need to.

Don't get me started on the whole spam problem, either.  All of the
newsgroups I've loved over the years have gone downhill due to being
flooded with spam.  I could be wrong, but I don't know of any news spam
cleaners; they're all meant for email.

Mail is good.  News is less so, though it has its place.


HTH  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] PHP Web Hosting

2004-04-22 Thread David T-G
Arthur --

...and then Arthur Pelkey said...
% 
% I am all for adventure when money goes into my wallet, the same cannot 
% be said for the opposite ;)

Being all for money when adventure goes into your wallet?  Heck, I'd be
all for that ;-)


HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] PHP Web Hosting

2004-04-22 Thread David T-G
Rene, et al --

...and then -{ Rene Brehmer }- said...
% 
% According to historical records, on Tue, 20 Apr 2004 10:39:33 -0400 John
% Nichel [EMAIL PROTECTED] wrote about Re: [PHP] PHP Web Hosting:
% 
% -{ Rene Brehmer }- wrote:
%  At 21:19 19-04-2004, John Nichel wrote:
%  
%  Greg Donald wrote:
% 
%  Your signature is twice the rfc1855 suggested limit.
...
% 
%  And the RFC1885 'guidelines' are also almost 10 years old.  I think 
...
%  
...
% 
% A, but the almost 10 year old RFC says this...
% 
% Limit line length to fewer than 65 characters and end a line with a 
% carriage return.
% 
% Hmm ... why the heck 65 characters ??? ... Old EGA screens were 80x34

Because by the time you get to the fourth or fifth reply, just as in this
top-heavy example, the original 65-char line will be shifted over by
quote markers and be nearing the 80-char screen limit after all.

/me fondly remembers a quoting war where the various posters'
contributions made a string of gibberish over 40 chars long ...
/me fondly remembers days when different quoting prefixes were
accepted -- nay, expected -- as well


% characters, VGA is 80x43 characters ... The reason Usenet standard is 76
% chars wide messages (today anyways) is that text-mode readers need the last
% 4 characters to display window borders and control chars along the message
% lines ...

What text-mode readers bother with window borders? :-)

But I agree with the CR/NL/CR-NL bit, and I can't imagine and RFC
casually calling a newline a carriage return.  Odd.


HTH  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] PHP Web Hosting

2004-04-22 Thread David T-G
Stanley, et al --

...and then Stanley X. Martin said...
% 
% Why don't you two just email each other instead of including us all in
% your little pissing contest?

Aw, where's your sense of adventure?

Oops; that one's been used already ;-)


% 
% Stanley G. Martin


HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] Whats faster? text files or mysql?

2004-04-22 Thread David T-G
Andrew --

...and then Andrew Fenn said...
% 
% I have two text files with two rows of data on each line sperated by a tab for about 
20 lines in each file. Would it be faster accessing this data by putting it in a mysql 
table?

For something so small I'd go with a text file unless you happen to
already really know and love your database server -- and it's not doing
much anyway.  The real time savings will come in your programming and
maintenance rather than in file access, so do whatever is easiest for
you.

My guess is that a straight file, even under something as bad as Windows
on an ATA disk, will be faster because of the overhead of talking to the
database; DBs shine when they have tons of data, not ounces.


HTH  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] Unwanted e-mails

2004-04-16 Thread David T-G
Travis, et al --

...and then Travis Low said...
% 
% Lester Caine wrote:
...
% SOMEBODY NEEDS TO GET THEIR ACT TOGETHER AND FIX THE SYSTEM SO THAT WE 
% C*A*N* UNSBSCRIBE !
% 
% I just unsubscribed and re-subscribed, no problems at all.
% 
% Did I miss anything?  :-)

Just some whining, apparently.

Perhaps it's time for me to break out the unsubscribe fee emails again.


% 
% cheers,
% 
% Travis


HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


[PHP] umask() and chmod()

2004-04-15 Thread David T-G
Hi, all --

When I move_uploaded_file() a file into place, I want to give it the
correct permissions; by default they are 600 (rw-/---/--).  I already
have the umask set correctly for any given situation in anticipation of
creating directories, and that works for creating files from scratch, but
chmod() needs a permissions setting rather than a umask.

The challenge is in representing this as octal.  With some mucking around
I was able to print

  $u = decoct(umask()) ;
  $m = 0777 ;
  $r = decoct($m) - $u ;
  print The setting is $r\n ;

and get

  The setting is 664

when umask returns 113.  All is great, right?  Well, no...  I need to
convert that 664 octal value into an octal representation of

  0664

to feed to chmod() -- and apparently I can't just

  $r = 0.$r ;

my way through it, because I get a parse error.

Maybe I'm barking up entirely the wrong tree anyway.  How can I set a
file's permissions based on whatever umask() returns?


TIA  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] umask() and chmod()

2004-04-15 Thread David T-G
Mike, et al --

...and then Ford, Mike   [LSS] said...
% 
% On 15 April 2004 16:26, David T-G wrote:
% 
%  but chmod() needs a permissions setting rather than a umask.
%  
%  The challenge is in representing this as octal.  With some
...
%  to feed to chmod() -- and apparently I can't just
%  
%$r = 0.$r ;
% 
% That would be
% 
% $r = '0'.$r;

Hmmm...  OK.


% 
% I'm not sure, however, that this is a totally foolproof way of doing it, as
% it would fail with any permission set (however unlikely) where the owner

Would it?  Suppose I were setting it to 007; that would be 0007 with the
leading zero and should still be fine.


% odgit was a zero -- perhaps you should be sprintf()-ing it?

Heck, I'll take any advice I can get :-)  I think, though, that the
problem is that I'm trying to use a string -- if I can get it built
correctly in the first place -- as an octal digit.


% 
% Cheers!
% 
% Mike


Thanks  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] file upload

2004-04-15 Thread David T-G
Tony (I'm guessing) --

...and then Anthony Ritter said...
% 
% In the following snippet, which uploads binary files to a mySQL database it
% works fine when Register Globals are set to ON.
...
% $data = addslashes(fread(fopen($form_data, r), filesize($form_data)));

This line is important to note.


% 
% $result=mysql_query(INSERT INTO binary_data
% (description,bin_data,filename,filesize,filetype) .
% VALUES
% ('$form_description','$data','$form_data_name','$form_data_size','$form_data
% _type'));

You use $data here because you created it; good enough.


% 
...
% However, when I turn the Register Globals to OFF and insert a $_FILES[ ][ ]
% array for the form variables such as:
% 
% -
% 
% $data = addslashes(fread(fopen($_FILES[form_data], r),
% filesize($_FILES[form_data])));
% 
% and
% 
% VALUES
% ('$_FILES[form_data][form_description]','$_FILES[form_data][data]','$_FILES[
% form_data][form_data_name]','$_FILES[form_data][form_data_size]','$_FILES[fo
% rm_data][form_data_type]'));
% -

Even though you're still creating $data you're now trying to send

  $_FILES[form_data][data]

as a value and I don't know what that is at all :-)

Change that back to $data and you should be fine.


% 
% The file does not get uploaded.
% 
% Any assiatnce will be greatly appreciated.
% Thank you.
% TR


HTH  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] umask() and chmod()

2004-04-15 Thread David T-G
Mike, et al --

Responding to your second one first...

...and then Ford, Mike   [LSS] said...
% 
% On 15 April 2004 16:26, David T-G wrote:
% 
%  When I move_uploaded_file() a file into place, I want to give it the
...
%  but chmod() needs a permissions setting rather than a umask.
%  
%  The challenge is in representing this as octal.  With some
...
% 
% I've just re-read this properly, and realised you want to feed the end value to 
chmod() -- so all the guff about octal representations is a complete red herring.  
What you want to feed to the 2nd parameter of chmod() is just:
% 
% 0777 ^ umask()

Ah!  Cool!  A bitwise NOT operator!

Perfect :-)


% 
% Within the computer, the value is just an integer, and that's what umask() provides 
and what chmod() expects for its 2nd argument -- so no conversions required.  Even 
0777 is an integer -- it's just a different way of representing 511 which is more 
understandable to us poor humans in that context.

Right.


% 
% Your original offering was, in fact, barking up the wrong tree -- what it was 
printing out, although it looked right, was the *decimal* value 664, which in octal 
would be 01230 and really not what you want.

Right; I wanted to get it as a string and then turn the string into
octal.


% 
% I guess what this boils down to is that integers are just integers when you 
manipulate them in your script -- octal, decimal, hex and any other representations 
are just convenient notations for making them more human readable.

Yep :-)


% 
% Cheers!
% 
% Mike


Thanks again  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] umask() and chmod()

2004-04-15 Thread David T-G
Mike --

...and then Ford, Mike   [LSS] said...
% 
% On 15 April 2004 17:26, David T-G wrote:
% 
%  ...and then Ford, Mike   [LSS] said...
%  %
%  % I'm not sure, however, that this is a totally foolproof way
%  of doing it, as
%  % it would fail with any permission set (however unlikely)
%  where the owner
%  
%  Would it?  Suppose I were setting it to 007; that would be 0007 with
%  the leading zero and should still be fine.
% 
% No.  The way you're building it, $r would be an integer before you add the leading 
zero -- 007 would thus be represented as just 7, and adding the leading zero the way 
I've shown above would give '07'.  Not good.

Indeed.  But of course I was trying to work with a string...


% 
...
%  Heck, I'll take any advice I can get :-)  I think, though, that the
%  problem is that I'm trying to use a string -- if I can get it built
%  correctly in the first place -- as an octal digit.
% 
% Possibly, but I think you're making the whole thing more complicated than it need 
be.  After a quick look at the manual, I'd suggest this:

As I clearly was.  But where did you see ^ in the manual?

Oh, I see it.  I had to look for it as ^ but I found it.  Oops; and it's
an XOR rather than a NOT.


% 
...
% Of course, I've been quite verbose there -- the short version is:
% 
%   $r = sprintf('%04o', 0777 ^ umask());

And the final version, I'm happy to say, is

  chmod ($target,0777^umask()) ;

and it works perfectly :-)


% 
% ... ;))
% 
% Cheers!
% 
% Mike


Thanks again  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] storing an array in an ini file

2004-04-14 Thread David T-G
Red, et al --

...and then Red Wingate said...
% 
% Hi,
% 
% had the same problem before and got around this by writing my own tiny
% parser that should work just nicely ( as serializing is a pain-in-the-ass when
% editing the .ini file on foot )

Indeed :-)

It looks quite interesting; thanks!


% 
% Anyway i switched to using an XML-File now :-)

One of these days...  Baby steps :-)


Thanks  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] SsH

2004-04-13 Thread David T-G
Brent --

...and then Brent Clark said...
% 
% Does anybody know if theirs a function or something for php that when I
% click a button it automatically sshes into a box runs a script and then
% exits? Ive seen it been done in java but php would be better.

If you want to connect from the *server* running php to some other box,
just use a system() call (once, of course, you have set up the keys so
that you can pop over with no password).  If you want to connect from the
PC running the browser, then you'll at least need an ssh program on your
box, and that java version may have implemented that connection for you.


% 
% Kind Regards
% Brent Clark


HTH  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] I need some help And the people at the Bug section pointed me to you

2004-04-13 Thread David T-G
Hi!

...and then [EMAIL PROTECTED] said...
% 
% Im a collage student 

Now that's an interesting one...


...
% on the make install is where I got the error
...
% 
% Reproduce code:
% ---
...
% chmod 755 /www/modules/libphp5.so
% chmod: failed to get attributes of `/www/modules/libphp5.so': No such
% file or directory
% apxs:Error: Command failed with rc=65536
% .
% make: *** [install-sapi] Error 1

Please forgive the perhaps silly question.  Are you root?  More properly,
do you have permission to write under /www?


HTH  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


[PHP] storing an array in an ini file

2004-04-13 Thread David T-G
Hi, all --

I have an ini file for my application and I use parse_ini_file to load it
and some custom code to save modifications.  I'd like to figure out how
to store array values in there since that is the logical place to keep
config data.  If I can't, I could probably use a string with @@ or | in
it as the token but an array is so much more elegant because that's what
it's meant to do :-)

Any suggestions?


TIA  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] storing an array in an ini file

2004-04-13 Thread David T-G
Curt, et al --

...and then Curt Zirzow said...
% 
% * Thus wrote David T-G ([EMAIL PROTECTED]):
%  
%  I have an ini file for my application and I use parse_ini_file to load it
%  and some custom code to save modifications.  I'd like to figure out how
%  to store array values in there since that is the logical place to keep
...
% 
% You could always serialize the array to a value. and unserialize it
% after the call to parse_ini_file().

I thought about that, but what I'm really after is not having to do any
special processing for a variable -- both because it makes special cases
and because then I'd have to reserialize it if I were to write out a
change.

Of course, I may be stuck at that point, but I'd sure love to see how I
can store it natively just like I can declare it natively in a script.


% 
% Curt


Thanks  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] storing an array in an ini file

2004-04-13 Thread David T-G
John, et al --

...and then John Holmes said...
% 
% David T-G wrote:
% 
% to store array values in there since that is the logical place to keep
% config data.  If I can't, I could probably use a string with @@ or | in
...
% 
% If you really need to define arrays, just put them in a .php file and 
% include() it. You're just going to use some hack to do it with an .ini 
% file and parse_ini_file(), so why bother?

1) I had hoped to not have to hack :-)

2) Another file that has to be writable by the web server is a pain

3) If I'm going to code a special case then I might as well do it in the
same file as all of the other configs

4) It would save me having to write yet another save-the-changes
mechanism (I kinda like what I have for the ini file; it worked out well
and has handled everything so far :-)


% 
% ---John Holmes...

Enough already.  I'll serialize any array and then handle it as a special
case.

Thanks to all for the help :-)


HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


[PHP] Wanted: login and CMS system with a twist

2004-04-12 Thread David T-G
Hi, all --

A client of mine wishes to create a web site which does more than just
the typical CMS functions in that what you can see not only depends on
whether or not you have an account but also how old your account is?).
Of course, I'd prefer that it is written in PHP :-)

Any recommendations?


TIA  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


[PHP] Re: commercial autoresponses (was Re: [PHP] Wanted: ...)

2004-04-12 Thread David T-G
Hi again, all --

...and then David T-G said...
% 
...
% Any recommendations?

I was amazed to receive from this

  - an entirely-in-German post apparently wishing me a happy Easter
  - a note from Credit Suisse letting me know they'd process my request
  - a promise from Astral Security and Finance to get back to me

and wondered for a moment if I'd really sent it to the right place!  Have
I really missed so much in a month of being too busy to post on the list?


TIA  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] Re: commercial autoresponses

2004-04-12 Thread David T-G
Jason, et al --

...and then Jason Barnett said...
% 
% David T-G wrote:
% 
% and wondered for a moment if I'd really sent it to the right place!  Have
% I really missed so much in a month of being too busy to post on the list?
% 
% No David, I receive those messages also when I post.  Just block them in 

Bleah.  What a pain!


% your mail reader.  As for your CMS question, don't know anything off 
% hand that does it, but you can track timestamps in your database and 
% show the special page for members that joined at a certain date/time 
% or earlier.

That's what I figured.  I want to avoid reinventing the wheel if
possible, though.


Thanks  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] Wanted: login and CMS system with a twist

2004-04-12 Thread David T-G
Justin, et al --

...and then Justin French said...
% 
% On 13/04/2004, at 1:10 AM, David T-G wrote:
% 
% A client of mine wishes to create a web site which does more than just
% the typical CMS functions in that what you can see not only depends on
% whether or not you have an account but also how old your account is?).
% Of course, I'd prefer that it is written in PHP :-)
% 
% Any recommendations?
% 
% Any CMS / membership system that tracks when the user joined with some 
% form of timestamp should be customisable to meet your needs:

Right.


% 
% ?php
% if($userJoinedStamp  $a) {
%   echo a;
% } elseif($userJoinedStamp  $b)   {
%   echo b;
% }
% ?

Well, actually more like

  if ( mktime() - $user['joined']['stamp']  a )
{ print a\n ; }

but I agree with the idea.


% 
% I'd look for a decent CMS that meets MOST of your needs, then tweak it 
% to match special needs like this one... there's no way you'll find 
% something that does everything.

Yeah, probably not.  But there's always hoping :-)  And I'm moderately
surprised nobody has yet had to invent this wheel (or has done so and not
told anyone).


% 
% Or, build it yourself, and cut out the overhead :)

My art ain't that great; I'd definitely want to start with something that
looked pretty and put on the controls :-)


Thanks  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] .doc file

2004-03-30 Thread David T-G
Tony, et al --

...and then Anthony Ritter said...
% 
% Greets,
% I've been able to open a remote URL, read it and then lop off everything
% except the last line and break it into an array with its' tabs - /t .

Good enough.


% 
% The data will then be inserted into a table.
% 
% However, the following URL shows reservoir storage and is a .doc file.  I am
% unable to run the same script with this URL since it is a .doc file - not a
% .txt file.

E!


% 
% The client has said that this is the only file that their office has and
% does not offer any csv or tsv .txt files.
% 
% Is there anyway to acheive formatting this data using the following file?
% 
% http://water.usgs.gov/orh/nrwww/odrm/storage2004.doc

Have you tried wvware?  It would be a temp file mess, but you could

  - get the doc file and store a temp copy
  - run wvText on it to convert to a text file
  - parse the results
  - clean up, of course

to get your last line.  The wv* utils do a quite acceptable job of
converting DOC files into other formats, and definitely don't need
a Windows server laying around.


% 
% Thank you.
% TR


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


[PHP] replacing chars in input

2004-03-23 Thread David T-G
Hi, all --

I would like to make things easier for my users and replace all of the
garbage characters

  `';:[EMAIL PROTECTED]*()[]{}/?\|+=

plus white space (\s) with underscores in the input.  I am, however,
having trouble getting my regexp to work.

I can comfortably do

  $i = preg_replace(/[\s]/,_,$i) ;

but trying to add other chars doesn't do a thing.

I want to end up with

  A-Za-z0-9_-

(letters, numbers, underscore and dash).

If there isn't a handy character class waiting for me, what must I do to
get those chars replaced?


TIA  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] Re: replacing chars in input

2004-03-23 Thread David T-G
Justin, et al --

...and then Justin Patrin said...
% 
% David T-G wrote:
% 
% I would like to make things easier for my users and replace all of the
% garbage characters
% 
%   `';:[EMAIL PROTECTED]*()[]{}/?\|+=
% 
% plus white space (\s) with underscores in the input.  I am, however,
% having trouble getting my regexp to work.
...
% 
% If there isn't a handy character class waiting for me, what must I do to
% get those chars replaced?
% 
% $i = preg_replace('/[^A-Za-z0-9_-]/', '_', $i);
% 
% That means anything that is not in that class should be replaced with '_'.

*duh*  Of course!  Brilliant in its simplicity.  I can't wait to try it.


% 
% -- 
% paperCrane Justin Patrin


Thanks  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] Image Storage

2004-03-23 Thread David T-G
Matt --

...and then Matt Palermo said...
% 
% I am creating a system to allow users to upload images to the site.  Would
% it be better to store the images in a MySQL table, or having it save the
% images to a directory on the server?  Anyone have any suggestions on this?
% Pros? Cons?

This has been debated to death; check the archives.  Although there are
passionate arguments for both approaches, I *think* that the consensus
for general applications where you don't have a specific reason to put
them in the DB is to go with the filesystem -- but, then, I'm also a
subscriber of that camp :-)


% 
% Thanks,
% 
% Matt
% http://sweetphp.com/


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


[PHP] how does array_multisort work?(!??)

2004-03-18 Thread David T-G
Hi, all --

I have an array like

  $a =
array
(
  'key' =
array
(
  'title' = Topic Title,
  'content' = Topic Content,
),
...
) ;

and I'd like to sort the whole thing not on the keys but on the titles.
It sounds like array_multisort should do exactly what I want, but I can't
seem to get it to work.  For a given source array kind of like

  $a
bookmark
  How To Bookmark
  This is all about bookmarking.
add
  Adding Pictures
  Let's talk about pictures.
zebra
  Caught You Here
  This is about zebras but it has a surprise title.

then I want

  $a
add
  Adding Pictures
  Let's talk about pictures.
zebra
  Caught You Here
  This is about zebras but it has a surprise title.
bookmark
  How To Bookmark
  This is all about bookmarking.

after sorting.

Will array_multisort sort on an arbitrary key of a multidimensional
array, or does it just sort multidimensional arrays but only in key
index priority?

Barring that, I imagine I'd have to either ensure that the array is
constructed in the proper order or make an index of titles = keys so
that I could sort that and then pull the key out to display the list.
Bleah.  Once again it would probably be easier to just lay out a DB
schema!


TIA  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


[PHP] catching URL#target params

2004-03-15 Thread David T-G
Hi, all --

I know that I can easily see

  http://URL?param=value

and even

  http://URL?value

but I haven't found any way to capture

  http://URL#target

as one would use to jump to a certain location in a plain HTML file.
When I try this in a PHP file and run phpinfo, I see nothing that
includes that target.

Is there a var that will work for me?


TIA  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] catching URL#target params

2004-03-15 Thread David T-G
Tom, et al --

...and then Tom Meinlschmidt said...
% 
% Hi,

Hi!


% 
% it could be done only by parsing $_SERVER['QUERY_STRING'] variable ...

Well, that's what I thought of first, but I got nothing.  To wit:

  bash-2.05a$ lynx -dump wftst.web-folio.net/help.php#foo | egrep -i 'foo|query'
 QUERY_STRING no value
 QUERY_STRING no value
 _SERVER[QUERY_STRING] no value
 _ENV[QUERY_STRING] no value

Any other ideas?


TIA  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] catching URL#target params

2004-03-15 Thread David T-G
Chris, et al --

...and then Chris Hayes said...
% 
% but I haven't found any way to capture
% 
%   http://URL#target
...
% Is there a var that will work for me?
% 
% usually this part of the URL  is handled by the browser and I have not find 
% a way to get at this with PHP.

Ahhh...  Bummer!


% maybe via a javascript detour?

Can't do that since I'm trying to write code that can handle the old
style call from some page that hasn't been updated, which means that I
don't control it.  All of my pages that point to help, of course, will
have been fixed already :-/


Thanks  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] catching URL#target params

2004-03-15 Thread David T-G
Tom, et al --

...and then Tom Meinlschmidt said...
% 
% BACK BACK BACK. I'm a stupid fool ...

No you aren't, or that means I'm one for thinking the same thing.

Hmmm...  That doesnt' lend a lot of weight to your side :-)


% 
% #something is NOT send to the server, so it's unable to track it ...

Really?  You mean it stays with the browser entirely?  Wow.


% 
% sorry

Yeah; thanks anyway!


% 
% /tom
% 
% request was a.php?aasdf=1234a#greetz
% and from apache log
% someip - - [15/Mar/2004:15:01:37 +0100] GET /~znouza/a.php?aasdf=1234a HTTP/1.1 
200 3325

Hully gee; it sure looks like you're right.

Well, anyone with old calls will just be screwed, then.  On with work...


Thanks again  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


[PHP] categorizing and array mapping

2004-03-15 Thread David T-G
Hi, all --

So I have this help script which will have a whopping bunch of help
entries in it and I'm thinking about categorizing.

Of course, I could just leave everything in one big array and then use
the targets, which will become the array keys, directly.  But I think I'd
like to categorize the tips, which means that I'll have to find a given
help topic (eg addpix or resize) not just in a big array but in one
of many category arrays (General, Upload, Manipulate, and so on).
So I need to know 'x' for

  $help_x[$tip]

so that I can display the contents.

I'm gonig to have to traverse all arrays anyway, because I'm going to
have a list of categories and tips down the left side, so building some
sort of index probably wouldn't cost me too much.  I could do something
like

  // setup
  $req = some_parse_query_string_function() ;
  // index column down left side
  foreach ( array_values($categories) as $v )
  {
print span class='cat'$v/spanbr\n ;
foreach ( array_keys($categories[$v]) as $k )
{
  $index[$k] = $v ; # index each tip's category
  print a href='$URL?req=$req' class='tip'$req/a ;
}
  }
  // tip window on right side
  print span class='show'$categories[$index[$req]][$req]/span ;

but I wonder if such an index is a good way to go and how that mess on
the last line will really work out.

I had hoped to do this conversion from a big file much like

  html
  head
  /head
  body
  pre
  a name='tipname'
  Text text text
  a name='another'
  More text
  ...
  /pre
  /body
  /html

to something with a nicer presentation in a quick swoop, which means not
going to a database yet (where I could, with a bit of planning, have a
table of categories and tips and easily make my links with the power of
the DB), but if this method will be just as painful as jumping to that
then perhaps I should bite the bullet and do it now.  Or maybe this ver
doesn't get categories, just like the current sprawl of HTML doesn't have
that blessing, either :-)

Recommendations?  Ideas?  Caveats?


TIA  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] Printing landscape

2004-03-15 Thread David T-G
Lou --

...and then Lou Apolonia said...
% 
% Is there a function/parameter that tells the printer to print in
% landscape?  I believe I've searched through the Printer Functions and
% haven't encountered such a thing.

In general, no.  Since PHP runs on the server, it has nothing to do with
your browser or printer or parllel port or phase of the moon.

You might be able to embed printer commands to switch to landscape as
part of your output stream, but it would depend on the printer and not be
very portable.

You could probably find some javascript to tell the browser to tell the
printer to use landscape, but I not only wouldn't sully myself by going
there :-) but don't have the slightest idea where to look anyway.

There's always educating/training the user, but that can be the hardest
task of all! ;-)


% 
% Any help is appreciated.

Good luck!


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] catching URL#target params

2004-03-15 Thread David T-G
Sebastiano, et al --

...and then Seba said...
% 
% I think that the only way to catch it is to rewrite the URL.
% 
% 1)Write pages with appropriates links. Somethink like
% href='www.yoursite.com/anchor_target/index.php'

Hmmm...  Do you mean that I should write the calling page this way?  I
can't do that; I'm planning for pages that I don't own that may not be
updated (or even formed properly from the start).  Or do you mean I
create a subdir and index.php file for every possible link target?  Ugh;
there are way too many of those.

Given a URL like

  http://web-folio.net/help.php#delcoll

that should look like

  http://web-folio.net/help.php?req=delcoll

for the new script, what do I put where in my site dir?


% 
% 2)Create e rewrite rule in the htacces file.

OK.


% 
% 
% 3)Catch the target value from the php page parsing the rewritten URL
% www.yoursite.com/index.phpanchor=target

That sounds good, I think.


% 
% I did it and it works.

Great!  Now tell me more :-)


% 
% 
% Sebastiano


Thanks  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] help with storing multiple values in session variables.

2004-03-15 Thread David T-G
Vimala --

...and then Vimala  S.P. said...
% 
% Hi,

Hi!


% 
...
% Is there any way of passing unicode strings properly with href and get?

If Richard's suggestion of urlencode doesn't work (though I expect it
to), you could also try base64_encode() to form your HREFs and then
base64_decode what you get in the script.  I use it frequently.


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] catching URL#target params

2004-03-15 Thread David T-G
Chris, et al --

...and then David T-G said...
% 
% ...and then Chris Hayes said...
% % 
...
% % maybe via a javascript detour?
% 
% Can't do that since I'm trying to write code that can handle the old
% style call from some page that hasn't been updated, which means that I
% don't control it.  All of my pages that point to help, of course, will
% have been fixed already :-/

After thinking about this I suddenly realized that such a JS detour would
fit well in my main help script, since that is what would catch the

  http://URL#target

link whether it can display it or not.  So in my script, when no param
is specified, I would need some code to see what the #target is and, if
present, reload with the proper ?req=target link.  That might work well.

So now, if I could stand the JS in my script, can anyone write me some
code I can have? :-)


Thanks again  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] * populate menu from directory *

2004-02-16 Thread David T-G
Dustin --

You have started a new thread by taking an existing message and replying
to it while merely changing the Subject: line.

That is bad, because it breaks threading.  When you reply to a message,
your mail client generates a References: header that tells everyone
to which posting(s) your posting refers.  A good mail client uses this
information to build a thread tree of the postings so that it is easy
to see just how they relate to each other.

With your posting style you successfully torpedoed this useful feature;
your posting shows up within an existing thread even though it is
completely unrelated.

Always do a fresh post when you want to start a new thread.  That means
that you do not select any sort of Reply when you start your message.
You can save the list address in your address book (or equivalent) for
convenience.

...and then Dustin Krysak said...
% 
% Hi there - I am a REAL new PHP coder (yeah I mostly use dreamweaver). I 

Welcome, and hang on for a great ride :-)


% was wondering if anyone could point me in the right direction... What I 
% want to do is have a generic template page for say a bunch of quicktime 

Good enough.


% movies... it would have a movie embedded, and a drop down menu below to 
% select the movie you want to watch.. what I was hoping to do was have 
% the menu populated by pulling the file names from the movies in the 

Easy enough, especially depending on where they live.


% directory on the server. I want to be able to simply FTP a new movie 
% onto the server, and then have the menu update itself. possible? I 
% would also be looking to do something similar with JPGS.

1) There are lots of gallery scripts out there, so you might look around
and avoid reinventing the wheel.

2) If the files are in the same directory as the script, just open the
dir and walk through it.  Be sure to not present '.' or '..' in the menu
(but still check whatever input you get back anyway).  If they're off in
some master directory, then do the same thing but look over there.

3) If the file paths are stored in a database, just connect to the DB and
pull the list and then loop through it just as in #2.


% 
% 
% d


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] A dumb question

2004-02-12 Thread David T-G
Jeremy --

You have started a new thread by taking an existing message and replying
to it while merely changing the Subject: line.

That is bad, because it breaks threading.  Whenever you reply to a
message, your mail client generates a References: header that tells all
recipients to which posting(s) your posting refers.  A mail client uses
this information to build a thread tree of the postings so that it is
easy to see just how they relate to each other.

With your posting style you successfully torpedoed this useful feature;
your posting shows up within an existing thread even though it is
completely unrelated.

Always do a fresh post when you want to start a new thread.  That means
that you do not select any sort of Reply when you start your message.
You can save the list address in your address book (or equivalent) for
convenience.

...and then Jeremy Schroeder said...
% 
% Hey Group

Hi!


% 
% I am starting to write class and objects and came across some syntax 
% that I dont understand.
% 
% What does the ampersand do in the bottom example code, they both work.
% 
% $n1 = $num1 - function();
% $n1 =  $num1 - function();

1) Search the manual.

2) Assigning by reference, as compared to the default assigning by value,
means that the variable on the left of the '=' now points to the very
same little chunk of memory as the variable on the right.  This is
different from the usual assignment in that when you change the left var
you change the value for the right var, too.

  $a = 1 ;
  $b = $a ;
  $c = $a ;
  $b++ ; $c-- ;
  print a = $a ; b = $b ; c = $c ;\n ;
  // a = 0 ; b = 2 ; c = 0

3) You can't, as far as I know, assign-by-reference a function, so your
code should generate a parse error.


% 
% -Blake


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] writing a manual

2004-02-10 Thread David T-G
Tim --

...and then Tim Thorburn said...
% 
% Hi,

Hiya!


% 
% Sorry for the slightly off-topic post, but I've just had a client ask me to 
% create a manual for the site management tool I wrote for them last 

Interesting...  You mean the tool isn't self-documenting? ;-)


% fall.  Since I've never had to do one before I'm a bit lost on what would 
% be a reasonable amount to charge and whether or not I should put any 

Technical writers charge plenty of money, too, so don't feel that this
work shouldn't cost much.  If I were you I'd set an hourly rate, perhaps
the same as your usual programming rate, and then spend an hour or two
sketching out an outline and perhaps an introduction.  This will give you
a better idea of how long it will take to do the whole thing and also
give the client something to see when he sees your quote (or estimate).


% restrictions on how many copies they receive or if I'm ok with them 
% photocopying and handing them out all over the organization.

Personally I wouldn't worry about this.  Deliver it in soft copy anyway
and then let them print as many copies as they like.  You're already
making money from the app (right? :-)

Once you get the hang of it, you may even integrate documentation into
your coding process (and, therefore, the price) so that a basic manual is
done when the code is and then you need only charge for fleshing it out.


% 
...
% PHP/MySQL stuff, though last time I tried to put a manual together it 
% quickly got to be over 40 pages and that client decided they didn't want it 
% in the end.

This is another reason you want to charge for your initial development
and show them where you're going.  There's no need to spend hours and
hours on the project only to not get paid for any of it.


% 
% Thanks
% -Tim


HTH  HAND  please let us know what you find and how you go

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] Re: Linked Table Structure

2004-02-10 Thread David T-G
Sajid --

...and then Sajid said...
% 
% Hi,

Hi!


% Thanks for your help.
% But what i feel is that this is a more tedious process to achieve what i
% want to.

Sometimes database work is :-)


% What will happen in this is that i have to enter proper Continent ID and
% Country ID in both Country and Club tables respectively.

That's true.  If you want a club to be in a particular country then
you'll have to specify what country.  How else could you do it?


% For that i have to go and check that these ID's are in the other tables.

Ahhh...  Now you're talking about 'foreign keys' in your relational
database.  This ensures that, should you change the country ID in the
country table, all of the clubs for that country will be updated.

You'll still have to enter the country ID, though, whether manually,
through a pulldown, or by matching text.


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] boolean search class

2004-02-06 Thread David T-G
Ray, et al --

...and then Ray Hunter said...
% 
% On Thu, 2004-02-05 at 20:46, David T-G wrote:
%  
%  I'm implementing a search and would like to move beyond accepting
...
%  are not in a database, so I won't be passing SQL code off to a real
%  searcher.]
% 
% How are you doing the search if not with a database?  What is your logic
% for implementing the search?

Very, very simple stuff.  The list of directories and files is held in an
array (a separate process uses File_Find-maptree() to make it after any
updates and writes the serialized array to a cache file, and then I read
it in) and I just want to do a text match.  At the moment I'm using
preg_grep but that just got a little unweildy because the next requirement
was for 'or' separated by spaces, so I quickly explode(' ')d the input
and now loop through the search array but I really don't want to have to
write a boolean parser (did it for class in college; that was enough :-)


% 
% I have used lucene (Jakarta-Apache) for doing searchs that is
% outstanding.

Hmmm...  Does this sound applicable?  What does lucene search?


% 
% --
% Ray


Thanks  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] boolean search class

2004-02-06 Thread David T-G
Ray, et al --

...and then Ray Hunter said...
% 
% On Fri, 2004-02-06 at 06:47, David T-G wrote:
%  Very, very simple stuff.  The list of directories and files is held in an
%...

% That is simple enough, however, I dont see much flexibility in it with

Just between you and me, I tend to agree, but at this point we don't need
flexibility.


% searching. So you are doing searching on directories and file names

Not quite; the serialized array *does* contain the directory list.
Imagine

  $tree =
  (
[0] =
(
  [0] = ./d1 ,
  [1] = ./d2 ,
  [2] = ./d2/s1 ,
  [3] = ./d2/s1/s2 ,
) ,
[1] =
(
  [0] = ./d1/f1 ,
  [0] = ./d1/f2 ,
  [1] = ./d2/f3 ,
  [1] = ./d2/f4 ,
  [1] = ./d2/f5 ,
  [2] = ./d2/s1/f6 ,
  [3] = ./d2/s1/s2/f7 ,
  [3] = ./d2/s1/s2/f8 ,
)
  )

or so.  Now my input is 'd1' or 'f2' or even 'd1 f2' or such.


% based on what is in the serialized array?  Will you need to search the
% document in the near future?

Presumably; this is a way to look through a directory tree and return
pointers to those that match.  Typically we'll have an array of 20 or 30
directories; often we'll have maybe 100; on rare occasion we might have
250 or more.


% 
% Lucene has that logic in it. However, not sure if lucene is the way to
% go. It will work for what you are doing. However, it might be an

OK; I'll at least read up on it.  Thanks!


% overkill depending on how many files you are searching on. You might be
% able to write a regexep using preg_match that will return what you are
% looking for.

Probably, but I'm more worried about handling some wacky input like

  (this or that) and the and (ot or her)

or something wonky.  So I could always kick back a no way, buddy! error
but I don't want to throw up all over everything getting confused by it.


% 
% --
% Ray


Thanks  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] thumbnail script

2004-02-06 Thread David T-G
Ryan --

...and then Ryan A said...
% 
% Hi,
% Anybody know of a thumbnail script which does either one of the following:
[snip]

Why, yes.  I call it

  http://web-folio.net/

and it does everything for which you ask and then some.  Just send all of
your clients to host with me and I'll give you a commission ;-)

OK...  Having spent quite a bit of time developing our gallery script
and a bit of looking around at competition, I haven't seen anything that
comes close.  In general, though, it's not too tough to check your source
files and both make the thumbnails and generate their image tags to
output in the page.


HTH  HAND  Good luck!

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] recursive direcotry listing

2004-02-06 Thread David T-G
Binay, et al --

...and then Binay said...
% 
% Hi all,

Hiya!


% 
% is there function which scans a particual directory recurisly and stores the content 
in array or other way? Listing of files should be in alphabetical way and directories 
should come on top.

Yep.  Get the File_Find pear module and just

  $find = new File_Find ;
  $separate = $find-maptree(.) ;
  $mixed = $find-maptreemultiple(.) ;

Now $separate looks like

  Array
  (
[0] =
(
  [0] = .
  [1] = ./d1
),
[1] =
(
  [0] = ./f1
  [1] = ./f2
  [2] = ./d1/f3
)
  )

and $mixed looks like

  Array
  (
[0] = f1
[1] = f2
[d1] =
Array
(
  [0] = f3
)
  )


% 
% Thanks
% 
% Binay


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] FreeBSD to Linux -- PHP Issues

2004-02-06 Thread David T-G
Daryl, et al --

...and then Daryl Meese said...
% 
% Hello all,

Hi!


% 
% I am considering changing hosting providers and moving from FreeBSD to
% Linux.

Because that's what the hosting provider you have in mind runs or because
you want to go with Linux?


% 
% My question is are there any PHP related issues to moving (functions that
% don't work on Linux but do on FreeBSD, etc)?

I haven't had any problems.  I host my sites on FreeBSD 4.5 and 4.8 and
develop on Linux (SuSE 8.1 and 9.0 and an LFS homebrew box).  I did
another project for a guy hosting Linux here at the same ISP.  Everything
has been peachy.


% 
% I doubt there are but have to cover the bases.

Good for you :-)  Of course, you won't really know until you run your
code on the new platform!


% 
% Also, if you got any suggestions for hosts with solid dedicated server plans
% I would appreciate replies of the list.

I host at DataPipe and absolutely love them.  I've pushed their UNIX
techs pretty hard (my FreeBSD boxes have a pretty involved PHP build,
while the Linux box needed some custom disk layout for mail tuning) and
they've kept up well.  They do everything from shared to dedicated and
their prices are pretty good -- and I've seen them match, too.

Yes, I sometimes can talk them into a free month for my cheapest server
if I send them a new customer, so if you do go to them I'd appreciate
your telling Don in sales that I sent you, but you don't have to and I
don't get anything else in any case :-)


% 
% Thanks,
% 
% 
% Daryl Meese


HTH  HAND  Happy hunting :-)

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] thumbnail script

2004-02-06 Thread David T-G
Ryan, et al --

...and then Ryan A said...
% 
% Hey David (my pal with the funny % prefix to replies...:-p )

Hi, Ryan (my ex-logo-drawing-buddy with the non-threading mailer ;-)


% Thanks for replying.

Sure thing.


% 
%  Why, yes.  I call it
%  http://web-folio.net/
% 
% Nice name.

Thanks!


% 
%  and it does everything for which you ask and then some.
% Kewl, is it free and can i download it and use it on my website?

Heh :-)  We're selling a service, dude.


% 
%   Just send all of
%  your clients to host with me and
%  I'll give you a commission ;-)
% 
% Damn, that answers my question, its not free and I cant download and use it
% on my website (wa)

Yep.


% 
% On a more serious note, nice site mate, but reay steep on the pocket,
% $250 setup fee? my pal sets up

It's a start.  We can see if the market dictates a change.


% computers and furnature for a lot less, and $25 a month for 100mb space? I
% know porn friendly sites that
% charge less and offer more. Reading prices like that made my right hand jump

Ah, but it's not just some space we're offering.  Go back and look again
(and then please tell me how you missed it and what needs to clarified,
because it's supposed to be obvious :-)

Think like a person definitely *not* on this list.  Your average realtor,
interior designer, quilter, flower arranger, jewelry maker, painter, or
whomever won't know the first thing (well, perhaps, but not the second
thing!) about how to put files on a web site or lay out web pages or even
what goes into making a web page.

What we do is make it incredibly easy to upload and manage pictures,
automatically handle the thumbnailing and layout into pages, and give you
plenty of space to do it (100M holds about 500 pix).  I know dozens of
realtors who each paid $1k for a template site (no indivduality there!)
with a glamour shot, a couple of buttons, and maybe another picture.
Then they pay $700/yr for basic hosting with no extras.  Meanwhile, they
don't know how to put up pictures, so they have to find students or,
worse yet, pay geeks to upload pictures -- and then they only get room
for a dozen or so.

In the small business market where people want reliable hosting with no
worries just like anyone else but don't have a budget for a designer and
a big hosting company, $25/mo is cheap.  At least, that's the plan ;-)


% for the mouse and find the little
% x at the top right of my browser and made me reach for a coke because of the
% fright I got! :-D

*grin*


% I'm pretty sure you wont get anyone off the list purchasing an account and
% there are a lot of people out there

Well, maybe not, but we're not really targeting the people here.  I know
that I can't compete on raw price (I don't have the investment capital to
create a data center that can handle the volume of customers that it would
take to do that), and I don't want to sell geeks because I've seen how
demanding and bothersome I am :-)

The value definitely has to be in the service.


% who pay more for _total_ crap, and your service is good sobest of
% luck and hope it goes well.

Thanks; we do, too.


% 
% 
%  OK...  Having spent quite a bit of time developing our gallery script
%  and a bit of looking around at competition, I haven't
%  seen anything that
%  comes close.
% 
% This sort of an app never really did cross my mind...so i dont know what
% your compettion is like, have a couple
% of urls? I promise i wont join any of them :-p

I don't have 'em handy, I'm afraid.  Check hotscripts and the like for
any gallery or thumbnail script.


% 
%   In general, though, it's not too tough to check your source
%  files and both make the thumbnails and generate their image tags to
%  output in the page.
% 
% Yeah, thats what i have been told on the list and off, but I have never
% really worked with GD + the image functions

Bah.  Nor have I; I use ImageMagick :-)


% and it seems better to first look around to see if anyone already made this
% rather than to try to invent the wheel all over

That's a good approach, and a good way to get started quickly.  It can
bite you in the long run, though.


% again, although I agree with Justin saying that while remaking the wheel
% you will understand the code better and it will
% be more specific to your needs. Another problem is I have GD 1 on one server
% and GD 2 on another...

This is also a good approach, and it can still end up biting you as you
grow, so I'm all for the former and then for rewriting from scratch for
version two :-)


% 
% I did get a few really helpful souls off the list who sent me code, mainly
% for jpg stuff, will try that out.

That's why we're all here :-)


% 
%  HTH  HAND  Good luck!
% 
% Sure did, and the same to you dude.

Thanks :-)


% 
% Cheers,
% -Ryan
% 


HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science

[PHP] boolean search class

2004-02-05 Thread David T-G
Hi, all --

I'm implementing a search and would like to move beyond accepting

  this that other

for simple any-word searching to a real boolean search.  Has anyone seen
any good classes or even functions for such?  [No, the source contents
are not in a database, so I won't be passing SQL code off to a real
searcher.]


TIA  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] boolean search class

2004-02-05 Thread David T-G
Daniel, et al --

...and then [EMAIL PROTECTED] said...
% 
% Mysql 4 MATCH AGAINST

Thanks for the reply, but how will this help me when a database is not
involved?


HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] Size of Arrays

2004-01-29 Thread David T-G
Sandro --

...and then Gandolf said...
% 
% Hello NG,

Hello from the mailing list :-)


% could anyone tell me how much is be the biggest size of an array - how many
% values could an array have?!
% I have to import 100.000 to 10.000.000 values an I have to know where the
% limit is.

1) I know of no practical limit, though realistically it's probably
MAXINT or so.

2) Five minutes with a test script would tell you, and I bet google could
tell you, so why bother the list with a question you could so easily
answer for yourself?  Go and try it and then report back where (if at
all) it breaks.  My bet is that you'l exhaust RAM and swap before you
break php, especially if you actually store something -- like, say, 32
bytes of useless string output -- in each entry.


% 
% Thanks a lot,
% 
% Sandro


HTH  HAND  Good luck

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] Create a zip archive from a folder

2004-01-29 Thread David T-G
Matt --

...and then Matt Palermo said...
% 
% Hello.  Does anyone know how I can easily create a zip archive from a folder

I can't say for certain that it will create, but the pclzip class from
Vincent Blavet seems pretty good and I use it extensively for extraction.
His site is

  http://phpconcepts.net/

but that seems a little sicko at the moment, so you might try sourceforge
instead.  If you google for pclzip you'll get lots of links.


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] Size of Arrays

2004-01-29 Thread David T-G
Stuart, et al --

...and then Stuart said...
% 
% David T-G wrote:
% 2) Five minutes with a test script would tell you, and I bet google could
...
% all) it breaks.  My bet is that you'l exhaust RAM and swap before you
% break php, especially if you actually store something -- like, say, 32
% bytes of useless string output -- in each entry.
% 
% Indeed. The following script had my machine happily swapping like crazy 
% at 320,000 array items (each being 1k, task manager showed 640meg total 
% memory in use on this development machine with 512meg RAM running WinXP).
[snip]

*grin*

We can figure, then, that if you cut down to 32b you'll probably get to
about a million entries, which is a nice, BIG, round[ish] number.  You
ought to give it a go.

My laptop and my dev server are in the middle of a 12G transfer, and my
production servers are, well, production, so I can't try this now, but if
there's interest I'll give it a go later.  My dev box (LFS Linux) only
has 384M RAM, though, so it won't be anything awesome.  A buddy of mine
hosts on a 2G [quad Xeon -- yum!] box with another 2G of swap, but he'd
kill me if I took down his business!

Anyone (perhaps at some company with deeper pockets than mine) have a
hefty dev server that could risk a crash in the name of playing mine's
bigger? :-)


HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] naming a directory after a user-submitted string

2004-01-28 Thread David T-G
Mike  Joey, et al --

...and then Mike Migurski said...
% 
% What kind of checking/filtering/changing do I need to do on a
% user-submitted string before I can feel comfortable using it to name a
...
% appreciative.  Or is this just a Terrible Idea That Should Never Be
% Contemplated?

In general, I'd say the latter, but I'm a little harsh :-)


% 
% A file or directory name in Unix can contain any character, except a

Note, however, that allowing many of these characters will cause you no
end of headaches.


% slash. On mac OS, you also can't use a colon because that was the old mac
% way of delimiting directories. I imagine windows has a similar restriction
% on the backslash. I think it has to be less than 256 characters as well,

Windows has numerous restrictions, both on characters allowed anywhere
and special names.

The only special characters I would allow are '@.' (in case you're naming
after email addresses) and the fairly common '_-' (polite word separators
to help your users) which gives us

  a-z
  A-Z
  0-9
  @._-

I don't really see a need for a comma, though that could be included as
well.  Anything else is likely to mess you up when trying to handle it
(just try to print a text input box whose value is

  O'Banion said come!

or such and have it show up in the browser...).

I'm also the type who will kick back an error rather than trying to
reformat the string, either in order to get rid of bad chars or to make
something unique in the event of a collision.  Thus, a simple

  if ( preg_match('/[EMAIL PROTECTED]/',$string) || file_exists($string) )
{ puke() ; }

could work nicely.


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] amp

2004-01-28 Thread David T-G
Diana --

...and then Diana Castillo said...
% 
% is there any function that will always replace a  with a amp in a
% string?

You are looking for a function ... A function that will replace an HTML
special character ... A PHP function to do this.  I shall consult the
Great Programmer.

Something is coming to me ... I see a function ... It's ... It's ...
It's in the manual!  [HINT: look for 'special character' since you
clearly didn't look for 'amp', which would do about as well.]


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] amp

2004-01-28 Thread David T-G
Stuart, et al --

...and then Stuart said...
% 
% Diana Castillo wrote:
% is there any function that will always replace a  with a amp in a
% string?
% 
% $string = str_replace('', 'nbsp;', $string);

Clearly I must need more coffee, because I completely fail to see how
this will satisfy her requirement.  Does this somehow do something other
than what it obviously appears to do?


% 
% -- 
% Stuart


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] Return-Path header and sending email with php

2004-01-25 Thread David T-G
Chris --

You have started a new thread by taking an existing message and replying
to it while merely changing the Subject: line.

That is bad, because it breaks threading.  Whenever you reply to a
message, your mail client generates a References: header that tells all
recipients to which posting(s) your posting refers.  A mail client uses
this information to build a thread tree of the postings so that it is
easy to see just how they relate to each other.

With your posting style you successfully torpedoed this useful feature;
your posting shows up within an existing thread even though it is
completely unrelated.

Always do a fresh post when you want to start a new thread.  That means
that you do not select any sort of Reply when you start your message.
You can save the list address in your address book (or equivalent) for
convenience.

...and then Chris Balay said...
% 
% Good Day Coders -

Hello!


% 
% I have built a newsletter program with php. It sends out an e-mail to a 
% couple thousand subcribers every day. All works well. My problem is that I 

Interesting.  I'm always astonished the people use php for mailing list
work instead of just using mailing list software.  But I'm glad it works.


% have know way of finding out which e-mails are not being delivered 
% successfully.

If you're running under safe mode, you're apparently stuck.  If you're
not, you need to go back and read the manual again.  It's either the
second gunman on the grassy knoll or the fifth parameter ;-)


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] Upload file size limits

2004-01-25 Thread David T-G
Chris --

...and then Chris Edwards said...
% 
% I would like to give the users of my web site the ability to upload video
% type files, up to 12 megs in size.

OK.


% 
% I notice in my PHI.INI there is a
% 
%  memory_limit =8M  ; Maximum amount of memory a script may consume
% (8MB)
% 
% does this include temporary such as a file being transferred?

As far as I can tell it does not; I have uploaded 20M and larger files
but haven't tweaked memory_limit.


% 
% Also I intend to set the PHI.INI 'upload_max_filesize = 2M' to
% 'upload_max_filesize = 12M'.

Good.


% 
% Am I going in the right direction?

You sure are!  This has, by the way, been covered in great detail; you
should check the archives for more info.


% 
% Thanks.


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] porting perl scripts to php

2004-01-24 Thread David T-G
Al --

You have started a new thread by taking an existing message and replying to
it while merely changing the Subject: line.

That is bad, because it breaks threading.  Whenever you reply to a message,
your mail client generates a References: header that tells all recipients
to which posting(s) your posting refers.  A mail client uses this information
to build a thread tree of the postings so that it is easy to see just how
they relate to each other.

With your posting style you successfully torpedoed this useful feature; your
posting shows up within an existing thread even though it is completely
unrelated.

Always do a fresh post when you want to start a new thread.  That means that
you do not select any sort of Reply when you start your message.  You can
save the list address in your address book (or equivalent) for convenience.

...and then [EMAIL PROTECTED] said...
% 
% Hi,

Hi!


% 
% I was wondering if there is an easy way to port perl scripts to php, or
% maybe someone could recommend someone who could help me?

The two languages are not terribly different; you may be able to do the
porting on your own if you know php.

You could exec the perl script and get the result if that setup works for
you.

I would be happy to be of service if you would like.  Feel free to drop
me a reply.


% 
% Thanks,
% Al


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] Securing php from rogue php scripts

2004-01-23 Thread David T-G
Adrian, et al --

...and then Adrian Teasdale said...
% 
% Hi there

Hi!


% 
% I have been reading about certain php scripts that, if used incorrectly,
% can compromise servers. There are certain open source scripts that I

Interesting.


% know if (no names mentioned) that have exploits that allow this and I
% want to know if there is a How to or best practice anywhere for
% securing PHP against this.  I was told to add some stuff to the php.ini
% file to prevent certain actions (phpinfo ,system, include, chown, chmod,
% exec, passthru, mail, readfile , dir , read, readdir) but was wondering
% if someone could give some advice

1) I'm no expert, though I'd like to be somewhat closer

2) If you're not speaking of safe mode, then look at safe mode

3) Please share what you find to help others, including me.


% 
% 
% Thanks
% 
% Ade


TIA  HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] PHP and email attachments

2004-01-22 Thread David T-G
Tim, et al --

...and then Tim Thorburn said...
% 
% Hi,

Hi!


% 
% A client of mine asked today if I could setup their current mass mailer to 
% send out attachments - I've never sent attachments with the mail() function 
% before, but before we get into that ... I wanted to ask an opinion of the 
% group.
...
% 
% This is the way I'm pitching it tomorrow, but are there any benefits to 
% actually sending these ppl a file attachment to their email that maybe I'm 
% not realizing?

I'm at the far, far extreme of the no eye candy email camp, so don't
get me wrong, but the obvious benefit of sending the attachment along
with the email is that it is then there for the user when he reads his
mail, whether he is on the 'net or not.  I spend little time on web sites
and almost none on forums (everyone's favorite, I know), but I get over a
thousand emails a day (29382 so far this month).  When I get an important
email that requires me to drag out the web browser, it immediately becomes
pretty unimportant.

That said, I also agree that your mail queue times will go way up if
you're sending large attachments along, so if you *do* attach, it should
be 1) relevant  required and 2) compact.  What sort(s) of attachments
are they considering?  If they want HTML-ized mail with pictures and
stationery backgrounds, then tell 'em to go and jump in the lake (well,
when dealing with the client, who is always right, sometimes we have to
be more diplomatic).  If they're sending huge MS-Offends files around,
strongly encourage them to re-think the presentation method and at least
to strip to RTF and then zip to compress.  If it's, say, a PGP signature,
then congratulate them and get to work :-)


% 
% Thanks


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] PHP and email attachments

2004-01-22 Thread David T-G
Radith --

...and then Raditha Dissanayake said...
% 
% I get over a
% thousand emails a day (29382 so far this month).  When I get an important
...
% not to mention the countless mails we recieved from you a couple of 
% months ago on this mailing lists topic in both the PHP and the qmail 
% list :-)

You noticed!  And you remembered!  How nice!  [Or does that just mean
that everyone still hates me? ;-]

Recall, though, that that was all about performance tuning (I eventually
got my processing down to a solid 110ms per message and under 15min of
queue latency on about 40k messages without having to buy any hardware or
even recompile for ridiculous queue concurrency; I'm pretty happy).  I
wasn't asking how to attach a 7 megabyte Word doc with illustrations,
half a dozen fonts, and stationery :-)


% 
% but seriously, Tim david knows his stuff i would listen to him.

*blush*  Thanks!


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] thumbnail

2004-01-21 Thread David T-G
Ed, et al --

...and then Ed Curtis said...
% 
%  Personally, I think Imagemagick's mogrify works alot better. I've been

I'm quite happy with IM, too, and use it both within and separate from
PHP.


% using GD for the past few months and it's very inconsistent on thumbnail
% quality even when the quality setting is at maximum.

How very interesting...  Thanks for the tip.


% 
%  The only real problem with mogrify is that you have to copy an image to a
% seperate location if you want to keep the original file as it overwrites
% the file it's making a thumnail of.

No need to copy+mogrify; just use

  convert [options] /path/to/old /path/to/new

instead :-)


% 
% Ed


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] a clean way to upload

2004-01-16 Thread David T-G
Matt --

...and then Matt Hedges said...
% 
% ?

He's telling you to search the list archives.  This is not new ground
you're breaking here.

Just call getimagesize() on the temp file and see what type it reports
back.


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] a clean way to upload

2004-01-16 Thread David T-G
Matt --

...and then Matt Hedges said...
% 
% Hello all,
% After playing around with the options, I've found that the following method
% for uploading something with constraints is the easiest...

I don't get it...  You have to upload in order to get to the server, so
all you're doing is returning the page saying hey, you blew it; try
again.  Where is the 'ease of uploading'?


TIA  HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] nested tags

2004-01-15 Thread David T-G
Gregor --

...and then Gregor Jaksa said...
% 
% HTML tags.

Yes, you can nest HTML tags.  The example below needs tr and td
elements to contain the second table, but in general it's fine.


% I can have something like
% table
%   first
%   table
% second table
%   /table
%   table
% /table
% 
% and i need to convert each table/table tags into something more user
% friendly.

Aside from John's suggestion :-) I don't see how much more friendly
you'll get.  Of course, I don't know where you're going, either.  Do
you mean, perhaps, that you want your user to be able to write

  first_table
first
second_table
  second table
/second_table
table
  /first_table

or the like?  Can you give us any more detail at all?


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] R: [PHP][PEAR] PEAR::DB_Common::nextId()

2004-01-15 Thread David T-G
Alessandro --

...and then Alessandro Vitale said...
% 
% hi,

Hi!


% 
% thanks to Rory for his suggestion.
% sure mysql_insert_id() could help. but I was looking for some trick for
% accessing the result of that function without having to deal to
% mysql_connect() again.

But how will you query the DB then?


% and i found it: PEAR::DB::getOnce(SELECT LAST_INSERT_ID());

Believe me, this has to be connected or it's doing the connect for you.


% doesn't work perfectly but is ok.

If that's good enough for you, then that's fine :-)


% 
% cheers
% 
% alessandro


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] nested tags

2004-01-14 Thread David T-G
Gregor --

...and then Gregor Jaksa said...
% 
% Can anyone provide me with some link or code on how to deal with nested
% tags.

What kind of tags?  HTML?  PHP?  Mattress?

What do you want to accomplish?


% 
% thx!


HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: Re[2]: [PHP] Can php select which ini file to use?

2004-01-13 Thread David T-G
Chris, et al --

...and then Chris Shiflett said...
% 
% --- Richard Davey [EMAIL PROTECTED] wrote:
%I need PHP4 and 5 on the same machine
%  
%   This can't happen. You'll have to pick one or the other.
...
% I was under the impression that the conflicts between the two were more
% fundamental to the engine and not platform specific. You're running these
% both simultaneously and haven't run into problems?

Even though he didn't ever say simultaneous, as he replied, it still
isn't impossible.  At the very least you can have two apaches listening
on two different ports and have one run php4 and the other run php5; I
strongly suspect that you could even have the primary recognize php5
files and hand them off to the other apache just like when you run
sites on their own ports instead of all sharing the same.


% 
% Chris


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] picturing webpage

2004-01-09 Thread David T-G
Eli --

...and then Eli Hen said...
% 
% Hello All,

Hi!


% 
% I wanted to know if it is possible to picture a webpage via PHP.
% By picturing I mean that the program can generate a picture, a view, out

Hmmm...  An interesting concept.


% of the page URL given. (Like sometimes you have in search engines, that you
% see the site URL and besides is the picture of the first page of the site).

Can you provide an example?  I know I've never seen this feature, and I'm
not sure I follow what you mean.


% What technologies I use for that? Is it possible with PHP?

Dunno and dunno, but let's find out :-)


% 
% -thanks, Eli


HTH  HAND  Happy New Year

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] Form validation: client- or server-side?

2004-01-09 Thread David T-G
Matt --

...and then Matt Grimm said...
% 
% Is there a distinct advantage to doing form validation / error checking on
% the server side using PHP?  That's how I've always done it because I know

1) I hate JavaScript.

2) Don't trust anything coming from a client.

You should be validating on the server anyway -- empty fields and all --
and so there's no need to do it twice especially when it eliminates
surfers who don't use JS.


HTH  HAND  Happy New Year

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] [Fwd: failure notice] Why??

2004-01-06 Thread David T-G
Rolf, et al --

...and then Rolf Brusletto said...
% 
% Whenever I submit a message to this list, I get a bounce back saying its 
% a dupe, anyone have any ideas?

I figured some pair subscriber has a loop in his .forward setup.


% 
% -- 
% Rolf Brusletto
% rolf[at]emailfeeds[dot]com
% http://www.emailfeeds.com


HTH  HAND  HNY

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] Comparison PHP to Perl

2004-01-06 Thread David T-G
Warren --

...and then Warren Vail said...
% 
% I am looking for a comparison of features supported by PHP vs those
% supported by Perl.

In general, I'd say that there's nothing that one can do that the other
can't, though I'd also say that for things not native to the language
(or even for things native that someone wanted to do differently :-)
perl will have a better library of modules available.


% 
% My gut tells me PHP is more robust, but we are trying to implement something

Interesting...  perl is a much more mature and seasoned language than
php; why do you figure the latter to be more robust, or perhaps how do
you define the term?  [Don't get me wrong; I think that php is growing
like a weed and will, within just a few years, show that same level of
maturity, depth of functionality (very much via contributed code), and
breadth of deployment.]


% in a company that has long had a standard allowing Perl as a sanctioned
% language, but current management does not want to fight for PHP as a new
% sanctioned language (most managers there have never heard of PHP and the
% resident Java zealots have almost established a monopoly).  The kind of

Bleah.  Anything but Java!


% thing I am looking for is SESSION support, I know it's supported by PHP, but
% not sure about Perl.  I don't want to have to grow my own session manager.

Recall that, for many years, nearly all dynamic web pages under Apache
were written in perl; after all, nobody wanted the overhread of a shell
process and nobody wanted the hassle of writing in C.  I will say with
confidence that perl can do anything that php can do, including sessions
(though I'm not an expert in either language; in fact, my perl is quite
rusty since I've been doing very primarily php for a while now).  There
is almost no piece in perl, such as the session manager you mention,
which you have to write; it's not uncommon to write a script which uses
a bunch of different modules and all you write is a bit of glue calling
one and handing to the other :-)

Does that make it right or wrong for you?  Nope; not by any means.  One
of the great shining points of php, IMHO, is how easy it is to write the
code and how you can turn it on and off for spitting out raw HTML (though
I must admit that I very, very rarely do so myself and even keep trying
to move to abstraction of data via templates, but that's neither here nor
there), and I agree with Mike that you can get punctuation soup pretty
quickly in perl -- though that's usually because of lazy programming, and
you can have lazy or bad programming in any language, including php.

You might talk to some of the more sane perl zealots there (yes, I'm sure
there are plenty and off the deep end, too :-) to learn a bit about perl
and cpan and more.  You might find it not so bad.  I definitely prefer it
for doing system scripts; I use the php CLI for one-lining test code, and
I have written php system scripts, but perl is [currently] better suited
to tasks where the web is nowhere in sight.


% One alternative is mainframe COBOL, which clearly will not support what we
% want to do.

As I said, anything but Java :-)


% 
% What would I lose by implementing in Perl (other than my mind)?

Probably nothing.  Meanwhile, by moving away from their standard language
for this one project, you'd be introducing a whole new ball of maintenance
that probably shouldn't be there.  If you want php for one project, don't.
If you want php as a new language, you might pick some of the uglier perl
scripts they have and rewrite them in php to show how straightforward and
pretty it is.


% 
% thanks in advance,

Good luck!


% 
% Warren Vail
% [EMAIL PROTECTED]


HTH  HAND  Happy New Year

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] Piping email

2004-01-04 Thread David T-G
Adrian --

You have started a new thread by taking an existing message and replying to
it while merely changing the Subject: line.

That is bad, because it breaks threading.  Whenever you reply to a message,
your mail client generates a References: header that tells all recipients
to which posting(s) your posting refers.  A mail client uses this information
to build a thread tree of the postings so that it is easy to see just how
they relate to each other.

With your posting style you successfully torpedoed this useful feature; your
posting shows up within an existing thread even though it is completely
unrelated.

Always do a fresh post when you want to start a new thread.  That means that
you do not select any sort of Reply when you start your message.  You can
save the list address in your address book (or equivalent) for convenience.

...and then Adrian Teasdale said...
% 
% Is it possible to pipe email directly to PHP like it's possible to do

Yes.


% with perl?  I need to do this using Exim which I'm also unfamiliar with
% so if anyone has done this I'd appreciate knowing how! :)

It's the same thing as for piping email to anything.  I don't know exim
from anything else, but I'd use the .forward file no matter what MTA is
installed.


% 
% Thanks
% 
% Ade


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


  1   2   3   4   5   >