Re: [PHP] MySQL and PHP

2002-01-18 Thread DL Neil

Brandon,

Please do some 'homework': Will the native query run from the MySQL command line, or 
in a admin tool? Have you
tried varying the number of fields? What are the column specifications?

In and amongst this you might like to check where you should have spaces (a) for 
legibility (particularly if
you're asking us to read it to help you), and (b) for machine parsing requirements.

=dn


- Original Message -
From: hugh danaher [EMAIL PROTECTED]
To: Brandon Orther [EMAIL PROTECTED]
Cc: Php-General [EMAIL PROTECTED]
Sent: 18 January 2002 01:14
Subject: Re: [PHP] MySQL and PHP


 Brandon,
 Try using single quotes rather than doubles in the values e.g.
 ('something','something else')
 hugh
 - Original Message -
 From: Brandon Orther [EMAIL PROTECTED]
 To: PHP User Group [EMAIL PROTECTED]
 Sent: Thursday, January 17, 2002 2:25 PM
 Subject: [PHP] MySQL and PHP


  Hello,
 
  I am trying to use mysql through php.  When I try to run the following
  query it does nothing.  I am trying to figure out if it is the query or
  php I am having a problem with.  Does anyone see a problem with the
  below query? (Note: This is for mysql)
 
  QUERY:
  INSERT INTO page_properties
  (page_name,open_menu,top_image,title_image,side_images)
  VALUES(30daypolicy,comp_info2,top_aboutus,titlebar_aboutus,30da
  y);
 
  Thanx for your help,
  Brandon
 


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Generating a new line in a text file

2002-01-18 Thread DL Neil

Chris,
\n = *nix
\r = Mac
\r\n = PC
(now that you've 'dropped' MS Notepad into the conversation...) The simplest M$ 
tools content themselves with
black blocks (apparently not being interested in your comfort), but the more 
sophisticated tools will sometimes
oblige...
=dn


- Original Message -
From: Chris Janes [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 18 January 2002 05:15
Subject: Re: [PHP] Generating a new line in a text file


 :
 : Ah, so you're opening the file in something that doesn't understand
 : newlines and prefers line feeds, then.
 :
 : In that case you'll want to use \r instead of \n.
 :
 : Jason

 You'll never guess what, that doesn't work either... still pretty black
 blocks, but no new line...

 In a foolish move (perhaps) I'm opening the file in MS Notepad (I know,
 there are better things to use, but I don't have them). I hope that
 eventually I'll be able to only have to open the file to check how many
 quotes are in it, and check spelling and the like...

 Bah, and I was hoping that working on this would help me get to sleep!
 Ah well...

 Chris


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] checking the content?????

2002-01-18 Thread DL Neil

Dani,
Am slightly confused/finding the question ambiguous.
Could you provide the code you have so far, and the relevant column specification(s)?
Could be simple or complex!
=dn


- Original Message - 
From: Dani [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 18 January 2002 12:22
Subject: [PHP] checking the content?


 hi!
 
 I 'm trying to make my script to check one by one whether there is a
 content in the field on a record.
 
 How do I do that?
 
 I use mysql_num_fields() but it doesn't work.
 
 Any reply is appriciated!
 
 regards,
 Dani
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: [PHP-WIN] command line are -c doesn't work on win2k?

2002-01-18 Thread DL Neil

Jeff,

The following batch files works for me (WinNTWS 4.0 SP6a):-

cd c:\program files\php
php.exe -q c:\.path.\w.php c:\.path.\webute.log

NB the first line reflects my PHP config - your mileage may vary!

Of course the other possibility is to add the PHP folder into the PATH environment 
variable...

Regards,
=dn


- Original Message - 
From: Jeff D. Hamann [EMAIL PROTECTED]
To: ; [EMAIL PROTECTED]
Sent: 18 January 2002 07:00
Subject: [PHP-WIN] command line are -c doesn't work on win2k?


 I've been trying to figure out what was wrong with my script...
 
 ?
 mail([EMAIL PROTECTED], Subject, command line mail() test);
 ?
 
 from the command line,
 
 php mail_test.php
 
 and getting,
 
 X-Powered-By: PHP/4.0.6
 Content-type: text/html
 
 attempting to deliver the mailbr
 bWarning/b:  Unknown error in bmail_test.php/b on line b3/bbr
 
 Then I found a solution at http://bugs.php.net/bug.php?id=6742 ,
 
 [22 Nov 2000 5:21am] [EMAIL PROTECTED]
 After a few emails this really got solved.
 Adding -c/path/to/phpini/ (command line)
 was the solution.
 
 --Jani
 but, when I tried it,
 php -c c:\php mail_test.php,
 Again, the results were,
 X-Powered-By: PHP/4.0.6Content-type: text/html
 
 attempting to deliver the mail
 brbWarning/b:  Unknown error in bmail_test.php/b on line
 b3/bbr
 
 
 So, I tried a gazillion permitations on -c, -c /php, -c
 c:/php -c:\php\php.ini, etc, etc, etc, to no avail...
 
 I finally moved the script into the same dir as php.exe and it worked fine.
 The problem is that I need to run the script from the normal path and not
 from c:\php...
 
 Does the -c switch actually work? How can I run this script from another
 dir? Is this a bug?
 
 Thanks,
 Jeff.
 
 
 --
 Jeff D. Hamann
 Hamann, Donald  Associates, Inc.
 PO Box 1421
 Corvallis, Oregon USA 97339-1421
 Bus. 541-753-7333
 Cell. 541-740-5988
 [EMAIL PROTECTED]
 www.hamanndonald.com
 
 
 
 -- 
 PHP Windows Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] command line are -c doesn't work on win2k?

2002-01-18 Thread DL Neil

Mike and Jeff,

 what about the [EMAIL PROTECTED]? is it failing on a 'bad' email address? or
 maybe putting everything in variables and trying

  mail($to,$subject,$message);

=there's a difference between the way PHP talks to an SMTP server (using mail()) on 
Win32 compared to *nix -
which can make advice on the forum 'tricky'. On Windows the email msg is shunted out 
of PHP and thrown at the
SMTP server with no ceremony - and no 'backwards' communication eg a confirmatory msg 
got it thanks. Whereas
*nix systems allow for some discussion between PHP and sendmail (for example).

=thus under Windows the quality of the email address is almost irrelevant (to PHP at 
least). However the email
lines from PHP.INI will be of interest. Can you post them please Jeff?

=Regards,
=dn




 on 1/18/02 9:14 AM, Jeff D. Hamann at [EMAIL PROTECTED] wrote:

  nope. no difference.
 
  jeff.
 
  Mike Cullerton [EMAIL PROTECTED] wrote in message
  [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  on 1/18/02 12:00 AM, Jeff D. Hamann at [EMAIL PROTECTED] wrote:
 
  I've been trying to figure out what was wrong with my script...
 
  ?
  mail([EMAIL PROTECTED], Subject, command line mail() test);
  ?
 
  from the command line,
 
  php mail_test.php
 
  and getting,
 
  X-Powered-By: PHP/4.0.6
  Content-type: text/html
 
  attempting to deliver the mailbr
  bWarning/b:  Unknown error in bmail_test.php/b on line
  b3/bbr
 
  didn't notice any other responses, and this is just a guess here, but how
  about taking the '()' out of the body of the message. ie, command line
  mail
  test
 
  -- mike cullerton   michaelc at cullerton dot com
 
 
 
 


  -- mike cullerton   michaelc at cullerton dot com



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: [PHP-WIN] command line are -c doesn't work on win2k?

2002-01-18 Thread DL Neil

Jeff,

Let's start 'casting around' then. If you've already done these (I may not have read 
all of your posts) please
discuss the results of the following:

1 what happens when you run the script in a browser?
2 with/without the -c and/or -q options, what happens when you run another PHP script 
from the command line?
3 if PHP is in the PATH, what happens if C:\ is the current directory and you attempt 
to run PHP (with or
without an argument/script filename)?

Do you have another PHP script that has sent email/used the mail() function 
successfully?

Please advise,
=dn


 the path to php is already in the PATH variable...

 I'm not doing anything different that http://bugs.php.net/bug.php?id=6742
 ,but for some reason the -c doesn't make a difference...

 Jeff.


 Dl Neil [EMAIL PROTECTED] wrote in message
 0d4f01c1a00e$87036ee0$2916100a@jrbrown">news:0d4f01c1a00e$87036ee0$2916100a@jrbrown...
  Jeff,
 
  The following batch files works for me (WinNTWS 4.0 SP6a):-
 
  cd c:\program files\php
  php.exe -q c:\.path.\w.php c:\.path.\webute.log
 
  NB the first line reflects my PHP config - your mileage may vary!
 
  Of course the other possibility is to add the PHP folder into the PATH
 environment variable...
 
  Regards,
  =dn
 
 
  - Original Message -
  From: Jeff D. Hamann [EMAIL PROTECTED]
  To: ; [EMAIL PROTECTED]
  Sent: 18 January 2002 07:00
  Subject: [PHP-WIN] command line are -c doesn't work on win2k?
 
 
   I've been trying to figure out what was wrong with my script...
  
   ?
   mail([EMAIL PROTECTED], Subject, command line mail() test);
   ?
  
   from the command line,
  
   php mail_test.php
  
   and getting,
  
   X-Powered-By: PHP/4.0.6
   Content-type: text/html
  
   attempting to deliver the mailbr
   bWarning/b:  Unknown error in bmail_test.php/b on line
 b3/bbr
  
   Then I found a solution at http://bugs.php.net/bug.php?id=6742 ,
  
   [22 Nov 2000 5:21am] [EMAIL PROTECTED]
   After a few emails this really got solved.
   Adding -c/path/to/phpini/ (command line)
   was the solution.
  
   --Jani
   but, when I tried it,
   php -c c:\php mail_test.php,
   Again, the results were,
   X-Powered-By: PHP/4.0.6Content-type: text/html
  
   attempting to deliver the mail
   brbWarning/b:  Unknown error in bmail_test.php/b on line
   b3/bbr
  
  
   So, I tried a gazillion permitations on -c, -c /php, -c
   c:/php -c:\php\php.ini, etc, etc, etc, to no avail...
  
   I finally moved the script into the same dir as php.exe and it worked
 fine.
   The problem is that I need to run the script from the normal path and
 not
   from c:\php...
  
   Does the -c switch actually work? How can I run this script from another
   dir? Is this a bug?
  
   Thanks,
   Jeff.
  
  
   --
   Jeff D. Hamann
   Hamann, Donald  Associates, Inc.
   PO Box 1421
   Corvallis, Oregon USA 97339-1421
   Bus. 541-753-7333
   Cell. 541-740-5988
   [EMAIL PROTECTED]
   www.hamanndonald.com
  
  
  
   --
   PHP Windows Mailing List (http://www.php.net/)
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
   To contact the list administrators, e-mail: [EMAIL PROTECTED]
  
  
 



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] command line are -c doesn't work on win2k?

2002-01-18 Thread DL Neil

Jeff,

If mail is working, then agree with your point about config.

Appendix B. Using PHP from the command line
Usage: php [-q] [-h] [-s [-v] [-i] [-f file] |  {file [args...]}
  -q Quiet-mode.  Suppress HTTP Header output.
  -C Do not chdir to the script's directory
  -c path  Look for php.ini file in this directory

PHP is case sensitive (whereas Windows is not).
Where is the .ini file? (not the PHP.exe file)

Does this help?
=dn

- Original Message -
From: Jeff D. Hamann [EMAIL PROTECTED]
To: DL Neil [EMAIL PROTECTED]; mike cullerton 
[EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: 18 January 2002 17:25
Subject: Re: [PHP] command line are -c doesn't work on win2k?


 This will work from the dir that contains php.exe..

 ?
 mail( [EMAIL PROTECTED], subject, test );
 ?

 here are the php.ini smtp lines...

 [mail function]
 ; For Win32 only.
 ;SMTP = stimpy - this works fine as does
 SMTP = 192.168.0.2

 ; For Win32 only.
 sendmail_from = [EMAIL PROTECTED]

 I don't see how this could be a config problem. The emails I have been
 sending state that the script works *fine* from the same dir as php.exe. The
 problem arises when I attempt to run the script from another directory...

 Jeff.


 - Original Message -
 From: DL Neil [EMAIL PROTECTED]
 To: mike cullerton [EMAIL PROTECTED]; Jeff D. Hamann
 [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Friday, January 18, 2002 9:09 AM
 Subject: Re: [PHP] command line are -c doesn't work on win2k?


  Mike and Jeff,
 
   what about the [EMAIL PROTECTED]? is it failing on a 'bad' email address?
 or
   maybe putting everything in variables and trying
  
mail($to,$subject,$message);
 
  =there's a difference between the way PHP talks to an SMTP server (using
 mail()) on Win32 compared to *nix -
  which can make advice on the forum 'tricky'. On Windows the email msg is
 shunted out of PHP and thrown at the
  SMTP server with no ceremony - and no 'backwards' communication eg a
 confirmatory msg got it thanks. Whereas
  *nix systems allow for some discussion between PHP and sendmail (for
 example).
 
  =thus under Windows the quality of the email address is almost irrelevant
 (to PHP at least). However the email
  lines from PHP.INI will be of interest. Can you post them please Jeff?
 
  =Regards,
  =dn
 
 
 
  
   on 1/18/02 9:14 AM, Jeff D. Hamann at [EMAIL PROTECTED]
 wrote:
  
nope. no difference.
   
jeff.
   
Mike Cullerton [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
on 1/18/02 12:00 AM, Jeff D. Hamann at [EMAIL PROTECTED]
 wrote:
   
I've been trying to figure out what was wrong with my script...
   
?
mail([EMAIL PROTECTED], Subject, command line mail() test);
?
   
from the command line,
   
php mail_test.php
   
and getting,
   
X-Powered-By: PHP/4.0.6
Content-type: text/html
   
attempting to deliver the mailbr
bWarning/b:  Unknown error in bmail_test.php/b on line
b3/bbr
   
didn't notice any other responses, and this is just a guess here, but
 how
about taking the '()' out of the body of the message. ie, command
 line
mail
test
   
-- mike cullerton   michaelc at cullerton dot com
   
   
   
   
  
  
-- mike cullerton   michaelc at cullerton dot com
  
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
   To contact the list administrators, e-mail: [EMAIL PROTECTED]
  
  
 
 


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] command line are -c doesn't work on win2k?

2002-01-18 Thread DL Neil

Jeff,

FWIW my system is set up to hold PHP in C:\program files\php, which is where the 
php.exe can be found.

PHP.ini is supposed to be in c:\winnt isn't it?

=dn


- Original Message -
From: Jeff D. Hamann [EMAIL PROTECTED]
To: DL Neil [EMAIL PROTECTED]; mike cullerton 
[EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: 18 January 2002 18:23
Subject: Re: [PHP] command line are -c doesn't work on win2k?


 do you have an ini, not the exe, file in c:\winnt\system32 ?

 jeff.

 - Original Message -
 From: DL Neil [EMAIL PROTECTED]
 To: Jeff D. Hamann [EMAIL PROTECTED]; mike cullerton
 [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Friday, January 18, 2002 9:53 AM
 Subject: Re: [PHP] command line are -c doesn't work on win2k?


  Jeff,
 
  If mail is working, then agree with your point about config.
 
  Appendix B. Using PHP from the command line
  Usage: php [-q] [-h] [-s [-v] [-i] [-f file] |  {file [args...]}
-q Quiet-mode.  Suppress HTTP Header output.
-C Do not chdir to the script's directory
-c path  Look for php.ini file in this directory
 
  PHP is case sensitive (whereas Windows is not).
  Where is the .ini file? (not the PHP.exe file)
 
  Does this help?
  =dn
 
  - Original Message -
  From: Jeff D. Hamann [EMAIL PROTECTED]
  To: DL Neil [EMAIL PROTECTED]; mike cullerton
 [EMAIL PROTECTED];
  [EMAIL PROTECTED]
  Sent: 18 January 2002 17:25
  Subject: Re: [PHP] command line are -c doesn't work on win2k?
 
 
   This will work from the dir that contains php.exe..
  
   ?
   mail( [EMAIL PROTECTED], subject, test );
   ?
  
   here are the php.ini smtp lines...
  
   [mail function]
   ; For Win32 only.
   ;SMTP = stimpy - this works fine as does
   SMTP = 192.168.0.2
  
   ; For Win32 only.
   sendmail_from = [EMAIL PROTECTED]
  
   I don't see how this could be a config problem. The emails I have been
   sending state that the script works *fine* from the same dir as php.exe.
 The
   problem arises when I attempt to run the script from another
 directory...
  
   Jeff.
  
  
   - Original Message -
   From: DL Neil [EMAIL PROTECTED]
   To: mike cullerton [EMAIL PROTECTED]; Jeff D. Hamann
   [EMAIL PROTECTED]; [EMAIL PROTECTED]
   Sent: Friday, January 18, 2002 9:09 AM
   Subject: Re: [PHP] command line are -c doesn't work on win2k?
  
  
Mike and Jeff,
   
 what about the [EMAIL PROTECTED]? is it failing on a 'bad' email
 address?
   or
 maybe putting everything in variables and trying

  mail($to,$subject,$message);
   
=there's a difference between the way PHP talks to an SMTP server
 (using
   mail()) on Win32 compared to *nix -
which can make advice on the forum 'tricky'. On Windows the email msg
 is
   shunted out of PHP and thrown at the
SMTP server with no ceremony - and no 'backwards' communication eg a
   confirmatory msg got it thanks. Whereas
*nix systems allow for some discussion between PHP and sendmail (for
   example).
   
=thus under Windows the quality of the email address is almost
 irrelevant
   (to PHP at least). However the email
lines from PHP.INI will be of interest. Can you post them please Jeff?
   
=Regards,
=dn
   
   
   

 on 1/18/02 9:14 AM, Jeff D. Hamann at [EMAIL PROTECTED]
   wrote:

  nope. no difference.
 
  jeff.
 
  Mike Cullerton [EMAIL PROTECTED] wrote in message
  [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  on 1/18/02 12:00 AM, Jeff D. Hamann at
 [EMAIL PROTECTED]
   wrote:
 
  I've been trying to figure out what was wrong with my script...
 
  ?
  mail([EMAIL PROTECTED], Subject, command line mail() test);
  ?
 
  from the command line,
 
  php mail_test.php
 
  and getting,
 
  X-Powered-By: PHP/4.0.6
  Content-type: text/html
 
  attempting to deliver the mailbr
  bWarning/b:  Unknown error in bmail_test.php/b on line
  b3/bbr
 
  didn't notice any other responses, and this is just a guess here,
 but
   how
  about taking the '()' out of the body of the message. ie,
 command
   line
  mail
  test
 
  -- mike cullerton   michaelc at cullerton dot com
 
 
 
 


  -- mike cullerton   michaelc at cullerton dot com



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail:
 [EMAIL PROTECTED]


   
   
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
   To contact the list administrators, e-mail: [EMAIL PROTECTED]
  
  
 
 




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To

Re: [PHP] Display a mesagge and redirect (newbie)

2002-01-17 Thread DL Neil

Alternatively, remember that HTML has this built in (and PHP outputs a HTML page):

move c) before a)
implement it using a meta tag in the HTML page HEAD section
d) will then happen after the defined time period

Regards,
=dn

- Original Message - 
From: Jon Farmer [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: 17 January 2002 12:42
Subject: Re: [PHP] Display a mesagge and redirect (newbie)


 c) and d) are clientside functions if you have already outputted data to the
 browser so use Javascript to do them
 
 --
 Jon Farmer
 Systems Programmer, Entanet www.enta.net
 Tel 01952 428969 Mob 07763 620378
 PGP Key available, send email with subject: Send PGP Key
 
 
 - Original Message -
 From: Simos Varelakis [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Thursday, January 17, 2002 12:36 PM
 Subject: [PHP] Display a mesagge and redirect (newbie)
 
 
  Hi to everyone
 
  I want to do the following and i dont know if its possible with php code
 
  a) run a mysql query
  b) display a simpe message
  c) delay few seconds
  d)auto redirect to a page
 
  can I do this with php
  i know how to do a) and b) and I can't do c) and d)
 
  note that if i try d) with function header (location URL')  got an error
  for headers already send :-(
 
  Thanks in advance for your help and time
 
  Best regards
 
  simos
 
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Display a mesagge and redirect (newbie)

2002-01-17 Thread DL Neil

Niklas,

 No good, since meta starts counting when page is first opened, so

Don't think this is applicable - When is the page opened: after the script reaches 
the meta, or after the
script concludes and the web server sends the page to the browser?

If the latter, then the speed of the connection affects the browser wait until the 
page is (temporarily)
displayed, but not the period of display.

Yes if the page being temporarily displayed is bloated, then the redirect-time period 
must be chosen with due
care.

Ultimately it seems way too complicated, but you could use PHP output buffering. By 
then I think the JavaScript
alternative will sound far more attractive...

Regards,
=dn

- Original Message -
From: Niklas Lampén [EMAIL PROTECTED]
To: Php-General [EMAIL PROTECTED]
Sent: 17 January 2002 14:05
Subject: RE: [PHP] Display a mesagge and redirect (newbie)


 No good, since meta starts counting when page is first opened, so
 clients with slow connection might not never see the message. I'd rather
 use
 body onLoad=setTimeout(\location.href='http://domain.com/page.html',
 5000\);
 which will execute right after the page is completely loaded and move to
 the next page after 5 seconds.


 Niklas


 -Original Message-
 From: Intruder [mailto:[EMAIL PROTECTED]]
 Sent: 17. tammikuuta 2002 15:52
 To: Php-General
 Subject: RE: [PHP] Display a mesagge and redirect (newbie)


  a) run a mysql query
  b) display a simpe message
  c) delay few seconds
  d)auto redirect to a page


 meta http-equiv=refresh content=5; URL=new_page.php

 body
  some message goes here !!!
 /body


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED] To
 contact the list administrators, e-mail: [EMAIL PROTECTED]


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] fixing mail for broken Outlook

