php-general Digest 17 Aug 2002 11:24:17 -0000 Issue 1530

Topics (messages 113026 through 113069):

odbc sql php
        113026 by: Saci

Upgraded to PHP 4.2.2 and completely lost all GET and POST variables
        113027 by: james daily
        113028 by: Rasmus Lerdorf
        113029 by: Justin Garrett

Re: ###PLEASE HELP### - delete a line from a text file
        113030 by: Bogdan Stancescu

Re: [PHP-DEV] Trying to input a webpage - need help
        113031 by: Markus Fischer

Replace
        113032 by: Alexander Lindstedt
        113033 by: Bogdan Stancescu
        113034 by: Jason Reid

silly arrays
        113035 by: Pafo

Re: array and a class
        113036 by: Pafo

Re: HTML-based mail with PHP
        113037 by: Manuel Lemos

Re: Moving Files - Stupid Error
        113038 by: Justin French

Re: Protocol on handling empty checkbox values
        113039 by: Justin French
        113054 by: David Yee
        113055 by: Justin French
        113056 by: Jean-Christian Imbeault
        113057 by: Jean-Christian Imbeault
        113067 by: David Yee

Re: secure files acess
        113040 by: Justin French

Re: Bulk Email [solution found!]
        113041 by: Manuel Lemos
        113043 by: Justin French
        113044 by: Manuel Lemos
        113045 by: Jason Wong
        113046 by: Justin French
        113047 by: Justin French
        113052 by: Manuel Lemos
        113062 by: Paul Roberts

Re: question about executing a bash shell script...
        113042 by: Jason Wong

Newbie: Update Multiple Records
        113048 by: Lists
        113050 by: Justin French

Continue processing after redirect?
        113049 by: Jason Morehouse
        113051 by: Jason Morehouse
        113053 by: Rasmus Lerdorf
        113063 by: lallous
        113064 by: Rasmus Lerdorf

Re: Sessions...
        113058 by: Tom Rogers

Re: session lost when back button hit?
        113059 by: Jean-Christian Imbeault
        113061 by: Justin French

Re: sessions: what to do when browser won't accept cookies?
        113060 by: Jean-Christian Imbeault

Problem about rpm package of php
        113065 by: EdwardSPL.ita.org.mo
        113066 by: Jason Wong
        113068 by: EdwardSPL.ita.org.mo

hyperlink parser
        113069 by: Roman

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 ---
This question is more on odbc sql than on php, since I'm sure everthing is
working on php side

I have a php form who fills on ODBC database ( Visual Foxpro) , everthing is
working except with one detail, I have a text area field on  my form and
when the user fill this area with to many characters the sql query  isn't
accepted, I found that the problem is due to the length of the data.

The field is a memo field who means they can accept any length,

This works ok
UPDATE catalogo SET MATERIAL = 'A12' WHERE KEYUNICA = 3941

But this crash

UPDATE catalogo SET MATERIAL =
'A123456789B123456789C123456789D123456789E123456789F123456789G123456789H1234
56789I123456789J123456789K123456789L123456789M123456789N123456789O123456789P
123456789q123456789r123456789s123456789t123456789u123456789v123456789x123456
789y123456789z123456789a123456789b123456789' WHERE KEYUNICA = 3941


The question is How is the write way to write a query when I need to updated
a field of type memo  with information from a Textarea or even any big array
of letters ?

Any tip ?



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

RE: phpsecurityadmin-2002-07-24.zip and PHP 4.2.2

PLATFORM: win 98

BACKGROUND: in order to use the above classes i had to
upgrade to PHP 4.2.2

PROBLEM: when i upgraded to 4.2.2, all my old scripts
lost the GET or POST info being passed.

COMMENTS: everything except the phpsecurityadmin classes
worked as expected under PHP 4.0.

after upgrade, phpsecurityadmin classes work but any old
scripts that are accepting data from previous page via
GET or POST do not.

i can manually parse the GET query string, but this is foolish
and time consuming.

it's as if the automatic variables are not getting assigned
the data being passed.

QUESTION: has anybody else run across this and
what was the resolution?

---------------------------------------------
James Daily
Phone : 816 943 9891
Email : [EMAIL PROTECTED] (or hit reply button)
Web   : http://tellmama.com/
Philosophy:
                            4     2                              1000
( cos(ø - r) - sin ø ) * ( r  - 2r  cos(2ø + 2.4) + 0.9) + 0.62r)     < 0

Education is a progressive discovery of our own ignorance.
                                               Will Durant

--- End Message ---
--- Begin Message ---
Did you bother reading the documentation and release notes before
upgrading?

Edit your php.ini file and turn register_globals on.

-Rasmus

On Fri, 16 Aug 2002, james daily wrote:

>
> RE: phpsecurityadmin-2002-07-24.zip and PHP 4.2.2
>
> PLATFORM: win 98
>
> BACKGROUND: in order to use the above classes i had to
> upgrade to PHP 4.2.2
>
> PROBLEM: when i upgraded to 4.2.2, all my old scripts
> lost the GET or POST info being passed.
>
> COMMENTS: everything except the phpsecurityadmin classes
> worked as expected under PHP 4.0.
>
> after upgrade, phpsecurityadmin classes work but any old
> scripts that are accepting data from previous page via
> GET or POST do not.
>
> i can manually parse the GET query string, but this is foolish
> and time consuming.
>
> it's as if the automatic variables are not getting assigned
> the data being passed.
>
> QUESTION: has anybody else run across this and
> what was the resolution?
>
> ---------------------------------------------
> James Daily
> Phone : 816 943 9891
> Email : [EMAIL PROTECTED] (or hit reply button)
> Web   : http://tellmama.com/
> Philosophy:
>                             4     2                              1000
> ( cos(ø - r) - sin ø ) * ( r  - 2r  cos(2ø + 2.4) + 0.9) + 0.62r)     < 0
>
> Education is a progressive discovery of our own ignorance.
>                                                Will Durant
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
http://www.php.net/ChangeLog-4.php

As of version 4.2 register_globals defaults to off.  You can turn it on in
your php.ini file, but it is recommended to use the new super global arrays
instead.

Justin

"James Daily" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> RE: phpsecurityadmin-2002-07-24.zip and PHP 4.2.2
>
> PLATFORM: win 98
>
> BACKGROUND: in order to use the above classes i had to
> upgrade to PHP 4.2.2
>
> PROBLEM: when i upgraded to 4.2.2, all my old scripts
> lost the GET or POST info being passed.
>
> COMMENTS: everything except the phpsecurityadmin classes
> worked as expected under PHP 4.0.
>
> after upgrade, phpsecurityadmin classes work but any old
> scripts that are accepting data from previous page via
> GET or POST do not.
>
> i can manually parse the GET query string, but this is foolish
> and time consuming.
>
> it's as if the automatic variables are not getting assigned
> the data being passed.
>
> QUESTION: has anybody else run across this and
> what was the resolution?
>
> ---------------------------------------------
> James Daily
> Phone : 816 943 9891
> Email : [EMAIL PROTECTED] (or hit reply button)
> Web   : http://tellmama.com/
> Philosophy:
>                             4     2                              1000
> ( cos(ø - r) - sin ø ) * ( r  - 2r  cos(2ø + 2.4) + 0.9) + 0.62r)     < 0
>
> Education is a progressive discovery of our own ignorance.
>                                                Will Durant
>


