[PHP] Submitting Form in E-mail to Server Fails

2002-08-09 Thread Jeff Hill

Submitting a form that is within the body of an e-mail message fails when I
use the 'post' method, although it works if I use 'get'. With the post
method, it will open up a web browser, but the receiving form's headers show
no data, no array, submitted. I thought at first it was a conflict with
submitting it to an https php page, but I've tried switching it to
unencrypted with the same result. I've been searching the php archives and
google for a day and a half without any positive leads (but I know I've seen
forms within e-mail messages and it's one of the few valid reasons for using
html in e-mail).

It seems as if it should be a simple html encoded page, but nothing seems to
work when I switch it to post method. I've set up a simple test form to use
within my HTML e-mail message that is output by php to qmail-inject to our
members:

echo . . . .
. form method=3D\post\
action=3D\http://www.hronline.com/test.php\;\n
. input type=3D\hidden\ name=3D\product\
value=3D\PayByCreditCard\\n
. input type=3D\submit\ name=3D\submit\ value=3D\Submit\\n
./form\n
   . . . . ;

I've tried specifying various media types with encType but no luck. My
test.php form  is just a simple effort at seeing anything that comes through
(picked up from a past php contributor):

htmlbody
?php
error_reporting(E_ALL);
echo  '

';
print_r(getallheaders());
print_r($HTTP_POST_VARS);
print_r($HTTP_POST_FILES);
echo '

';
?
/body/html

Any suggestions appreciated. I'm running PHP4.1.2 as a cgi and as an Apache
1.3.23 module, mod_ssl 2.8.7, OpenSSL0.9.6c on a Debian server with kernel
2.4.17. I'm using the php.ini configuration file unmodified from the
distribution, except for some MySQL setting changes. I've tested using
Outlook Express and Eudora with IE 6.0 and Netscape 6.1 on a Windows XP
machine.

I appreciate that this is probably not a real issue with php directly, but
I'm using php to output the form and to recieve the results back, so I
thought this should be an acceptable question for the list.

Thanks for any direction and a really wonderful PHP. I'm amazed at how it's
grown over the years.

Jeff Hill




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Sending automatically mail

2002-08-09 Thread Jeff Hill

Well, if you compile a cgi version of php, just add a cronjob to run your
script. When you automate these things though, especially if it's sending
out e-mail, it's best to carefully setup error reporting to catch any script
failures or faults -- you want them reported to you quickly and to kill the
script gracefully. I learned the hard way with members our e-mail
publication.

Regards,

Jeff Hill

- Original Message -
From: César Aracena [EMAIL PROTECTED]
To: 'Jan Souman' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, August 09, 2002 1:36 PM
Subject: RE: [PHP] Sending automatically mail


 I had a question like this once, and the most applicable answer I got
 from this list was to make a script which triggers *IF* a certain time
 of day was reached. The only problem is that it had to be triggered by
 one visitor's clicking at least (the script was asleep in a page until
 that page was called).

 Now, it comes to my mind that you could have one hidden page which META
 refresh tags (refreshing itself let's say every hour), with a script
 inside that will trigger *IF* a certain hour (time) has passed.

 I hope this makes any sense, C.

  -Original Message-
  From: Jan Souman [mailto:[EMAIL PROTECTED]]
  Sent: Friday, August 09, 2002 2:03 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP] Sending automatically mail
 
  I would like my php-script to send a mail every day automatically,
 without
  anyone opening my site.
 
  Is this possible and if yes can anyone tell how to do this?
 
  Kind regards,
 
  Jan
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: AddType x-httpd-php to Root Dir ...Solution

2001-11-21 Thread Jeff Hill

Thanks for the suggestion, but no, it was something else. What else it
was, I don't know. I took the plunge and did the when in doubt,
upgrade route -- the server is now:

Apache/1.3.22 -- AuthMySQL/2.30 -- PHP/4.0.6 -- mod_ssl/2.8.5 --
OpenSSL/0.9.6b

Now, 24 hr. of straight work upgrading, the problem has gone away. I
don't know which of these programs had which bug, but I did nothing
other than upgrade, albeit a 24-hr task due to the AuthMySQL issues.

Which now prompts the question, perhaps delusional from lack of sleep,
if hardly anyone is using mod_auth_mysql, as seems to be the case, what
is everyone using to authenticate access? -- especially for larger sites
(I have 70K+ pages).

Regards,

Jeff Hill


Richard Lynch wrote:
 
 Jeff Hill wrote:
 
  AddType application/x-httpd-php html
 
  All users who enter any subdirectory with a .htaccess authentication
  requirement get a 401 error instead of the pop-up authentication request
  they should get (I use authmysql). The same thing happens if I try
  changing my Apache httpd.conf from:
 
 Wild Guess:
 My first guess would be that the version of MySQL you used with authmysql
 and the version of MySQL you compiled into Apache are not matching up, and
 end up tromping on each other somehow.
 
 If you still have the source directories, check the config.log files or
 whatever to see what versions of MySQL got compiled into each package.
 
 --
 Like music?  http://l-i-e.com/artists.htm
 
 --
 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]