2002-01-16 Thread DL Neil

Hank,
You say just text and text/plain. 
What do you mean by mungs the formatting? What formatting in plain text?
=dn


 I've got an app that sends emails, not complicated emails, their just
 text, the mail text is stored in text files on the server so they can be
 edited independant of the code, I've then got a function that reads the
 file (using file()) ... iterates the array, chop(), append \r\n and
 builds a message.
 
 This text gets sent using mail() -- works great for everything but
 Outlook which seems to lose all the line breaks and generally mungs the
 formatting to heck.  I've tried sending a Content-type: text/plain;
 header ... doesn't help.
 
 The only thing that keeps me from losing my mind is that I accidently
 had the wrong header Content-type: text/text; at first and while it
 created an attachment in Outlook, the attachemnt was properly formatted.
 
 Anyone else have this problem and solved it?
 -- 
 Hank Marquardt [EMAIL PROTECTED]
 http://web.yerpso.net
 GPG Id: 2BB5E60C
 Fingerprint: D807 61BC FD18 370A AC1D  3EDF 2BF9 8A2D 2BB5 E60C
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Mulitple Attachments using php

2002-01-16 Thread DL Neil

Sam,

 I know I hear you all groan with this topic...
 I know this topic has been asked before...

 But looking through the archives there have been a lot of advice, URLs,
 classes given out, yet I haven't really found anything that can easily be
 implemented so that I can send muliple attachments in an single email.

 I have managed it with one code but it always introduced an ATT01583.ATT
 file, which I do not understand.
 Any guidence would be very useful,


=check out the classes available for email/MIME processing at phpguru.org. These 
contain examples to
illustrate/document the class-code's facilities, including attachments (simply repeat 
the requisite steps).

=beyond that, and the recommendation contained in the above, check out the RFCs for 
email/MIME formatting.

=dn



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: [PHP-DB] Re: [PHP] mysql_insert_id?

2002-01-16 Thread DL Neil

Hi Martin,

  2 because the (function argument) controlling feature is the connection, it is not 
possible for another
  concurrent user to 'steal' your ID or influence the ID returned to you - it's all 
yours!

 Ok, assume you are correct, but what if you are using persistent
 connections (ie pconnet)?

=According to the manual (Chapter 22. Persistent Database Connections) there is no 
difference in functionality
between persistent and non-persistent connections (only a (possible) difference in 
efficiency/response time).
Thus use of persistence does not buy you into other issues.

=If I leave it there, you're going to come back with another question, aren't you!?

=This is my understanding. A connection is set up to enable communication between the 
PHP script and the RDBMS.
The connection is exclusive to the script and only lasts the life of the script. Now 
let's look at the word
script. Each user/browser is processed within the (Apache) web server as a separate 
child process. If the
process calls for PHP processing, then what happens in one process within the web 
server is kept quite separate
from what's happening in another process. This applies even if they both use PHP, and 
even if they are both
running the same PHP script, and even against the same MySQL db/tbl, ie because of the 
way Apache works, there
is no 'sharing' of connections/cleverness in a bid for extra 'efficiency'.

=Thus there is no way for my (connection) use of the db to interfere with your 
(separate connection) use of the
same, in terms of AUTO_INCREMENT, INSERT IDs, and suchlike.

=I'd really like to hear from someone who can talk more authoritatively on the subject 
though!

=Regards,
=dn



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] mysql_insert_id?

2002-01-16 Thread DL Neil

Hi Jimmy,

  2 because the (function argument) controlling feature is the
  connection, it is not possible for another concurrent user to
  'steal' your ID or influence the ID returned to you - it's all

  Ok, assume you are correct, but what if you are using persistent
  connections (ie pconnet)?

 don't worry, persistent connection is per-child-process basis,
 so concurrent users will use different connection to DB.

 the only problem i can think of might occur with pconnect is,
 last_insert_id() will return you the last inserted ID from
 previous 'session', not current 'session'.
 to prevent this, you should call last_insert_id() only when
 your INSERT query executed succesfully.

=Of course a right-living boy like me, cannot conceive of why one would look up 
LAST_INSERT other than
immediately after the INSERT/UPDATE command...

=However this is an interesting thought and you are right. There are differences 
between the MySQL
LAST_INSERT_ID and the PHP MySQL_

=The MySQL manual (6.3.6.2  Miscellaneous Functions) talks about Returns the last 
automatically generated value
that was inserted into an AUTO_INCREMENT column...The last ID that was generated is 
maintained in the server on
a per-connection basis., and a number of other if-s, but-s, and maybe-s that will get 
everyone going.

=(However I believe it also answer's Martin's question!)

=What I have noted is that the PHP manual 
(http://www.php.net/manual/en/function.mysql-insert-id.php) works
slightly differently (and possibly more simply), as well as emphasising the 
immediately after relationship
between this call and the preceding INSERT. An interesting point here and that is that 
it takes care of Jimmy's
concern: what happens if the INSERT query was successful.

=I think I prefer the PHP approach - and it is probably more efficient/quicker (from 
PHP) too.

=Further thoughts?
=dn



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] mysql_insert_id?

2002-01-16 Thread DL Neil

Hi Jimmy,

  the only problem i can think of might occur with pconnect is,
  last_insert_id() will return you the last inserted ID from
  previous 'session', not current 'session'.
  to prevent this, you should call last_insert_id() only when
  your INSERT query executed succesfully.
  =Of course a right-living boy like me, cannot conceive of why one would
  look up LAST_INSERT other than immediately after the INSERT/UPDATE command...
 calling last_insert_id() after INSERT is the number one rule
 of course :)
 What i mean was, what if the INSERT query fail, but the script still
 execute the last_insert_id() function?
 Most probably the returned value would be wrong, because it will
 return the last_insert_id of previous INSERT query (from previous
 'session')

=right living was a (poor) joke following your previous post's .SIG file 
aphorism...not a criticism. Now that
you have mentioned the possibility, I can imagine the odd (very odd) use for 
collecting an ID from a preceding
interraction (with the database).

=session is not the correct word/its use is potentially confusing (perhaps that's 
why it's in quotes?) -
persistence refers to the continuing connection between PHP and MySQL.

  =What I have noted is that the PHP manual
  (http://www.php.net/manual/en/function.mysql-insert-id.php) works
  slightly differently (and possibly more simply), as well as
  emphasising the immediately after relationship between this call
  and the preceding INSERT.

 I might be wrong, but i think PHP's mysql_insert_id() must be using
 MySQL's API function call.
 Meaning, it will return whatever value MySQL return.
 Or in other word, mysql_insert_id() and last_insert_id() will return
 the same result.

 I have look thru the manual link above, and i think the phrase
 immediately after in the manual is more to advise the user to do
 mysql_insert_id() immediately after the INSERT query,
 because last_insert_id value might get overwritten by the newest one.

 the immediately after phares in the manual doesn't mean that PHP's
 mysql_insert_id() function is somehow tied to the previous/last
 INSERT query, so that if the INSERT fails then mysql_insert_id()
 will intelegently return the correct value.

 just my 1 cent

=Agreed it would seem perfectly logical that the PHP function simply calls the MySQL 
source function. However it
is also possible that in order to save time the LAST_ID information is built into the 
resultset coming back from
the INSERT - thus when mysql_insert_id() is called PHP would not need to go back to 
MySQL/last_insert_id(). On
the other hand, the apparent differences between the two manuals may simply be in the 
expression of two
authors... I don't know [but would welcome competent advice!]

=the immediate advice is transparently logical best practice.

=I'm not sure that I've understood your last point. The comparison/difference, as I 
read/understood it, is that
if the INSERT works then both functions will operate correctly. However if the INSERT 
fails, then MySQL's
last_insert_id() will return the ID of the last record successfully inserted during 
the connection (whenever
that was) - without necessarily any recognition of an immediately preceding failure. 
Whereas PHP's
mysql_insert_id() is keyed to the resource identifier and returns zero if the 
**latest** INSERT failed for some
reason (and the rationale for my earlier comments/comparison).

=My thinking is that the PHP rationale makes the most/safest sense to me, and if I'm 
'in' PHP it seems best to
stick with that 'mode' than to go 'out' to MySQL to find the 'same' answer.

=Intriguing stuff,
=dn


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] mysql_fetch_row - how do I fetch a specific row?

2002-01-16 Thread DL Neil

Phil,

 After I make a queryhow do I fetch a specific row from that query ??

=isn't the purpose of the query to return specific results?
=dn



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] fixing mail for broken Outlook

2002-01-16 Thread DL Neil

Hank,

 basically tabs and line breaks disappear ... almost like it's treating
 the message as html .. whitespace is history.

=I haven't gone back to the RFC to see what the rules about tabs are - but then when 
does M$ follow 'the rules'
(Outlook).

=are you using a *nix box? There is a difference between *nix, Windows, and Mac with 
line ends being represented
by LF, CRLF, or CR.