--- End Message ---
--- Begin Message ---
Hi Nick!

First off, *please* read a netiquette guide before posting -- I hate 
seeing a conational of mine posting a message like yours ("###PLEASE 
HELP###" and "I am waiting for an answer" are extremely rude - you're 
not paying for support on this mailing list, so you can't demand 
anything). Other than that, I'd point out cleaning up your code before 
posting because we don't have to read through your "slickiness" -- but 
that may be a matter of personal opinion.

Your problem resides exactly in your code's slickiness - which 
incidentally doesn't make it any faster. Try this conventional code instead:

function delete_user($sterge_user, $path) {
   [1]
   $fisierul=$orig=file($path);
   for($i=0;$i<sizeOf($fisierul);$i++) {
     list($uname,,,,)=explode(":",$fisierul[$i]);
     if ($uname==$sterge_user) {
       $fisierul=array_splice($fisierul,$i,1);
       $i--;
     }
   }
   if ($fisierul!=$orig) {
     [...]
   }
   [2]
}

[...] contains the trivial task of imploding $fisierul (using "\r\n" or 
"\n", depending on the OS) and writing it. Make sure you check for and 
create a lock file at [1] and respectively unlink it at [2] -- or simply 
use a database instead, for that matter.

Anyway, just in case you *really* want to use your original code, the 
problem is that the code (probably) finds the line to delete but doesn't 
go any further than that - plus it's consuming unnecessary resources by 
rewriting the file line by line.

Bogdan

Radio X wrote:
> i have a text file with some of this elements:
>  
> name:adress:telephone:email:password
> 
> i want to delete this line using for identifier the 'name' only.
> 
> // $sterge_user="name"; this is the value sent by form witch will be the identifier
> // $path="some_of_my_files"; the file used here allready set with 777 chmod
> 
> function delete_user($sterge_user, $path){
> $i = 0;
>     $fisierul = file($path);
>     $fp = fopen($path, "w");
>     while (!sizeof($fisierul))
>      {
>         $data = fgetcsv ($fisierul, 4096, ":");
>              if ($data[0]==$sterge_user)
>     {
>    for ($i=0; $i<=sizeof($data);){$data[i]="";++$i;}
>     }
>      fwrite($fp, $data);
>   }
>     fclose($fp);
> }
> 
> I am waiting for an answer, please
> 
> Nick
> 


--- End Message ---
--- Begin Message ---
On Fri, Aug 16, 2002 at 08:02:17PM -0400, Ken Meyer wrote : 
> I am trying to write a script that will read a page from
> another website. So long at the page is accessed via a "GET",
> this is no problem; I just need to open the page using fopen,
> readfile or file_get_contents. The problem is that I need to
> access a page that requires a "POST". Any suggestions as to how
> I could do this?

    You can either use the curl extension (see manual) or
    "Snoopy" (see sourceforge), a browser client class.

    - Markus

ps: php-general@ is the right list to post such questions.
-- 
GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc
"Finally, if someone actually flying a plane is relying on
a freakin' webcam to land, we're all in trouble."
- A /. poster.
--- End Message ---
--- Begin Message ---
If i want to find just a word in a variable, and then replace just that
specific word... is there any simple way to do this?


--- End Message ---
--- Begin Message ---
Have you tried searching string functions on http://www.php.net ?

Bogdan

Alexander Lindstedt wrote:
> If i want to find just a word in a variable, and then replace just that
> specific word... is there any simple way to do this?
> 
> 

--- End Message ---
--- Begin Message ---
str_replace is your friend in this situation

Jason Reid
[EMAIL PROTECTED]
--
AC Host Canada
www.achost.ca

----- Original Message ----- 
From: "Alexander Lindstedt" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, August 16, 2002 6:05 PM
Subject: [PHP] Replace


> If i want to find just a word in a variable, and then replace just that
> specific word... is there any simple way to do this?
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


--- End Message ---
--- Begin Message ---
i got a php-script like this, just to make sure that it works before i try
to implement it:
<html>
<head>
<title>debug</title>
</head>
<body>
'***************************************' OUTPUT
'**************************************'<br><br>
<?php

class Relic {

  var $RelicName = Array();
  var $RelicType = Array();
  var $RelicRealm = Array();
  var $RelicOwner = Array();
  var $i;

 function PrintInfo() {
   for ($this->i = 0; $this->i < count($this->RelicName); $this->i++) {
   print "$this->RelicName[$this->i]  :  $this->RelicType[$this->i]  :
$this->RelicRealm[$this->i]  :  $this->RelicOwner[$this->i]<br>";
   }
 }

 function SetName($name) {
     $this->RelicName[] = $name;
 }

 function SetType($type) {
   $this->RelicType[] = $type;
 }

 function SetRealm($realm) {
   $this->RelicRealm[] = $realm;
 }

 function SetRelicOwner($owner) {
   $this->RelicOwner[] = $owner;
 }

}

$temp = new Relic();
$temp->SetName("olle");
$temp->SetType("melee");
$temp->SetRealm("Hibernia");
$temp->SetRelicOwner("Albion");
$temp->SetName("bertil");
$temp->SetType("melee");
$temp->SetRealm("Albion");
$temp->SetRelicOwner("Hibernia");
$temp->SetName("sture");
$temp->SetType("magic");
$temp->SetRealm("Midgard");
$temp->SetRelicOwner("Midgard");
$temp->PrintInfo();
?>

</body>
</html>

the function PrintInfo prints out this:
'***************************************' OUTPUT
'**************************************'

Array[0] : Array[0] : Array[0] : Array[0]
Array[1] : Array[1] : Array[1] : Array[1]
Array[2] : Array[2] : Array[2] : Array[2]

heh,, not exacly what i wanted  :/

regards
patrick


--- End Message ---
--- Begin Message ---
solved it  thx anyway
"Pafo" <[EMAIL PROTECTED]> skrev i meddelandet
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> i got my nice looking class like this:
> <?php
>
> class Relic {
>   var $RelicName;
>   var $RelicType;
>   var $RelicRealm;
>   var $RelicOwner;
>
>  function PrintInfo() {
>    print "$this->RelicName  :  $this->RelicType  :  $this->RelicRealm  :
> $this->RelicOwner<br>";
>  }
>
>  function CheckForPrint() {
>    if ($this->RelicName == "" || $this->RelicType == "" ||
$this->RelicRealm
> == "" || $this->RelicOwner == "") {
>    return false;
>    } else {
>    return true;
>    }
>  }
>
>  function Clean() {
>    $this->RelicName = "";
>    $this->RelicType = "";
>    $this->RelicRealm = "";
>    $this->RelicOwner = "";
>  }
>
>  function SetName($name) {
>      $this->RelicName = $name;
>  }
>
>  function SetType($type) {
>    $this->RelicType = $type;
>  }
>
>  function SetRealm($realm) {
>    $this->RelicRealm = $realm;
>  }
>
>  function SetOwner($owner) {
>    $this->RelicOwner = $owner;
>  }
>
>  function DebugPrint() {
>    print $this->RelicName;
>  }
> }
>
> $temp = new Relic();
> $temp->SetName("test");
> $temp->DebugPrint();
> ?>
>
> but the thing is i want an array that is based on my class, so i want to
use
> $relicarray[1]->DebugPrint();
> how does it work,, anyone that can give me a working example, cause i cant
> find any  :/
>
> regards
> patrick
>
>


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

