php-general Digest 21 Apr 2002 22:46:30 -0000 Issue 1300

Topics (messages 93876 through 93916):

Variable substitution
        93876 by: Greg Hulands
        93877 by: Jason Wong

Re: Better standards in PHP-coding
        93878 by: Tom Rogers

Re: Session Tutorial
        93879 by: R. Visser

Re: I would like to get a script to display in a frame
        93880 by: R. Visser
        93882 by: The_RadiX

Re: creating table help
        93881 by: R. Visser

Thanks
        93883 by: Victor Javier Martinez Lopez

inline CGI
        93884 by: Werner de Schepper
        93885 by: Rasmus Lerdorf
        93887 by: Werner de Schepper

can you show an example?
        93886 by: bob

Re: Would this work?  (mod_rewrite)
        93888 by: bvr

Re: mail() + attachment
        93889 by: Boaz Yahav

Re: Open Download-Box
        93890 by: Boaz Yahav

Ways to promote PHP applications?
        93891 by: Pekka Saarinen

How to check flags?
        93892 by: albertonews
        93893 by: Miguel Cruz
        93895 by: albertonews
        93898 by: Miguel Cruz
        93901 by: Rasmus Lerdorf

Re: Attachments
        93894 by: Jason Soza
        93897 by: Jason Wong
        93900 by: Jason Soza

Using an external program.
        93896 by: Raymond Lilleodegard
        93899 by: Miguel Cruz

phpLISTMAN
        93902 by: Randum Ian
        93903 by: Mark Charette
        93904 by: Randum Ian
        93905 by: php.alister.dnsalias.com
        93906 by: Mark Charette
        93907 by: Alnisa Allgood
        93915 by: Miguel Cruz

Calling pg_connect from a class included..
        93908 by: Smileyq
        93914 by: Smileyq

Re: constructor in php4?
        93909 by: Smileyq

Re: Classes??
        93910 by: Smileyq

MySQL question
        93911 by: Mantas Kriauciunas
        93912 by: .ben

adding numbers in a text file
        93913 by: Craig Westerman

ereg size limit???
        93916 by: SP

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,
I am trying to make an e-mail form so that I can generate an e-mail to send
to all the users of the system. In the message part I want to be able to do
something like this.

Dear $fName,
Welcome to .....

When it then sends the e-mail, it should substitute $fName with the current
row in the database. For some reason it does not get automatically
substituted when using mail(to, subject, message). Is there a function that
substitutes variables with there values and returns a string.

Any help is greatly appreciated,

Thanks,
Greg

--- End Message ---
--- Begin Message ---
On Saturday 20 April 2002 17:08, Greg Hulands wrote:
> Hi,
> I am trying to make an e-mail form so that I can generate an e-mail to send
> to all the users of the system. In the message part I want to be able to do
> something like this.
>
> Dear $fName,
> Welcome to .....
>
> When it then sends the e-mail, it should substitute $fName with the current
> row in the database. For some reason it does not get automatically
> substituted when using mail(to, subject, message). Is there a function that
> substitutes variables with there values and returns a string.

Depending on your existing code, your options include eval(), 
substr_replace(), str_replace().

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Make me look like LINDA RONSTADT again!!
*/
--- End Message ---
--- Begin Message ---
Hi
I like the following form, not sure how much time gets wasted in parsing 
but it's easy > for me < to follow :)

while(something):
         if(something else):
                 yada;
         else:
                 forget it;
         endif;
endwhile;

Tom


At 11:51 AM 21/04/2002, Frank wrote:

>"The nice thing about standards is that there are so many to choose between".
>
>Subject: Uses of block markers in coding
snip

--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:

> Recently I have been trying to work with sessions however I must admit that
> I am not sure I completely understand them. Does anyone know of a good
> tutorial that thoroughly explains sessions?

> Thanks in advance


I can write one if you want, send me a mail.


Greetings,

René

--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:

> Does anyone have any experience with making script output display in a
> frame??  I would like to get this to happen on an e-commerce site I am
> designing and am stuck.  I have tried <form method=POST
> action=myscript.php target=main> with no success.  Please help.

> ----
> Jeff Means
> CIO for PicoTech
> http://www.picotech.net


Hi Jeff,

maybe it's a good idea to create a hidden HTML-form in the output frame.

In that case you can use javascript in your input frame in order to send
the given
values to the hidden form in your output frame. After that you can submit
the hidden form using the same javascript in your input form.

For example your output frame is called "output"

To fill your hidden frame with input data:

   output.document.forms[0].hidden_name.value="value";


I would simply create a hidden submit-button (using css display-function)

You can activate this button out of javascript with:

   output.document.forms[0].submit.click();