=Regards,
=dn


 On Wed, Jan 16, 2002 at 04:29:03PM -, DL Neil wrote:
  Hank,
  You say just text and text/plain.
  What do you mean by mungs the formatting? What formatting in plain text?
  =dn
 
 
   I've got an app that sends emails, not complicated emails, their just
   text, the mail text is stored in text files on the server so they can be
   edited independant of the code, I've then got a function that reads the
   file (using file()) ... iterates the array, chop(), append \r\n and
   builds a message.
  
   This text gets sent using mail() -- works great for everything but
   Outlook which seems to lose all the line breaks and generally mungs the
   formatting to heck.  I've tried sending a Content-type: text/plain;
   header ... doesn't help.
  
   The only thing that keeps me from losing my mind is that I accidently
   had the wrong header Content-type: text/text; at first and while it
   created an attachment in Outlook, the attachemnt was properly formatted.
  
   Anyone else have this problem and solved it?
   --
   Hank Marquardt [EMAIL PROTECTED]
   http://web.yerpso.net
   GPG Id: 2BB5E60C
   Fingerprint: D807 61BC FD18 370A AC1D  3EDF 2BF9 8A2D 2BB5 E60C
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
   To contact the list administrators, e-mail: [EMAIL PROTECTED]
  
  
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 

 --
 Hank Marquardt [EMAIL PROTECTED]
 http://web.yerpso.net
 GPG Id: 2BB5E60C
 Fingerprint: D807 61BC FD18 370A AC1D  3EDF 2BF9 8A2D 2BB5 E60C
 *** Web Development: PHP, MySQL/PgSQL - Network Admin: Debian/FreeBSD
 *** PHP Instructor - Intnl. Webmasters Assn./HTML Writers Guild
 *** Beginning PHP -- Starts January 7, 2002
 *** See http://www.hwg.org/services/classes



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] mysql_insert_id?

2002-01-16 Thread DL Neil

Jimmy,


  However it is also possible that in order to save time the LAST_ID
  information is built into the resultset coming back from the INSERT -
  thus when mysql_insert_id() is called PHP would not need to go back
  to MySQL/last_insert_id().

 yes, what you said could be true also.

 Well, there's only one way to be sure how mysql_insert_id() works...read
 the source code of PHP :) but unfortunately I dont have the source code,
 and even if I do, I won't read it, because I am lousy at reading someone's
 code...:)

=or run a script to perform an INSERT, then pause, eg go to a form, and whilst 
nothing's happening take the
MySQL server offline, then restart the script by returning from the form, and execute 
the call...

=I can't do this because my portable runs everything on one box (dev and prod and...).

 nice discussion, Neil :)

=thinking that stretches the mind!
=dn


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] mysql_insert_id?

2002-01-15 Thread DL Neil

Hi Wee,

 Is it possible that I would get the wrong ID (Not the ID I just inserted in
 Auto_Increment field) by using mysql_insert_id function if someone is also
 inserting record at the same time? How does mysql_insert_id work accurately?


=A couple of things here:

1 if the field is defined as Auto_Increment then YOU will not insert an ID. Leave 
the field out of the INSERT
statement or transfer NULL, and MySQL will insert the correct ID value according to 
the 'increment' policy.

The construction of the mysql_insert_id() looks like this:
$AutoIncrementId = mysql_insert_id( $MySQLConnection );
Note that the function argument is the connection to MySQL (not the db/tbl !). Thus 
the ID is a by-product of
the connection (and the most recent INSERT it handled) - re-read the appropriate page 
in the manual for more
information, if required.

2 because the (function argument) controlling feature is the connection, it is not 
possible for another
concurrent user to 'steal' your ID or influence the ID returned to you - it's all 
yours!

The only way to get the wrong ID is to perform two IDs and then (vainly) try to get 
hold of the previous ID -
only the latest ID is available.

Clear now?
=dn




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] mysql_insert_id?

2002-01-15 Thread DL Neil

Hi Wee,

 Is it possible that I would get the wrong ID (Not the ID I just inserted in
 Auto_Increment field) by using mysql_insert_id function if someone is also
 inserting record at the same time? How does mysql_insert_id work accurately?


=A couple of things here:

1 if the field is defined as Auto_Increment then YOU will not insert an ID. Leave 
the field out of the INSERT
statement or transfer NULL, and MySQL will insert the correct ID value according to 
the 'increment' policy.

The construction of the mysql_insert_id() looks like this:

$AutoIncrementId = mysql_insert_id( $MySQLConnection );

Note that the function argument is the connection to MySQL (not the db/tbl !). Thus 
the ID is a by-product of
the connection (and the most recent INSERT it handled) - re-read the appropriate page 
in the manual for more
information, if required.

2 because the (function argument) controlling feature is the connection, it is not 
possible for another
concurrent user to 'steal' your ID or influence the ID returned to you - it's all 
yours!

The only way to get the wrong ID is to perform two IDs and then (vainly) try to get 
hold of the previous ID -
only the latest ID is available.

Clear now?
=dn





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Time Zone Offset?

2002-01-13 Thread DL Neil

Marvin,

 I'm using the PHP date() function on my site, but since my hosting company
 (Pair Networks) is on the East Coast and I'm on the West Coast, everything
 shows as three hours later (for most of my visitors, anyway). Pair tells me
 there's no setting I can make on my account to change the server time zone.

=not competent to comment. Recommend a review of the php.ini file commands and even if 
you can't gain access to
that file on the server, the function which allows you to make a change to the PHP 
environment for the life of
the current script.

 Can anyone recommend a way to set an offset for the date() function in PHP?
 (I searched on php.net and couldn't find anything.)

=I run an international service, and would have had a massive headache if each client 
was to see things stated
in their own timezone. We agreed that each would make specifications in their own 
timezone (and language...) but
that all system output would be in GMT.

=To your question: read up on the time/date functions for GMT, convert all input and 
store all date/times as
GMT; and at retrieval time convert time/dates from GMT to whichever time zone you want 
to use. PS also takes
care of bi-annual summer time discontinuities too (should they apply to you).

=Regards,
=dn



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: [PHP-DB] Re: [PHP] convert yyyy/mm/dd to mm/dd/yyyy, how?

2002-01-13 Thread DL Neil

Rasmus,

I have held several datetime-related conversations with people recently, and another 
series about 'when'/whether
to use PHP or MySQL functionality.

Here you are, the man of PHP, advising Sander to use MySQL functionality! (and in 
marked contrast to the
(biased) advice one might expect on PHP lists, eg JDEW's reply) I'm grinning at the 
apparent incongruity, but
with no insult to yourself.

Would you care to comment further on when one should consider using SQL commands in 
favor of implementing
identical functionality in PHP (and possibly in some situations, vice-versa)?

Regards,
=dn



- Original Message -
From: Rasmus Lerdorf [EMAIL PROTECTED]
To: Sander Peters [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: 13 January 2002 19:52
Subject: [PHP-DB] Re: [PHP] convert /mm/dd to mm/dd/, how?


 MySQL has plenty of functions to return dates to you in any format you
 specify.  Please read
 
http://mysql.com/documentation/mysql/bychapter/manual_Reference.html#Date_and_time_functions
 and pay special attention to the DATE_FORMAT() function.

 -Rasmus



 On Sun, 13 Jan 2002, Sander Peters wrote:

  Hello everybody,
 
  convert /mm/dd to mm/dd/, how?
 
  MYSQL does everything in /mm/dd.
  I live in the Netherlands and we are use to the format dd/mm/.
 
  What's the best way to display it as mm/dd/ in a table on a query?
 
  My first idea whas to split the date up in vars in php and then print
  the vars in the way I like it
  Is this a bad idea? Or are there better sollutions?
 
  Thanx in advance for answering!
 
 
 
  --
  Met vriendelijke groet / With Greetings,
 
  Sander Peters
 
 site: http://www.visionnet.nl/
email: mailto:[EMAIL PROTECTED]
  webmail: mailto:[EMAIL PROTECTED]
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Invalid Email Characters

2002-01-13 Thread DL Neil

Alexis,

 Could anybody confirm exactly which characters, if any, are NOT valid in an
 email address.


=such rules of the Internet are laid out in documents called RFCs (initially they 
are Requests for Comment
but once adopted become ...) You are looking for RFC822 (although there are others 
pertinent to email). Try
http://www.freesoft.org/CIE/RFC/822/

=unfortunately beware, the 'rules' are honored as much in the breach as the 
observance...!

=Regards,
=dn



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] multiple replaces...

2002-01-12 Thread DL Neil

Yes, I thought about that. But, what should I do when the markers are absolutely NOT 
in any sequence.

=sequence would matter if it was possible that one of the markers could replace some 
text and that replacement
subsequently became the marker for a further replacement ... nightmare=recursion!

I also thought about something like
$replace[1][1] = !one!; //marker
$replace[1][2] = hehee; //replace with
$replace[1][1] = test; //marker
$replace[1][2] = foobar; //replace with
$replace[1][1] = repl; //marker
$replace[1][2] = humpty-dumpty; //replace with
$replace[1][1] = blah; //marker
$replace[1][2] = boo; //replace with

Now, when I would do a loop thingie that goes through all those, then it would be a 
pretty nice and compact
solution...

What about speed issues regarding this solution?

=check out string functions. On simple stuff they will beat RegEx for speed hands down 
- but watch out if
case-sensitivity is relevant.

=dn



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: Parsing SAR output with PHP.

2002-01-11 Thread DL Neil

Or checkout the sql import facilities offered by your choice of database to 'convert' 
the data from log to
db-tbl, then set up your analysis in PHP+SQL separately.
=dn

- Original Message -
From: Martin Wickman [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 11 January 2002 09:08
Subject: [PHP] Re: Parsing SAR output with PHP.


 Austin Gonyou wrote:

  The real question I suppose is how could I parse this type
  of output into something I could use to make a graph.
 
  Example:
  12:20:00 PM   CPU %user %nice   %system %idle
  12:30:00 PM   all  2.17  0.79  0.77 96.27


   Problem is I'm not sure how to go about breaking up the rows
   to allow them to be inserted into the db. Thanks in advance for
   any ideas.

 I guess fields are separated with tabs? Then just use split, as in:


 list($time,$cpu,$ser,$nice,$ststem, $idle)= split (\t, $line);

 Then build your INSERT sql clause. Graph building is then a simple
 matter of passing the data as arrays to your php graph system.


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: [PHP-DB] Re: [PHP] need help looping through each record with a query -stumped

2002-01-10 Thread DL Neil

Brian,

 first off, Martin your suggestion looks great but I don't think its SQL
 syntax is supported by MySQL. It's a good start though - gives me something
 to work with :)

=until it is tried, you won't know! From an SQL point of view it looks ok. In fairness 
to Martin, from the
'further information' given since it may not do everything you want...

 Unfortunately, since this database is ancient and far from
 normalized/optimized, neither table uses unique id's. So looking at the
 scores table the fields are Username, Month, and Score.
 Another big dud is the fact that the Month field is varchar, not a date
 field. So this makes it difficult to sort, as Mehmet suggested.
 And this also makes it difficult to write a function to automate the 3
 consecutive month aspect that's required. That's why I had to code to look
 for specific months - this month (January) counting back 3 (December,
 November, October). Students have until the end of the month to take the
 monthly test - so they can maintain certification if they have passed Dec.,
 Nov., and Oct.'s tests. Or, if they have taken and passed January's test,
 they can be certified if they've also passed December and November. Make
 sense? 4 months total: if the first 3 are passed and/or last 3 are passed
 the student is certified.
...

=regardless of the age of the database, the data appears to be normalised (to the 
description given) however it
is definitely NOT optimised. You will notice that each of the contributors has been 
attempting to work in MySQL,
but you still have the other option - that of tidying up and debugging your torturous 
PHP code! The PHP effort
can be used to attempt to 'recover' from the poor database structure, but as you have 
observed, at some cost -
particularly if you ask yourself how you are going to get things to work in 
February... The problem with
persisting in this is that you have a weak database structure AND you have some hairy 
(hard to understand) PHP
code as a work-around (and may God bless all who sail in her)!

=like the others, my recommendations consist of revisiting your business rules and 
then 'optimising' the
database/data structure - best to fix the problem at its source!

=the idea that the NAME of each month should be used for processing is causing major 
problems. The name of the
month is a LABEL, ie is very useful at the tops of reports, letters, newspapers, etc. 
It is NOT a tool for
calculations. If you'd like to take a look at the archives of the PHP discussion list, 
you'll find my
contribution on this topic dated a few days ago entitled: counting with dates 
(help!) talking about the three
primary date formats and their uses.

=So if I sit a test this month (January), and the last month of last year (December), 
and the second-last month
of 2000 (November) [and with blinding arrogance, let me assume that I would pass each 
with flying colors (cough,
cough)], and further assume that I haven't sat any other tests [much more my speed!]; 
the current logic
(apparently) credits me with a certification!? [thank you] Now before anyone following 
this labrythine logic
starts to laugh, let me say that there are good reasons/procedures that might be in 
place to prevent such a
stupidity happening - but they will almost certainly also make the process of keeping 
historical records more
difficult.

=how does the system keep track of people who do not sit a test during a particular 
month?

=and the other way around: if I sit the test today and fail [please no jeers, I'm very 
sensitive] do the rules
allow/is it possible for me to 'resit' during January. Thus is it possible for me to 
sit (and pass) single tests
in Nov and Dec, but sit two tests in Jan - one a 'fail' and one a 'pass'. If so, are 
you looking at my last
three tests with a view to certification, or are you looking at my last three passes 
(during the pertinent three
months)?

=further: can we assume that a record will be entered into the scores table regardless 
of whether the person
passed or failed? (I have assumed so)

=while on this theme, how is the system to react if tests are not held during a 
particular month, eg the
certification center is closed for summer/Christmas vacation, or out of respect for 
September 11?

=another question about 'rules': the problem description indicates that it is possible 
for a person to have sat
January's test already/early in the month, but it is also possible that (s)he has not. 
Are the tests held on a
particular date for all candidates, or does the system allow each candidate to pick 
his/her own test date?
(which also implies that the January date for all candidates will either be the same, 
or is potentially very
different) - this may make it easier/harder to define an SQL query.

=finally, if I have understood correctly, certification is calculated by three 'month' 
units, not 90-days. Thus
the rule is not three passes in the last 90 days, but is in fact (today) something 
like the last 100 

Re: [PHP] does this work?

2002-01-10 Thread DL Neil

Erik,

Two suggestions:
1 check out mysql_fetch_assoc(), and
2 make use of AS to 'set' the variable names (carried through from MySQL to PHP).

Regards,
=dn

- Original Message - 
From: Erik Price [EMAIL PROTECTED]
To: Rick Emery [EMAIL PROTECTED]; PHP [EMAIL PROTECTED]
Sent: 10 January 2002 22:15
Subject: Re: [PHP] does this work?


 But as I was writing before, what I'm really trying to do with this 
 isn't just echo the COUNT of records in a table.
 
 What do I need to separate the array $temprow into pieces so that I 
 can get at the data:
 
 $tempsql = SELECT divisions.div_name, divisions.div_id
  FROM divisions;
 $tempresult = mysql_query($tempsql, $db);
 $temprow = mysql_fetch_array($tempresult);
 
 I wonder if I'm being too ambiguous in describing this.
 
 $temprow now contains the information extracted from $tempresult by 
 mysql_fetch_array(), right?
 And $tempresult was the result of the SELECT query I posted above.
 
 So, how can I separate the information in $temprow into useable chunks 
 or variables.  I'm reading about explode(), but it isn't clear to me how 
 I can use this in this instance.
 I would like to loop through the array $temprow and echo each record's 
 contents (divisions.div_name and divisions.div_id) on each step.  This 
 is to populate a select box (listbox).
 
 Any advice, anybody?
 
 Thank you,
 Erik
 
 
 On Thursday, January 10, 2002, at 05:00  PM, Erik Price wrote:
 
  Wait, my bad.  Typo... all my fault.
  I feel like an ass.
 
 
  Erik
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] counting with dates (help!)

2002-01-07 Thread DL Neil

RE: [PHP] counting with dates (help!)Hi Sander,
(and Chris, and Martin)

 $today = date(Ymd, mktime(0,0,0, date(m),date(d),date(Y)));
 $last_week = date(Ymd, mktime(0,0,0, date(m),date(d)-7,date(Y)));
 echo ($today - $last_week);
 The result is a number like 8876 (20020107-20011231 = 8876)
 But in date thinking it should be 7!
No, that's the difference in time represented by the number of seconds.
You still need to work with it a little more.
8876 / 60 = number of hours  /* 60 = number of seconds in an hour */
8876 / 60 / 24 = number of days.  /* 24 = number of hours in a day */

=I'm sorry but neither the above, nor the suggestion of Julian dates was correct (in 
all cases). The two numbers
($today and $last_week) generated in the PHP code above are in CCYYMMDD format (as 
used by MySQL to store dates,
BTW).

