php-windows Digest 17 May 2001 15:55:50 -0000 Issue 603

Topics (messages 7657 through 7681):

truncating of file in fopen.
        7657 by: pratap.ladhani.processbiz.co.in

Re: [PHP] Web Host
        7658 by: Deependra B. Tandukar

Re: error in ip2long
        7659 by: Chris Adams

Re: Web Host
        7660 by: motorpsychkill

Re: REBUILD of PHP
        7661 by: andrew morton

Re: Canceling a Query
        7662 by: John Lim

Re: extracting email addresses
        7663 by: Johan Lundqvist
        7672 by: afan
        7673 by: afan

Discussion about using data with Scriptview.
        7664 by: Alessio Bernesco Lāvore

Getting the URL of the parent script/page in an included script
        7665 by: Timo Würsch
        7666 by: Alessio Bernesco Lāvore

postgresql extension hanging
        7667 by: Joseph Okomba

Session variables
        7668 by: Bob Sears

PHP development DLL where Docs?
        7669 by: Igor

it's frustrating
        7670 by: M. Weller
        7671 by: Brian Paulson
        7674 by: M. Weller
        7675 by: Michael Kelley
        7681 by: M. Weller

Re: My SQL
        7676 by: Bob Hall

Re: I need help!!!
        7677 by: Michael Kelley

R: [PHP-WIN] it's frustrating
        7678 by: Giuseppe D'Ambrosio

PHP and Multiple databases
        7679 by: Scott Ellis

still frustrating must be a configuration problem
        7680 by: M. Weller

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]


----------------------------------------------------------------------


I have a small script which opens an image file (gif/jpeg) and converts 
it to binary format.

My problem is that the script runs perfectly well in my local machine. 
But when I upload it to the server and try to parse the same image file 
on the server, it is truncated in between only.. I do not seem to 
understand why it happens. My local machine is a Win 98 and the server 
is a Win 2K Server.

Any body if faced such a problem before and might have found out a 
solution please suggest directions..

Thanks to all in advance.

Pratap Ladhani





Contact [EMAIL PROTECTED]

Warm Regards,
Deependra B. Tandukar
www.coremag.net/cvs/dt.htm

Training and Networking Assistant
ICOD/ICIMOD
www.icimod.org

Co-ordinator
CORExpress
The Only Native Computer Magazine of Nepal
www.coremag.net
+++++++++++++++++++++++++++++++++++++++++++++++
===============================================
----- Original Message -----
From: "Manesh Manickam" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, May 16, 2001 06:34 PM
Subject: [PHP] Web Host


> I need a web host with myslq and PHP. Also i would be good if it have a
STMP
> server to!  Please just reply to there posts!
>
>
> --
> 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]
>
>





On 16 May 2001 19:56:52 -0700, Ruslan Ohitin <[EMAIL PROTECTED]> wrote:
> hello all!
> 
> I try to convert ip address (aaa.bbb.ccc.ddd)
> to IPv4 integer using ip2long().
> 
> ip2long("200.200.200.12") = 3368601612
> but it must be -926365684.

That's the same value - the first time is treating it as an unsigned integer,
the second as a signed integer.

Chris




why don't you see for yourself? ;)

I think common questions like these warrant a search through the archives
first since they have been asked many times before.

go here first, you'll find a lot of answers about common topics such as
'hosts'.

http://marc.theaimsgroup.com/?l=php-general

::-----Original Message-----
::From: Manesh Manickam [mailto:[EMAIL PROTECTED]]
::Sent: Wednesday, May 16, 2001 9:12 AM
::To: afan; [EMAIL PROTECTED]
::Subject: RE: [PHP-WIN] Web Host
::
::
::are they all free?
::
::-----Original Message-----
::From: afan [mailto:[EMAIL PROTECTED]]
::Sent: Wednesday, May 16, 2001 12:39 PM
::To: [EMAIL PROTECTED]; Manesh Manickam
::Subject: Re: [PHP-WIN] Web Host
::
::
::I use http://www.cqhost.com and http://www.1stconnection.net and I don't
::have any problems.
::
::Afan Pasalic
::
::----- Original Message -----
::From: "Manesh Manickam" <[EMAIL PROTECTED]>
::To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
::Sent: Wednesday, May 16, 2001 5:49 AM
::Subject: [PHP-WIN] Web Host
::
::
::> I need a web host with myslq and PHP. Also i would be good if it have a
::STMP
::> server to!  Please just reply to there posts!
::>
::>
::> --
::> 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 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]
::
::