It's very simple, but I think it should work.


Greetings,

René

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

Can't you simply use:

output.document.forms[0].submit()


I did Javascript for 3 years but that was a while back now.. But there is
most definitely a submit function for forms so you don't have to use that
queer invisible submit trick..




... Hope that helps ...


:::::::::::::::::::::::::::::::::::::::::::
:  Julien Bonastre [The-Spectrum.org CEO]
:  A.K.A. The_RadiX
:  [EMAIL PROTECTED]
:  ABN: 64 235 749 494
:  QUT Student :: 04475739
:::::::::::::::::::::::::::::::::::::::::::


----- Original Message -----
From: "R. Visser" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, April 21, 2002 9:22 PM
Subject: [PHP] Re: I would like to get a script to display in a frame


> [EMAIL PROTECTED] wrote:
>
> > Does anyone have any experience with making script output display in a
> > frame??  I would like to get this to happen on an e-commerce site I am
> > designing and am stuck.  I have tried <form method=POST
> > action=myscript.php target=main> with no success.  Please help.
>
> > ----
> > Jeff Means
> > CIO for PicoTech
> > http://www.picotech.net
>
>
> Hi Jeff,
>
> maybe it's a good idea to create a hidden HTML-form in the output frame.
>
> In that case you can use javascript in your input frame in order to send
> the given
> values to the hidden form in your output frame. After that you can submit
> the hidden form using the same javascript in your input form.
>
> For example your output frame is called "output"
>
> To fill your hidden frame with input data:
>
>    output.document.forms[0].hidden_name.value="value";
>
>
> I would simply create a hidden submit-button (using css display-function)
>
> You can activate this button out of javascript with:
>
>    output.document.forms[0].submit.click();
>
>
> It's very simple, but I think it should work.
>
>
> Greetings,
>
> René
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:

> I'm very new to php and PostgreSQL.  I keep getting the following error
> when I try to create a table:

> Warning: Wrong parameter count for pg_exec() in
> /var/www/html/elkan/createtable.php on line 23
> The table, ghdsl could not be created

> Here is the code I'm using:

> <?php

> // set variables
> $tablename = "ghdsl";
> $dbname = "testingdb";
> $user = "testinguser";
> $password = "xxxxxx";

> $connect = "pg_connect($dbname, $user, $password)";

> $query = "CREATE table $tablename (id INT UNSIGNED NOT NULL
> AUTO_INCREMENT PRIMARY KEY, ip TEXT, customer TEXT, dslphone TEXT, date
> TEXT, vpivci TEXT)";

>  if (pg_exec($dbname, $query, $connect))
>   {
>   print ("The table, $tablename was successfully created");
>   } else {
>   print ("The table, $tablename could not be created");
>   }

> ?>

> thanks for any help.


Hi there,

the function pg_exec only takes two strings withing his brackets.

1. Integer connection index (returned by pg_connect() )
2. Query string

Try changing your code to:   if (pg_exec($connect, $query))


Greetings,

René

--- End Message ---
--- Begin Message ---
Thanks everyone for your help.


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

I like to include the html-output of a perl script in my php-page. The perl
script is on the same server as the php file, so I use de passthru(
[docroot/path/perl-file] ) function to include de html output of the script
in my php page.
Basicly yhis works fine, but I don't know how to pass parameters to this
script. normally  the perl script is executed by
http://website/path/perl-file?paramA=A&paramB=B. I have to pass those
parameters in order to get the right html output.

Any help would be appreciated.

Werner


--- End Message ---
--- Begin Message ---
virtual()

On Sun, 21 Apr 2002, Werner de Schepper wrote:

> Hello,
>
> I like to include the html-output of a perl script in my php-page. The perl
> script is on the same server as the php file, so I use de passthru(
> [docroot/path/perl-file] ) function to include de html output of the script
> in my php page.
> Basicly yhis works fine, but I don't know how to pass parameters to this
> script. normally  the perl script is executed by
> http://website/path/perl-file?paramA=A&paramB=B. I have to pass those
> parameters in order to get the right html output.
>
> Any help would be appreciated.
>
> Werner
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

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

Thank you.
Actually I did try the virtual function before and but the perl didn't seem
to produce any output. Now I looked better: I switched of all warnings,
including the request execution failed warning!!!

Greetings Werner

"Rasmus Lerdorf" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> virtual()
>
> On Sun, 21 Apr 2002, Werner de Schepper wrote:
>
> > Hello,
> >
> > I like to include the html-output of a perl script in my php-page. The
perl
> > script is on the same server as the php file, so I use de passthru(
> > [docroot/path/perl-file] ) function to include de html output of the
script
> > in my php page.
> > Basicly yhis works fine, but I don't know how to pass parameters to this
> > script. normally  the perl script is executed by
> > http://website/path/perl-file?paramA=A&paramB=B. I have to pass those
> > parameters in order to get the right html output.
> >
> > Any help would be appreciated.
> >
> > Werner
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>