On 08/16/2002 12:54 PM, Liam Gibbs wrote:
> I'm having trouble with some HTML-based mail with PHP.
> It's not the regular thing where I can't get it to use
> the tags instead of just printing them. That part's
> fine; it comes out HTML-based.
> 
> My problem is the way it's not accessing a certain
> image. I get a broken link instead of an image at the
> top of my e-mail. I had it print the URL at which it
> should find the image, and then cut and paste that in
> my browser, and the image comes up fine. But, as far
> as putting it in the e-mail, it's not working out.

Unless you put absolute URLs for the image tags, you will need to embed 
the image files in the message. That is done with multipart/related 
messages.

Here you may find a ready to use PHP component that solves that problem 
in a half-dozen lines:

http://www.phpclasses.org/mimemessage


-- 

Regards,
Manuel Lemos

--- End Message ---
--- Begin Message ---
The function move_uploaded_file() is what you want, not copy().

http://php.net/move_uploaded_file


Of course, there are full working examples in the manual, found doing a
simple whole-site search on "file upload".

http://www.php.net/manual/en/features.file-upload.php


Justin French



on 17/08/02 2:53 AM, Steve Keller ([EMAIL PROTECTED]) wrote:

> ack to the tmp directory to look for the file. Here's a
> sample error:
> 
> Warning: Unable to create '/test/data/test.txt': No such file or directory
> in /usr/local/www/vhosts/healthtvchannel.org/htdocs/test/upload.php on line 17
> 
> That's with using:
> 
> copy("{$UploadedFile}","/test/data/".$UploadedFile_name);
> 
> $UploadedFile being the name I'm using. Both variables seem to be returning
> correctly. $UploadedFile returns the temp name, and $UploadedFile_name
> returns the actual name. The file is also far under the maximum file size.
> The /test/data has Nobody write permissions, I know because I'm writing to
> a file in it with another script, and there's no file in there with the
> same file name to cause overwriting ownership conflicts.

--- End Message ---
--- Begin Message ---
I'd use an array on some way, but the other option is to see if the var is
set, else set it to N

if(isset($_POST['my_checkbox_var'])) {
    $_POST['my_checkbox_var'] = 'N';
}


Probably what I'd do is create an array for the possible checkbox values,
then USE THAT ARRAY to build the form.  Then I can re-use the array on the
validation script, checking that each element isset()... if they aren't, set
them to 'N'.


To throw in a curve-ball, you can set the default value for your MySQL
column to 'N', which means that any value you DON'T write will be 'N', and
those you do will be 'Y'.


Justin French





on 17/08/02 4:24 AM, David Yee ([EMAIL PROTECTED]) wrote:

> Hi all.  For a universal form script I'm writing I want to store a 'Y' in a
> table field if a checkbox is checked and an 'N' if it's not.  The problem is
> that when the form is posted if the checkbox is not checked the checkbox
> variable is not passed.  E.g.
> 
> <form method=POST action=submit.php>
> <input type=checkbox name=my_checkbox_var value=Y>
> </form>
> 
> If the checkbox is checked, I get $_POST['my_checkbox_var'] == 'Y', but if
> not $_POST['my_checkbox_var'] is not even set.  So what I've been doing is
> putting the variable names of the checkbox fields into an array, serializing
> it, and then pass the string as a hidden input on the form.  Then in the
> page that handles the POST I unserialize the array to determine if checkbox
> fields were passed and then handle accordingly.  But I'm wondering is there
> a better way (or at least a standard way) of doing this?
> 
> David
> 

--- End Message ---
--- Begin Message ---
> I'd use an array on some way, but the other option is to see if the var is
> set, else set it to N
>
> if(isset($_POST['my_checkbox_var'])) {
>     $_POST['my_checkbox_var'] = 'N';
> }
>
>
> Probably what I'd do is create an array for the possible checkbox values,
> then USE THAT ARRAY to build the form.  Then I can re-use the array on the
> validation script, checking that each element isset()... if they aren't,
set
> them to 'N'.

Yes that's what I was doing- because the form has other elements other than
checkboxes I have to distinguish between the checkboxes and the others and
hence a separate array for checkboxes.

> To throw in a curve-ball, you can set the default value for your MySQL
> column to 'N', which means that any value you DON'T write will be 'N', and
> those you do will be 'Y'.

Great idea!  Actually after I posted the question I thought of the same
thing :-).  This is probably the most elegant way.  I am curious though why
PHP doesn't just create the variable anyways and just assign it a null value
if the box is not checked.

David

--- End Message ---
--- Begin Message ---
on 17/08/02 3:19 PM, David Yee ([EMAIL PROTECTED]) wrote:

> Great idea!  Actually after I posted the question I thought of the same
> thing :-).  This is probably the most elegant way.  I am curious though why
> PHP doesn't just create the variable anyways and just assign it a null value
> if the box is not checked.

It's not PHP's fault -- it's the CGI/POST specs.  The browser is not sending
it through, because that's what it was told to do :)

Justin French

--- End Message ---
--- Begin Message ---
Dear David you haev just hijacked my thread. When you want to post a 
message please do not just hit the reply button and just change the 
Subject line. If you do that you message will appear in someone else's 
message thread.

It really ruins it for people who use mail/news readers with threads 
enabled and worse, you might not get any answers to your question since 
it might get lost deeps in a totally unrelated mesage thread.

Just a friendly reminder on netiquette. Please don't do it again.

Jc

David Yee wrote:
> Hi all.  For a universal form script I'm writing I want to store a 'Y' in a
> table field if a checkbox is checked and an 'N' if it's not.  The problem is
> that when the form is posted if the checkbox is not checked the checkbox
> variable is not passed.  E.g.
> 
> <form method=POST action=submit.php>
> <input type=checkbox name=my_checkbox_var value=Y>
> </form>
> 
> If the checkbox is checked, I get $_POST['my_checkbox_var'] == 'Y', but if
> not $_POST['my_checkbox_var'] is not even set.  So what I've been doing is
> putting the variable names of the checkbox fields into an array, serializing
> it, and then pass the string as a hidden input on the form.  Then in the
> page that handles the POST I unserialize the array to determine if checkbox
> fields were passed and then handle accordingly.  But I'm wondering is there
> a better way (or at least a standard way) of doing this?
> 
> David
> 