-- 

--  HR On-Line:  The Network for Workplace Issues --
http://www.hronline.com - Ph:416-604-7251 - Fax:416-604-4708


-- 
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: Authentication Options: Was AddType x-httpd-php ...

2001-11-21 Thread Jeff Hill

Well, your the expert, so I'll look into this further, but do you have
any statistics, or a guess, as to the load auto_prepending an entire
site would add to a server? 

I've always been under the impression that adding PHP to every page will
add significant load. I'm not familiar enough with session management,
but it seems like your setup would add a heavy load?

Currently, only a small portion of our pages are PHP -- those linking
into databases and covering the front end negotiation.

Again, your the expert, so I'll just have to do some research. Thanks
for the suggestion.

Jeff

Fred wrote:
 
 I always write my own authentication scripts in PHP using PHP's built in
 session management.  If you want to protect entire directories or sites,
 just add the authentication routine to your auto_prepend file and it will
 work for any page you are trying to authenticate.
 
 If set up correctly it works really well, because a user can enter the site
 from any page (perhaps from a bookmark) and if they are not logged in they
 will get a login prompt and once logged in will go directly to whatever page
 they were trying to access.
 
 Furthermore, if you write your own authentication script for use in
 auto_prepended files, you can use it with little or no modification on any
 site you desire.
 
 Fred

-- 
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] AddType x-httpd-php to Root Directory Fouls Authentication

2001-11-20 Thread Jeff Hill

Why would Apache foul up authentication requests when the following
.htaccess file is placed in my root directory:

AddType application/x-httpd-php html

All users who enter any subdirectory with a .htaccess authentication
requirement get a 401 error instead of the pop-up authentication request
they should get (I use authmysql). The same thing happens if I try
changing my Apache httpd.conf from:

ErrorDocument 401 /needacct.html
to
ErrorDocument 401 /needacct.php

Otherwise, PHP seems to be running without a hitch, doing a beautiful
job as always. I've been running my same configuration for a year and a
half without a problem, but I just tried doing this switch and ran into
a wall. I also use the exact same .htaccess in some subdirectories
without a problem -- the .html files are processed. I've been hammering
at this for a day and really can't see where the error could be -- it's
just too simple.

I'm running: Apache/1.3.12 -- AuthMySQL/2.20 -- PHP/4.0.0 --
mod_ssl/2.6.4 -- OpenSSL/0.9.5a -- Debian kernel 2.2.16-RAID

I know I should upgrade, but I've checked the various changelogs and
haven't seen anything related. I've seen others with 404 redirects to
PHP files, so this is most likely a problem on my end, but I'm at a loss
where to look.

Any suggestions?

Thanks for any assist.

Regards,

Jeff Hill

-- 
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] Piping Mime String to Metamail Fails -- Solution

2001-07-18 Thread Jeff Hill

Don Read wrote:
 
 On 13-Jul-01 Jeff Hill wrote:
  Don Read wrote:
  On 13-Jul-01 Jeff Hill wrote:
   Don Read wrote:
   On 13-Jul-01 Jeff Hill wrote:
I've tried everything I can to pipe a string with mime content to
metamail, but it fails in every variation of:

--snip---

 ok, i was thinking system(), but was on the fpassthru page in the manual ...
 sorry.
 But looking at your while (!feof()) loop above ...
 Hey, there are limits to a shell argument length, ya know.

Actually, I truly am ignorant of the limits, but hopefully I've avoided
any disastrous outcomes in my solution.

 alternative:
 $p=popen('/usr/bin/metamail -d -q -r -w -x -y','w');
 fwrite($p, $mime_string);
 pclose($p);
 

I tried your code above, and while it did process the mime, it didn't
return the results so that I could determine the file name. I did try
many different tacks, but nothing seemed to work -- that may of course
just be due to my limited knowledge.

After messing with this for several days, I found that metamail was a
poor choice anyway, reading that development has apparently stopped and
that it has a security hole in the current version. 

I then tried reformime, from the maildrop package. It worked better, but
I ran into the same problems trying to get it to work with PHP.

In the end, I opted to have my mail server (qmail) pipe incoming
messages to MHonArc (it does a wonderful job handling mime). MHonArc
extracts the mime and then passes the rest of the message to PHP, which
puts it into an MySQL database. This may not be an elegant solution, and
I suspect it's wasteful of resources, but my usage is only for our
internal customer support and contact management -- a hundred or so
e-mail a day.

While this took far longer than I ever expected, it is wonderful to be
able to match incoming mail against our user database (which is in
MySQL). Now a user's entire record, past e-mail, followups and the whole
thing pop-up whenever they send us a message.

Thanks for all the effort. 

Best Regards,

Jeff Hill


 Regards,
 --
 Don Read   [EMAIL PROTECTED]
 -- It's always darkest before the dawn. So if you are going to
steal the neighbor's newspaper, that's the time to do it.