--- End Message ---
--- Begin Message ---
the manual says:
reference which returned from a function can be passed by reference.

i can not think it is useful .
can you show an example?

thanks!
--- End Message ---
--- Begin Message ---
This can also be achieved by doing

Alias / /home/blah/script.php

no need to use mod_rewrite !!

bvr.

[ rswfire ] wrote:

> Assume I want *.domain.*/*.* to automatically call index.php (without 
> the user knowing and without any redirecting at all):
>
> RewriteEngine  on
> RewriteBase    /
> RewriteRule    *.* index.php [R]
>
> I don't know what in the world the [R] is, but it's in almost all of 
> the mod_rewrite examples...  :-)
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at 
> http://explorer.msn.com/intl.asp.
>
>


--- End Message ---
--- Begin Message ---
Class for sending mail with MIME attachments in multipart format using
external send mail, mime code and zip
http://www.weberdev.com/index.php3?GoTo=get_example.php3?count=336

Class to send a file as an attachment with the php mail() function.
http://www.weberdev.com/index.php3?GoTo=get_example.php3?count=1583

How-to send e-mail with attachments ( with some corrections ) 
http://www.weberdev.com/index.php3?GoTo=get_example.php3?count=1260

Sincerely

berber

Visit http://www.weberdev.com/ Today!!!
To see where PHP might take you tomorrow.



-----Original Message-----
From: Wolf-Dietrich von Loeffelholz [mailto:[EMAIL PROTECTED]]
Sent: Saturday, April 20, 2002 10:44 PM
To: [EMAIL PROTECTED]
Subject: [PHP] mail() + attachement


Is it possible to send with mail an attachment .. if yes, how ???

Greetings
wolf


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

--- End Message ---
--- Begin Message ---
How to force the user to download a file instead of opening it up in an
controlled environment within the browser (i.e. MS Word/Adobe Acrobat)
http://www.weberdev.com/index.php3?GoTo=get_example.php3?count=1627

How to let a user download a picture by clicking on it instead of
needing to right click and Save-As.
http://www.weberdev.com/index.php3?GoTo=get_example.php3?count=1562

Sincerely

berber

Visit http://www.weberdev.com/ Today!!!
To see where PHP might take you tomorrow.


-----Original Message-----
From: Martin Thoma [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 18, 2002 3:20 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Open Download-Box


Hello! I have a PDF-File, which the user should download (it should not
open in the browser, even if the Adobe-Reader-Pluging is installed). I
use:

 $filename = $DOCUMENT_ROOT."/".$QUERY_STRING;
 $fd = fopen ($filename, "rb");
 $contents = fread ($fd, filesize ($filename));
 fclose ($fd);

 header("Content-type: application/octet-stream");
 header("Content-Disposition:attachment;filename=$savename");

 echo $contents;

This doesn't work in IE (Version 6, 5 is not tested yet): When I get the
download-box and I choose "open" instead of "save", the download-box
opens again! Then pressing "open", everything is okay, but why is the
box opened twice?

Martin



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

--- End Message ---
--- Begin Message ---
Hi,

Do you have any good sites which list (and review) php applications?

I already know http://www.hotscripts.com/PHP/Scripts_and_Programs/ and 
http://php.resourceindex.com (they update the content two moths late!).

Thanks,

Pekka
http://photography-on-the.net/ee/

--- End Message ---
--- Begin Message ---
I don't know how to say this in english, so try to discover:

2 = Married
4 = Single
8 = With Children
16 = Without Children
32 = Man
64 = Woman

then we add the values we want
74 = Woman Married With Children

how to use this flag system in PHP? like, configuring:

2 = Block
4 = Menu
8 = System

12 = Module with menu and system


I want to explode the final value into the smaller ones....


--- End Message ---
--- Begin Message ---
On Sun, 21 Apr 2002, albertonews wrote:
> I don't know how to say this in english, so try to discover:
> 
> 2 = Married
> 4 = Single
> 8 = With Children
> 16 = Without Children
> 32 = Man
> 64 = Woman
> 
> then we add the values we want
> 74 = Woman Married With Children

Look up the operators & and |

If you can give a more concrete example then I can give you a little code 
snippet.

miguel

--- End Message ---
--- Begin Message ---
I want this:

2 Bloco
4 Sessão
8 Sistema

only this three

but I don't want nothing like this:
If ($abc == 10) {
}

I want something that really explode the number....

21/04/2002 14:30:37, Miguel Cruz <[EMAIL PROTECTED]> wrote:

>On Sun, 21 Apr 2002, albertonews wrote:
>> I don't know how to say this in english, so try to discover:
>>
>> 2 = Married
>> 4 = Single
>> 8 = With Children
>> 16 = Without Children
>> 32 = Man
>> 64 = Woman
>>
>> then we add the values we want
>> 74 = Woman Married With Children
>
>Look up the operators & and |
>
>If you can give a more concrete example then I can give you a little code
>snippet.
>
>miguel
>
>
>



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

  if ($abc & 2) print 'Bloco';
  if ($abc & 4) print 'Sessão';
  if ($abc & 8) print 'Sistema';

Or...

  // take an integer and turn it into an indexed array. For each bit
  // b that is set, subscript b of the array will be set to 1. For 
  // instance, bitsplit(5) would return an array with subscripts 0
  // and 2 set to 1.
  function bitsplit($bits)
  {
    $r = array();
    $i = 0;
    while ($bits)
    {
      if ($bits & 1)
        $r[$i] = 1;
      $i++;
      $bits >>= 1;
    }
    return $r;
  }

miguel

On Sun, 21 Apr 2002, albertonews wrote:
> I want this:
> 
> 2 Bloco
> 4 Sessão
> 8 Sistema
> 
> only this three
> 
> but I don't want nothing like this:
> If ($abc == 10) {
> }
> 
> I want something that really explode the number....
> 
> 21/04/2002 14:30:37, Miguel Cruz <[EMAIL PROTECTED]> wrote:
> 
> >On Sun, 21 Apr 2002, albertonews wrote:
> >> I don't know how to say this in english, so try to discover:
> >>
> >> 2 = Married
> >> 4 = Single
> >> 8 = With Children
> >> 16 = Without Children
> >> 32 = Man
> >> 64 = Woman
> >>
> >> then we add the values we want
> >> 74 = Woman Married With Children
> >
> >Look up the operators & and |
> >
> >If you can give a more concrete example then I can give you a little code
> >snippet.
> >
> >miguel
> >
> >
> >
> 
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

--- End Message ---
--- Begin Message ---
if($abc & 2) echo "2 Bloco<br>\n";
if($abc & 4) echo "4 Sessao<br>\n";
if($abc & 8) echo "8 Sistema<br>\n";

-Rasmus

On Sun, 21 Apr 2002, albertonews wrote:

> I want this:
>
> 2 Bloco
> 4 Sessão
> 8 Sistema
>
> only this three
>
> but I don't want nothing like this:
> If ($abc == 10) {
> }
>
> I want something that really explode the number....
>
> 21/04/2002 14:30:37, Miguel Cruz <[EMAIL PROTECTED]> wrote:
>
> >On Sun, 21 Apr 2002, albertonews wrote:
> >> I don't know how to say this in english, so try to discover:
> >>
> >> 2 = Married
> >> 4 = Single
> >> 8 = With Children
> >> 16 = Without Children
> >> 32 = Man
> >> 64 = Woman
> >>
> >> then we add the values we want
> >> 74 = Woman Married With Children
> >
> >Look up the operators & and |
> >
> >If you can give a more concrete example then I can give you a little code
> >snippet.
> >
> >miguel
> >
> >
> >
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
I haven't been able to identify what process actually truncates the file.
All I know is that it's not my mailserver. I don't believe it's in the
coding either, as both Perl and PHP do this, and both work great otherwise.
Anyhow:

This reads the file from the form:
        function get_file($filename){

                $return = '';
                if($fp = fopen($filename, 'rb')){
                        while(!feof($fp)){
                                $return .= fread($fp, 1024);
                        }
                        fclose($fp);
                        return $return;

                }else{
                        return FALSE;
                }
        }

This adds any files to a list of attachments:
        function add_attachment($file, $name = '',
$c_type='application/octet-stream', $encoding = 'base64'){
                $this->attachments[] = array(
                                                                        'body'  => 
$file,
                                                                        'name'  => 
$name,
                                                                        'c_type'       
 => $c_type,
                                                                        'encoding'     
 => $encoding
                                                                  );
        }

This adds a MIME subpart for the attachment:
        function &add_attachment_part(&$obj, $value){

                $params['content_type'] = $value['c_type'];
                $params['encoding']     = $value['encoding'];
                $params['disposition']  = 'attachment';
                $params['dfilename']    = $value['name'];
                $obj->addSubpart($value['body'], $params);
        }

This is out of the build mail function, adding the text and attachments to
an e-mail:
                        case $text AND $attachments:
                                $message =& $this->add_mixed_part();
                                $this->add_text_part($message, $this->text);

                                for($i=0; $i<count($this->attachments); $i++)
                                        $this->add_attachment_part($message, 
$this->attachments[$i]);
                                break;

Anything look wrong so far?

Just in case this may help, here's the part of the Perl script that adds
files to the e-mail. This script results in a truncation the same way as the
PHP script:

sub attachFilesToMail {
        my $type = shift;
        my $msg = shift;
        my $hasBody = shift;
        my ($key, $file);
        while (($key, $file) = each %{$CONFIG{$type}}) {
                ($debug) && print STDERR "examining attachment $key, $file\n";
                next unless ($key =~ /(\d+)file/ && -f $file);
                my $attachNum = $1;
                $file =~ m!/([^/]+)$!;
                my $filename = $1;
                my $mime_type =
                        $CONFIG{$type}->{"${attachNum}mime"};
                ($debug) && print STDERR "Attaching a mime type of $mime_type for
$filename ($key)\n";
                unless ($mime_type) {
                        $mime_type = (!$fhBug && -T $file) ? 'text/plain' :
                                                                        
'application/octet-stream';
                }
                my @stats  = stat($file);
                ($debug) && print STDERR "Attaching $file ($stats[7] bytes) " .
                                                                 "to email\n";
                my $data = { Path => $file,
                                         ReadNow => 1,
                                         Filename => $filename
                                         };
                unless ($mime_type =~ /^text\//) {
                        $data->{'Encoding'} = "base64";
                }

                if (!$hasBody) {
                        $$msg->data("This is a MIME message with attachments");
                }
                my $m = $$msg->attach(%$data);
                $m->attr("content-type" => $mime_type);
        }
}
-----Original Message-----
From: Jason Wong [mailto:[EMAIL PROTECTED]]
Sent: Sunday, April 21, 2002 12:10 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Attachments


On Sunday 21 April 2002 06:02, Jason Soza wrote:
> They actually vary as to where they become truncated - some are at 633
> bytes, some are at 1kb. The odd thing is that the PHP script I'm using to
> process the form actually pics up the correct filesize, it reports it to
me
> under a $filesize variable I've setup. It'll report, say
file2_filesize...:
> 69147 but the actual attachment is 1kb.

Please post your code.

> Like I said, I have this same problem using both Perl scripts and PHP
> scripts. In php.ini my post_max size is 8M and upload_max_filesize is 2M.
> Looking through the Apache mailing list archives, it looks like others
> running Apache on win32 have experienced the same problems, but there are
> no answers. I'm a little stumped myself!

Have you narrowed down the problem to whether the uploaded file is truncated
or whether the mail attachment process truncates the file?

--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
<<<<< EVACUATION ROUTE <<<<<
*/