Umm I'm sort of new to this whole PHP thing but isn't the only nice
thing about running the windows version that you don't have to recompile
to add an extension? I think you can just uncomment it in your php.ini
file... I'm sure I'll be corrected if I'm wrong.

andrew

-----Original Message-----
From: Joshua Butcher [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 15, 2001 11:14
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] REBUILD of PHP


I do not have Visual C++, but I need a rebuild of PHP to support
Graphing,
Charting and IMAP functions for my job.  Is there someone out there who
can
do this build for me?

Joshua Butcher



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






Hello,

This is a workaround. Can you use T-SQL's: SET ROWCOUNT ?

This limits the number of rows returned by a query.

-- John

""Brinkman, Theodore"" <[EMAIL PROTECTED]> wrote in
message FE8510398BFE854F9653B5C32DBB652FD4F39E@oh_daytn_xch01">news:FE8510398BFE854F9653B5C32DBB652FD4F39E@oh_daytn_xch01...
> I'm working on an application for work where users will be querying the
> database to get information back about processed documents.  I'm trying to
> set up a way for a user to cancel a query which is taking too long.  I'm
> using MS SQL Server 2000.  The interface for the cancel is easy enough, a
> form containing a button that says 'cancel' and a value or set of values
> identifying the query being run.
>
> I've found 'KILL <SPID>', but the problem is that all the connections to
the
> database are done through the web-server so they get the same SPID, which
> means that EVERY query being run by EVERY user gets killed.  (Obviously
not
> an acceptable solution.)  Does anybody out there know of a way to
> specifically kill a single query/stored procedure?  We're willing to track
> as many values as necessary to do it.
>
> Thanks.
>
> - Theo
>
> --
> 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]
>






Get in contact with some SPAM people... they all seem to get it done...

afan wrote:
> 
> Hi all,
> there is my problem: I have a large text file with a lot of email addresses included 
>in text. I have to extract just email addresses from a whole text.
> What's the way to do that?
> 
> Thanks for any help!
> 
> Afan




Thanks Johan for your HELP!

----- Original Message -----
From: "Johan Lundqvist" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 17, 2001 12:38 AM
Subject: Re: [PHP-WIN] extracting email addresses


> Get in contact with some SPAM people... they all seem to get it done...
>
> afan wrote:
> >
> > Hi all,
> > there is my problem: I have a large text file with a lot of email
addresses included in text. I have to extract just email addresses from a
whole text.
> > What's the way to do that?
> >
> > Thanks for any help!
> >
> > Afan
>
> --
> 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]
>
>





I found this as a solution:

$content = eregi("([[:alnum:]_.-]+)@([^[:space:]>;\"]*)", $contents,
$EmailArray);
echo"$EmailArray[0]";

but I have to try with your solution too.

Thank you Mike.

p.s. It's not for spam. Client want to check his incoming emails!

----- Original Message -----
From: "Michael Rudel" <[EMAIL PROTECTED]>
To: "'afan'" <[EMAIL PROTECTED]>
Sent: Thursday, May 17, 2001 7:09 AM
Subject: RE: [PHP-WIN] extracting email addresses


> Hey afan,
>
> just make a strpos for an @, get the first blank with the @
> as offset parameter, substr the string from to the first blank
> after the @, and substr the result again from the last blank
> (strrpos) to the end. thats it.
>
> Sorry, but I'm not thinking in regexp's =8) this would be a
> better solution.
>
> Learning by doing.
>
> Greetinx,
>   Mike
>
> P.E.: Plz don't use this to SPAM !
>
> > -----Original Message-----
> > From: afan [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, May 17, 2001 6:56 PM
> > To: [EMAIL PROTECTED]
> > Subject: Fw: [PHP-WIN] extracting email addresses
> >
> >
> > Thanks Johan for your HELP!
> >
> > ----- Original Message -----
> > From: "Johan Lundqvist" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Thursday, May 17, 2001 12:38 AM
> > Subject: Re: [PHP-WIN] extracting email addresses
> >
> >
> > > Get in contact with some SPAM people... they all seem to
> > get it done...
> > >
> > > afan wrote:
> > > >
> > > > Hi all,
> > > > there is my problem: I have a large text file with a lot of email
> > addresses included in text. I have to extract just email
> > addresses from a
> > whole text.
> > > > What's the way to do that?
> > > >
> > > > Thanks for any help!
> > > >
> > > > Afan
> > >
> > > --
> > > 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 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]
> >