--- End Message ---
--- Begin Message ---
Dear David you haev just hijacked my thread. When you want to post a 
message please do not just hit the reply button and just change the 
Subject line. If you do that you message will appear in someone else's 
message thread.

It really ruins it for people who use mail/news readers with threads 
enabled and worse, you might not get any answers to your question since 
it might get lost deeps in a totally unrelated mesage thread.

Just a friendly reminder on netiquette. Please don't do it again.

Jc

David Yee wrote:
> Hi all.  For a universal form script I'm writing I want to store a 'Y' in a
> table field if a checkbox is checked and an 'N' if it's not.  The problem is
> that when the form is posted if the checkbox is not checked the checkbox
> variable is not passed.  E.g.
> 
> <form method=POST action=submit.php>
> <input type=checkbox name=my_checkbox_var value=Y>
> </form>
> 
> If the checkbox is checked, I get $_POST['my_checkbox_var'] == 'Y', but if
> not $_POST['my_checkbox_var'] is not even set.  So what I've been doing is
> putting the variable names of the checkbox fields into an array, serializing
> it, and then pass the string as a hidden input on the form.  Then in the
> page that handles the POST I unserialize the array to determine if checkbox
> fields were passed and then handle accordingly.  But I'm wondering is there
> a better way (or at least a standard way) of doing this?
> 
> David
> 


--- End Message ---
--- Begin Message ---
> It's not PHP's fault -- it's the CGI/POST specs.  The browser is not
sending
> it through, because that's what it was told to do :)
>


Ah- got it.  That would make sense since it's the browser that's send the
form data to the server, and if it doesn't chose to....  I wonder why the
CGI/POST specs are like that- there's probably a good reason?

David

--- End Message ---
--- Begin Message ---
Pass the file through a PHP script, using header() to set the mime-type,
then passing the file through.

Pretty sure there's examples (and documentation of the problems with IE)in
the manual:

php.net/header


Justin French


on 17/08/02 6:36 AM, David Buerer ([EMAIL PROTECTED]) wrote:

> I have a bunch of files which need to be kept secure. I need to allow a user
> access to them them based on a criteria which I can programmatically
> determine.
> 
> My question, is how can I allow the user to download or view only one file
> on my computer without allowthem to just enter the URL into their browser of
> the file and view it?
> 

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

On 08/16/2002 05:37 PM, Daren Cotter wrote:
> First, a recap of my problem:
> 
> I need to send personalized emails to my member list
> on a daily basis. I use PHP to query the MySQL
> database, and loop through the results using the
> mail() function. Problem: very slow, browser/php times
> out, etc.
> 
> Solution:
> 
> First, I configure sendmail to use "queueonly" as the
> DeliveryMethod (see sendmail.cf) instead of
> "background". Then, when my PHP script runs, mailings
> simply get queued instead of actually delivered. This
> is a x10 speed increase. My script queues
> approximately 1,000 mailings per minute (a x10 speed
> increase). Then, I modified the
> /etc/rc.d/init.d/sendmail script to process the queue
> every 5 minutes, instead of the default one hour. This
> insures that the mailings actually get sent soon after
> they're queued, and you won't have to wait for
> important emails to come through.

As I mentioned before this solution is set for disaster as you grow into 
larger number of recipients. The problem is that queuing separate 
messages for each recipient will fill up your disk. But that is not all. 
The eventual message bounces that you will get will only aggravate your 
problem. If you can live without personalization, don't think twice, 
forget it. If you have doubts, think again.