--- End Message ---
--- Begin Message ---
On Monday 22 April 2002 01:51, Jason Soza wrote:
> I haven't been able to identify what process actually truncates the file.

This should be the easiest to nail down. Add a bit of code so that when the 
file gets uploaded, it gets copied somewhere, then you can manually check its 
size. Obviously, if the filesize is OK then the problem is further down the 
line (probably the mail code).

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
f u cn rd ths, itn tyg h myxbl cd.
*/
--- End Message ---
--- Begin Message ---
Hmm... Okay, I used this script I found on hotscripts - it copies the entire
file to the specified directory:

      echo "<p><center>Trying to upload to: "
         . $upload_path . $filename . "</center></p>\n";

      if ( file_exists($upload_path.$filename) ) {
         echo "<p><font color='red'><center>"
            . $message["fileexists"]."</font></center></p>";

      } else {
         if( move_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'],
                   $upload_path.$filename) ) {
            echo "<p><center>" . $message["complete"]."</center></p>";
         } else {
            echo "<p><font color='red'><center>"
               . $message["incomplete"]."</font></center></p>";
         }

Now why would this work but the e-mail scripts not?


-----Original Message-----
From: Jason Wong [mailto:[EMAIL PROTECTED]]
Sent: Sunday, April 21, 2002 10:13 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Attachments