Hi everyone,

I'd like to know your opinion about these question:

I have to create a redistribuitable CD using Scriptview. The CD will contain
a limited edition of an actual website, based on a MySQL database.
The question is: what's the best way to use the data with Scriptview?
The data are some simple products description (5 char fields, approx.) and
the products are about 50.

I've thinked those solutions:

- Several files to include (one for product) with variable declaration and
name equal to the product (i.e. mug.php, title="Coffee Mug" color="White",
etc.).
- A unique text file containing the data, with a parsing function to extract
data.
- (forbidden dream) An XML file containing products data... (i suppose expat
functionality are not allowed with Scriptview).

Considering that extracting format data from the database is not really a
problem, according to you, what's the best choice?
Is there some one alternative and convenient solution?

Thanks,

Alessio.






I've got a bit of a problem here: I've got a php script which is
included and will thus be executed in every page on my web site. How can
i change the behaviour of this included script depending on the parent
page's URL? Many thanx

Timo





I've used this script to include modify date and copyright notes in every
page.
It grab the informations of the page where was included... i think you can
do something similar for other varibles than the last modification date.

Greets,
Alessio.

note.php.inc
<?
 $file=basename($PHP_SELF);
  $modifica=getdate(fileatime($file));
  $modifica=$modifica["mday"]."/".$modifica["month"]."/".$modifica["year"]."
".$modifica["hours"].":".$modifica["minutes"].".".$modifica["seconds"];
 echo "<!-- File modificato il $modifica -->\n";
  echo "<!-- Tutti i diritti riservati - DCS -->\n";
?>

"Timo Würsch" <[EMAIL PROTECTED]> ha scritto nel messaggio
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I've got a bit of a problem here: I've got a php script which is
> included and will thus be executed in every page on my web site. How can
> i change the behaviour of this included script depending on the parent
> page's URL? Many thanx
>
> Timo
>
>
> --
> 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]
>







Hi,

I have installed the php_pgsql extension that comes with php-4.0.5 on NT but
it keeps hanging. I tried running PHP both as CGI and as an Apache module
but keeps hanging whenever I enable the php_pgsql extension. All other PHP
extensions for windows are running properly.

I will be very grateful for any ideas on how to sort out this problem. If
somebody knows of a stable php_pgsql extension for windows please let me
know.

Thanks in advance.





For the following code blocks:



#---------- top.php              first program entered

session_start();
session_register  ('trackingnumber');

