php-windows Digest 26 Mar 2004 02:08:37 -0000 Issue 2182
Topics (messages 23269 through 23280):
PHP5RC1 and fasctcgi from Shane Caraveo
23269 by: Thierry B.
PLEASE HELP...Email attachment corruption
23270 by: Ron.Herhuth.tatumpartners.com
23271 by: Roy Henderson
23272 by: Justin Patrin
23276 by: DvDmanDT
23279 by: Manuel Lemos
Re: Convert string to date
23273 by: Harpreet K. Singh
23274 by: trystano.aol.com
Re: w32api GUI
23275 by: DvDmanDT
23277 by: Bill Zeller
Re: Replicating Double quotes
23278 by: trystano.aol.com
php_iconv.dll ???
23280 by: Jason Barnett
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
Hi,
did someone succeeded to run fastcgi for IIS from Shane Caraveo (
isapi_fcgi.dll ) with PHP5. I get the message "Server Error, unable to
connect to fastcgi server."
Thierry B.
--
Click below to answer / cliquez ci dessous pour me repondre
http://cerbermail.com/?MQkxTL4vUP
--- End Message ---
--- Begin Message ---
I am dying here. I'm on a deadline and I can't get
attachments...specifically PDFs and Word Docs to send without corruption.
I am using the script below to send the emails, and I have used several of
the classes on PHP.classes to try but everytime the files show up and the
error reads "The File is damaged and could not be repaired" when they are
opened. When I print the message out to the browser it appears as though
the entire string is not being sent. Is there any ini settings that might
affect this? I am really in a bind and don't know what to do. Any
suggestions would be greatly appreciated.
SCRIPT:
ini_set("sendmail_from","[EMAIL PROTECTED]");
$toaddress = "[EMAIL PROTECTED]";
$fromaddress = "Tatum CIO Tax <[EMAIL PROTECTED]>";
$subject = "Tatum CIO K-1 & State Tax Information";
$headers = "From: $fromaddress\n";
$headers .= "Reply-To: $fromaddress\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/mixed; boundary=\"MIME_BOUNDARY\"\n";
$headers .= "X-Sender: $fromaddress\n";
$headers .= "X-Mailer: PHP4\n";
$headers .= "X-Priority: 3\n";
$headers .= "Return-Path: $fromaddress\n";
$headers .= "This is a multi-part message in MIME format.\n";
$message = "--MIME_BOUNDARY\n";
$message .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n";
$message .= "Content-Transfer-Encoding: quoted-printable\n\n";
$message .= "\n\n";
// email text message goes here
$message .= "
\n
Attached to this email are the following 3 documents: to you from the
Tatum CIO Tax
\n\n
";
$message .= "\n";
$message .= "--MIME_BOUNDARY\n";
// FILE ATTACHMENT CODE
$file_url = "Simpletest.pdf";
$fp = fopen($file_url,"r");
$str = fread($fp, filesize($file_url));
$str = chunk_split(base64_encode(implode("", file("Simpletest.pdf")))); ;
$message .= "Content-Type: application/pdf; name=\"Simpletest.pdf\"\n";
$message .= "Content-disposition: attachment\n";
$message .= "Content-Transfer-Encoding: base64\n";
$message .= "\n";
$message .= "$str\n";
$message .= "\n";
$message .= "--MIME_BOUNDRY\n";
$message .= "--MIME_BOUNDRY--\n";
// echo "TO: $toaddress <br><br>SUBJECT: $subject<br><br>MESSAGE:
$message<br><br><br><br>";
mail("[EMAIL PROTECTED]",$subject,$message,$headers);
--- End Message ---
--- Begin Message ---
Ron,
A comment and a suggestion:
1) Your part separator should NOT be a constant - especially not a trivial
one. Ideally it should be a random hash. As it stands, if one of your
messages were to be incorporated into another message which also used the
same trivial separator then you would encounter problems. I know that's not
top of your worry list today but you should bear it in mind.
2) As a debug, I suggest you do a decode and save immediately after your
base64 encode to $str. That way at least you will narrow the location of the
problem down to either the preparation of the message or its transport.
Roy
----------------------------------------------------------------
[This message has been routed via James V2.1.3 on REBEX-MERCURY]
--- End Message ---
--- Begin Message ---
Ron Herhuth wrote:
I am dying here. I'm on a deadline and I can't get
attachments...specifically PDFs and Word Docs to send without corruption.
I am using the script below to send the emails, and I have used several of
the classes on PHP.classes to try but everytime the files show up and the
error reads "The File is damaged and could not be repaired" when they are
opened. When I print the message out to the browser it appears as though
the entire string is not being sent. Is there any ini settings that might
affect this? I am really in a bind and don't know what to do. Any
suggestions would be greatly appreciated.
SCRIPT:
ini_set("sendmail_from","[EMAIL PROTECTED]");
$toaddress = "[EMAIL PROTECTED]";
$fromaddress = "Tatum CIO Tax <[EMAIL PROTECTED]>";
$subject = "Tatum CIO K-1 & State Tax Information";
$headers = "From: $fromaddress\n";
$headers .= "Reply-To: $fromaddress\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/mixed; boundary=\"MIME_BOUNDARY\"\n";
$headers .= "X-Sender: $fromaddress\n";
$headers .= "X-Mailer: PHP4\n";
$headers .= "X-Priority: 3\n";
$headers .= "Return-Path: $fromaddress\n";
$headers .= "This is a multi-part message in MIME format.\n";
$message = "--MIME_BOUNDARY\n";
$message .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n";
$message .= "Content-Transfer-Encoding: quoted-printable\n\n";
$message .= "\n\n";
// email text message goes here
$message .= "
\n
Attached to this email are the following 3 documents: to you from the
Tatum CIO Tax
\n\n
";
$message .= "\n";
$message .= "--MIME_BOUNDARY\n";
// FILE ATTACHMENT CODE
$file_url = "Simpletest.pdf";
$fp = fopen($file_url,"r");
$str = fread($fp, filesize($file_url));
$str = chunk_split(base64_encode(implode("", file("Simpletest.pdf")))); ;
$message .= "Content-Type: application/pdf; name=\"Simpletest.pdf\"\n";
$message .= "Content-disposition: attachment\n";
$message .= "Content-Transfer-Encoding: base64\n";
$message .= "\n";
$message .= "$str\n";
$message .= "\n";
$message .= "--MIME_BOUNDRY\n";
$message .= "--MIME_BOUNDRY--\n";
// echo "TO: $toaddress <br><br>SUBJECT: $subject<br><br>MESSAGE:
$message<br><br><br><br>";
mail("[EMAIL PROTECTED]",$subject,$message,$headers);
If you're on a deadline I highly suggest grabbing PEAR's Mail_MIME
package and using it instead of generating your own e-mails.
http://pear.php.net/package/Mail_MIME
--
paperCrane <Justin Patrin>
--- End Message ---
--- Begin Message ---
Maybe the files are damaged even before they get to the php script?
--
// DvDmanDT
MSN: dvdmandt€hotmail.com
Mail: dvdmandt€telia.com
"Ron Herhuth" <[EMAIL PROTECTED]> skrev i meddelandet
news:[EMAIL PROTECTED]
I am dying here. I'm on a deadline and I can't get
attachments...specifically PDFs and Word Docs to send without corruption.
I am using the script below to send the emails, and I have used several of
the classes on PHP.classes to try but everytime the files show up and the
error reads "The File is damaged and could not be repaired" when they are
opened. When I print the message out to the browser it appears as though
the entire string is not being sent. Is there any ini settings that might
affect this? I am really in a bind and don't know what to do. Any
suggestions would be greatly appreciated.
SCRIPT:
ini_set("sendmail_from","[EMAIL PROTECTED]");
$toaddress = "[EMAIL PROTECTED]";
$fromaddress = "Tatum CIO Tax <[EMAIL PROTECTED]>";
$subject = "Tatum CIO K-1 & State Tax Information";
$headers = "From: $fromaddress\n";
$headers .= "Reply-To: $fromaddress\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/mixed; boundary=\"MIME_BOUNDARY\"\n";
$headers .= "X-Sender: $fromaddress\n";
$headers .= "X-Mailer: PHP4\n";
$headers .= "X-Priority: 3\n";
$headers .= "Return-Path: $fromaddress\n";
$headers .= "This is a multi-part message in MIME format.\n";
$message = "--MIME_BOUNDARY\n";
$message .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n";
$message .= "Content-Transfer-Encoding: quoted-printable\n\n";
$message .= "\n\n";
// email text message goes here
$message .= "
\n
Attached to this email are the following 3 documents: to you from the
Tatum CIO Tax
\n\n
";
$message .= "\n";
$message .= "--MIME_BOUNDARY\n";
// FILE ATTACHMENT CODE
$file_url = "Simpletest.pdf";
$fp = fopen($file_url,"r");
$str = fread($fp, filesize($file_url));
$str = chunk_split(base64_encode(implode("", file("Simpletest.pdf")))); ;
$message .= "Content-Type: application/pdf; name=\"Simpletest.pdf\"\n";
$message .= "Content-disposition: attachment\n";
$message .= "Content-Transfer-Encoding: base64\n";
$message .= "\n";
$message .= "$str\n";
$message .= "\n";
$message .= "--MIME_BOUNDRY\n";
$message .= "--MIME_BOUNDRY--\n";
// echo "TO: $toaddress <br><br>SUBJECT: $subject<br><br>MESSAGE:
$message<br><br><br><br>";
mail("[EMAIL PROTECTED]",$subject,$message,$headers);
--- End Message ---
--- Begin Message ---
Hello,
On 03/25/2004 10:15 AM, Ron Herhuth wrote:
I am dying here. I'm on a deadline and I can't get
attachments...specifically PDFs and Word Docs to send without corruption.
I am using the script below to send the emails, and I have used several of
the classes on PHP.classes to try but everytime the files show up and the
error reads "The File is damaged and could not be repaired" when they are
opened. When I print the message out to the browser it appears as though
the entire string is not being sent. Is there any ini settings that might
affect this? I am really in a bind and don't know what to do. Any
suggestions would be greatly appreciated.
Have you tried this class? It sends messages with attachments perfectly,
guesses the file type automatically if necessary and comes with an
example of how to do it:
http://www.phpclasses.org/mimemessage
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--- End Message ---
--- Begin Message ---
Thanks a lot. You seem to always come up with a solution that hits right at
the problem and fixes it. Thanks a lot for all your help.
Regards,
Harpreet
----- Original Message -----
From: "Svensson, B.A.T. (HKG)" <[EMAIL PROTECTED]>
To: "''Php-Windows ' '" <[EMAIL PROTECTED]>
Sent: Tuesday, March 23, 2004 3:10 PM
Subject: RE: [PHP-WIN] Convert string to date
> With MS SQL server you can do something like this:
>
> select convert(char(10), expiration, 101) as <something>
> ...
> order by convert(varchar, expiration, 112)
>
> 112 gives the date format as "yyyymmdd", and that should
> solve your problem.
>
> -----Original Message-----
> From: Harpreet K. Singh
> To: 'Php-Windows '
> Sent: 23-3-2004 19:06
> Subject: [PHP-WIN] Convert string to date
>
> I have a report that has an expiration field
>
> I want to sort by expiration but when clicked it sorts alphanumerically
> and shows january 01 before march 03 no matter what the year.
>
> If i do select expiration and sort it works fine but if i say
> select [expiration]=convert(char(10), expiration, 101) it sorts alpha
> numerically.
>
> I want to display in the format above but sort by date
>
> Please help
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
Then were is the solution to my Data retrieval problem! :)
--- End Message ---
--- Begin Message ---
Hi.. Intresting idea, but you really should forget about that extension.. It
doesn't really work, it's no longer under development and it's not supported
afaik.. :p In PHP5, a new extension, named FFI will replace w32api.. I don't
think it's included, so you'll have to get it from pecl or snaps.php.net..
Also, shouldn't you use some hWnd? 0 seems a bit bad... :p But anyway, I
don't really have any idea what I'm writing about..
Oh, and you might wanna try other PHP versions.. I had code working in 4.2.*
and maybe even 4.3.0, that doesn't work with latest versions...
--
// DvDmanDT
MSN: dvdmandt€hotmail.com
Mail: dvdmandt€telia.com
"Bill Zeller" <[EMAIL PROTECTED]> skrev i meddelandet
news:[EMAIL PROTECTED]
> Hey guys,
>
> I have a non-standard question regarding Windows programming.
>
> My objective is to create a small PHP wrapper for some basic win32 api
> stuff, such as creating message boxes and some dialog windows. This would
be
> used for windows command line scripting, not for web development. I
realize
> php-gtk exists, but I'd like to do this mainly for the native widget-ness
> and to learn more about the windows API.
>
> I have three questions.
>
> (using windows xp pro and php-4.3.4)
> 1) What's wrong with this code? The documentation is not up to date, and
> this should work. (other functions, using the same idea, do work. For
> example, "long GetTickCount () From Kernel32.dll" works fine)
>
> <?php
> if (!dl("php_w32api.dll")) {
> echo "Unable to load php_w32api.dll";
> exit;
> }
>
> $api = new win32;
> $api->registerfunction("long MessageBox (long hWnd, string lpText, string
> lpCaption, long uType) from User32.dll");
>
> if ($api->MessageBox(0, "testing", "testing somemore", 0) == 0)
> {
> echo "failed";
> }else{
> echo "succeeded";
> }
> ?>
>
> (nothing happens and failed is always printed)
>
> 2) Will this be supported in PHP 5? I downloaded RC 1 and don't see a
> php_w32api.dll in the extensions directory.
>
> 3) Do you know another way of accessing functions in dlls on windows?
>
> Thanks
>
> Best Regads,
> Bill Zeller
--- End Message ---
--- Begin Message ---
Hi,
The FFI extension works great and seems to be more intuitive than w32api.
Thanks for your help.
-bill
"Dvdmandt" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi.. Intresting idea, but you really should forget about that extension..
It
> doesn't really work, it's no longer under development and it's not
supported
> afaik.. :p In PHP5, a new extension, named FFI will replace w32api.. I
don't
> think it's included, so you'll have to get it from pecl or snaps.php.net..
>
> Also, shouldn't you use some hWnd? 0 seems a bit bad... :p But anyway, I
> don't really have any idea what I'm writing about..
>
>
> Oh, and you might wanna try other PHP versions.. I had code working in
4.2.*
> and maybe even 4.3.0, that doesn't work with latest versions...
> --
> // DvDmanDT
> MSN: dvdmandt€hotmail.com
> Mail: dvdmandt€telia.com
> "Bill Zeller" <[EMAIL PROTECTED]> skrev i meddelandet
> news:[EMAIL PROTECTED]
> > Hey guys,
> >
> > I have a non-standard question regarding Windows programming.
> >
> > My objective is to create a small PHP wrapper for some basic win32 api
> > stuff, such as creating message boxes and some dialog windows. This
would
> be
> > used for windows command line scripting, not for web development. I
> realize
> > php-gtk exists, but I'd like to do this mainly for the native
widget-ness
> > and to learn more about the windows API.
> >
> > I have three questions.
> >
> > (using windows xp pro and php-4.3.4)
> > 1) What's wrong with this code? The documentation is not up to date, and
> > this should work. (other functions, using the same idea, do work. For
> > example, "long GetTickCount () From Kernel32.dll" works fine)
> >
> > <?php
> > if (!dl("php_w32api.dll")) {
> > echo "Unable to load php_w32api.dll";
> > exit;
> > }
> >
> > $api = new win32;
> > $api->registerfunction("long MessageBox (long hWnd, string lpText,
string
> > lpCaption, long uType) from User32.dll");
> >
> > if ($api->MessageBox(0, "testing", "testing somemore", 0) == 0)
> > {
> > echo "failed";
> > }else{
> > echo "succeeded";
> > }
> > ?>
> >
> > (nothing happens and failed is always printed)
> >
> > 2) Will this be supported in PHP 5? I downloaded RC 1 and don't see a
> > php_w32api.dll in the extensions directory.
> >
> > 3) Do you know another way of accessing functions in dlls on windows?
> >
> > Thanks
> >
> > Best Regads,
> > Bill Zeller
--- End Message ---
--- Begin Message ---
Here it is. Its the one you took the piss out of comments.
Hi all,
>
> I have a problem in that when I am retrieving data from MySQL that containes
> double quotes, the double quotes gets repeat, and also the string that does
> contain double quotes gets double quotes added to the begin and end of it For
> example I get the following:
>
> "16"" Manikin"
>
> From what should be the following
>
> 16" Manikin
>
> Wh I inserted the data into the database I used the 'addslashes' function.
> Even when I use the 'stripslashes' the output is still the same.
>
> Anyone have any clues? :-s
Ok, here is the procedure in which I am inserting the data into the database...
// Retrieve a line from a file
$line = trim($file_contents[$i]);
//explode the line into an array
$arr = explode(",", $line);
// and then add slashes to exploded data items
$name = addslashes(trim($arr[1]));
With the name variable I then use it inside a query string
When retrieving the data from the database I use the following...
stripslashes($rows[ 'name' ])
--- End Message ---
--- Begin Message ---
I'm using php5.0.0rc1 and trying to use the new dom xml functions. I
thought that I needed the php_iconv.dll to do this, but it's not
distributed in the binary package. Do I even need this for dom xml, and
if so where can I download the extension?
--- End Message ---