On Monday 22 April 2002 01:51, Jason Soza wrote:
> I haven't been able to identify what process actually truncates the file.

This should be the easiest to nail down. Add a bit of code so that when the
file gets uploaded, it gets copied somewhere, then you can manually check
its
size. Obviously, if the filesize is OK then the problem is further down the
line (probably the mail code).

--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
f u cn rd ths, itn tyg h myxbl cd.
*/

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

--- End Message ---
--- Begin Message ---
Hi all!

I am trying to interact with a simple exe program. I manage to get the
program started, but I need to send some commands to it as well. My script
looks like this:

<?php

$var = exec('fax.exe');

$var = shell_exec('cmd S');

$var = shell_exec('cmd fax_test.txt');

$var = shell_exec('cmd 67590000');

?>

And do I need to run the exec() function everytime I would like the program
to do some work for me? Is there a way to access the program later somehow,
without opening a "new" program?

Thankfull for all help and hints! : )

Best regards

Raymond Lilleødegård


--- End Message ---
--- Begin Message ---
On Sun, 21 Apr 2002, Raymond Lilleodegard wrote:
> I am trying to interact with a simple exe program. I manage to get the
> program started, but I need to send some commands to it as well. My script
> looks like this:
> 
> <?php
> 
> $var = exec('fax.exe');
> 
> $var = shell_exec('cmd S');
> 
> $var = shell_exec('cmd fax_test.txt');
> 
> $var = shell_exec('cmd 67590000');
> 
> ?>
> 
> And do I need to run the exec() function everytime I would like the program
> to do some work for me? Is there a way to access the program later somehow,
> without opening a "new" program?