=So you are correct (Sander):
20020107 less
20011231 equals
8876

=but this number is meaningless. If the formulae proposed above are applied, the 
answer is not 7 days.

=Similarly (Julian dates = CCYYDDD format)
2002007 less
2001365 equals
642

=However let's jump forward in time, to tomorrow (hey what's 45 minutes between 
friends?):
20020108 less
20020101 equals
0007

=and:
2002008 less
2002001 equals
007

=woohoo! How come they 'work' tomorrow but not today? Because (using the first format) 
whilst the last and
second to last digits represent days (hence it 'works' tomorrow), the preceding pair 
of digits represent months,
and the procession of days into months is not a decimal progression. (smack your 
forehead into the wall
now...but don't do it too often, because no matter how good it feels, it'll feel a 
whole lot better when you
stop!)

=this is also the reason that using a Julian date format won't work - they look like 
decimal numbers (look like
a duck), you can perform arithmetic on them (walk like a duck), but if your 
calculation spans a year-break you
will discover that they are not really decimal numbers (and they bark like a dog).

=The three main date formats are:

1 CCYYMMDD (as mentioned above) because it is the way MySQL does things. You can't use 
this for 'real
arithmetic' as we've just discussed, but you can do comparisons,
eg is 'today'  'yesterday' (when I was young...)

2 dd-mm-ccyy (or variant) which is the way humans like to read their dates. This 
is for appearances, and
once again not for arithmetic/logic.
PS never, never, never (did I say never) use dd/mm/yy or mm/dd/yy because of the 
ambiguities it causes -
particularly between Americans and the rest of the world (and date-guessing functions 
- see your manual)

3 UNIX Epoch timestamp which is a count of the number of seconds since midnight 1 Jan 
1970 (GMT). This is an
absolutely ugly way to look at dates (and times), but it is really easy to use for 
arithmetic and after a while
you don't think it at all odd that without any effort you can recall that there are 
86,400 seconds in one day.

=Now that piece of trivia, a pocket protector, and band-aid keeping your spectacle 
frames together will make you
a babe-magnet in every bar (well those that serve Heineken anyway).

=Putting aside several HOURS to study the two manuals to get your head around date 
functions is time well spent
(yes I know, it takes me a little longer...) - particularly the sheer number of SQL 
date functions (the power of
which is all too frequently overlooked). Regarding the PHP functions, I made a page 
list, and as I made notes
about each one, I annotated it with a 'purpose' so that I could keep them straight in 
my mind. Well, enough of
me and there reasons why girls in bars don't talk to me...

=Let me do my usual frustrating thing and ask you what you are REALLY wanting to do. 
You don't actually want to
subtract those two numbers/PHP variables, because you already know the answer in their 
very creation...

=Regards,
=dn



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] configuring sever to send mail (Win2k)

2002-01-04 Thread DL Neil

CJ,

 i have a problem using the mail function on my server.
   win2000 Pro
   IIS 5.0
   PHP Version 4.0.6

 i'm not sure if it's a configuration problem with IIS or i'm missing
 something in the php.ini file.


The pre-requisite is that the php.ini file points to a visible SMTP server. Please 
review the [mail function]
section of that file.
If you have further questions please include that section, plus PHP version number in 
your reply.

Regards,
=dn



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Formats with PHP

2001-12-29 Thread DL Neil

Hey Steve,

 Im need to generate an email and Im trying  to keep the  exact spacing
 I use when I define the body of the email. When the email is sent and i
 view it with Outlick Express or simply use Pine, the spacing is all out
 of wack. (Too many spaces here, not enough spaces there)

 I think i need something like  Perl's Format features but not sure.

 Any advice ?


Is this a plain text email message or MIME encoded, eg HTML? If the former, then the 
spaces have been inserted
by 'authoring' program. If by spacing you are referring to vertical spacing/wrapping, 
then that is limited by
some email clients.

Have you ECHOed the message body prior to message transmission to verify when/where 
the spaces are
added/subtracted?

=dn


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] how to create html tables in php

2001-12-29 Thread DL Neil

Hi Sander,


 I made a database with bookmarks, these bookmarks are catogarized by
 type.
 Now I want to display those bookmarks in tables by category. This works
 already fine.
 The only problem I have is that the tables are very difficult to handle.

 I want to make 4 tables in a row (so that will be 4 dif categories with
 bookmarks) and after that, the next table should start under the first
 one.
 Like this

 categorycategorycategorycategory
 xxx xxxxxx xxx
 xxx xxxxxx xxx
 xxx xxxxxx xxx

 categorycategorycategorycategory
 xxx xxxxxx xxx
 xxx xxxxxx xxx
 xxx xxxxxx xxx


 (x = a weblink ;-)

 The (dutch)  website where you can find a full example for what I mean:
 http://www.startpagina.nl/

The description (above) shows category-columns of a regular/uniform length/height, so 
that the second set of
four category headings all appear on the same line. The web page example does not look 
like this, but the next
category starts immediately under the last entry of its columnar predecessor...

How are you retrieving the bookmarks from the database - all in one query, or a series 
of queries to retrieve a
category at a time? (I'll assume the former)

Here are two ways to implement in PHP (depending upon how you want to 'visualise' the 
data):
1 table - see the data as four columns
Set up a two-dimensional array in RAM, and by working through the db-resultset a row 
at a time populate the
table with column-row data by working down each column until the category changes and 
then shifting over one
column, etc, then print the table with two (nested) loops to output one row at a time 
across the columns until
all of the table data has been dealt with. (You could view the resultset as a 'buffer' 
and really get
complicated to 'save' RAM, but my advice would be to get the above working first, and 
then try any optimisation
ideas)
2 resultset
View the resultset as a single column of bookmarks (or read it into a single 
one-dimensional array), depending
upon your chosen db and PHP's retrieval mechanism you could set up four 'pointers' 
into the resultset - one for
each column, then read one result-row from each of the four pointers (incrementing as 
you go) to immediately
output within each of the four output columns.

Programmatically, it would be a lot easier to implement the flow the categories 
horizontally, eg
category xxx xxxxxx
category xxx xxxxxx xxx
 xxx xxx
category xxx xxxxxx xxx

Enough to get you going?

Regards,
=dn



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Weird database stuff.

2001-11-13 Thread DL Neil

Third db question today: do folk know there is a (lightly loaded) '[PHP-DB] list' with 
some v.competent members?


Hi Alexander,

- Original Message -
 Let me start by laying out some facts:

 SELECT e.NAME AS customer, g.NAME AS driver_lastname, g.FIRSTNAME AS
 driver_firstname, $CommonSQL, COUNT(g.NAME) AS number FROM ENTITY e, ENTITY
 g, EXPERTISE_FILE f, DAMAGE_CASE d WHERE (f.CUSTOMER = '$CustomerID') AND
 (e.ID = f.CUSTOMER) AND (g.ID = f.DRIVER) AND (d.OWNER_EXP_FILE = f.ID) AND
 (f.DATE_REPORT BETWEEN '$StartDate' AND '$EndDate') GROUP BY e.NAME, g.NAME,
 g.FIRSTNAME

 The query above is one of the statistics gathering queries in my application.
 This one will run flawlessly.
 If however I add this condition: AND (f.DRIVER = '$DriverID') before AND
 (g.ID = f.DRIVER), the script will eat all CPU and RAM (and eventually swap
 aswell) on my PowerEdge 2500SC.
 If I run both queries from inside psql (I use PostgreSQL), they -both- (!)
 complete within split seconds...

 If I leave set_time_limit() on the default of 30 secs, my script will time
 out somewhere around these lines (though it seems like coincidence...):
 function CalcDenied
 (
 $Requested,
 $Agreed
 )

 {
 $Denied = $Requested - $Agreed;-- Timeout here
 if ($Denied  0)   -- Sometimes here
 {
 $Denied = 0;
 }

 return $Denied;
 }

 To me, this does not seem to make any sense, especially since the first query
 (without the additional condition) runs fine, whilst it has to return many
 more rows.

 Does anyone have any idea what could be going on?


=I've got this sinking feeling that suggests I'm missing something obvious, but ...

=Have you tried ECHOing those long SELECT statements in PHP to see how they resolve, 
before throwing them at
PostGres? Have you tried putting an ECHO into CalcDenied() to ensure that you are 
getting what you, er,
$Requested and that it agrees/$Agreed with what you expected? (sorry, had to ask) - 
the $CommonSQL bothers me
for some reason...

=I don't use PostGres, but the clause that you introduce does not require another 
index/table/resource, so on
the face of it I can see no problem with the SQL - except consider using:

GROUP BY customer, driver_lastname,  driver_firstname

=Apart from the time-out point, why do you link the SELECT and the function - what 
data passes between them (is
it ECHOed...)?

=Are you sure that the function is not being repeatedly called until the script times 
out (default time is
30secs) because of some never-ending loop condition - how many times is it being 
called per data-row? How many
data rows are we talking about here?

=Sorry if they're just 'shots in the dark'!
=Let me know,
=dn



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] mail() with mailing lists problem

2001-11-13 Thread DL Neil

Rudolph,
Mail() is v.finicky!
Windows machines need more than the \n - what are you running?
Have you tried putting some string of characters into the (text) msg body?
Can you send us a copy of the actual email msg showing the headers etc (output as 
received at the POP/IMAP
server) - after clipping all/most of the encoded contents please?
=dn