if (IsSet($trackingnumber)){
   print ("Issued session destroy because trackingnumber = 
$trackingnumber<br>");
   session_destroy();
   print ("trackingnumber = $trackingnumber<br>");
} else {
   print ("trackingnumber has not been set<br><br>");
}

print ("<html>");
print ("<head>");
print ("</head>");
print ("<body>");
print ("<h3>top.php is the entry point ...</h3>");
print ("<h3>This is the value of trackingnumber:  $trackingnumber<br><br>");
print ("<a href=\"middle.php\">To middle</a>");
print ("</body>");
print ("</html>");



#---------- middle.php                 second program entered

session_start();
session_register('trackingnumber');

if (!IsSet($trackingnumber)){
   $mtime = explode (" ",microtime());
   $mseconds = $mtime[0] * 1000000000;
   srand($mseconds);
   $trackingnumber = rand();
   print ("<h3>tracking number on input is: ".$trackingnumber."<br></h3>");
   print ("<h3>was reset<br><br></h3>");
} else {
   print ("<h3>tracking number on input is: ".$trackingnumber."<br></h3>");
   print ("<h3>was not reset<br><br></h3>");

}


$rnumber = 1234567;
print ("trackingnumber:  $trackingnumber<br>");
print ("rnumber:         $rnumber<br><br>");
print ("session name: ".session_name());
print ("<br>");
print ("session id:   ".session_id());
print ("<br>");

#----- check for the previous session's existance

print ("<html>");
print ("<head>");
print ("</head>");
print ("<body>");
print ("<h3>middle.php<br><br>This is the session id being passed to 
bottom: [");
print ("$trackingnumber");
print ("]</h3>");
print ("<a href=\"bottom.php?Session=$trackingnumber\">To bottom<br><br></a>");
print ("<a href=\"top.php\">To top</a>");
print ("</body>");
print ("</html>");



#---------- bottom.php         third program entered

session_start();

parse_str($QUERY_STRING);

print $Session;

print ("<html>");
print ("<head>");
print ("</head>");
print ("<body>");
print ("<h3>bottom.php<br><br>This is what was passed from middle: [");
print $Session;
print ("]</h3>");
print ("<a href=\"middle.php\">Back to middle</a>");
print ("</body>");
print ("</html>");


Entering program top.php, I check whether the variable $trackingnumber has 
been set. If so, I want to destroy its contents. $trackingnumber should be
empty upon entry to middle.php, where it gets set and passed to bottom.php. 
In traversing backwards, entry to top.php should empty the contents of
$trackingnumber. Why doesn't the session_destroy() perform that?

Bob





Could someone help me to find tutorials or any kind of docs
on the subject "How to develop, build and compile my own code libs in C/C++
for PHP-Win32
in form of DLLs or implement it in the PHP source"
Many Thanks,
Igor Grigin.





Hello,

does anybody know if it is possible to sent mails with Windows2000 including
images???

I am trying now since ages. As long as I echo the result of  all works fine.

-------------------------
$filename = 'mypicture.jpg';
$myimage = fread($fp = fopen($filename, 'rb'), filesize($filename));
fclose($fp);

$inhalt=chunk_split(base64_encode($myimage ));

echo $inhalt;//just to check if it's working after that I build the
additional headders of the mail function
-------------------------

But as soon as I sent an email with the image it echos only about 80% and
the email doesn't go.
I have no trouble using Linux, but I need to run it under windows.

Any idea??

Thanks

Markus






Are you trying to attach it or put the image in the body of the message?

If you  are trying to attach it try looking at this message from the
archives

http://marc.theaimsgroup.com/?l=php-general&m=99003506223055&w=2

Thank You
Brian Paulson
Sr. Web Developer
The Pueblo Chieftain
www.chieftain.com
1-800-279-6397


-----Original Message-----
From: M. Weller [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 17, 2001 6:27 AM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] it's frustrating


Hello,

does anybody know if it is possible to sent mails with Windows2000 including
images???

I am trying now since ages. As long as I echo the result of  all works fine.

-------------------------
$filename = 'mypicture.jpg';
$myimage = fread($fp = fopen($filename, 'rb'), filesize($filename));
fclose($fp);

$inhalt=chunk_split(base64_encode($myimage ));

echo $inhalt;//just to check if it's working after that I build the
additional headders of the mail function
-------------------------

But as soon as I sent an email with the image it echos only about 80% and
the email doesn't go.
I have no trouble using Linux, but I need to run it under windows.

Any idea??

Thanks

Markus



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







Thanks Brian for your fast respond.

I tried but still the same:  it doesn't work.

I used the following code:
-----------------------------------------------------------
$filename = 'background.gif';
$myimage = fread($fp = fopen($filename, 'r'), filesize($filename));
fclose($fp);

$content = chunk_split ( base64_encode ( $myimage ) );
$boundary = 'NEXT_PART';
$message= "Content-Type: multipart/mixed; boundary='$boundary'\n";
$message.= "Mime-Version: 1.0\n";

then in the message:

$message.= "--$boundary\n";
$message.= "Content-Type: image/gif; name='my_image.gif'\n";
$message.= "Content-Transfer-Encoding: base64\n";
$message.= "Content-Disposition: attachment\n\n";

$message = $content;     // here I used $message .= $content;

mail("[EMAIL PROTECTED]","", "", $message);
-----------------------------------------------------------




""Brian Paulson"" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Are you trying to attach it or put the image in the body of the message?
>
> If you  are trying to attach it try looking at this message from the
> archives
>
> http://marc.theaimsgroup.com/?l=php-general&m=99003506223055&w=2
>
> Thank You
> Brian Paulson
> Sr. Web Developer
> The Pueblo Chieftain
> www.chieftain.com
> 1-800-279-6397
>







I found this on PHP.net It works when you hardcode the values (where I 
have the value arrows.gif). I've been playing with it trying to modify 
it to do an upload and sending of an email with any kind of attachment.

<?

/*
  *  Class mime_mail
  *  Original implementation by Sascha Schumann <[EMAIL PROTECTED]>
  *  Modified by Tobias Ratschiller <[EMAIL PROTECTED]>:
  *      - General code clean-up
  *      - separate body- and from-property
  *      - killed some mostly un-necessary stuff
  */

class mime_mail
  {
  var $parts;
  var $to;
  var $from;
  var $headers;
  var $subject;
  var $body;

   /*
   *     void mime_mail()
   *     class constructor
   */
  function mime_mail()
   {
   $this->parts = array();
   $this->to =  "";
   $this->from =  "";
   $this->subject =  "";
   $this->body =  "";
   $this->headers =  "";
   }

   /*
   *     void add_attachment(string message, [string name], [string ctype])
   *     Add an attachment to the mail object
   */
  function add_attachment($message, $name =  "", $ctype = 
"application/octet-stream")
   {
   $this->parts[] = array (
                            "ctype" => $ctype,
                            "message" => $message,
                            "encode" => $encode,
                            "name" => $name
                           );
   }

/*
  *      void build_message(array part=
  *      Build message parts of an multipart mail
  */
function build_message($part)
  {
  $message = $part[ "message"];
  $message = chunk_split(base64_encode($message));
  $encoding =  "base64";
  return  "Content-Type: ".$part[ "ctype"].
                         ($part[ "name"]? "; name = \"".$part[ "name"]. 
"\"" :  "").
                          "\nContent-Transfer-Encoding: 
$encoding\n\n$message\n";
  }

/*
  *      void build_multipart()
  *      Build a multipart mail
  */
function build_multipart()
  {
  $boundary =  "b".md5(uniqid(time()));
  $multipart =  "Content-Type: multipart/mixed; boundary = 
$boundary\n\nThis is a MIME encoded message.\n\n--$boundary";

  for($i = sizeof($this->parts)-1; $i >= 0; $i--)
     {
     $multipart .=  "\n".$this->build_message($this->parts[$i]). 
"--$boundary";
     }
  return $multipart.=  "--\n";
  }

/*
  *      void send()
  *      Send the mail (last class-function to be called)
  */
function send()
  {
  $mime =  "";
  if (!empty($this->from))
     $mime .=  "From: ".$this->from. "\n";
  if (!empty($this->headers))
     $mime .= $this->headers. "\n";

  if (!empty($this->body))
     $this->add_attachment($this->body,  "",  "text/plain");
  $mime .=  "MIME-Version: 1.0\n".$this->build_multipart();
  mail($this->to, $this->subject,  "", $mime);
  }
};  // end of class

/*
  * Example usage
  */

  $attachment = fread(fopen("arrows.gif", "r"), filesize("arrows.gif"));

  $mail = new mime_mail();
  $mail->from = "someone";
  $mail->headers = "Errors-To: [EMAIL PROTECTED]";
  $mail->to = "someone else";
  $mail->subject = "Testing...";
  $mail->body = "This is just a test";
  $mail->add_attachment("$attachment", "arrows.gif", "image/gif");
  $mail->send();


?>



M. Weller wrote:

> Thanks Brian for your fast respond.
> 
> I tried but still the same:  it doesn't work.
> 
> I used the following code:
> -----------------------------------------------------------
> $filename = 'background.gif';
> $myimage = fread($fp = fopen($filename, 'r'), filesize($filename));
> fclose($fp);
> 
> $content = chunk_split ( base64_encode ( $myimage ) );
> $boundary = 'NEXT_PART';
> $message= "Content-Type: multipart/mixed; boundary='$boundary'\n";
> $message.= "Mime-Version: 1.0\n";
> 
> then in the message:
> 
> $message.= "--$boundary\n";
> $message.= "Content-Type: image/gif; name='my_image.gif'\n";
> $message.= "Content-Transfer-Encoding: base64\n";
> $message.= "Content-Disposition: attachment\n\n";
> 
> $message = $content;     // here I used $message .= $content;
> 
> mail("[EMAIL PROTECTED]","", "", $message);
> -----------------------------------------------------------
> 
> 
> 
> 
> ""Brian Paulson"" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> 
>> Are you trying to attach it or put the image in the body of the message?
>> 
>> If you  are trying to attach it try looking at this message from the
>> archives
>> 
>> http://marc.theaimsgroup.com/?l=php-general&m=99003506223055&w=2
>> 
>> Thank You
>> Brian Paulson
>> Sr. Web Developer
>> The Pueblo Chieftain
>> www.chieftain.com
>> 1-800-279-6397
>> 


-- 

Michael Kelley                  
[EMAIL PROTECTED] 
        
Programmer/Systems Analyst I    
New Mexico State University
Information and Communication Technologies
Work # (505)-646-1374
P.O. Box 30001
MSC: 3AT
Las Cruces, NM 88003









Thank you Michael,

it isn't working with images larger then 3kB.
I start to belive Windows is making the trouble. Who knows why.
Meanwhile I tried a lot of different mail classes, wrote my own code but
nothing works.


Markus


"Michael Kelley" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I found this on PHP.net It works when you hardcode the values (where I
> have the value arrows.gif). I've been playing with it trying to modify
> it to do an upload and sending of an email with any kind of attachment.
>
> <?
>
> /*
>   *  Class mime_mail
>   *  Original implementation by Sascha Schumann <[EMAIL PROTECTED]>
>   *  Modified by Tobias Ratschiller <[EMAIL PROTECTED]>:
>   *      - General code clean-up
>   *      - separate body- and from-property
>   *      - killed some mostly un-necessary stuff
>   */
>
> class mime_mail
>   {
>   var $parts;
>   var $to;
>   var $from;
>   var $headers;
>   var $subject;
>   var $body;
>
>    /*
>    *     void mime_mail()
>    *     class constructor
>    */
>   function mime_mail()
>    {
>    $this->parts = array();
>    $this->to =  "";
>    $this->from =  "";
>    $this->subject =  "";
>    $this->body =  "";
>    $this->headers =  "";
>    }
>
>    /*
>    *     void add_attachment(string message, [string name], [string
ctype])
>    *     Add an attachment to the mail object
>    */
>   function add_attachment($message, $name =  "", $ctype =
> "application/octet-stream")
>    {
>    $this->parts[] = array (
>                             "ctype" => $ctype,
>                             "message" => $message,
>                             "encode" => $encode,
>                             "name" => $name
>                            );
>    }
>
> /*
>   *      void build_message(array part=
>   *      Build message parts of an multipart mail
>   */
> function build_message($part)
>   {
>   $message = $part[ "message"];
>   $message = chunk_split(base64_encode($message));
>   $encoding =  "base64";
>   return  "Content-Type: ".$part[ "ctype"].
>                          ($part[ "name"]? "; name = \"".$part[ "name"].
> "\"" :  "").
>                           "\nContent-Transfer-Encoding:
> $encoding\n\n$message\n";
>   }
>
> /*
>   *      void build_multipart()
>   *      Build a multipart mail
>   */
> function build_multipart()
>   {
>   $boundary =  "b".md5(uniqid(time()));
>   $multipart =  "Content-Type: multipart/mixed; boundary =
> $boundary\n\nThis is a MIME encoded message.\n\n--$boundary";
>
>   for($i = sizeof($this->parts)-1; $i >= 0; $i--)
>      {
>      $multipart .=  "\n".$this->build_message($this->parts[$i]).
> "--$boundary";
>      }
>   return $multipart.=  "--\n";
>   }
>
> /*
>   *      void send()
>   *      Send the mail (last class-function to be called)
>   */
> function send()
>   {
>   $mime =  "";
>   if (!empty($this->from))
>      $mime .=  "From: ".$this->from. "\n";
>   if (!empty($this->headers))
>      $mime .= $this->headers. "\n";
>
>   if (!empty($this->body))
>      $this->add_attachment($this->body,  "",  "text/plain");
>   $mime .=  "MIME-Version: 1.0\n".$this->build_multipart();
>   mail($this->to, $this->subject,  "", $mime);
>   }
> };  // end of class
>
> /*
>   * Example usage
>   */
>
>   $attachment = fread(fopen("arrows.gif", "r"), filesize("arrows.gif"));
>
>   $mail = new mime_mail();
>   $mail->from = "someone";
>   $mail->headers = "Errors-To: [EMAIL PROTECTED]";
>   $mail->to = "someone else";
>   $mail->subject = "Testing...";
>   $mail->body = "This is just a test";
>   $mail->add_attachment("$attachment", "arrows.gif", "image/gif");
>   $mail->send();
>
>
> ?>
>
>
>
> M. Weller wrote:
>
> > Thanks Brian for your fast respond.
> >
> > I tried but still the same:  it doesn't work.
> >
> > I used the following code:
> > -----------------------------------------------------------
> > $filename = 'background.gif';
> > $myimage = fread($fp = fopen($filename, 'r'), filesize($filename));
> > fclose($fp);
> >
> > $content = chunk_split ( base64_encode ( $myimage ) );
> > $boundary = 'NEXT_PART';
> > $message= "Content-Type: multipart/mixed; boundary='$boundary'\n";
> > $message.= "Mime-Version: 1.0\n";
> >
> > then in the message:
> >
> > $message.= "--$boundary\n";
> > $message.= "Content-Type: image/gif; name='my_image.gif'\n";
> > $message.= "Content-Transfer-Encoding: base64\n";
> > $message.= "Content-Disposition: attachment\n\n";
> >
> > $message = $content;     // here I used $message .= $content;
> >
> > mail("[EMAIL PROTECTED]","", "", $message);
> > -----------------------------------------------------------
> >
> >
> >
> >
> > ""Brian Paulson"" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> >
> >> Are you trying to attach it or put the image in the body of the
message?
> >>
> >> If you  are trying to attach it try looking at this message from the
> >> archives
> >>
> >> http://marc.theaimsgroup.com/?l=php-general&m=99003506223055&w=2
> >>
> >> Thank You
> >> Brian Paulson
> >> Sr. Web Developer
> >> The Pueblo Chieftain
> >> www.chieftain.com
> >> 1-800-279-6397
> >>
>
>
> --
>
> Michael Kelley
> [EMAIL PROTECTED]
>
> Programmer/Systems Analyst I
> New Mexico State University
> Information and Communication Technologies
> Work # (505)-646-1374
> P.O. Box 30001
> MSC: 3AT
> Las Cruces, NM 88003
>
>
>
>
>
>
> --
> 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]
>






(First he posts the entire contents of a large file, and then he 
wants to know where we want him to put it. A world full of comedians, 
and he's volunteering to be the straight man!)

You can put it anywhere you want. But if you put it in your bin 
folder, you won't have to include the path.

(I think I deserve sainthood for that answer. Beautification at the least.)

Bob Hall

>where to i put nuke.sql?
>
>-----Original Message-----
>From: Zak Greant [mailto:[EMAIL PROTECTED]]
>Sent: Wednesday, May 16, 2001 9:27 PM
>To: Manesh Manickam; [EMAIL PROTECTED]
>Subject: Re: [PHP-WIN] My SQL
>
>
>Open a Command Prompt
>CD into your mysql bin directory (often c:\mysql\bin\)
>Run the command
>
>Ciao,
>
>Zak
>
>
>
>----- Original Message -----
>From: "Manesh Manickam" <[EMAIL PROTECTED]>
>To: "Zak Greant" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
>Sent: Wednesday, May 16, 2001 7:25 PM
>Subject: RE: [PHP-WIN] My SQL
>
>
>  > where do i do this, i am win2k
>  >
>  > -----Original Message-----
>  > From: Zak Greant [mailto:[EMAIL PROTECTED]]
>  > Sent: Wednesday, May 16, 2001 6:17 PM
>  > To: Manesh Manickam; [EMAIL PROTECTED]
>  > Subject: Re: [PHP-WIN] My SQL
>  >
>  >
>  > Manesh,
>  >
>  > Don't be surprised that people are less than helpful when you sent a huge
>  > (34k) message to the list! :)
>  >
>  > The command you need is this:
>  >
>  > mysql db_name < nuke.sql
>  >
>  > Change the db_name to whatever database you want the tables to appear in.
>  >
>  > All of this info is in the MySQL docs.
>  >
>  > --zak
>  >
>  >
>  >
>  >
>  > ----- Original Message -----
>  > From: "Manesh Manickam" <[EMAIL PROTECTED]>
>  > To: "Manesh Manickam" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
>  > Sent: Wednesday, May 16, 2001 3:37 PM
>  > Subject: RE: [PHP-WIN] My SQL
>  >
>  >
>  > > COME ONE!! PLEASE!!!!
>  > >
>  > > -----Original Message-----
>  > > From: Manesh Manickam [mailto:[EMAIL PROTECTED]]
>  > > Sent: Wednesday, May 16, 2001 4:39 PM
>  > > To: [EMAIL PROTECTED]
>  > > Subject: [PHP-WIN] My SQL
>  > >
>  > >
>  > >
>  > > How do i add these table, the file is called nuke.sql
>  > >
>  > > when i run it, it just shows as text. i use IIS5
>
>
>
>--
>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 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]

Know thyself? Absurd direction!
Bubbles bear no introspection.     -Khushhal Khan Khatak
MySQL list magic words: sql query database




They way I handled something like this was, I read the line in with 
fread breaking it up into "$chunks"
        $chunk1 = fread( $fp, 12); //Your string#1
        $chunk2 = fread( $fp, 11); //The URL
        $chunk3 = fread( $fp,  5); //the INT
         $chunk4 = fread( $fp, 50); //The final String
Then when building the next page I would make a link by using this syntax

printf("<td><center><a href=\"%s\">%s</a></center></td>",$chunk1,$Chunk2);


Since you're reading in multiple lines at a time I'd read them into an array
$i=0;
while ( !feof($fp))
        {
        $chunk1[$i] = fread( $fp, 12); //Your string#1
        $chunk2[$i] = fread( $fp, 11); //The URL
        $chunk3[$i] = fread( $fp, 5); //the INT
        $chunk4[$i] = fread( $fp, 50); //The final String       
        global $i;//Since we use $i outside the while make it global
        $i++;
        }
then print from an array
for ($j=0; $j<$i; $j++)
        {
                printf("<td><center><a 
href=\"%s\">%s</a></center></td>",$chunk1[$J],$Chunk2[$J]);
        }




Alain Menard wrote:

> I clicked on the send button to fast...
> 
> The part that i'm having problem with is the second part. Especially the one
> about the first string becomming a link to the corresponding URL.
> 
> 
> ""Alain Menard"" <[EMAIL PROTECTED]> wrote in message
> 9dv3k5$873$[EMAIL PROTECTED]">news:9dv3k5$873$[EMAIL PROTECTED]...
> 
>> Hi!!
>> 
>> I'm presently working on my personal web site and i would like to use PHP
> 
> to
> 
>> do the following :
>> 
>> 1- Read a string in the following format from a text file :
>>      string;url;integer;string
>>      string;url;integer;string
>>      string;url;integer;string
>>                 ...
>>      string;url;integer;string
>> 
>> 
>> 2- Generate a page containing the resulting list in the following format :
>> 
>>               string      integer     string
>>               string      integer     string
>>               string      integer     string
>>                                ...
>>               string      integer     string
>> 
>>       where the first string is a link to the corresponding url.
>> 
>> Any help would be welcome at this point.
>> Thank you in advance...
>> 
>> Alain Menard
>> 
>> 
>> 
>> 
>> --
>> 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]
>> 