Look into popen().

miguel

--- End Message ---
--- Begin Message ---
Hi there,

I am trying to find a Mailing List Manager on the net that is written in PHP
that access a database of emails, and other information, in order to manage
and maintain a list of subscribers.

I have now decided to write my own, both to fill a possible niche in the PHP
code world, and also to further my understanding of PHP. I am asking your
help in providing me with a list of things that need to implemented into
this code in order to provide something that people want to use. I am
willing to make this code widely available to who ever wants it, and
eventually code something that will be useable by other people in the PHP
world.

I have thought of the following, and if people could suggest/add to this
list I would greatly appreciate it!

Control Panel
-Add User
-Delete User
-Validate Email
-Send Mail (HTML/Text)
-Archive Mail

HTML Generator
-Subscription Box
-Unsubscribe Box
-Statistics

Can anybody help me with this project codenamed "phpLISTMAN"???

Kind Regards, Ian.
---
Randum Ian
DJ / Reviewer / Webmaster, DancePortal (UK) Limited
[EMAIL PROTECTED]
http://www.danceportal.co.uk
DancePortal.co.uk - Global dance music media

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

> From: Randum Ian [mailto:[EMAIL PROTECTED]]

>
> Control Panel
> -Add User
> -Delete User
> -Validate Email
> -Send Mail (HTML/Text)
> -Archive Mail
>
> HTML Generator
> -Subscription Box
> -Unsubscribe Box
> -Statistics

Let's see. Double opt-in with cryptographic/time security, automatic bounce
message processing, programmable and scalable message handling, automated
relay centers for very large lists, both digest & regular versions, deny
processing, multiple posting addresses, management functions available via
email processining, moderation, etc. ...

In other words, you might want to look through all the man pages and code
for something like ezmlm and figure out if you want to duplicate all that
work. Mailing lists are non-trivial pieces of code, and one little mistake
can affect thousands of people (and your bandwidth).

Mark C.


--- End Message ---
--- Begin Message ---
Is that a nice way of saying that I am wasting my time in doing such a
project? I just get frustrated at not having a Mailing List Manager that I
can use to manage large lists of users.

Is it more bother than it is worth?

----- Original Message -----
From: "Mark Charette" <[EMAIL PROTECTED]>
To: "Randum Ian" <[EMAIL PROTECTED]>; "PHP" <[EMAIL PROTECTED]>
Sent: Sunday, April 21, 2002 8:47 PM
Subject: RE: [PHP] phpLISTMAN


>
> > From: Randum Ian [mailto:[EMAIL PROTECTED]]
>
> >
> > Control Panel
> > -Add User
> > -Delete User
> > -Validate Email
> > -Send Mail (HTML/Text)
> > -Archive Mail
> >
> > HTML Generator
> > -Subscription Box
> > -Unsubscribe Box
> > -Statistics
>
> Let's see. Double opt-in with cryptographic/time security, automatic
bounce
> message processing, programmable and scalable message handling, automated
> relay centers for very large lists, both digest & regular versions, deny
> processing, multiple posting addresses, management functions available via
> email processining, moderation, etc. ...
>
> In other words, you might want to look through all the man pages and code
> for something like ezmlm and figure out if you want to duplicate all that
> work. Mailing lists are non-trivial pieces of code, and one little mistake
> can affect thousands of people (and your bandwidth).
>
> Mark C.
>
>
>
>

--- End Message ---
--- Begin Message ---
On Sun, 21 Apr 2002 20:52:17 +0100, you wrote:

>Is that a nice way of saying that I am wasting my time in doing such a
>project? I just get frustrated at not having a Mailing List Manager that I
>can use to manage large lists of users.
>
>Is it more bother than it is worth?