- Original Message -
From: Rudolf Visagie [EMAIL PROTECTED]
To: TD - Sales International Holland B.V. [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: 13 November 2001 08:40
Subject: RE: [PHP] mail() with mailing lists problem


 True. I had the attachment outside of the function (encoding once) but this
 is a leftover of debugging and trying to get it to work. I hadn't thought of
 Bcc-ing everybody. I'll try that, thanks. Still doesn't solve the problem,
 though. Maybe a socket is the answer.

 -Original Message-
 From: TD - Sales International Holland B.V. [mailto:[EMAIL PROTECTED]]
 Sent: 12 November 2001 04:15
 To: Rudolf Visagie
 Subject: Re: [PHP] mail() with mailing lists problem


 If you send the same message over and over wouldn't it be a LOT wiser to BCC

 the rest of the people? This way you are MIME-encoding the attachment over
 and over which consumes a lot of resources. MIME-encoding a 10MB file will
 suck up a P-III 600 for 20 to 30 secs or so depending on other background
 processes and diskspeed. MIME encoding the same attachment a 1000 times
 doesn't appear really fast to me. Also, with all the headers you use, you
 could just as well open a socket to the SMTP service, then you could have
 additional error checking I guess...


 Just some thoughts..

 regards

 On Monday 12 November 2001 13:47, you wrote:
  Hi All,
 
  While everybody is on this topic, here's a problem I have been having. I
  use mail() in a function in a loop to send e-mail with an attachment. The
  e-mails get sent out to the different recipients but only the last one
 gets
  sent correctly. The rest loses the 'From:' somewhere so that the message
  ends up with the server name as from who and with the encoded attachment
  inside of the message body. Here's the function:
 
  function mail_attachment ($to, $subject, $message, $addr_from,
 $attachment,
  $filename) {
 
  /*
  This function sends an e-mail with a file attachment using the
  standard
  PHP mail function with parameters $to, $subject and $message.
  The $attachment parameter is a string with the attachment file
  content with
  filename $filename.
  */
 
  $boundary = b.md5(uniqid(time()));
  $mime = From: $addr_from\n;
  $mime .= Reply-To: $addr_from\n;
  $mime .= X-Mailer: Digital Healthcare Solutions\n;
  $mime .= X-Sender: $addr_from\n;
  $mime .= Content-type: multipart/mixed; ;
  $mime .= boundary = $boundary\n\n;
  $mime .= This is a MIME encoded message.\n\n;
  // First the regular message
  $mime .= --$boundary\n;
  $mime .= Content-type: text/plain\n;
  $mime .= Content-Transfer-Encoding: base64;
  $mime .= \n\n.chunk_split(base64_encode($message)).\n;
  // Now the attachment
  $mime .= --$boundary\n;
  $mime .= Content-type: text/plain\n;
  $mime .= Content-Transfer-Encoding: base64\n;
  $mime .= Content-Disposition: attachment; ;
  $mime .= filename = .chr(34).$filename.chr(34);
  $mime .= \n\n.chunk_split(base64_encode($attachment)).\n;
  $mime .= --$boundary--;
 
  mail ($to, $subject, , $mime);
  }
 
  and here's the loop in which it gets called:
 
  $i = 0;
  while (isset($EmailAddress[$i])) {
  mail_attachment ($EmailAddress[$i], URGENT Communication,
  $message, $addr_from, $attachment, $filename);
  $i++;
  }
 
  Does anybody have any ideas?
 
  Rudolf Visagie
  Principal Software Developer
  Digital Healthcare Solutions
  Tel. +27(0)11 266 6946
  Fax. +27(0)11 266 5080
  Cell: +27(0)82 895 1598
  E-mail: [EMAIL PROTECTED]

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: mail() w/ mailing lists

2001-11-12 Thread DL Neil

   Is is advisable that I mail lots of users from a database via one call to
   mail() ?

 why not make a loop and send to one email at a time. if you have over
 1000 I would use something else than mail(), ex direct to smtp with sockets.


Henrik,

It is my opinion (too?) that mail() is difficult to use in a non-trivial application. 
I have not
used/investigated sockets. I have had good success with a 'wrapper class/function set' 
for mail(). I'm wondering
if I should also look at what you have proposed.

What does the extra effort of using sockets give you that using a decent wrapper for 
mail() wouldn't? For
example do you get a 'msg sent' confirmation advice?

Does the socket-based connection require more than standard access (Id/pswd) to the 
SMTP server? -is it both
Linux and Windows compatible? -is it both in-house server and ISP compatible?

Please advise,
=dn
(will appreciate good web references if it would save you time)


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Attachments again

2001-11-12 Thread DL Neil

Hi Sjoerd,
 
 When i send a dynamic HTML newletter, which contains newsitems in the
 database I now send the e-mail with a link to the image on the webserver.
 What i would like to do is instead of linking the image, send the image as a
 sort of attachment. So an internetconnection is not required when viewing
 the e-mail.


I use www.phpguru.org's, HTML MIME class.

Regards,
=dn



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Date help (no not that kind)

2001-11-11 Thread DL Neil

Hi Sundog,
Can help you with dates (but no, if you want that kind you'll definitely not be 
wanting my advice...)

- Original Message -
 I am trying to determine if todays date ($today) is within a week
 ($startcheck) of a given date ($dob). This is what I have so far.

 $todaydate = (date(Y-d-m));
 $today = strtotime($todaydate);
 // $today prior to strtotime = 2001-10-11
 $startcheck = strtotime(2001-08-11);
 $dob = strtotime(2001-15-11);

 //$today is CLEARLY between the two dates I'm testing with but no is
 always returned.

 if($today = $dob  $startcheck = $today) {
 print yes;
 }
 else {
 print no;
 }

 Here are the values assigned to the vars, why is $today so much smaller
 than $startcheck and $dob?

 1002783600 = today
 1005452940 = startcheck
 1005451980 = dob

 win32 php4


Let's start with perceptions because there's a couple here that have the potential 
to hold you on the
side-benches whilst everyone else has a date and has made it to the dance floor...

The manual (http://www.php.net/manual/en/function.strtotime.php) says, strtotime --  
Parse about any english
[sic] textual datetime description into a UNIX timestamp. The key word is any and 
the fact that it is not
all.

 //$today is CLEARLY between the two dates I'm testing with but no is
 always returned.

Er, no - it is not clear! A quick geography/horology lesson: the rest of the world 
either do not use the same
date system or do not express the Gregorian calendar the way Americans do. Today no 
one has a problem with a
date written as 11/11/2001, but when 10/11/2001 is written down, does it mean 
yesterday (10-Nov-2001) or one
month back (11-Oct-2001)? In America, the two formats are known as American 
(MM/DD/CCYY) and European
(DD/MM/CCYY) format.

Moving to the format used in the code above (2001). A format of this nature is 
widely used because it
facilitates sorting/comparisons - ah but watch those perceptions, if you were 
comparing/sorting/performing
arithmetic on two dates, one in Oct and one in Nov, then the convention will have to 
be CCYYMMDD = century,
year, month, then day! BTW you will see the logical flow of this ever decreasing 
period/increasing precision,
and how it can be kept going into CCYYMMDDHHMMSS and thereafter depending upon your 
needs, time base/available
utility functions, etc!

The function is called 'string to time'. In other words, a series of alphanumeric 
characters are passed, and a
date-time is returned (in the form of a UNIX timestamp). Given that there are many 
perceptions involved in
interpreting what the incoming string of digits means, some dates cannot be 
unambiguously expressed/resolved (eg
yesterday's date).

It's always a good idea to add some 'debug echoes' to new code, just to be sure that 
your perceptions agree with
the computer's implacable logic - I added to your code:

echo Todaydate=$todaydate~;
echo brToday=$today~ Startcheck=$startcheck~ DoB=$dob~;
echo br.
 Today=.date(Y-M-d,$today).
 ~ Startcheck=.date(Y-M-d,$startcheck).
 ~ DoB=.date(Y-M-d,$dob).~;

and this was returned:

Todaydate=2001-11-11~
Today=1005436800~ Startcheck=1005510600~ DoB=1005509700~
Today=2001-Nov-11~ Startcheck=2001-Nov-11~ DoB=2001-Nov-11~no

The last no is the original output, but before that you can see 'why' - if the date 
values/definitions are
modified, the code works exactly as (I perceive, is) required.

Regards,
=dn



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: Questions about php.ini

2001-11-03 Thread DL Neil

Would the annotated manual LXV. PHP options  information be of any use?
=dn

- Original Message - 
From: jennyw [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 03 November 2001 03:18
Subject: [PHP] Re: Questions about php.ini


 This is a dedicated server, and I have several sites on it. One of the
 things I'd like to be able to set differently for each site is session
 expiration. Is there a way to do this without mucking around w/ php.ini?
 
 Thanks!
 
 Jen
 
 
 Jason Wood [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  I host with iServer (now ViaVerio) and we dont have a php.ini file (that
 we
  can get to, anyways) either.   I run phpinfo() and it says that the ini
 file
  is in /usr/local/lib but nuthin's there.
 
  What exactly do you want to use different ini files for anyways?
 
 
  --
  Jason Wood
  Chief Technology Officer
  Expressive Tek, Inc.
  407 Kehrs Mill Road
  Ballwin, MO 63011
  Phone 636.256.1362
  www.expressivetek.com
 
 
  Jennyw [EMAIL PROTECTED] wrote in message
  [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
   I've signed up with a dedicated Web host that has PHP installed. The
 weird
   thing is that there is no php.ini anywhere. Is the file optional?
  Everything
   seems to be behaving okay.
  
   I have several Web sites that I'm setting up. Is it possible to use
   different php.ini files for each Web site? I'm using apache with
 mod-php.
  I
   see that PHP will search for php.ini in the working directory first.
 Does
   this mean that the way to accomplish what I want is to put a php.ini
 file
  in
   each directory that has .php files? It would be better if there was a
 way
  to
   have a php.ini file affect all files in a site, instead of putting
 php.ini
   files in all subdirectories of the site where there are .php files.
  
   Thanks!
  
   Jen
  
  
  
  
 
 
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Incoming mail to PHP as Apache module

2001-11-03 Thread DL Neil

 Maybe I should be posting this on the Procmail list but someone here
 might have a non-Procmail solution. I'm trying to get a PHP script to
 process incoming email. The script will lookup a database and do
 something depending on the mail headers. I'm running on a FreeBSD
 virtual server account with sendmail as the mta. I've searched the
 archives and read numerous discussions about this but I'm not quite
 sure what my best option is.
 
 Most suggestions say to use aliases or Procmail to pipe to PHP running
 in cgi mode. I'm trying to avoid that because I have PHP running very
 nicely as an Apache module and disk space is at a premium so I don't
 want to waste another 4 Mb or so on the cgi executable.
... 
 I'd appreciate any suggestions or ideas.


Ross,
Following your comments about HDD space, would the PHP-IMAP functions be any use?
Annotated manual: XXXVII. IMAP, POP3 and NNTP functions
=dn




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] regular expression

2001-11-01 Thread DL Neil

Wow, there are some long and curly ways to use RegExp-s aren't there? I'm not very 
good at them (and I hear that
they can be expensively inefficient) so I tend to look elsewhere.

Check out pathinfo -- Returns information about a file path
array pathinfo (string path)
pathinfo() returns an associative array containing information about path. The 
following array elements are
returned: dirname, basename and extension.

- the basename result appears to give what you have requested: with all entered 
directory names but NOT
assigned their names to file name

However you then go on to talk about qwert.txt.ru  = qwert.txt.ru.

I'm not sure what pathinfo() does in this situation with regard to its extension 
result. Perhaps you will test
and advise!? Nor can I be sure that the previous contribution will address that part 
of the problem. Does having
a filename containing multiple dots (placed in the appropriate directory) contravene 
the specification?

=dn


- Original Message -
From: Christian Reiniger [EMAIL PROTECTED]
To: Galkov Vladimir [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: 01 November 2001 11:50
Subject: Re: [PHP] regular expression


On Thursday 01 November 2001 10:39, Galkov Vladimir wrote:
  Need to remove all ../   /..  from user inputing string to prevent
 him walking and creating filesdirectories where I don't whant see
 them/him...

 The string:

  $path =
 eregi_replace('([..]{2,})|([./]{2})|([../]{3,})|([/.]{2})|([/..]{3})',
 '', $path);

 works good with any  combinations ( ../../..qwert.txt  =  qwert.txt)
 untill somth like /../asd/../qwert.txt will be entered ...
 (/../asd/../qwert.txt = asdqwert.txt).
  So the qwestion is how upgrade regular expression to remove all this
 correctly (with all entered directory names but NOT assigned their
 names to file name...

Here's what I use (take out the parts useful to you):

function FixSrcURI ($SrcURI)
{
// remove script name
$SrcURI = preg_replace ('#^/*{{$ Page.Source }}/*#', '', $SrcURI);

// remove potentially harmful parts
$SrcURI = preg_replace ('#/?\.\./?#', '/', $SrcURI);
$SrcURI = preg_replace ('#/\./#', '/', $SrcURI);
$SrcURI = preg_replace ('#/\.$#', '/', $SrcURI);
$SrcURI = preg_replace ('#/{2,}#', '/', $SrcURI);
$SrcURI = preg_replace ('#^/#', '', $SrcURI);

if (preg_match ('#(\A|/)\.#', $SrcURI) ||
preg_match ('#CVS#', $SrcURI))
{
pbHTTP_404 ();
}

if ($SrcURI == '') {
return array ($SrcURI, -1, 'src');
}
else {
$matches = array ();

if (preg_match ('#^[^/]+$#', $SrcURI))
{
return array ($SrcURI, '', $SrcURI);
}
elseif (preg_match ('#^(.*)/([^/]*)$#', $SrcURI, $matches))
{
return array ($SrcURI, $matches [1], $matches [2]);
}
else
{
pbHTTP_404 ();
return false;
}
}
}

--
Christian Reiniger
LGDC Webmaster (http://lgdc.sunsite.dk/)

/* you are not expected to understand this */

- from the UNIX V6 kernel source

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: [PHP-WIN] 4.0.6 mssql.dll Extension load failure

2001-11-01 Thread DL Neil

Mike,

 We have PHP installed as an ISAP module on our W2K IIS5 server and
 its operational with no problems - phpinfo() runs just fine.

 But - When I uncomment the php_mssql.dll extension in php.ini I get an error
 when PHP starts up saying it cannot find the .dll file.

 The extension directory is correctly set to, c:\php\extensions
 and the actual file itself is in that directory as wells as
 c:\winnt\system32 and MSSQL client libraries are loaded and operational.

I found that PHP was adding the slash between the dir name and the extension's 
filename, and that caused a
problem such as you have described - so did adding a slash as the final character. 
Here is the code that works
on my WinNT4.0/Apache set up (watch the dir diff):

extension_dir = C:/program files/php/extensions

 Cant think of anything else I need to do - does the .dll file need
 be registered with regsrvr or something ??

=no

  Can anybody give me some pointers please this problem is driving me nuts -
 I even tried reversing the slashes to the UNIX way !

=um, don't like the sound of that...
=dn



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] mail() extra headers not working

2001-11-01 Thread DL Neil

  I am trying to ad extra headers to email's I am sending through php. I
 want to ad Reply-To: and Bounse-To: addresses.  But when add them useing
 the  forth feild of the mail() funtion.
 mail($recipient,$msubject,$message,Reply-To:  $sender);
 but for some reason when I send this e-mail it puts a newline befor this
 header so it becomes part of the message not the headers.  Any ideas on
 what to do??



Byron,

I had the same problem. Gave up!

I recommend that you check out Richard Heyes' MIME and SMTP classes available from 
http://www.phpguru.org/.

Regards,
=dn



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Utility script: dates

2001-11-01 Thread DL Neil

Somewhere on my travels around the many PHP/script sites, I'm sure that at one time I 
noticed a date-display
utility. I cannot find it again. Please would someone point the way...

What I'm looking for:
displays a form with a variety of date/time fields, user enters a date/time into 
various fields -
utility returns with equivalent values/formats, eg timestamp to calendar, local to 
GMT, date to day of week,
etc.

Please advise,
=dn



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] spliting results into 2 colomns

2001-10-31 Thread DL Neil

 I have following code, sorry it's pretty big for posting,  i want to
 split the output into 2 colomns, been trying almost all still can't
 get it working


Harik,

First off, have you checked the manual 
(http://uk.php.net/manual/en/function.mysql-result.php) and the
recommendations against the use of mysql_result()? In this situation, one of the 
mysql_fetch_... functions might
be a better choice because both data fields could be extracted in one operation. Apart 
from 'efficiency', the
other reason for my saying this (I have never used _result()) is that I can't see 
where the manual talks about
what _result() returns when it gets to an end-of-data situation (the _fetch_ functions 
return FALSE and are thus
perfect for use in controlling while loops).


Now to logic. May I offer a short programming lesson? If you are an experienced 
programmer and this is 'talking
down' to you, I apologise. However this question has been asked (in a few guises) a 
couple of times recently, so
lets get an answer up on the FAQs/archives...

This program requires two processing loops: one to cycle through the available topic 
data, the other to display
results in a two-column HTML table. Most of us think in terms of starting at the 
beginning (get the data) and
working through to the end (display the results) - from the script provided it seems a 
reasonable assumption
that you have done exactly this, and that everything is working properly (up to that 
last step before the
end). However computers are logical but not rational. Sometimes it is worth starting 
at the end and working
back towards the beginning!

The 'second loop is described as being responsible for presenting the results (in 
this example, a table with
two columns). There are three logical parts to the entire process: setting up the HTML 
code for the table,
looping through the rows (and columns), closing off with the end of table HTML code.

In pseudo code it looks like:

   prepare the web page (as necessary) and echo the TABLE tag
   for each row of the table
  echo the TR tag
  echo the first column (TDdata/TD)
  echo the first column (TDdata/TD)
  echo the /TR tag
   echo the /TABLE tag and close the web page

Quick aside: with two columns the above is acceptable. If there were numerous columns, 
but also because the
other processing required here brings added complexity, an inner loop might be 
appropriate, thus:

   prepare
   for each row
  TR
  for each column
 echo the TDdata/TD
  /TR
   finish-off

Now let's talk about the topic-data loop process. Again, divide the logic into three 
parts: setting up MySQL and
SELECTing the primary data, looping through each of the SELECTed records, and cleaning 
up afterwards. The
existing script is neatly laid out to show this. In pseudo code, the script's logic 
becomes:

   set-up db and query table
   for each row returned
  perform secondary query/assemble and format full report data
  present topicId, topicName, and counter
   close down

That being the case, can all of the processing of individual (in-bound) data records 
be packaged into a
user-defined function? (modular programming) If the function returns true/false as 
well as the next data record,
then the boolean state can be used to detect the end-of-data condition:

   set up
   while ( not end-of-data )
  getnextrow()
   close down

OK, so much for all that, how do the two halves get put back together? There are two 
loops, one cycling through
HTML table tags, and the other cycling through a DB recordset/resultset. Because the 
output format is the
important part/has the higher number of logical components/subdivisions, it must 
dominate the logic. Thus the
data-provisioning part should be inverted - instead of squirting out data like a hose, 
which the HTML then has
to be 'fitted around'; it should be set up like an on-demand drip feed, so that when 
the HTML requires a
'squirt' of data, it is delivered, one swallow at a time! Let's do this in two stages 
- first of all, with no
data processing (ie just reporting/important part first). Combine the two set up 
code-blocks, and the two
close-down code blocks and outline the HTML processing:

   prepare the page (as necessary) and echo the TABLE tag
   set-up db and query table
   ---
   for each row of the table
  echo the TR tag
  for each column
 echo the column data (TDdata/TD)
  echo the /TR tag
   ---
   echo the /TABLE tag
   close down (the DB)

But how do we know how many rows to put in the table? Answer: we don't, and so have to 
set up the loop controls
accordingly. if you prefer to continue using for-loops you can control these by use of 
the numOfRows =
mysql_num_rows ($result) code; or if you make the outer into a while-loop then the 
idea of the boolean
(mentioned above) brings a process-while-there's-still-data logic into play:

   Function getnextrow(...)
  perform secondary query/assemble and format full 

Re: [PHP] lesson in NOT how to run your php website ...

2001-10-30 Thread DL Neil

  I teach law at a university  .. I also run the website here ...
 
 Thankfully Tasmania is not considered part of Australia. :)
 
 *troll bait away*

=but are you trolling for bad lawyer jokes to wind up brendan, or inviting the rest to 
take on the Aussies?

=Tasmania advertises itself as the bit under, down-under
separatist revenge on mainlander ignorance?

=mind you, the words ignorance and Aussie in the same sentence...
=dn



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] PHP templates vs XML

2001-10-29 Thread DL Neil

In an on-again-off-again desultory style, I keep trying to find the time to study 
template systems - and quite
separately see if I can find a practical use for XML.

The idea of a template system is that the HTML code/presentation of the final view to 
the user/browser, can be
devised/maintained quite separately from the PHP code required to pull data out of the 
back-end
db/processing/whatever. Correct?

The systems I've looked at do this by allowing you to put 'tags' into the HTML which 
are subsequently
expanded/replaced with 'real data' by the template processor immediately before 
presentation to the browser.

Now, again broadly speaking, XML allows us to define our own tags, which are 
subsequently ... Correct?

So: when would you use a template system and when would you use XML?
(and thus: on which one should I concentrate my research? )

Any all pointers/references to online information sources will be much appreciated.
=dn



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Displaying please wait

2001-10-29 Thread DL Neil

Is there someone 'up' on the way Apache works who can offer some comment please?

Th how do I display 'please wait'  question was asked by someone (else) last week. 
The standard answer is
no - server-side PHP assembles an HTML page, and when it is completed the whole page 
is transmitted from the
web server to the browser. However is this strictly true?

I managed to do something warned about in lesson two of ComSc 101, and put my PHP into 
a never-ending loop (hey,
after all these years, it's just to keep me humble...). What was happening was that a 
database record would be
read in, a whole pile of debug 'echo's sent to the screen to demonstrate the 
processing, then the next record,
and so on... the governor/loop limit code failed and was stuck on 'true' so while true 
loop forever...

What I saw on the screen - particularly the behavior of the scroll bars, was that a 
certain amount of data
(let's call it a 'buffer') was produced within Apache, and then it would be sent to 
the screen, then there would
be a short pause, then another 'buffer' load would be displayed in the browser, then a 
pause... This behavior
similar to response from a long-distance www link or taking stuff down a slow dial-up 
line from an overloaded
server; BUT everything on my machine is local !

Does this mean that Apache retains a certain amount of the page internally, but once 
the volume grows, Apache
relieves storage pressure by transmitting even though the whole HTML page has not yet 
been resolved? If so, any
idea what the 'buffer' size might be? Or is there any way to adjust that 'buffer' size 
HTML page by page?

Enquiring minds and all that...
=dn




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] how to recognize local or server execution?

2001-10-28 Thread DL Neil

John,

Netscape! Differences between servers AND differences between browsers AND differences 
between in-browser and
command-line operations!
Isn't life fun?

Like you I'm messing around with some of these differences as part of a bid to 
'convert' an existing set of
scripts from browser i/f to command-line. At present I'm putting up with all the HTML 
output - that's a ToDo
'soon' I guess; but have fixed the time-clock base so that everything is converted 
back and forth between
UTC/GMT and local times.

Like you I have rolled-my-own function which uses the following two variables: 
SetSuffix($argv[0],
$GLOBALS[SERVER_NAME]);
$ServerName is used to work out which (Apache) Vserver is running the script, whereas 
$directory is used to work
out where code is being run from (at the command line). The main decision being driven 
from here is whether to
run off the 'production' or 'test' database - I've just tweaked that from code I wrote 
some weeks ago around
another global. I guess I'll now have to emulate your plan and now work out how to 
control all the output, if
not logging, then displaying at the command line/green screen as opposed to the 
browser.

Regards,
=dn

  Thanks for the idea. I have just resurrected and had another play with my
 'testbench.php', running it from both
  IE/Apache and in a DOS box.
 
  It includes the following code:
 [...]

 Thanks (also thanks to the others for the useful comments  ideas).

 I don't have $HTTP_SERVER_VARS[SERVER_NAME]
 or $GLOBALS[SERVER_ADDR] or $SERVER_SOFTWARE
 probably because my server is netscape (nsapi?). They
 are all blank. Yes I declared them 'global'.

 I ended up with these functions which seem to do the trick, at
 least for my server and NT.

 function isonserver()
 {
 global $PHP_SELF,$argc;
 return $argc==0  isset($PHP_SELF)  $PHP_SELF;
 }

 function getpagename()
 {
 global $PHP_SELF,$argv;
 return basename(isonserver() ? $PHP_SELF : $argv[0]);
 }

 function getlinedelimiter()
 {
 return isonserver() ? \n : \r\n;
 }

 The pagename is critical to my site, because the code needs
 the page name to recognize certain suffixes and 'special page
 names.

 Perhaps it is only sufficient to test for $PHP_SELF and not $argc,
 but I threw in $argc==0 anyway.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] HELP: Syntax Needed

2001-10-28 Thread DL Neil

 Jokes aside, I still don't get it.

=the word it is part of the difficulty everyone faces in thinking about whether they 
could help or not - what
it is, is not apparent
1 there is a problem with a mysql_pconnect() call, and
2 there is a problem with a mysql_query() call.
Which one is it?

=the confusing presentation of the question, even more confused by the lack of 
substance/focus in the rejoinder,
is not helping.

=the very first suggestion that those who have answered more-or-less this exact 
'pconnect' question many times a
week for ..., is a not-so-subtle hint to RTFM (and/or to review the list archives). 
When you read up about how
to write variables and constants, and how to use the mysql_... functions, then more 
will become obvious, and
less sarcasm will come your way.

=worse, you have quoted incomplete/inaccurate code fragments, so immediately the 
question arises: what else has
been left out? (the answer being closely related to it).

=The manual clearly says that missing out certain calls may not matter because MySQL 
will make assumptions and
attempt to carry on, but the instant problems arise, surely it would be better to 
follow all the examples in the
manual - which step through all of the calls, in sequence?

=next point: if you have a problem with a series of instructions, go back to first 
principles, break things down
and throw in echo/printr statements to 'prove' any and all assumptions - particularly 
the first time you try out
some code.

=last point: EVERY call to a client-server function should be checked (there's RTFM 
again), this will show if
the fault lies at 'pconnect', at 'open', and/or at the 'query' stage.

=dn
PS lecture mode off - please take advantage of our 'two-fer' special offer: any two 
well formed questions sent
to the list this week will be answered for the same price as one!



  $host = localhost;
  $MyAccount = AccountName;
  $MyTable = Table1;
  $MyPassword = beep;

 This works:
 mysql_pconnect($host,AccountName,beep);
 $news = mysql_query(SHOW TABLE STATUS FROM AccountName LIKE 'Table1');

 Why doesn;'t this?

  $myconnection = mysql_pconnect($host,$MyTable,$MyPassword);
  ...
  $news = mysql_query(SHOW TABLE STATUS FROM $MyAccount LIKE
  '$MyTable');

 I have tried variations with or without  and '. Is there a way to make this
 work? Or do I have to do as above every time?

  $host :)

 Your telling me to put $host in $host? OK:

  $myconnection = mysql_pconnect($host,$MyAccount,$MyPassword);

 It doesn't work?! Neither does:

  $myconnection = mysql_pconnect($host,$MyAccount,$MyPassword);
  $myconnection = mysql_pconnect('$host','$MyAccount','$MyPassword');

 If I try this, $stringing just $host, it works!?

 mysql_pconnect($host,AccountName,beep);



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] switch-statement overrides use of global arrays?

2001-10-28 Thread DL Neil

Imar,
The global array is being defined in the mainline, but not populated. What happens if 
you set element 0 to some
value (to take up some storage space first) and then try the switched function calls?
When you say Alas, this also emptied the array each time I went from one function to 
another via the switch
statement. do you mean that the array definition line is inside the same loop that 
causes the switch statement
to be revisited?
(it shouldn't be - put it right at the beginning of the 'mainline' and ensure that it 
is not re-executed (which
would indeed 'reset' the values))
Regards,
=dn



- Original Message -
From: Imar de Vries [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 28 October 2001 21:49
Subject: Re: [PHP] switch-statement overrides use of global arrays?


 Henrik Hudson wrote:

  I would think you would need to define $array_test outside in a global
  environment rather then inside the function since I think/thought it will
  just stay scoped in there and that  global was used to access variables
  which weren't defined inside a functions scope and make it look outside.
 
  In other words
 
  //Define GLOBAL
  $array_test = array();
 
  switch(){
  BLAH
  BLAH
 
  }
 
  function main() {
  global $array_test;
  BLAH
  BLAH
 
  }
 
  function test_one(){
  global $array_test;
  BLAH
  BLAH
 
  }

 Yes, the only way I could avoid errors that occurred when I tried to manipulate
 the array, was to add a $array_test = array(); a few lines before the switch
 statement. Alas, this also emptied the array each time I went from one function
 to another via the switch statement.

 I guess I am trying something that is just not possible (when I insist on using
 the switch statement)?
 --
 Imar de Vries - [EMAIL PROTECTED] - ICQ 6972439



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Replace text

2001-10-27 Thread DL Neil

 Hello guys

 function replace_text_smiley(){

 global $comment;
 // To add a relation between a text smiley a an image smiley do this:
 // $faces[text smiley here] = img tag to image smile here;

 $faces[:)] = IMG SRC=\emoticons/smile.gif\;
 $faces[:P] = IMG SRC=\emoticons/tongue.gif\;
 $faces[:D] = IMG SRC=\emoticons/happy.gif\;
 $faces[:(] = IMG SRC=\emoticons/mad.gif\;
 $faces[;)] = IMG SRC=\emoticons/wink.gif\;

 while(list($text,$image) = each($faces))
 {
 $comment = str_replace($text,$image,$comment);
 }

 return $comment;
 }

 this function replaces faces to smilies images

 then in a separete file i use this function and another one to replace urls... the 
url replacement is ok but
it doesn't change the text to smilies..

 any guesses?? :)

=do you really want those quotation marks in the str_replace function call?
=dn



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] command line option f -- how do i get the name of the file?