-- 

Michael Kelley                  
[EMAIL PROTECTED] 
        
Programmer/Systems Analyst I    
New Mexico State University
Information and Communication Technologies
Work # (505)-646-1374
P.O. Box 30001
MSC: 3AT
Las Cruces, NM 88003











>I found this on PHP.net It works when you hardcode the values (where I 
>have the value arrows.gif). I've been playing with it trying to modify 
>it to do an upload and sending of an email with any kind of attachment.
>
><?
>
>/*
>  *  Class mime_mail
>  *  Original implementation by Sascha Schumann <[EMAIL PROTECTED]>
>  *  Modified by Tobias Ratschiller <[EMAIL PROTECTED]>:
>  *      - General code clean-up
>  *      - separate body- and from-property
>  *      - killed some mostly un-necessary stuff
>  */


look at http://www.heyes-computing.net/scripts/

there's what you're looking for (I think)

** Author........: Richard Heyes <[EMAIL PROTECTED]>
** Filename......: html_mime_mail.class
** Last changed..: 28/01/01
** Notes.........: Based upon mime_mail.class
**                 by Tobias Ratschiller <[EMAIL PROTECTED]>
**                 and Sascha Schumann <[EMAIL PROTECTED]>.


also on my site
http://boltthrower.webhop.org/opensource/moom.html
( a remote database interface (in the case Oracle) all via mail using that class)



HTH,
bye,
Giuse,
http://boltthrower.webhop.org/









I am fairly new to PHP and have used it on a few sites but I have not been 
dealing with databases much (in PHP). I am wanting to know if a single 
instance of PHP can be configured to connect to multiple databases or does 
is a new instance required for each DB. The scenario is that I may be 
pulling content from multiple databases (Oracle, MySQL, SQL Server...) for 
a single web site.

I am not looking for any involved explanations just a simple yes or no and 
any reference points you may have from experience on how (at a high level) 
and if there are any "tricky parts"  that might make the process painful.

Thanks,
Scott






Thank you Michael and Brian,

I tried your code and the behavior is still the same.
It isn't working with images larger then 3kB.

No idea what to do.


I am using W2k server running IIS 5 and the latest release of php




Reply via email to