Probably is.

What would be useful is a set of PHP programmatical interfaces to
other list managers (eg, Mailman), let them do what they do well, and
have PHP talk to them to add/subscribe/etc.  It's a real pity that
they don't have XML-RPC interface (that I know of).

Alister
--- End Message ---
--- Begin Message ---
Just about all of them can have/do have simple HTML interfaces that can send
data to them. I built one for ezmlm in about 20 minutes ... and then found a
number of them already available.

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]

>
> On Sun, 21 Apr 2002 20:52:17 +0100, you wrote:
>
> >Is that a nice way of saying that I am wasting my time in doing such a
> >project? I just get frustrated at not having a Mailing List
> Manager that I
> >can use to manage large lists of users.
> >
> >Is it more bother than it is worth?
>
> Probably is.
>
> What would be useful is a set of PHP programmatical interfaces to
> other list managers (eg, Mailman), let them do what they do well, and
> have PHP talk to them to add/subscribe/etc.  It's a real pity that
> they don't have XML-RPC interface (that I know of).

>


--- End Message ---
--- Begin Message ---
At 8:38 PM +0100 4/21/02, Randum Ian wrote:
>Hi there,
>
>I am trying to find a Mailing List Manager on the net that is written in PHP
>that access a database of emails, and other information, in order to manage
>and maintain a list of subscribers.
>

Not to discourage your efforts, but there are an array of free and 
fee-based products written in PHP that handle mailing list. The 
bigger issue seems to be bi-directional distribution list (aka 
listservs), where both the owner and recipients can send mail.

But for pure mailing list management, you could look at the people at 
Octeth http://www.octeth.com, their email manager pro gets high 
ratings.  You could also test, try, and or modify one of the over 50 
mailing list scripts coded in PHP at HotScripts.com.

        http://www.hotscripts.com/PHP/Scripts_and_Programs/Mailing_List_Managers/

Alnisa
-- 
   .........................................
    Alnisa  Allgood
    Executive Director
    Nonprofit Tech
    (ph) 415.337.7412  (fx) 415.337.7927
    (url)  http://www.nonprofit-techworld.org
    (url)  http://www.nonprofit-tech.org
    (url)  http://www.tech-library.org
   .........................................
    Nonprofit Tech E-Update
    mailto:[EMAIL PROTECTED]
   .........................................
    transforming nonprofits through technology
   .........................................
--- End Message ---
--- Begin Message ---
On Sun, 21 Apr 2002, Randum Ian wrote:
> I am trying to find a Mailing List Manager on the net that is written in
> PHP that access a database of emails, and other information, in order to
> manage and maintain a list of subscribers.

I might instead suggest focusing your efforts on making a really nice PHP 
front end for ezmlm. There are things it does that you'll never really be 
able to pull off in PHP, yet it's extremely ugly to configure, and 
therefore could use a hand. I've seen a few front ends for it but none of 
them impressed me all that much.

Creating a robust mailing list manager from scratch is not a trivial
exercise. Doing it in PHP - with one process, hamstrung by
environment-imposed execution time limits, etc., sounds like madness 
unless you're making something very lightweight.

miguel

--- End Message ---
--- Begin Message ---
I have recently been trying to create a class called Database with 
methods inside it to ease my coding with web applications. I've noticed 
though when I create an object from the class like
$x = new Database();
Then try to call the connectDB() method (function we call it in PHP) 
like so

$x->connectDb(bla bla bla bla);
I get the error message that the function cannot be found as if it is 
for some reason looking in the class itself for a function of pg_connect 
when it should be using the PHP libriaries instead. Anybody else run 
into this problem or know a way to fix it.

Thanks
---
Sloan
--- End Message ---
--- Begin Message ---
Okay well I answered my own dumb question on this one the server on 
which I was running these on did not have postgresql support built in 
but now I'm running into another problem. When I try to disconnect from 
the server using pg_close in a method(function) I can't seem to find out 
which link to use because I called the connection with a method also. 
Any ideas?

Below is the code to the class

<?
// Database.class
/* This class will specifiy options and methods you can use to connect 
to a databaseserver and use the methods to pull data connect and insert 
or delete data
*/

class Database
{
   var $connection; 
   
   function Database()
   {
      print ("In Database Constructor<br>");
   } // end Database Constructor
   
   function connectDb($host,$user,$dbname,$pw)
   {
      print ("Starting Database connection...<br>");
      $connection = pg_connect("host=$host user=$user dbname=$dbname 
password=$pw");
      
      return $connection;

   } // end connectDb method
   
   function freeResult($result)
   {
      pg_freeresult($result);
   } // end freeResult method
   
   function disconnectDb($con)
   {
      print ("<br><br>Closing Connection...");
      pg_close($con);
   } // end disconnectDb method
}// end class Database




In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Smileyq) wrote:

