php-windows Digest 25 Mar 2004 11:16:51 -0000 Issue 2181

Topics (messages 23261 through 23268):

Re: Email with attachments coming through damaged
        23261 by: Justin Patrin
        23265 by: Manuel Lemos

I need to display records of a Database on html,
        23262 by: M.Feoli
        23263 by: Jim Hunter
        23264 by: Trystano.aol.com

w32api GUI
        23266 by: Bill Zeller

Proper coding?
        23267 by: Jim MacDiarmid

Re: Session problem
        23268 by: Roman A Mikhailov

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 --- Ron Herhuth wrote:

Hi,

I'm trying to send an attachment via email using the following function,
but it keeps coming through damaged.  I am having no trouble emailing the
same attachment using OutLook.  Is there something wrong with the function
I'm using?  The attachment shows up and I'm not getting any errors, but it
just won't open up in Acrobat.

Thanks,
Ron






<?


$email_address = "[EMAIL PROTECTED]";
$email_from = "[EMAIL PROTECTED]";
$subject = "Testing Email with attachments";
$msg = "Text message shown in email";
$attach_filepath = array("2003_CIO_K1_Memo.pdf");

xmail($email_address,$email_from,$subject,$msg,$attach_filepath);


function xmail($email_address,$email_from,$subject,$msg,$attach_filepath)
{ $b = 0; $mail_attached = ""; $boundary = md5(uniqid(time(),1))."_xmail"; if (count($attach_filepath)>0) { for ($a=0;$a<count($attach_filepath);$a++) { if ($fp = fopen($attach_filepath[$a],"rb")) { $file_name = basename($attach_filepath[$a]); $content[$b] = fread($fp,filesize($attach_filepath[$a])); $mail_attached .= "--".$boundary."\r\n" ."Content-Type: application/pdf; name=\"$file_name\"\r\n" . "Content-Transfer-Encoding: base64\r\n" . "Content-Disposition: attachment; filename=\"$file_name\"\r\n\r\n" .chunk_split(base64_encode($content[$b]))."\r\n"; $b++; fclose($fp); } else { echo "NEIN"; } } $mail_attached .= "--".$boundary." \r\n"; $add_header ="MIME-Version: 1.0\r\nContent-Type: multipart/mixed; boundary=\"$boundary\""; $mail_content = "--".$boundary."\r\n" . "Content-Type: text/plain; charset=iso-8859-1; format=flowed\r\n" . "Content-Transfer-Encoding: 8bit\r\n\r\n" . $msg."\r\n\r\n".
$mail_attached;
return mail($email_address,$subject,$mail_content,"From:
".$email_from."\r\n".$add_header);
} else


           return mail($email_address,$subject,$msg,"From: ".$email_from);
       }
}

?>







I would suggest using a known good solution, such as PEAR's Mail_MIME package.


http://pear.php.net/package/Mail_MIME

--
paperCrane <Justin Patrin>

--- End Message ---
--- Begin Message --- Hello,

On 03/24/2004 05:22 PM, Ron Herhuth wrote:
I'm trying to send an attachment via email using the following function,
but it keeps coming through damaged.  I am having no trouble emailing the
same attachment using OutLook.  Is there something wrong with the function
I'm using?  The attachment shows up and I'm not getting any errors, but it
just won't open up in Acrobat.

This is probably a bug in the mail() function. You may want to try this class to compose and send messages with attachements. It comes with simple examples on 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 ---
Hi,   I am rephrasing my last question,

I have a database which I need to access via Web,  and display multiple
pages of the resulting records of the select statement I issue.

Is there a code for this out there,  which I could start with.


thanks

--- End Message ---
--- Begin Message ---
If you are not aware of www.phpclasses.org, then you might want to start
there. There are a few classes that are in the DB group that you simply pass
the SQL to the class and it does the query and creates the HTML for you.
Very neat and tidy and easy to use.  I use baagrid.php and here is an
example of 'all' the code it takes to display the grid:

    mysql_connect('localhost', 'xxx', 'xxxx');
    @mysql_select_db("scanner") or die ("Unable to select database");
    $sqlstr="select * from golf";
    $bd = new baaGrid($sqlstr);
    $bd->display();

That's it!

Jim Hunter
 
-------Original Message-------
 
From: M.Feoli
Date: Wednesday, March 24, 2004 03:14:56 PM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] I need to display records of a Database on html,
 
Hi, I am rephrasing my last question,
 
I have a database which I need to access via Web, and display multiple
pages of the resulting records of the select statement I issue.
 
Is there a code for this out there, which I could start with.
 
 
thanks
 
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
.

--- End Message ---
--- Begin Message ---
I take it you are referring to Paging?

Tryst

--- End Message ---
--- Begin Message ---
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 ---
Fellow PHP list members,

I'm hoping you can share your knowledge and help me.  I'm incorping the
PEAR:DB module into my scripts and I'm running into a situation.  To
make a long story short..  I basically have 2 files. Index.php and an
include file I'm calling db_functions.php which I'm creating myself.  **
NOTE: watch for wrapping **

In the index.php file I have the following code:

require_once('include/db_connect.php');   
require_once('include/db_functions.php');

/* includes commonly used functions */
require_once('common.php');

$sphist_rec_count =
GetRecCount('RecentActiveSpaces','RECENT_SPACE_COUNT');


In my db_functions.php, I have the function called GetRecCount(). It
basically retrieves the
Record count from a mySQL table. For some reason, the "db_object" object
doesn't get created unless 
I include the db_connect.php inside the GetRecCount function.  Something
tells me that this is not proper
Coding, and I was wondering if someone could tell me if there is another
way to do this?

Thanks,
Jim

--- End Message ---
--- Begin Message ---

>I want to know how can i do to make the session dont expire?. i have an
>application that works with sessions, when i left the browser open for a
>while, i dont know maybe 30 minutes, when i try to go into a section it
>throw me an error, for session expire, how can i fic that?.


HI!

/ cookies/ :)

--- End Message ---

Reply via email to