-- 

--  HR On-Line:  The Network for Workplace Issues --
http://www.hronline.com - Ph:416-604-7251 - Fax:416-604-4708


-- 
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] Piping Mime String to Metamail Fails

2001-07-13 Thread Jeff Hill

I've tried everything I can to pipe a string with mime content to
metamail, but it fails in every variation of:

exec(echo $mime_string | /usr/bin/metamail -d -q -r -w -x -y ,
$met_res) ;

I can successfully write the mime string to a tmp file, and then:

exec( cat /tmp/mime_mail | /usr/bin/metamail -d -q -r -w -x -y ,
$met_res) ;

but this seems very inefficient (writing a string to a file only to pass
it to a program). I'm also afraid the file may still be busy from the
write at the time I try to pass it to metamail.

I've tried using PassThru, System and the backtick operator as well.
I've tried the -e switch for echo, with nothing. The closest I've
gotten, running php as a cgi from the terminal, is the bash response:

sh: -c: line 1: syntax error near unexpected token `|'
sh: -c: line 1: ` | /usr/bin/metamail -d -q -r -w -x -y '

I suspect that the problem is in echoing mime content, but I'm uncertain
how else I could pipe the string to metamail? 

This is the last hitch in my script for handling incoming e-mail and
putting the mime into attachments as appropriate in a mysql database. I
looked through the archives at the various methods for handling mime,
and using metamail seemed like the best idea, but now I'm wondering.

Thanks for any suggestions.

Jeff Hill,
No programmer 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]




Re: [PHP] Piping Mime String to Metamail Fails

2001-07-13 Thread Jeff Hill

Don Read wrote:
 On 13-Jul-01 Jeff Hill wrote:
  I've tried everything I can to pipe a string with mime content to
  metamail, but it fails in every variation of:
 
  exec(echo $mime_string | /usr/bin/metamail -d -q -r -w -x -y ,
  $met_res) ;
 
  what about /bin/echo ...

Nope, but I do appreciate the thought. Using /bin/echo just results in
$met_res becoming an empty array, as does my example string.

I should have said before that I've also tried this with several
versions of php, primarily 4.0.6 (all on Debian sid linux). 

Regards,

Jeff Hill
 
 Regards,
 --
 Don Read   [EMAIL PROTECTED]
 -- It's always darkest before the dawn. So if you are going to
steal the neighbor's newspaper, that's the time to do it.
 
 --
 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]

-- 

--  HR On-Line:  The Network for Workplace Issues --
http://www.hronline.com - Ph:416-604-7251 - Fax:416-604-4708


-- 
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] Piping Mime String to Metamail Fails

2001-07-13 Thread Jeff Hill

Don Read wrote:
 On 13-Jul-01 Jeff Hill wrote:
  Don Read wrote:
  On 13-Jul-01 Jeff Hill wrote:
   I've tried everything I can to pipe a string with mime content to
   metamail, but it fails in every variation of:
  
   exec(echo $mime_string | /usr/bin/metamail -d -q -r -w -x -y ,
   $met_res) ;
 
   what about /bin/echo ...
 
  Nope, but I do appreciate the thought. Using /bin/echo just results in
  $met_res becoming an empty array, as does my example string.
 
 
 Huh ?

 
 $cmd='/bin/echo'  . $mime_string | /usr/bin/metamail -d -q -r -w -x -y ;
 echo ' cmd is:br', $cmd, 'p';
 fpassthru($cmd);


Well, I really do appreciate the help; maybe I'm misunderstanding
something. Using your statement above and executing the php script from
bash, I first get the results of your echo statement:

  cmd is:br/bin/echo 
  . . . then the $mime_string, and then on the last line, 
  | /usr/bin/metamail -d -q -r -w -x -y pbr

After your echo statement, the fpassthru($cmd) results come back: 

bWarning:/b Supplied argument is not a valid File-Handle resource in
b./mimescript_test.php/b on line b9/bbr

The entire contents of this mimescript_test.php are:
---
#!/usr/local/bin/php -q
?php
 
$fp0 = fopen('php://stdin','r') or die(couldnt open stdin); 
while(!feof($fp0)) {
$mime_string .= fgets($fp0,4096);
}
$cmd='/bin/echo'  . $mime_string | /usr/bin/metamail -d -q -r -w -x -y
;
echo ' cmd is:br', $cmd, 'p';
fpassthru($cmd);
?


As it seems fpassthru is supposed to work with the file pointer rather
than string, I did try using $fp0 rather than $mime_string, but I got
not a valid File-Handle resource.

If I substitute exec for fpassthru and add a $return to capture what
comes back, I get an empty array (I get a response of Array when
attempting to echo the $return variable, when I echo $return[0], etc., I
get nothing.

If I substitute system for fpassthru, I get only 127 when I echo the
$return.

I'm not the expert, but it certainly seems the problem lies in getting
the /bin/echo command pipe the string to metamail, and I'm not certain
how to make it do so.

Regards,

Jeff Hill

-- 
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]