> I have recently been trying to create a class called Database with 
> methods inside it to ease my coding with web applications. I've noticed 
> though when I create an object from the class like
> $x = new Database();
> Then try to call the connectDB() method (function we call it in PHP) 
> like so
> 
> $x->connectDb(bla bla bla bla);
> I get the error message that the function cannot be found as if it is 
> for some reason looking in the class itself for a function of pg_connect 
> when it should be using the PHP libriaries instead. Anybody else run 
> into this problem or know a way to fix it.
> 
> Thanks
> ---
> Sloan
--- End Message ---
--- Begin Message ---
Well its going to execute from the class in which you created the object 
thats how OOP works. 


In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Bob) wrote:

> the manual says:the function A will be called.
> in fact, the function B is called.
> why?
> my config : win98/pws2/php411(CGI)
> 
> <?php
> class A
> {
>     function A()
>     {
>         echo "I am the constructor of A.<br>\n";
>     }
> 
>     function B()
>     {
>         echo "I am a regular function named B in class A.<br>\n";
>         echo "I am not a constructor in A.<br>\n";
>     }
> }
> 
> class B extends A
> {
>     function C()
>     {
>         echo "I am a regular function.<br>\n";
>     }
> }
> 
> // This will call B() as a constructor.
> $b = new B;
> ?>
> 
> thaks
--- End Message ---
--- Begin Message ---
yes you can put as many classes as you want inside a file doesn't matter.



In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Gerard Samuel) 
wrote:

> Maybe a simple question.
> But can one file contain 2 or more classes??
> Thanks
>
--- End Message ---
--- Begin Message ---
Hey PHP General List,

  Amm... can anybody point me to some good tutorial that talks about
  SELECT from detabase? what i need is ... like i have table with lots
  of rows.... and i need to output them all to the page... it goes
  like most of news sections in the page... thanks for help.
  (i need to learn more about SELECT'ing things from database)

:------------------------------:
        Have A Nice Day! 
 Mantas Kriauciunas A.k.A mNTKz

Contacts:
[EMAIL PROTECTED]
Http://mntkz-hata.visiems.lt

--- End Message ---
--- Begin Message ---
In brief, and in no way finished (no error trapping, commenting, etc)...

<?
        $db = mysql_connect("localhost", "root");

        mysql_select_db("test",$db);

        $result = mysql_query("SELECT CountryID, CountryName FROM
tblcountries",$db);

        echo "<table border=1>\n";
        echo "  <tr>\n";
        echo "    <td>CatNumber</td>\n";
        echo "    <td>Title</td>\n";
        echo "  </tr>\n";

        while ($myrow = mysql_fetch_row($result))
        {

                echo "<tr>\n";
                echo "  <td>$myrow[0]</td>\n";
                echo "  <td>$myrow[1]</td>\n";
                echo "</tr>\n";

        }

        echo "</table>\n";
?>

hth,

 .ben

> -----Original Message-----
> From: Mantas Kriauciunas [mailto:[EMAIL PROTECTED]]
> Sent: 22 April 2002 01:07
> To: PHP General List
> Subject: [PHP] MySQL question
>
>
> Hey PHP General List,
>
>   Amm... can anybody point me to some good tutorial that talks about
>   SELECT from detabase? what i need is ... like i have table with lots
>   of rows.... and i need to output them all to the page... it goes
>   like most of news sections in the page... thanks for help.
>   (i need to learn more about SELECT'ing things from database)
>
> :------------------------------:
>         Have A Nice Day!
>  Mantas Kriauciunas A.k.A mNTKz
>
> Contacts:
> [EMAIL PROTECTED]
> Http://mntkz-hata.visiems.lt
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
I have a simple count file named count_db that contains ONLY the following:


{
  'total' => 39540000
}


I need to open file, find numbers in the file, add $newnumbers to existing
numbers. Then write these new numbers over the original numbers and close
the file.

Also while I'm doing this a counter script will be reading this file, but
NOT writing to it. Will the file need to be locked while adding $newnumber
to it?

Thanks

Craig ><>
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
I am trying to validate my input with ereg but I get the error "Warning:
REG_BADBR" when I try over 255 characters.  Is there anyway around this?

Works
=====
if(eregi('^[A-Za-z]{1,255}$', "test sentence"))
  echo "valid input";

Doesn't Work
============
if(eregi('^[A-Za-z]{1,256}$', "test sentence"))
  echo "valid input";



--- End Message ---

Reply via email to