> The problem with the above solution used to be this:
> certain emails generated from my site (welcome emails,
> password lookup emails, etc) need to be sent
> IMMEDIATELY, and cannot wait in the queue for 5
> minutes. The solution for this: not using the built-in
> mail() command in PHP. I created my own mail script
> (by modifying something someone else already did)
> which opens a socket directly with the mail server.
> Code is below.
> 
> // Sends the email directly to the mail server using
> SMTP. This is done
> // so sendmail can be setup using the queue method on
> the server, and
> // confirmation emails, etc, can be sent immediately
> to the member.
> function smtp_mail($to, $from_name, $from_email,
> $reply_to_email, $subject, $body) {
>       $smtp = fsockopen("your_mail_server_here", 25);

I am not sure that sending to the local mailer queue via SMTP would be 
any better than using sendmail itself to put the message there. Anyway, 
I am afraid that the message will still wait for sendmail to process it


>       if ($smtp == 0)
>               return 0;
>       fputs($smtp,"helo
> machines_host_and_domain_name_here\r\n");
>               $line = fgets($smtp, 1024);
>       fputs($smtp,"mail from: $from_email\r\n");
>               $line = fgets($smtp, 1024);
>       fputs($smtp,"rcpt to: $to\r\n");
>               $line = fgets($smtp, 1024);
>       fputs($smtp,"data\r\n");
>               $line = fgets($smtp, 1024);
>       fputs($smtp,"From: $from_name <$from_email>\r\n");
>       fputs($smtp,"Reply-To: $reply_to_email\r\n");
>       fputs($smtp,"To: $to\r\n");
>       fputs($smtp,"Subject: $subject\r\n");
>       fputs($smtp,"\r\n");
>       fputs($smtp,"$body\r\n");
>       fputs($smtp,".\r\n");
>               $line = fgets($smtp, 1024);
>       fputs($smtp, "QUIT\r\n");
>       fclose($smtp);
>       return 1;
> }

I am afraid this code needs a lot of work or else it will choke on some 
servers due to multi-line responses, maybe not on the actual sendmail 
version and configuration you are using, but definetely on some SMTP 
servers.


-- 

Regards,
Manuel Lemos

--- End Message ---
--- Begin Message ---
I wouldn't call this a real solution, since it relies heavily on specific
server requirements and config changes.  Simple fact is that a LOT of PHP
programmers are on shared servers, and their hosts would NOT want 50,000
emails queued up on disk.  No way!!

I'd expect doing this frequently on a shared server would be the fastest way
to get your account shut down.

Justin French



on 17/08/02 6:37 AM, Daren Cotter ([EMAIL PROTECTED]) wrote:

> I have found a solution to my bulk email problem. I'm
> posting my solution simply because I spent nearly a
> year finding it, and I KNOW there's many other people
> in my same situation.
> 
> First, a recap of my problem:
> 
> I need to send personalized emails to my member list
> on a daily basis. I use PHP to query the MySQL
> database, and loop through the results using the
> mail() function. Problem: very slow, browser/php times
> out, etc.
> 
> Solution:
> 
> First, I configure sendmail to use "queueonly" as the
> DeliveryMethod (see sendmail.cf) instead of
> "background". Then, when my PHP script runs, mailings
> simply get queued instead of actually delivered. This
> is a x10 speed increase. My script queues
> approximately 1,000 mailings per minute (a x10 speed
> increase). Then, I modified the
> /etc/rc.d/init.d/sendmail script to process the queue
> every 5 minutes, instead of the default one hour. This
> insures that the mailings actually get sent soon after
> they're queued, and you won't have to wait for
> important emails to come through.
> 
> The problem with the above solution used to be this:
> certain emails generated from my site (welcome emails,
> password lookup emails, etc) need to be sent
> IMMEDIATELY, and cannot wait in the queue for 5
> minutes. The solution for this: not using the built-in
> mail() command in PHP. I created my own mail script
> (by modifying something someone else already did)
> which opens a socket directly with the mail server.
> Code is below.
> 
> // Sends the email directly to the mail server using
> SMTP. This is done
> // so sendmail can be setup using the queue method on
> the server, and
> // confirmation emails, etc, can be sent immediately
> to the member.
> function smtp_mail($to, $from_name, $from_email,
> $reply_to_email, $subject, $body) {
> $smtp = fsockopen("your_mail_server_here", 25);
> if ($smtp == 0)
> return 0;
> fputs($smtp,"helo
> machines_host_and_domain_name_here\r\n");
> $line = fgets($smtp, 1024);
> fputs($smtp,"mail from: $from_email\r\n");
> $line = fgets($smtp, 1024);
> fputs($smtp,"rcpt to: $to\r\n");
> $line = fgets($smtp, 1024);
> fputs($smtp,"data\r\n");
> $line = fgets($smtp, 1024);
> fputs($smtp,"From: $from_name <$from_email>\r\n");
> fputs($smtp,"Reply-To: $reply_to_email\r\n");
> fputs($smtp,"To: $to\r\n");
> fputs($smtp,"Subject: $subject\r\n");
> fputs($smtp,"\r\n");
> fputs($smtp,"$body\r\n");
> fputs($smtp,".\r\n");
> $line = fgets($smtp, 1024);
> fputs($smtp, "QUIT\r\n");
> fclose($smtp);
> return 1;
> }
> 
> Function is called as follows:
> 
> if (!smtp_mail("recipient_email_here",
> $EMAIL_FROM_NAME, $EMAIL_FROM_EMAIL,
> $EMAIL_FROM_REPLY_TO, $SIGNUP_VALIDATION_SUBJECT,
> "Test Body")) {
> print "error: mail not sent";
> } else {
> print "it worked!";
> }
> 
> Hope this helps others!
> 
> __________________________________________________
> Do You Yahoo!?
> HotJobs - Search Thousands of New Jobs
> http://www.hotjobs.com

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

On 08/16/2002 10:45 PM, Justin French wrote:
> I wouldn't call this a real solution, since it relies heavily on specific
> server requirements and config changes.  Simple fact is that a LOT of PHP
> programmers are on shared servers, and their hosts would NOT want 50,000
> emails queued up on disk.  No way!!
> 
> I'd expect doing this frequently on a shared server would be the fastest way
> to get your account shut down.

Yes, very true. Actually on shared servers, most ISP would not allow you 
  to send messages to that many recipients even if you use just send one 
message in Bcc for all because in the end it will consume much bandwidth.

Some people think that working around the problem by sending just to a 
few hundred at a time will solve the problem, but they are just fooling 
themselves because it will still consume the same, if not more, bandwidth.

Another problem why shared server hosting companies forbid bulk-mailing 
is that they can't be sure if what people is sending is really solicited 
e-mail, even if you sware that it is. There is always the risk of having 
their IP ranges blacklisted by anti-spammers and they do not want to 
deal with that.

Many people are resorting to ADSL/cable lines for bulk-mail (solicited 
or not). Because of that, many ISP have included the IPs of those 
connection in the Dial-Up List which is basically used by many mail 
server administrators to refuse messages as they may be from hit-and-run 
spammers.

If you are really sending solicited e-mail, eitheir you use a server 
that you absolutely control or hire e-mail delivery hosting services 
that are meant for that purpose, despit they currently are not very cheap.

Regards,
Manuel Lemos

> on 17/08/02 6:37 AM, Daren Cotter ([EMAIL PROTECTED]) wrote:
> 
> 
>>I have found a solution to my bulk email problem. I'm
>>posting my solution simply because I spent nearly a
>>year finding it, and I KNOW there's many other people
>>in my same situation.
>>
>>First, a recap of my problem:
>>
>>I need to send personalized emails to my member list
>>on a daily basis. I use PHP to query the MySQL
>>database, and loop through the results using the
>>mail() function. Problem: very slow, browser/php times
>>out, etc.
>>
>>Solution:
>>
>>First, I configure sendmail to use "queueonly" as the
>>DeliveryMethod (see sendmail.cf) instead of
>>"background". Then, when my PHP script runs, mailings
>>simply get queued instead of actually delivered. This
>>is a x10 speed increase. My script queues
>>approximately 1,000 mailings per minute (a x10 speed
>>increase). Then, I modified the
>>/etc/rc.d/init.d/sendmail script to process the queue
>>every 5 minutes, instead of the default one hour. This
>>insures that the mailings actually get sent soon after
>>they're queued, and you won't have to wait for
>>important emails to come through.
>>
>>The problem with the above solution used to be this:
>>certain emails generated from my site (welcome emails,
>>password lookup emails, etc) need to be sent
>>IMMEDIATELY, and cannot wait in the queue for 5
>>minutes. The solution for this: not using the built-in
>>mail() command in PHP. I created my own mail script
>>(by modifying something someone else already did)
>>which opens a socket directly with the mail server.
>>Code is below.
>>
>>// Sends the email directly to the mail server using
>>SMTP. This is done
>>// so sendmail can be setup using the queue method on
>>the server, and
>>// confirmation emails, etc, can be sent immediately
>>to the member.
>>function smtp_mail($to, $from_name, $from_email,
>>$reply_to_email, $subject, $body) {
>>$smtp = fsockopen("your_mail_server_here", 25);
>>if ($smtp == 0)
>>return 0;
>>fputs($smtp,"helo
>>machines_host_and_domain_name_here\r\n");
>>$line = fgets($smtp, 1024);
>>fputs($smtp,"mail from: $from_email\r\n");
>>$line = fgets($smtp, 1024);
>>fputs($smtp,"rcpt to: $to\r\n");
>>$line = fgets($smtp, 1024);
>>fputs($smtp,"data\r\n");
>>$line = fgets($smtp, 1024);
>>fputs($smtp,"From: $from_name <$from_email>\r\n");
>>fputs($smtp,"Reply-To: $reply_to_email\r\n");
>>fputs($smtp,"To: $to\r\n");
>>fputs($smtp,"Subject: $subject\r\n");
>>fputs($smtp,"\r\n");
>>fputs($smtp,"$body\r\n");
>>fputs($smtp,".\r\n");
>>$line = fgets($smtp, 1024);
>>fputs($smtp, "QUIT\r\n");
>>fclose($smtp);
>>return 1;
>>}
>>
>>Function is called as follows:
>>
>>if (!smtp_mail("recipient_email_here",
>>$EMAIL_FROM_NAME, $EMAIL_FROM_EMAIL,
>>$EMAIL_FROM_REPLY_TO, $SIGNUP_VALIDATION_SUBJECT,
>>"Test Body")) {
>>print "error: mail not sent";
>>} else {
>>print "it worked!";
>>}
>>
>>Hope this helps others!
>>
>>__________________________________________________
>>Do You Yahoo!?
>>HotJobs - Search Thousands of New Jobs
>>http://www.hotjobs.com
> 
> 



-- 

Regards,
Manuel Lemos

--- End Message ---
--- Begin Message ---
On Saturday 17 August 2002 09:45, Justin French wrote:
> I wouldn't call this a real solution, since it relies heavily on specific
> server requirements and config changes. 

It's a bit harsh to say it's not a real solution just because it relies on 
some specifics. There's no harm in taking advantage of your situation and use 
whatever resources you can to complete your job.

I run a qmail server. When I send out newsletters, I run a query and extract 
the mailing addresses I need. Then I build a .qmail file (similar to 
sendmail's alias file), and finally I send mail to that .qmail (alias). The 
mail is queued once and all recipients listed in the .qmail file gets a copy. 
It is a solution that works for me so don't tell me that that is a virtual 
solution :)

The fact is that a solution that relies solely on PHP would probably be too 
slow, unreliable and messy.

> Simple fact is that a LOT of PHP
> programmers are on shared servers, and their hosts would NOT want 50,000
> emails queued up on disk.  No way!!

But you would have 50,000 mails going out anyway regardless of what solution 
you come up with. You mentioned sparklist in previous posts. Assuming that 
they allow customised mailings, how would you get 50,000 pieces of info to 
them so that they can perform the mailing?

> I'd expect doing this frequently on a shared server would be the fastest
> way to get your account shut down.

I would recommend getting a dedicated server. They start from USD100/month and 
can easily cope with 10-20 sites so cost per site is only $5-10. Of course 
that opens another can of worms because you would have to deal with server 
administration etc.

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

/*
There's something different about us -- different from people of Europe,
Africa, Asia ... a deep and abiding belief in the Easter Bunny.
                -- G. Gordon Liddy
*/

--- End Message ---
--- Begin Message ---
on 17/08/02 12:08 PM, Daren Cotter ([EMAIL PROTECTED]) wrote:

> I highly doubt there are very many websites that need
> to send 50,000+ emails daily that are still existing
> on shared servers.

The problem would still likely be there for mailing lists of 2000 people.  I
just don't want people to see your post and think "woo-hoo", I've found the
answer to all my problems!!

This is *a* solution, but not the best for the majority of developers.


Justin French




> In any case, no, this is not a solution for people
> like that. The first step they need to take is a
> dedicated server.
> 
> I posted my comments because after a very long time of
> research, I have found no better way of doing what I'm
> doing.

--- End Message ---
--- Begin Message ---
on 17/08/02 12:22 PM, Jason Wong ([EMAIL PROTECTED]) wrote:

> It's a bit harsh to say it's not a real solution just because it relies on
> some specifics. There's no harm in taking advantage of your situation and use
> whatever resources you can to complete your job.

True.  Point taken :)


> I run a qmail server. When I send out newsletters, I run a query and extract
> the mailing addresses I need. Then I build a .qmail file (similar to
> sendmail's alias file), and finally I send mail to that .qmail (alias). The
> mail is queued once and all recipients listed in the .qmail file gets a copy.
> It is a solution that works for me so don't tell me that that is a virtual
> solution :)

nice!!

> The fact is that a solution that relies solely on PHP would probably be too
> slow, unreliable and messy.

True.


>> Simple fact is that a LOT of PHP
>> programmers are on shared servers, and their hosts would NOT want 50,000
>> emails queued up on disk.  No way!!
> 
> But you would have 50,000 mails going out anyway regardless of what solution
> you come up with. You mentioned sparklist in previous posts. Assuming that
> they allow customised mailings, how would you get 50,000 pieces of info to
> them so that they can perform the mailing?

The difference with sparklist over running something on a shared host is
that Sparklist is a dedicated mailinglist company, so their servers are
geared up for this one task.  The problem with aiming to achieve this is on
a shared server with 100-200 other websites is that the server is geared
towards hosting sites, not bulk mail.

Given a dedicated server, all is well, but my *guess* is that many of the
developers on here are on shared servers (at least those in the
newbie-beginner-intermediate levels).

I haven't looked into sparklist too heavily... US$50/month is a little
steep.  Their minimum per month is 50,000 emails, and i'm likely to only
send 1000-2000, but they do offer customised emails.


>> I'd expect doing this frequently on a shared server would be the fastest
>> way to get your account shut down.
> 
> I would recommend getting a dedicated server. They start from USD100/month and
> can easily cope with 10-20 sites so cost per site is only $5-10. Of course
> that opens another can of worms because you would have to deal with server
> administration etc.


This will be something i look into over the next year.  I have about 15
sites hosted on a reseller account... it'd be nice to move them into my own
server when the $'s add up... (haven't seen much in the way of dedicated
servers for under US$300 though...).


Justin French


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

On 08/16/2002 11:22 PM, Jason Wong wrote:
> I run a qmail server. When I send out newsletters, I run a query and extract 
> the mailing addresses I need. Then I build a .qmail file (similar to 
> sendmail's alias file), and finally I send mail to that .qmail (alias). The 
> mail is queued once and all recipients listed in the .qmail file gets a copy. 
> It is a solution that works for me so don't tell me that that is a virtual 
> solution :)
> 
> The fact is that a solution that relies solely on PHP would probably be too 
> slow, unreliable and messy.

I also use qmail but I don't use any .qmail file. I just use 
qmail-inject puting all receipients in BCC. It always takes less than 3 
seconds. What really takes some time is the extraction of addresses from 
a SQL database.


-- 

Regards,
Manuel Lemos

--- End Message ---
--- Begin Message ---
i tried it using the 5th parameter with -odd and the mail got qued but i also need to 
set [EMAIL PROTECTED] (so i get those bounces) but i got <[EMAIL PROTECTED] -odd> for the 
return path in the email. 

i then tried it with the -odd first and it qued the mail but didn't set the return 
path, i also want to set it so it only returns the headers using -Rhdrs so need to set 
3 options when sendmail is called.

can you set multiple options with the 5th parameter? i would have thought it would 
append the stuff in the 5th to the sendmail path set in php.ini but it doesn't seem to 
work that way.

i can do this fine by using popen() and adding the parameters to the path so i can't 
see why it doesn't play with the mail function.

Paul Roberts
http://www.paul-roberts.com
[EMAIL PROTECTED]
++++++++++++++++++++++++



----- Original Message ----- 
From: "Manuel Lemos" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, August 17, 2002 2:36 AM
Subject: [PHP] Re: Bulk Email [solution found!]


> Hello,
> 
> On 08/16/2002 05:37 PM, Daren Cotter wrote:
> > First, a recap of my problem:
> > 
> > I need to send personalized emails to my member list
> > on a daily basis. I use PHP to query the MySQL
> > database, and loop through the results using the
> > mail() function. Problem: very slow, browser/php times
> > out, etc.
> > 
> > Solution:
> > 
> > First, I configure sendmail to use "queueonly" as the
> > DeliveryMethod (see sendmail.cf) instead of
> > "background". Then, when my PHP script runs, mailings
> > simply get queued instead of actually delivered. This
> > is a x10 speed increase. My script queues
> > approximately 1,000 mailings per minute (a x10 speed
> > increase). Then, I modified the
> > /etc/rc.d/init.d/sendmail script to process the queue
> > every 5 minutes, instead of the default one hour. This
> > insures that the mailings actually get sent soon after
> > they're queued, and you won't have to wait for
> > important emails to come through.
> 
> As I mentioned before this solution is set for disaster as you grow into 
> larger number of recipients. The problem is that queuing separate 
> messages for each recipient will fill up your disk. But that is not all. 
> The eventual message bounces that you will get will only aggravate your 
> problem. If you can live without personalization, don't think twice, 
> forget it. If you have doubts, think again.
> 
> 
> 
> > The problem with the above solution used to be this:
> > certain emails generated from my site (welcome emails,
> > password lookup emails, etc) need to be sent
> > IMMEDIATELY, and cannot wait in the queue for 5
> > minutes. The solution for this: not using the built-in
> > mail() command in PHP. I created my own mail script
> > (by modifying something someone else already did)
> > which opens a socket directly with the mail server.
> > Code is below.
> > 
> > // Sends the email directly to the mail server using
> > SMTP. This is done
> > // so sendmail can be setup using the queue method on
> > the server, and
> > // confirmation emails, etc, can be sent immediately
> > to the member.
> > function smtp_mail($to, $from_name, $from_email,
> > $reply_to_email, $subject, $body) {
> > $smtp = fsockopen("your_mail_server_here", 25);
> 
> I am not sure that sending to the local mailer queue via SMTP would be 
> any better than using sendmail itself to put the message there. Anyway, 
> I am afraid that the message will still wait for sendmail to process it
> 
> 
> > if ($smtp == 0)
> > return 0;
> > fputs($smtp,"helo
> > machines_host_and_domain_name_here\r\n");
> > $line = fgets($smtp, 1024);
> > fputs($smtp,"mail from: $from_email\r\n");
> > $line = fgets($smtp, 1024);
> > fputs($smtp,"rcpt to: $to\r\n");
> > $line = fgets($smtp, 1024);
> > fputs($smtp,"data\r\n");
> > $line = fgets($smtp, 1024);
> > fputs($smtp,"From: $from_name <$from_email>\r\n");
> > fputs($smtp,"Reply-To: $reply_to_email\r\n");
> > fputs($smtp,"To: $to\r\n");
> > fputs($smtp,"Subject: $subject\r\n");
> > fputs($smtp,"\r\n");
> > fputs($smtp,"$body\r\n");
> > fputs($smtp,".\r\n");
> > $line = fgets($smtp, 1024);
> > fputs($smtp, "QUIT\r\n");
> > fclose($smtp);
> > return 1;
> > }
> 
> I am afraid this code needs a lot of work or else it will choke on some 
> servers due to multi-line responses, maybe not on the actual sendmail 
> version and configuration you are using, but definetely on some SMTP 
> servers.
> 
> 
> -- 
> 
> Regards,
> Manuel Lemos
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 


--- End Message ---
--- Begin Message ---
On Saturday 17 August 2002 04:35, Kelly Meeks wrote:
> Hi folks,
>
> I'm learning shell scripting via linux, and have written a script that
> creates the core files necessary for a users website from a master set of
> files.
>
> Works from the shell just fine (bash makethesite.sh username pathtoputfiles
> pathtogetfiles)
>
> Trying to execute this via php, and it literally does nothing.
>
> If I try something like:
> $bashoutput=shell_exec('bash makethesite.sh username pathtoputfiles
> pathtogetfiles'); echo $bashoutput;
>
> I get nothing output, and the script doesn't execute.

What does the php logs say? You should set error_reporting to E_ALL.

> Any ideas?

The user that the webserver (assuming apache) is usually nobody or apache and 
may not have the necessary permissions to execute your script. Also try 
specifying the complete path to bash.

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

/*
Those who educate children well are more to be honored than parents, for
these only gave life, those the art of living well.
                -- Aristotle
*/

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

I'm a newbie.  I've been searching google and php.net trying to find
information on how to set up a Master Page to do multiple records updating,
but have found very little.  I have a table with 10 rows of data from MySQL
and I'd like the user to check the "Approve" checkbox and for as many as he
wants to approve and then click "Submit".

If someone could point me in the right direction, I'd greatly appreciate it!

Thanks,  Doug

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

Print out your data onto a master page, with checkboxes.  The checkboxes
should be an array, with the ID (or some other unique identifier) of each
row.  The array would look something like:

$approve['1'] => 'Y';
$approve['2'] => 'Y';
$approve['3'] => 'Y';
...
$approve['10'] => 'Y';


The array will only contain rows which were checked.

Then on the next page, you loop through the array with a foreach statement,
updating the table to suit:

foreach($approve as $k => $v)
    {
    $sql = "UPDATE .... WHERE id='{$k}'";
    $result = mysql_query($sql);
    }

Hope this is enough to get you started.


Justin French


on 17/08/02 1:37 PM, Lists ([EMAIL PROTECTED]) wrote:

> Hi everyone,
> 
> I'm a newbie.  I've been searching google and php.net trying to find
> information on how to set up a Master Page to do multiple records updating,
> but have found very little.  I have a table with 10 rows of data from MySQL
> and I'd like the user to check the "Approve" checkbox and for as many as he
> wants to approve and then click "Submit".
> 
> If someone could point me in the right direction, I'd greatly appreciate it!
> 
> Thanks,  Doug
> 

--- End Message ---
--- Begin Message ---
Any ideas if it's possible to keep a script running for a short time after a
client has been redireced?

i.e:
<?
header("Location: http://php.net";);
# contunue running...
mail("[EMAIL PROTECTED]", "Hey", "Hi!");
?>

Using Redhat Linux, Apache & PHP 4.2.2.

Much thanks!
-Jason


--- End Message ---
--- Begin Message ---
Sorry... that seems to work by default... what-dadda ya know!

"Jason Morehouse" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Any ideas if it's possible to keep a script running for a short time after
a
> client has been redireced?
>
> i.e:
> <?
> header("Location: http://php.net";);
> # contunue running...
> mail("[EMAIL PROTECTED]", "Hey", "Hi!");
> ?>
>
> Using Redhat Linux, Apache & PHP 4.2.2.
>
> Much thanks!
> -Jason
>
>


--- End Message ---
--- Begin Message ---
Sure, in fact, that happens by default unless you explicitly exit or try
to output something.

On Sat, 17 Aug 2002, Jason Morehouse wrote:

> Any ideas if it's possible to keep a script running for a short time after a
> client has been redireced?
>
> i.e:
> <?
> header("Location: http://php.net";);
> # contunue running...
> mail("[EMAIL PROTECTED]", "Hey", "Hi!");
> ?>
>
> Using Redhat Linux, Apache & PHP 4.2.2.
>
> Much thanks!
> -Jason
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

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

Now that the topic has been brought,

How much long will the script keep running after the redirection request has
been made?

Doesn't that behaviour depend from browser to browser ?


Thanks,


Elias

"Rasmus Lerdorf" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Sure, in fact, that happens by default unless you explicitly exit or try
> to output something.
>
> On Sat, 17 Aug 2002, Jason Morehouse wrote:
>
> > Any ideas if it's possible to keep a script running for a short time
after a
> > client has been redireced?
> >
> > i.e:
> > <?
> > header("Location: http://php.net";);
> > # contunue running...
> > mail("[EMAIL PROTECTED]", "Hey", "Hi!");
> > ?>
> >
> > Using Redhat Linux, Apache & PHP 4.2.2.
> >
> > Much thanks!
> > -Jason
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>


--- End Message ---
--- Begin Message ---
It has absolutely nothing to do with the browser.  PHP is a server-side
language.  See

   http://www.php.net/manual/en/features.connection-handling.php

-Rasmus

On Sat, 17 Aug 2002, lallous wrote:

> Hello Rasmus,
>
> Now that the topic has been brought,
>
> How much long will the script keep running after the redirection request has
> been made?
>
> Doesn't that behaviour depend from browser to browser ?
>
>
> Thanks,
>
>
> Elias
>
> "Rasmus Lerdorf" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Sure, in fact, that happens by default unless you explicitly exit or try
> > to output something.
> >
> > On Sat, 17 Aug 2002, Jason Morehouse wrote:
> >
> > > Any ideas if it's possible to keep a script running for a short time
> after a
> > > client has been redireced?
> > >
> > > i.e:
> > > <?
> > > header("Location: http://php.net";);
> > > # contunue running...
> > > mail("[EMAIL PROTECTED]", "Hey", "Hi!");
> > > ?>
> > >
> > > Using Redhat Linux, Apache & PHP 4.2.2.
> > >
> > > Much thanks!
> > > -Jason
> > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

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

Friday, August 16, 2002, 4:13:39 AM, you wrote:
KSM> Am I mistaken to assume that a Session is automatically
KSM> destroyed if a Window Browser is closed?

The session as such is not destroyed only the cookie used to id it if you are using
cookies. If The SID is being passed in the url and that is bookmarked
then the session could be restarted before the timeout occurs in a new
browser.

-- 
regards,
Tom

--- End Message ---
--- Begin Message ---
Alok K. Dhir wrote:
>
> By any chance, is page one the "entrance" page to your application?

Yes.

> I.e. is there a session id in either the query string of the page URL or
> was there one passed to it via a POST?

Nope. Is the is the entrance so there is no nothing passed to it. Users 
just enter the URL in the location bar, for example, and come in.

> Without cookies enabled, there is no way to allow users to use the back
> button to go back to the entrance page while maintaining the session.

Really? I just turned cookies and javascript off and then visited 
Amazon.com. I added an item to my cart, hit the back buttonall way back 
to the entrance and then checked my cart ... lo-and-behold the item was 
in my cart still. How did they do that?

> One (hackish) solution to this is to cause the entrance page to
> immediately redirect to itself using either PHP's header function, or a
> meta refresh.  Your goal here is to make it so that hitting back from a
> secondary page would take you to the post-refreshed entrance page which
> has the session ID.

Ok. Can you explain this in more detail? I understand the concept you 
are suggesting but I can't picture how to do this in PHP.

Thanks for the info!

Jc

--- End Message ---
--- Begin Message ---
on 17/08/02 4:01 PM, Jean-Christian Imbeault ([EMAIL PROTECTED])
wrote:

>> One (hackish) solution to this is to cause the entrance page to
>> immediately redirect to itself using either PHP's header function, or a
>> meta refresh.  Your goal here is to make it so that hitting back from a
>> secondary page would take you to the post-refreshed entrance page which
>> has the session ID.
> 
> Ok. Can you explain this in more detail? I understand the concept you
> are suggesting but I can't picture how to do this in PHP.

Something like:

If there isn't a session, start one and redirect to the same page WITH the
session id, otherwise just continue the session.

In theory, you should always get a session ID in the URL of startpage.php.

But I can't stress enough, this is all theory -- the code hasn't been tested
at all... nor particularly thought through :)


startpage.php:

<? // untested code

if(!isset(session_id()))
    {
    session_start();
    header("Location: startpage.php?PHPSESSID=".session_id())
    }
else
    {
    session_start();
    }
?>
<HTML>
...
</HTML>


Justin French

--- End Message ---
--- Begin Message ---
Jerry wrote:
> 
> I kind of hate it when sites do this, but you could have the first page 
> reload itself if it doesn't have an SID, and add an SID to itself. This 
> way, if they use the back button, the first "first page" they come to 
> has the SID.

But if they it the back button again they would come to the real first 
they came to and that page would reload itself, generating a new SID no?

I did some testing and found that there must be a way.

I turned cookies and javascript off and then visited Amazon.com. I added 
an item to my cart, hit the back button all way back to the entrance and 
then checked my cart ... lo-and-behold the item was in my cart still. 
How did they do that?

Maybe some use of header() on the first page to redirect itslef to page 
with a SID?

Jc

--- End Message ---
--- Begin Message ---
Dear All,

How can I enable --with-imap with rpm / SPRMS packages of php ?

Thank for your help !

Edward.




--- End Message ---
--- Begin Message ---
On Saturday 17 August 2002 16:38, [EMAIL PROTECTED] wrote:
> Dear All,
>
> How can I enable --with-imap with rpm / SPRMS packages of php ?

If you're using Redhat then install the php-imap-*.rpm package.

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

/*
If the future isn't what it used to be, does that mean that the past
is subject to change in times to come?
*/

--- End Message ---
--- Begin Message ---
If I want to enable the options ( eg : --enable-ftp, --with-gd,
--with-gettext, --with-memory-limit etc ), so how can I do with rpm / SPRMS
package of php ?

Thank a lots !

Jason Wong wrote:

> On Saturday 17 August 2002 16:38, [EMAIL PROTECTED] wrote:
> > Dear All,
> >
> > How can I enable --with-imap with rpm / SPRMS packages of php ?
>
> If you're using Redhat then install the php-imap-*.rpm package.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> If the future isn't what it used to be, does that mean that the past
> is subject to change in times to come?
> */
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


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

I'd need to parse html page and get all hyperlinks there.

Is there any easy way to do it ? I'm not so good at regexps :(

$file=file("http://url.html";);

could be good start :)

Thanks for any help,

Roman



--- End Message ---

Reply via email to