2001-10-27 Thread DL Neil

 I am writing a script using php's command line ability and I am lost on 
 how to work with a file when I don't kow what the file's name is.
 
 Example:
 script.php -f file
 
 In my script, how do I reference the file when I have no idea what it's 
 name is going to be?
 
 The scrip will get called by another application: the other application 
 will pipe a file to my scrip and then the scrip has to work with the 
 file and output an altered file with a new filename. I have no idea what 
 the name of the file is going to be beforehand.


lucas

Take a look at environment variables (etc).

=dn



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP File not found

2001-10-26 Thread DL Neil

 The only pages that are getting this error are the ones that php is mapped
 to parse (i.e. .html .php .phtml) if I go to a page that doesn't exist with
 a .htm or .cgi extension etc it works fine and I get the standard IIS 404
 error page.
 But when it is a page that php processes thats when the CGI error returns.

=I'm working from (vague) memory and a good six months back when it was my first (and 
only) time to work with the
IIS/PHP combination. Once I fired up Apache and figured out a few of its quirks, I saw 
little reason to run the heavier
product - even on a WinNT/2000 machine. I can't even remember the IIS terminology... I 
seem to recall that there is a
tab/frame somewhere within the MMC for setting up scripting languages/server side 
processing. In the flurry of detail
there, does it set up a separate exception processing (eg Error 404/500 pages) handler 
for each script processor? That
being the case, there would be no standard: 404 error page, but a series of error 
pages for each - and such a structure
may indicate why you find a different behavior for HTML as PHP

=... but I hear ominous creaks from the thin ice beneath me...

 What are the [PHP-Win] mavens?

=We are conversing on the [PHP] discussion list. There is a companion list dedicated 
to the use of PHP under Windows
called [PHP-Win].

=(from Cambridge International Dictionary of English)
maven
noun [C]
AMERICAN INFORMAL
a person with good knowledge or understanding of a subject
He's a baseball maven who knows Hank Aaron's home run statistics by heart.

(apologies for sullying your tender ears with such an Americanism)

=As I say, I'm sure a 'practising Windows professional' would be able to assist you 
(more) competently, and I think that
is where you'lll find (at least) one.

=Regards,
=dn





 THanks.
 Dl Neil [EMAIL PROTECTED] wrote in message
 048001c15dab$d5c0fcf0$a516100a@jrbrown">news:048001c15dab$d5c0fcf0$a516100a@jrbrown...
   I have just set up PHP on my webserver (IIS 4 on NT4).
   I have set up the script mapping so that I can save php files as .html
 and
   php processes them.
  
   This works fine until someone goes to a page that doesn't exist -
 instead of
   getting the customised error 404 page (i.e. the page you requested
 cannot be
   found), php prints:
  
   CGI Error
  
   The specified CGI application misbehaved by not returning a complete set
 of
   HTTP headers. The headers it did return are:
  
   And thats all I get.
  
   Does anyone know how to customise this page or set up a new one?
 
 
  Chris,
  That's an IIS function (not PHP).
  It's a pane accessible from the MMC.
  Perhaps the [PHP-Win] mavens could help?
  =dn
 
 



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] variable gets lost in function problem again...

2001-10-26 Thread DL Neil

 I have an two dimensional array that is returned from code from an included
 file. I'm assigning parts of the array to variables ( $variable =
 $array[key][value]; ). This works fine and can be printed until I send
 it through a function eg. ( ereg_replace( , _, $variable); ). After
 this, $variable is blank.
 
 I don't think it's my code because substituting a text string for the array
 data (eg. $variable = this is some text;) works just fine.
 
 It has something to do with the assigning array data to a variable or
 perhaps that the data comes from an included file... This could be a bug in
 PHP? 



Spunk

Could you post some excerpted code please? 

You seem to have multiple issues:
1 communication between a 'mainline' and INCLUDEd code
2 communication between a 'mainline' and a function
3 working with scalars and arrays
4 working with text strings and ?text arrays
- which may or may not be related/relevant

Let's start with simple ideas:
0 put debug echo statements into the function (or everywhere) to track progress
1 if you take the processing code out of the INCLUDE file and put it in the 
'mainline', does it then work as planned?
2 do you have an  to indicate a pass by reference cf a pass by value (see manual)?
3 and 4 does the processing use tools/approach/functions that only work with 
scalars/arrays/strings?
A process of elimination...

Keep us posted,
=dn



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Debugging aids (after the style of: Error management)

2001-10-26 Thread DL Neil

Don't you like the side-benefits of this list, eg that someone comes up with a 
question that gets your thought processes
running or suggests an idea you'd not otherwise come up with!?

So further to the question:

 How can I know the line and the file from where a function has called. I
 already know __FILE__ and __LINE__, but I don't want to transmit them in
 arguments.

is there a debugging facility in PHP which displays a 'map' of which functions have 
called which?

So for example, a script crashes at line_56 in file_fred.php, which is what we've all 
come to know and love; but I'd
like to know that it got there by the mainline calling FnOpen(), which called 
FnInitialise(), which in turn called
FnUncleTomCobbleighAndAll(), where some incompetent happily three layers down tried to 
share out the spoils by dividing
by zero (or whatever)...

Looking in the manual I started with:

Chapter 8. Constants
Predefined constants
A constant is a identifier (name) for a simple value. As the name suggests, that value 
cannot change during the
execution of the script (the magic constants __FILE__ and __LINE__ are the only 
exception). A constant is case-sensitive
by default. By convention constants are always uppercase.


but if these two are the only magic constants then I'm out of luck there. So I 
meandered through the PHPINFO and
environment variables, but nothing stood up and popped me in the eye.

Anyone know better/have a bright idea?
=dn



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] how to recognize local or server execution?

2001-10-26 Thread DL Neil

Mark,
Backing John's question up by one iteration: is there a PHP environment variable which 
can be used to
distinguish between code being run from the command line and code being run in a 
browser?
- and the Million dollar question, sorry make that the M$ question: will it also work 
under Windows?
Please advise,
=dn


On Fri, 26 Oct 2001 17:18:37 -0400, John A. Grant wrote:
I have an xxx.php page that runs on my Unix server.  I also
run php.exe on my NT box to generate the corresponding
xxx.html file like this:
  c:\ php -q xxx.php  xxx.html

The xxx.php file contains stuff like this:
  print hello\n;

That means stdout from the server and the xxx.html file
both contain \n.  I would like the xxx.html file to contain
\r\n so it can be viewed/edited with notepad. Yes,
notepad and \r\n both suck, but that's another story...

So I guess I would like my code to look like this:
  if(running php.exe on my NT box){

try:
if (strstr(php_uname(), Windows)) {

$delimiter=\r\n;
  }else{
$delimiter=\n;
  }

and then my code looks like:
  print hello$delimiter;

How can I do this?

--
John A. Grant  * I speak only for myself *  (remove 'z' to reply)
Radiation Geophysics, Geological Survey of Canada, Ottawa
If you followup, please do NOT e-mail me a copy: I will read it here






--
Mark, [EMAIL PROTECTED] on 10/26/2001



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] how to recognize local or server execution?

2001-10-26 Thread DL Neil

Thanks for the idea. I have just resurrected and had another play with my 
'testbench.php', running it from both
IE/Apache and in a DOS box.

It includes the following code:
-
echo br.sizeof($argv).~Array of Args passed to script=;
while ( $element = each( $argv ) )
{echo br; echo $element[ key ]; echo  = ; echo $element[ value ]; }
echo brhr\n;
echo br.sizeof($argc).~Cmd line params passed to script=$argc;
echo brhr\n;
-

In the browser it responds with:
-

0~Array of Args passed to script=



1~Cmd line params passed to script=0


-

In the DOS box it produces:
-
br1~Array of Args passed to script=br0 = c:\data\webs\brucedev\testbench.php
brhr
br1~Cmd line params passed to script=1brhr
-

Which is a vaguely fascinating difference, but sadly, not one that adequately 
distinguishes between different
execution environments.

I'm most intrigued that my first expectation proved to be incorrect:
-
print check if running as CGI module: ;
if ($PHP_CGI) {print yes;} else {print no;}
and
$sapi_type = php_sapi_name();
if ($sapi_type == cgi)
  print You are using CGI PHP\n;
else
  print You are using .$sapi_type.PHP\n;
-

produces the following results in both 'environments':
-
check if running as CGI module: no~
and
You are using CGI PHP ~
-

My script goes on and on, trying to work through as much of the PHPINFO() output as I 
can find the means/the
manual descriptions to generate. There are substantial differences in output, eg no 
Apache information is
presented to the DOS box. So the number of, ie sizeof($HTTP_ENV_VARS) also differs 
markedly.

The $GLOBALS[SERVER_ADDR] suggestion intrigued me, because it returns an IP address 
when a server is involved
(haven't looked this up, I assume it's the IP of the Apache server?) but when running 
in the DOS box there is no
server so it returns '' (empty string) or quite possibly ( !is_set() ).

Not being at all experienced in dealing with environment variables, I was hoping for 
further
clarification/inspiration.

=dn



 may be

 $argv
 Array of arguments passed to the script. When the script is run on the
 command line, this gives C-style access to the command line parameters. When
 called via the GET method, this will contain the query string.

 $argc

 Contains the number of command line parameters passed to the script (if run
 on the command line).

 In case you have any parameter



 hope this helps... and this should work on windows too.

 - Original Message -
 From: DL Neil [EMAIL PROTECTED]
 To: Mark [EMAIL PROTECTED]; [EMAIL PROTECTED];
 [EMAIL PROTECTED]
 Sent: Friday, October 26, 2001 6:12 PM
 Subject: Re: [PHP] how to recognize local or server execution?


  Mark,
  Backing John's question up by one iteration: is there a PHP environment
 variable which can be used to
  distinguish between code being run from the command line and code being
 run in a browser?
  - and the Million dollar question, sorry make that the M$ question: will
 it also work under Windows?
  Please advise,
  =dn
 
 
  On Fri, 26 Oct 2001 17:18:37 -0400, John A. Grant wrote:
  I have an xxx.php page that runs on my Unix server.  I also
  run php.exe on my NT box to generate the corresponding
  xxx.html file like this:
c:\ php -q xxx.php  xxx.html
  
  The xxx.php file contains stuff like this:
print hello\n;
  
  That means stdout from the server and the xxx.html file
  both contain \n.  I would like the xxx.html file to contain
  \r\n so it can be viewed/edited with notepad. Yes,
  notepad and \r\n both suck, but that's another story...
  
  So I guess I would like my code to look like this:
if(running php.exe on my NT box){
 
  try:
  if (strstr(php_uname(), Windows)) {
 
  $delimiter=\r\n;
}else{
  $delimiter=\n;
}
  
  and then my code looks like:
print hello$delimiter;
  
  How can I do this?
  
  --
  John A. Grant  * I speak only for myself *  (remove 'z' to reply)
  Radiation Geophysics, Geological Survey of Canada, Ottawa
  If you followup, please do NOT e-mail me a copy: I will read it here
  
  
  
  
 
 
  --
  Mark, [EMAIL PROTECTED] on 10/26/2001
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: Loading message

2001-10-25 Thread DL Neil

 I suspect that PHP does all of it's work and, only when complete, will it
 send the generated html to the client.

 No matter what you try and do there's no way you can output the progress of
 your script to the browser while it is still being parsed.

 I could be wrong, but this is my understanding of it.

 Is your script really taking that long to be parsed that you need a loading
 progress bar or is the html (including graphics etc) just very big?


=ok, so why not display a stripped down first page which displays LOADING etc, and 
which then immediately calls
another page, ie the one that does the heavy processing?

=the timed redirect is managed through a HTML meta-tag. I've used it with native-HTML 
pages, but not tried to specify a
.PHP page (yet)

=give it a go!
=dn



 Anyway,

 Hope this helps
 Derek

 - Original Message -
 From: Daniel Alsén [EMAIL PROTECTED]
 To: php [EMAIL PROTECTED]; _lallous
 [EMAIL PROTECTED]
 Sent: Thursday, October 25, 2001 11:27 AM
 Subject: RE: [PHP] Re: Loading message


  I will try experimenting with that.
 
  But my situation is:
 
  A page with multiple php file includes. The page loads on to the includes,
  loads them and continues to load the includes below.
  I want to display some sort of text while the include still isn´t loaded.
 
  Likewise i would like to display some sort of loading message while a
  database search is active.
 
  - Daniel
 
   -Original Message-
   From: _lallous [mailto:[EMAIL PROTECTED]]
   Sent: den 25 oktober 2001 13:14
   To: [EMAIL PROTECTED]
   Subject: [PHP] Re: Loading message
  
  
   the page won't ever showup unless the webserver finishes
   processing the PHP
   file, therefore the Loading ... will appear while the page is
   waiting for
   its component to finish loading (images, javascripts, flash files, )
  
   therefore what you're asking for has a javascript solution:
  
   1)make a div with width and height about 1000 and absolute position w/
   z-index=1000
   2)add a body.onload event so that when the pages loads you hide
   that layer.
   3)that layer can hold any text or tags as you want like: Please
 wait
  
   this division's code:
   div id='loadinglayer'
   style='left:0;top:0;width:1000;height:1000;position:absolute;z-ind
  ex:1000;ba
   ckground:black'Please wait/div
  
   body onload='hidelayer()'
   /body
  
   script
   function hidelayer()
   {
 if(document.all)
   document.all['loadinglayer'].style.visibility=hidden;
 else
   document.layers['loadinglayer'].visibility=hide;
   }
   /script
  
   hope that helps
   Daniel alsén [EMAIL PROTECTED] wrote in message
   [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Hi,
   
is there a easy way in php to display text like Loading... while
   elements
on a page is being loaded from the server?
   
Regards
# Daniel Alsén| www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   |  #
   
  
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
   To contact the list administrators, e-mail: [EMAIL PROTECTED]
  
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 



 **
 This e-mail (and any attachment) is intended only for the attention
 of the addressee(s). Its unauthorised use, disclosure, storage
 or copying is not permitted. If you are not the intended recipient,
 please destroy all copies and inform the sender by return e-mail.
 This e-mail (whether you are the sender or the recipient) may be
 monitored, recorded and retained by Business Information
 Publications Limited (BiP). E-mail monitoring/ blocking software
 may be used, and e-mail content may be read at any time.You
 have a responsibility to ensure laws are not broken when composing
 or forwarding e-mails and their contents.
 **


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: is there a commandline php.exe interpreter?

2001-10-25 Thread DL Neil

 John A. Grant [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  I've installed ActivePerl, which gives me a way to run .pl files,
  i.e. :
  c:\ perl someprogram.pl
 
  Does the Win32 php installation give me a command-line
  interpreter like that?
 [...]
 No replies. I guess not, just server-based... :(

=maybe we're all hoping someone intelligent will pipe up, so we call all learn!?

=I can fire up a DOS box (WinNT 4.0), navigate to the bin sub-directory and run PHP 
with a script as an argument.

=However as PHP is 'built' to output HTML and the DOS box is no web browser... you'd 
need to be using pure ASCII output!

=give it a go Jo!

=dn



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP File not found

2001-10-25 Thread DL Neil

 I have just set up PHP on my webserver (IIS 4 on NT4).
 I have set up the script mapping so that I can save php files as .html and
 php processes them.
 
 This works fine until someone goes to a page that doesn't exist - instead of
 getting the customised error 404 page (i.e. the page you requested cannot be
 found), php prints:
 
 CGI Error
 
 The specified CGI application misbehaved by not returning a complete set of
 HTTP headers. The headers it did return are:
 
 And thats all I get.
 
 Does anyone know how to customise this page or set up a new one?


Chris,
That's an IIS function (not PHP).
It's a pane accessible from the MMC.
Perhaps the [PHP-Win] mavens could help?
=dn



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Truncating Lines

2001-10-25 Thread DL Neil

Please define long, and perhaps think of that in the context of the RFC ?822 is it?
=dn

- Original Message - 
From: BT News [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 25 October 2001 17:38
Subject: [PHP] Truncating Lines


 Hi,
 
 I have the following code, which reads in an html file
 
 $fd = fopen(somefile.html, r);
 while (!feof($fd)) {
   $buffer = fgets($fd, 4096);
   $body .= $buffer;
 }
 fclose($fd);
 
 I am then mailing this:
 
  if (mail($username. .$email., $mailsubject, $body, From:
 .$Fromname. .$Fromaddress.\nContent-Type: text/html;
 charset=iso-8859-1
 ))
 
 All works fine, except when a particular line in the html file is unusually
 long. Where this is the case, the mail gets sent but the long line truncates
 (the last character on the line being ! (exclamation mark)) followed by the
 remainder of the line on a new line. This obviously causes problems when
 trying to display the HTML.
 
 Strangely though, if the recipient of the mail is a local user (i.e. a user
 residing on this box), the line does not truncate and the HTML source
 remains intact. Equally, if I write out the contents of $body to the screen,
 the HTML source is intact.
 
 I suspect Sendmail may be the culprit, but I'm not sure.
 
 I realise I could keep my HTML source lines to a certain length, however
 these are often created dynamically so it's not that straight forward.
 
 
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Package mechanism

2001-10-24 Thread DL Neil

 I have a need for a package mechanism like that provided by TCL. We
 write a
 lot of code in reusable libraries and often encounter the situation in
 which
 an application uses a particular library but requires at least version X
 or
 greater.

 The require(), require_once(), etc. functionality doesn't provide any
 version
 checking facility and I'm not aware of any other such mechanism built
 into
 PHP.

 I played around with the following which kind of emulates the TCL
 behaviour:
 In each library I set a variable that contains that file's version
 number
 (automatically populated by CVS keyword expansion). I then replaced my
 require() statements by a customised version which takes version number
 arguments.

 So, in my application script I have, for example:

 require_once(package.inc);
 package_require(libraryfile.inc, 1.5, 0);
 ...

 And in package.inc I have:

 function package_require($file, $minVersion, $maxVersion) {

 require_once($file);

 // Code to check if $file is within the specified bounds

 }


 The obvious (potential) problems with this approach are with respect to
 scope. Most of the libraries I use contain function and class
 definitions and
 I'm not at all sure about the consequences of declaring these from
 within
 another function (package_require()). To my surprise, though, it seemed
 to
 work. No errors were generated and I could happily use the classes and
 functions as usual. I'm a little nervous, though, about problems that
 are not
 immediately visible.

 Secondly, there is the problem of global variables. Any variables set in
 the
 global scope in the library files are now in the local scope of the
 package_require() function. I cannot put 'global' declarations for each
 of
 these as I would have to know about each and every one of them in
 advance
 which prevents it from being a general solution.

 Does anyone else have some good ideas about this issue?
 Are there any plans to implement this in PHP itself where it properly
 belongs?



Douw,

As to the first question: if package_require($file, $minVersion, $maxVersion) was set 
up to only return the assembled
filename (not perform the require call), and the require_once($file) nested that 
function call and was placed in the
'mainline', would that allay some of your concerns?

 require_once( package_require( $file [, args ] ) );

- but what if there isn't a suitable candidate? Would there be some advantage to 
setting package_require() to return a
boolean (suitable include file found - success/failure) and then:

 package_require( $file [, args ] ) ? require_once( $file ) : die( 'or whatever' );

which 'blends' quite happily into a list of require_once() calls - but could be an 
if-then-else construct if you prefer
that presentation.

As to the last question, I can't say, but I was recently asking for a tidy method to 
keep development/test and
production code/includes/databases separate and ended up writing my own name-handler, 
much as yours...

Regards,
=dn



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Package mechanism

2001-10-24 Thread DL Neil

Douw,

It's kind of eerie the way your reply appears in my email before I can see my 
intervening post!!!???
Perhaps you're just more important than me (bow, scrape, simper...)

 Thanks for the feedback and additional ideas.

=HTH

 I had also though that it might be necessary to separate out the
 require_once() and the version check. I would rather do the
 require_once() first (unconditionally) and then the version check rather
 than the other way around for performance reasons; ie.
 require_once($file);
 if (!package_require($file, 1.5, 0)) die( 'or whatever' );

=you want the 'good news' before the 'bad'?

 If we did
 package_require( $file [, args ] ) ? require_once( $file ) : die( 'or
 whatever' );
 we would presumably have to open $file twice (once for the check and
 once for the loading), although a decent file system cache would
 presumably ameliorate this).

=have no detail of what happens within package_require(). What is the 'checking' logic?

=I assumed (!?) that you might be using a directory level 'scan' of 'include-dir' for 
possible code-candidates. Is it
necessary to actually open the file (prior to the 'require' itself) or is the file 
name sufficiently indicative? eg I'm
working on Req_MySQLv3.php (my own higher-level access/error checking routines) at the 
moment.

 I'd prefer not to go the route of having many versions of each library
 lying around and having to assemble an appropriate filename, especially
 on deployment servers. I'd rather that there is a single version and the
 application simply indicates failure if it is not recent enough.

=seems reasonable - as long as the first thing that happens after the delivery of new 
code to the production environment
is that someone checks that all the requisite linkages do in fact, work. If on the 
other hand, this is not a script that
is repeatedly called, but is perhaps the first in a 'conversation', eg a login screen, 
then the overhead is
insignificant, and if its possible to assume all checks at this stage will 'assure' 
the version relationships for the
rest of the scripts in the conversation you only need to do it once for the whole 
conversation.

=I'm intrigued though (as mentioned, I tried working through such a procedure a while 
back) - back to the question about
'logic', if that's not 'prying'...
=dn



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] how do i give optional arguments to functions??

2001-10-24 Thread DL Neil

 On Wednesday 24 October 2001 19:14, Richard S. Crawford wrote:
 
 The default value for $image parameter was missing:
 
  function top ($image=defaultvalue) {
   if ($image==defaultvalue) echo blah blah blah;
   else echo blah blah $image blah;
  }

If the default value can be set to an empty string can the if statement then be 
removed?

   function top ($image=)
   {
  echo blah blah $image blah;
   }

- watch those spaces (if they're present in live data)!
=dn



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] mktime() problem

2001-10-23 Thread DL Neil

 I'm running 4.0.6 on a Solaris 8 box. The output given by
 echo mktime(0,0,0,1,1,1970);
 is 3600.
 
 Shouldn't it be 0? My box's locale is set to the UK defaults, so as I write
 this we are in daylight savings (GMT+1). Would this make a difference? (I
 have already tried
 echo mktime(0,0,0,1,1,1970,0);
 to force non-daylight-savings, but I still get 3600.) Am I doing something
 wrong, or have I found a bug?


James,
Had to worry about this too!
Try comparing gmmktime() and mktime().
Regards,
=dn



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] mktime() problem

2001-10-23 Thread DL Neil

So do I:
 echo brMkt:  . mktime(0,0,0,1,1,1970);
 echo brGMT:  . gmmktime(0,0,0,1,1,1970);
produces
 Mkt: 0
 GMT: -3600
BTW I'm running PHP under WinNT4.0

mktime -- Get UNIX timestamp for a date 
(http://www.php.net/manual/en/function.mktime.php)
Returns the Unix timestamp corresponding to the arguments given. This timestamp is a 
long integer containing the number
of seconds between the Unix Epoch (January 1 1970) and the time specified.

gmmktime -- Get UNIX timestamp for a GMT date 
(http://www.php.net/manual/en/function.gmmktime.php)
Identical to mktime() except the passed parameters represents a GMT date.

Given that 1Jan1970 was not in Summer time, I would expect that a localised British 
(etc) machine would deliver the same
answer from both functions. So there's some logic here that I don't follow either. 
Perhaps someone of greater mind...?

I will send you a sandbox routine I made up when I was playing with times and dates, 
and trying to get a handle on
working in GMT to settle (WORLD wide web) relative time-ing issues. It's not flash, 
but happily dumps out various
date/time function results and illustrates the various argument/format choices (I'm 
not sure of list rules, so I'll send
it privately - if anyone else wants it, please email me directly. HTH). Run it today - 
you'll get the rd after 23rd,
and this week - to get a GMT/BST difference!

Here's a sample run:
--
UNIX microtime=0.26452800 1003852812~

UNIX epoch timestamp=1003852812~
Alternative method=1003852812~

Local/RFC=Tue, 23 Oct 2001 17:00:12 +0100~
Local/Times: hh/HH:mm:ss=05/17:00:12~
Local/Days: d, dd, ddd, day, Su0Sa6=23,23,Tue,Tuesday,2~
Local/Months: long, mmm, mm=October,Oct,10~
Local/Years: , yy=2001,01~
Local/Booleans: DST,Lyr=1,0~
Local/Misc: AM/PM, am/pm, st/nd, days/mmm, day/yr=PM,pm,rd,31,295~
Local/TimeZones: diffGMT, PC-TZ, offset=+0100,,3600~

Date to Timestamp=1003852812~

GMT/RFC=Tue, 23 Oct 2001 16:00:12 +~
GMT/Times: hh/HH:mm:ss=04/16:00:12~
GMT/Days: d, dd, ddd, day, Su0Sa6=23,23,Tue,Tuesday,2~
GMT/Months: long, mmm, mm=October,Oct,10~
GMT/Years: , yy=2001,01~
GMT/Booleans: DST,Lyr=0,0~
GMT/Misc: AM/PM, am/pm, st/nd, days/mmm, day/yr=PM,pm,rd,31,295~
GMT/TimeZones: diffGMT, PC-TZ, offset=+,,0~

Date to GMT Timestamp=1003849212~

UNIX microtime=0.00617600 1003852813~
--

Regards,
=dn



 Oh dear, I still get -3600 when I do

 echo gmmktime(0,0,0,1,1,1970);

 Why?

 James

 -Original Message-
 From: Fairbairn,J,James,IVLH4 C
 Sent: 23 October 2001 13:57
 To: [EMAIL PROTECTED]
 Subject: RE: [PHP] mktime() problem


 Thanks, I'll use gmmktime() from now on!

 James

 -Original Message-
 From: DL Neil [mailto:[EMAIL PROTECTED]]
 Sent: 23 October 2001 13:54
 To: Fairbairn,J,James,IVLH4 C; php-general
 Subject: Re: [PHP] mktime() problem


  I'm running 4.0.6 on a Solaris 8 box. The output given by
  echo mktime(0,0,0,1,1,1970);
  is 3600.
 
  Shouldn't it be 0? My box's locale is set to the UK defaults, so as I
 write
  this we are in daylight savings (GMT+1). Would this make a difference? (I
  have already tried
  echo mktime(0,0,0,1,1,1970,0);
  to force non-daylight-savings, but I still get 3600.) Am I doing something
  wrong, or have I found a bug?


 James,
 Had to worry about this too!
 Try comparing gmmktime() and mktime().
 Regards,
 =dn


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] str_replace binary safe??

2001-10-22 Thread DL Neil

 Hi folks,
 following problem appeared on PHP 3.0.16 on LINUX
 I have a binary file, where I want to replace some letters
 I do the following:
 $filename = xyz.sdc;
 $fd = fopen( $filename, r+b ); // also tried r
 $x=filesize( $filename ); // this shows the correct filesize 22528 byte
 $contents = fread( $fd, $x );
 fclose( $fd );
 $y=strlen($contents); // The first mistake $y = 32956 byte 
 echo BEFOREbr.$contents;
 $contents=str_replace(UU,123456, $contents);
 echo AFTERbr.$contents;
 
 It seems, that php converts HEX 00 00  to HEX 5C 30 just when it reads the 
 data in
 memory because at the BEFORE echo the data will be shown as \0 (hex 00 00 ).
 The filesize will be correct when I save the str_replaced text and the text 
 will be cahnged
 correct.
 Any idea, where this comes from??


Oliver,

Let's start with the fopen(), where the mode expression might be causing problems - 
should it be rb?
http://www.php.net/manual/en/function.fopen.php

If the 'binary' component hasn't been recognised it might explain the first mistake.
The ensuing problems may even stem from there...

Regards,
=dn



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] str_replace binary safe??

2001-10-22 Thread DL Neil

   following problem appeared on PHP 3.0.16 on LINUX
   I have a binary file, where I want to replace some letters
   I do the following:
   $filename = xyz.sdc;
   $fd = fopen( $filename, r+b ); // also tried r
   $x=filesize( $filename ); // this shows the correct filesize 22528 byte
   $contents = fread( $fd, $x );
   fclose( $fd );
   $y=strlen($contents); // The first mistake $y = 32956 byte
   echo BEFOREbr.$contents;
   $contents=str_replace(UU,123456, $contents);
   echo AFTERbr.$contents;
   It seems, that php converts HEX 00 00  to HEX 5C 30 just when it reads the
   data in
   memory because at the BEFORE echo the data will be shown as \0 (hex 00
  00 ).
   The filesize will be correct when I save the str_replaced text and the
  text
   will be cahnged
   correct.
   Any idea, where this comes from??
 Let's start with the fopen(), where the mode expression might be causing
 problems - should it be rb?
 http://www.php.net/manual/en/function.fopen.php
 If the 'binary' component hasn't been recognised it might explain the
 first mistake.
 The ensuing problems may even stem from there...
 Thanks DLNeil,
 I tried rb r r+b(C-style) always the same :(
 Any other suggestions ?

=not really, but (here's the end of a beautiful friendship) I've managed to get the 
code to work as required (on my
WinNT box - I thought it was us Windows users who always have to accept 
second-best!?). I took your code, added various
extras and amended things that wouldn't run on my system - my added code is indented 
and your original commented out
where necessary - see section 1 below. I then threw my c:\boot.ini file (287b used, 
512b allocated) against it, and
asked that the three appearances of the word multi be replaced by 123, which 
caused a 6-byte contraction - see
section 2 below. I don't think anything I changed has altered the original logic.

=Despite my earlier observations, my system doesn't care whether the fopen() mode is 
set to r, rb, or r+b. However
as soon as I shifted from the ultra-short boot.ini to using the binary ntldr file I 
noticed that PHP baulked at the
backslash (fine with forward slash though).

=a few thoughts:
1 the file must be local to be able to use filesize() (it may not be a remote URL for 
example) - but then you say the
filesize is initially correct so that's not it.
2 the replace function is case sensitive (I can't see your data file, so is that a 
possible problem?).
3 the manual does say that the replace function was buggy in older versions of PHP.
4 I've added some error checks. If you run them against your data, do they throw out 
anything?

=let us know,
=dn

--

html
headtitleOliver/[PHP]/title/head
body
?php

//$filename = xyz.sdc;
//$fd = fopen( $filename, r+b ); // also tried r
   $filename = c:\boot.ini;
   $fd = fopen( $filename, rb );
   if (!( $fd ) ) echo Could not open file: $filename;
$x=filesize( $filename ); // this shows the correct filesize 22528 byte
   echo filesize=$x;
   $contents  = fread( $fd, $x );
   if (!$contents) echo FileSysRead failed~BR;
//$contents = fread( $fd, $x );
fclose( $fd );
$y=strlen($contents); // The first mistake $y = 32956 byte
echo brBEFOREbr.$contents;
   echo brlength=$y;
   $contents=str_replace(multi,123, $contents);
//$contents=str_replace(UU,123456, $contents);
echo brAFTERbr.$contents;
   echo brlength=.strlen($contents);

?
/body
/html

--

filesize=287
BEFORE
[operating systems] multi...etc...
length=287
AFTER
[operating systems] 123...etc...
length=281

--



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: Annotated PHP Manual

2001-10-20 Thread DL Neil

 Khalid Hazmi wrote:
  How I can download the current Annotated PHP Manual???


 There is no such thing... AFAIK.
= Yasuo Ohgaki


Yasuo: Yes there is (and VERY useful it is too), check out the range of PHP 
documentation available from
http://www.php.net/docs.php

Khalid: Unlike some other packages I don't think there's a zipped-up, 
ready-for-download version. I presume this is
because the online version is always 'the latest' - but I don't know how often they 
update it (maybe that's somewhere on
the page I just quoted!?) You could try something called a webwhacker to download 
the web of pages that make up the
manual...

=dn



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: [PHP-DB] variable operators in queries

2001-10-19 Thread DL Neil

 Is it possible to put variable operators in queries?

=I can see no reason why not - you're not actually putting the 'variable' in the 
'query', just using a PHP-variable to
build a PHP-string which will be sent to MySQL as a SQL query...

 I tried this (the real variable comes from a form)
 $Date_Operator =(=);
 sql=SELECT * FROM poeple WHERE age $Date_operator 20;
 $result_id = mysql_query($sql);

 It doesn't work like this. I also tried:
 sql=SELECT * FROM poeple WHERE age \$Date_operator\ 20
 $result_id = mysql_query($sql);
 it didn't work either.


Sander,

First of all, may I recommend the liberal use of 'debug echo's. At this stage you 
don't know if the fault is in the
construction of the query, or within the PHP-MySQL interface, or... Recommend you 
insert something like echo Query is
$sql for your own health/sanity. Secondly how are you viewing the 'results' from the 
database to judge that it doesn't
work?

The reason for this comment is that people is spelled incorrectly, and unless this 
misspelling is consistent...
In similar vein, you have used the term sql in the assignment statements, but 
(rightly) $sql within the query and the
odd semi-colon (;) is missing too!

Regards,
=dn



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: executing script at specified time

2001-10-18 Thread DL Neil

The answer cron refers to *nix OpSys. It is the name of a demon/daemon that kicks of 
commands/jobs at a pre-specified
time and/or on a regular basis.
M$ spell it at.
Was that your question?
=dn

- Original Message -
From: Lucas Chan [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 18 October 2001 01:15
Subject: [PHP] Re: executing script at specified time


 cron?

 Regards,

 [ lucas ]




 Richard Baskett [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]...
  How can I execute a php script at a specified time using an Apache server?
  Let's say I wanted to send everyone an email, who had updated their
 personal
  information within the last 24 hours, every night at midnight...
 
  I would write a script that would get the current date and time, check a
  mysql database for all rows that met the date critieria, and automatically
  email everyone that met that criteria.
 
  I am guessing most administrators would not want to make sure they are in
  front of a browser at midnight every night to run the script, so how can I
  do this? :)
 
  Thanks ahead of time!
 
  Rick
 



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] IMAP Question

2001-10-18 Thread DL Neil

 Is it possible to use imap_mail() on php 4.0.6 on NT machine?
 Maybe anyone has dll  for this.


Yes Val. It is possible.
See related thread/discussion list: [PHP-WIN] Help on using mail() function
=dn


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] parsing a string

2001-10-18 Thread DL Neil

John,

Two inter-dependent problems:
1 a means of identifying a cipher within the text
2 a means of replacing the cipher with HTML code

1 there are a limited number of graphics formats (.GIF, .JPG, .PNG, etc) and the 
number you are prepared to contemplate
may be even shorter. Thus it would not be difficult to use the filetype as a means to 
trigger a RegExp - and thus have
no need for a label mechanism at all.

2 I'm finding RegExps a bit hairy too. However there are a number of illustrations 
'out there', eg in PHP and Perl web
site articles, and I'm sure there are some you could borrow/amend - I'm coming up to 
needing one fairly similar if you
want to 'trade'/division of labor.

Now I just know you're going to say that so far I've dealt with just the first 
component of [bird.gif,this is a bird] -
and just like every Canuck, you'd be right (or at least that's how the rest of us 
humor you(s))! First let's restate
that cipher as

   space+bird.gifthis is a bird

where space+ is at least one character of them immediately prior to the file name. 
Now you can see that the very same
RegExp that recognises/pulls out the graphic filename, should also be able to pull out 
the alt-text, because that is
enclosed within quotes (ie just as the HTML will require it). Because the quotes 
(could even offer the user/author a
choice of single or double!) are paired, and the first is immediately after the 
filename, you won't have problems with
other quoted strings getting caught up/misinterpreted!

It takes a warped mind...

Warped enough for you?
=dn


- Original Message -
From: John A. Grant [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 18 October 2001 17:11
Subject: [PHP] parsing a string


 I'm reading some HTML text from a file and echoing it to
 stdout. The HTML text contains IMG but I would rather
 have the server do the work of looking up the image size.
 I know how to lookup the image size with getimagesize().
 My problem is in coming up with a good format for embedding
 a reference to the image in the text and then writing the code
 to parse it.

 So instead of this:
 here is some text img src=bird.gif width=100 height=20
 alt=this is a bird and here is more text and another
 image img src=plane.gif width=123 height=23
 alt=this is a plane and more text

 I would like to have something like this:
 here is some text [bird.gif,this is a bird] and here
 is more text and another image [plane.gif, this is a plane]
 and more text

 Crossing line boundaries is not an issue - each text string
 is complete. I need to be able to dump out the string until I
 see a reference to an image, then extract the name and alt text,
 handle it (by emitting IMG) and continue to echo text from
 the string until I encounter another image reference.

 My problem is in coming up with a syntax for this and then
 to write the code to extract the information.

 In the above example, I'm using the syntax:
 [filename,text]

 but it's conceivable that the HTML text might also contain
 [some plain text not related to images]

 so I thought about some of these:
 {filename,alt text} - not good, text might contain {plain text]
 @filename, alt text@
 img(filename,alt text)

 Using the same @ delimiter at each end might make it easier
 to use explode() to split the text.  But perhaps img(filename,text)
 is more elegant, but it might need more skills than I have in using
 regex to recognize it and extract it.  Also I need to figure out how
 to extract and echo the plain text around it.

 Any ideas are appreciated. Thanks.

 --
 John A. Grant  * I speak only for myself *  (remove 'z' to reply)
 Radiation Geophysics, Geological Survey of Canada, Ottawa
 If you followup, please do NOT e-mail me a copy: I will read it here




 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] PHP Filesystem functions/reference table

2001-10-18 Thread DL Neil

Isn't it fun when people asking questions on the list spark off your own 
thoughts/inspiration!?

Has anyone seen a tabulation of the functions in (manual: IV Function Reference XXVI. 
Filesystem functions) that shows
which functions [don't] work under what conditions? eg

Col1: function name,
Col2: if it works under *nix/Windows/etc,
Col3: if it works for remote files/URLs

Please advise,
=dn



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




<    1   2   3