php-general Digest 3 Sep 2002 10:02:43 -0000 Issue 1563

Topics (messages 114963 through 115000):

Re: help, array values echoed as Array on loop!
        114963 by: Victor

Re: How to escape " in hidden field?
        114964 by: Tom Rogers
        114965 by: Martin Towell
        114984 by: Martin Thoma
        114987 by: Tom Rogers

ftp question
        114966 by: Victor
        114970 by: nicos.php.net
        114971 by: victor
        114972 by: victor

Re: Why doesn't the second instance work?
        114967 by: Tom Rogers
        114980 by: David Robley

Re: crontab programmed with mysql ??
        114968 by: nicos.php.net
        114969 by: Tom Rogers

Re: coockie expiration problems
        114973 by: Tom Rogers

Re: Forum structure
        114974 by: Justin French

Re: mail() function problem
        114975 by: Akhmad D. Sembiring
        114976 by: Manuel Lemos
        114977 by: Akhmad D. Sembiring
        114978 by: Manuel Lemos

Re: unexpected T_SL
        114979 by: Voisine

IE won't post on Windows, but will on Mac
        114981 by: Jed Verity
        114982 by: Martin Towell
        114983 by: Jed Verity
        114988 by: Tom Rogers

mysql string comparison not working
        114985 by: David Banning
        114989 by: Henry
        114999 by: lallous

Session problem
        114986 by: Monil Chheda

Function expects string but receiving array Warming??
        114990 by: Jean-Christian Imbeault
        114991 by: Justin French
        114993 by: Chris Wesley
        114996 by: Jean-Christian Imbeault

limit in a loop function to prevent server load
        114992 by: electroteque
        114994 by: Bas Jobsen

Re: mail()  again...
        114995 by: :B nerdy

html to php with echo <<<
        114997 by: adi

wordwrap function (that skips html tags)
        114998 by: 457945.gmx.net

threads in Apache 1.3
        115000 by: Heiko Mundle

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 ---
Thank you, I figured it out 30 seconds after I posted the question, you
were right about the problem.

- Victor > www.argilent.com

-----Original Message-----
From: Chris Wesley [mailto:[EMAIL PROTECTED]] 
Sent: Monday, September 02, 2002 4:11 PM
To: 'PHP'
Cc: Victor
Subject: Re: [PHP] help, array values echoed as Array on loop!

On Mon, 2 Sep 2002, Victor wrote:

> $ID_arr[] = explode(',', $pictures); # make db data into array
> This is the string:
> 15,16,17,18,19
>
> why does it echo as Array?

... because you've created an array ($ID_arr) with an array as the first
value (the result of the call to explode()).  Take the brackets off
$ID_arr, and you'll get what you want.  You don't want your array in an
array ... you just want an array.

$ID_arr = explode(',', $pictures);

If you really wanted your array in the array, then loop over $ID_arr[0].
(I doubt that's what you were going for, though.)

        hth,
        ~Chris


______________________________________________________________________ 
Post your free ad now! http://personals.yahoo.ca
--- End Message ---
--- Begin Message ---
Hi,

Monday, September 2, 2002, 7:59:43 PM, you wrote:
MT> Hello!

MT> I have a simple hidden input-field like
MT> <INPUT TYPE="HIDDEN" VALUE="Hello world" NAME="Message">

MT> Now sometimes I need to insert " like:

MT> <INPUT TYPE="HIDDEN" VALUE="Hello \"world\"" NAME="Message">
MT> But this makes PHP (or the browser?) cutting of the string after "Hello
MT> ". How can I escape the "?

MT> Martin

Try this with single quotes:

     <INPUT TYPE="HIDDEN" VALUE='Hello "world"' NAME="Message">

-- 
regards,
Tom

--- End Message ---
--- Begin Message ---
Hi Martin

You can also do this

 <INPUT TYPE="HIDDEN" VALUE="Hello &quot;world" NAME="Message">

HTH
Martin  :)



-----Original Message-----
From: Tom Rogers [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 03, 2002 11:24 AM
To: Martin Thoma
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] How to escape " in hidden field?


Hi,

Monday, September 2, 2002, 7:59:43 PM, you wrote:
MT> Hello!

MT> I have a simple hidden input-field like
MT> <INPUT TYPE="HIDDEN" VALUE="Hello world" NAME="Message">

MT> Now sometimes I need to insert " like:

MT> <INPUT TYPE="HIDDEN" VALUE="Hello \"world\"" NAME="Message">
MT> But this makes PHP (or the browser?) cutting of the string after "Hello
MT> ". How can I escape the "?

MT> Martin

Try this with single quotes:

     <INPUT TYPE="HIDDEN" VALUE='Hello "world"' NAME="Message">

-- 
regards,
Tom


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
> Try this with single quotes:
>
>      <INPUT TYPE="HIDDEN" VALUE='Hello "world"' NAME="Message">

Year, but then I couldn't use single-quotes in the text ;-) The problem is that
the content of the field is inserted by the user, so I cannot say if he uses
single- and/or double-quotes.


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

Tuesday, September 3, 2002, 4:35:45 PM, you wrote:
>> Try this with single quotes:
>>
>>      <INPUT TYPE="HIDDEN" VALUE='Hello "world"' NAME="Message">

MT> Year, but then I couldn't use single-quotes in the text ;-) The problem is that
MT> the content of the field is inserted by the user, so I cannot say if he uses
MT> single- and/or double-quotes.


How about this then...
<?
$test = "Hello \"O'Brian\"";
?>
<INPUT TYPE="HIDDEN" VALUE="<?echo htmlentities($test)?>" NAME="Message">

No need to decode the returned value



-- 
regards,
Tom

--- End Message ---
--- Begin Message ---
I took the scriopt from php manual and adapted it to my needs, but I get
an error:

Warning: ftp_put(): user_pictures/vic/: No such file or directory in
/home/victor/argilent-www/sites/kodak/upload_picture.php on line 103

This is the code:

        # set up basic connection
        $conn_id = ftp_connect($ftp_server);
        
        # login with username and password
        $login_result = ftp_login($conn_id, $ftp_user, $ftp_pass);
        
        # check connection
        if ((!$conn_id) || (!$login_result)) {
                echo 'FTP connection has failed.';
                exit;
        }
        $destination = $picture_location.'/'.$f_username.'/';
        # upload the file
        $upload = ftp_put($conn_id, $destination, $picture, FTP_BINARY);
        
        # check upload status
        if (!$upload) {
                echo 'FTP upload has failed.';
        }
        
        # close the FTP stream
        ftp_close($conn_id);

I added the destination variable so that I can easily edit the
destination if I sweitch servers, I'm guessing the error occurs because
php doesn't know where to take the file from?! I'm guessing here, but it
would be nice if someone tough me a bit more about ftp with php.

user_pictures/vic is the directory the $picture has to go in, but I
dunno why it doesn't work.

- Victor > www.argilent.com


______________________________________________________________________ 
Post your free ad now! http://personals.yahoo.ca
--- End Message ---
--- Begin Message ---
Hi,

Your script upload the file to
/home/victor/argilent-www/sites/kodak/user_pictures/vic/
are you sure that is the correct path name? If its not, just put the entier
name and not only a part of it.

--
Merci de nous avoir choisi. - Thanks you for your choice.
Nicos - CHAILLAN Nicolas
[EMAIL PROTECTED]
[EMAIL PROTECTED]
www.GroupAKT.com - Hébergement Group.
www.WorldAKT.com - Hébergement de sites Internet
"Victor" <[EMAIL PROTECTED]> a écrit dans le message de news:
000001c252ea$36e90160$[EMAIL PROTECTED]
> I took the scriopt from php manual and adapted it to my needs, but I get
> an error:
>
> Warning: ftp_put(): user_pictures/vic/: No such file or directory in
> /home/victor/argilent-www/sites/kodak/upload_picture.php on line 103
>
> This is the code:
>
> # set up basic connection
> $conn_id = ftp_connect($ftp_server);
>
> # login with username and password
> $login_result = ftp_login($conn_id, $ftp_user, $ftp_pass);
>
> # check connection
> if ((!$conn_id) || (!$login_result)) {
> echo 'FTP connection has failed.';
> exit;
> }
> $destination = $picture_location.'/'.$f_username.'/';
> # upload the file
> $upload = ftp_put($conn_id, $destination, $picture, FTP_BINARY);
>
> # check upload status
> if (!$upload) {
> echo 'FTP upload has failed.';
> }
>
> # close the FTP stream
> ftp_close($conn_id);
>
> I added the destination variable so that I can easily edit the
> destination if I sweitch servers, I'm guessing the error occurs because
> php doesn't know where to take the file from?! I'm guessing here, but it
> would be nice if someone tough me a bit more about ftp with php.
>
> user_pictures/vic is the directory the $picture has to go in, but I
> dunno why it doesn't work.
>
> - Victor > www.argilent.com
>
>
> ______________________________________________________________________
> Post your free ad now! http://personals.yahoo.ca


--- End Message ---
--- Begin Message ---
Actually, that is the correct path. Which is why I don't understand why
it's not working. And as a user I'm using myself... waitaminute, the
folders are created by the user www, and I argilent may not have write
permission, maybe that's why it's not working. I should try with a
folder I create as me to see if I can write to it.

- Victor > www.argilent.com

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: Monday, September 02, 2002 9:46 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: ftp question

Hi,

Your script upload the file to
/home/victor/argilent-www/sites/kodak/user_pictures/vic/
are you sure that is the correct path name? If its not, just put the
entier
name and not only a part of it.

--
Merci de nous avoir choisi. - Thanks you for your choice.
Nicos - CHAILLAN Nicolas
[EMAIL PROTECTED]
[EMAIL PROTECTED]
www.GroupAKT.com - Hébergement Group.
www.WorldAKT.com - Hébergement de sites Internet
"Victor" <[EMAIL PROTECTED]> a écrit dans le message de news:
000001c252ea$36e90160$[EMAIL PROTECTED]
> I took the scriopt from php manual and adapted it to my needs, but I
get
> an error:
>
> Warning: ftp_put(): user_pictures/vic/: No such file or directory in
> /home/victor/argilent-www/sites/kodak/upload_picture.php on line 103
>
> This is the code:
>
> # set up basic connection
> $conn_id = ftp_connect($ftp_server);
>
> # login with username and password
> $login_result = ftp_login($conn_id, $ftp_user, $ftp_pass);
>
> # check connection
> if ((!$conn_id) || (!$login_result)) {
> echo 'FTP connection has failed.';
> exit;
> }
> $destination = $picture_location.'/'.$f_username.'/';
> # upload the file
> $upload = ftp_put($conn_id, $destination, $picture, FTP_BINARY);
>
> # check upload status
> if (!$upload) {
> echo 'FTP upload has failed.';
> }
>
> # close the FTP stream
> ftp_close($conn_id);
>
> I added the destination variable so that I can easily edit the
> destination if I sweitch servers, I'm guessing the error occurs
because
> php doesn't know where to take the file from?! I'm guessing here, but
it
> would be nice if someone tough me a bit more about ftp with php.
>
> user_pictures/vic is the directory the $picture has to go in, but I
> dunno why it doesn't work.
>
> - Victor > www.argilent.com
>
>
> ______________________________________________________________________
> Post your free ad now! http://personals.yahoo.ca



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

______________________________________________________________________
Post your free ad now! http://personals.yahoo.ca
--- End Message ---
--- Begin Message ---
Actually, that is the correct path. Which is why I don't understand why
it's not working. And as a user I'm using myself... waitaminute, the
folders are created by the user www, and I argilent may not have write
permission, maybe that's why it's not working. I should try with a
folder I create as me to see if I can write to it.

- Victor > www.argilent.com

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: Monday, September 02, 2002 9:46 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: ftp question

Hi,

Your script upload the file to
/home/victor/argilent-www/sites/kodak/user_pictures/vic/
are you sure that is the correct path name? If its not, just put the
entier
name and not only a part of it.

--
Merci de nous avoir choisi. - Thanks you for your choice.
Nicos - CHAILLAN Nicolas
[EMAIL PROTECTED]
[EMAIL PROTECTED]
www.GroupAKT.com - Hébergement Group.
www.WorldAKT.com - Hébergement de sites Internet
"Victor" <[EMAIL PROTECTED]> a écrit dans le message de news:
000001c252ea$36e90160$[EMAIL PROTECTED]
> I took the scriopt from php manual and adapted it to my needs, but I
get
> an error:
>
> Warning: ftp_put(): user_pictures/vic/: No such file or directory in
> /home/victor/argilent-www/sites/kodak/upload_picture.php on line 103
>
> This is the code:
>
> # set up basic connection
> $conn_id = ftp_connect($ftp_server);
>
> # login with username and password
> $login_result = ftp_login($conn_id, $ftp_user, $ftp_pass);
>
> # check connection
> if ((!$conn_id) || (!$login_result)) {
> echo 'FTP connection has failed.';
> exit;
> }
> $destination = $picture_location.'/'.$f_username.'/';
> # upload the file
> $upload = ftp_put($conn_id, $destination, $picture, FTP_BINARY);
>
> # check upload status
> if (!$upload) {
> echo 'FTP upload has failed.';
> }
>
> # close the FTP stream
> ftp_close($conn_id);
>
> I added the destination variable so that I can easily edit the
> destination if I sweitch servers, I'm guessing the error occurs
because
> php doesn't know where to take the file from?! I'm guessing here, but
it
> would be nice if someone tough me a bit more about ftp with php.
>
> user_pictures/vic is the directory the $picture has to go in, but I
> dunno why it doesn't work.
>
> - Victor > www.argilent.com
>
>
> ______________________________________________________________________
> Post your free ad now! http://personals.yahoo.ca



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

______________________________________________________________________
Post your free ad now! http://personals.yahoo.ca
--- End Message ---
--- Begin Message ---
Hi,

Tuesday, September 3, 2002, 6:49:25 AM, you wrote:

MK> Everything is good, Everything is fine, so I decide to put the same=20
MK> snippet of code in again, this time pointing to a different page -- 
MK> One=20=

MK> page lets you edit the fields, the other shows you the final output,=20
MK> the item from the database featured on a web page.

MK> <p>preview an endpage:</p>

MK> <?
MK> //create a list of editible items
MK> echo "<form method=3Dpost action=3Dpreview.php>";
MK> echo "<select name=3Did>";
MK> for ($i=3D0; $i <$num_results; $i++)
MK> {
MK>         $row =3D mysql_fetch_array($result);
MK>         echo "<option value=3D$row[id]> $row[id], =
MK> $row[productname]</option>";
MK> }
MK> echo "</select>";
MK> echo "<input type=3Dsubmit name=3Dsubmit>";
MK> echo "</form>";
?>>=00=00

MK> The second instance does not work, I get a select with "," as each=20
MK> option, no population with the id or productname. Clearly, I don't=20
MK> understand something here, can anyone tell me what?

MK> Thanks for the time,

MK> Michael

To use the result a second time you will need to reset the internal mysql
pointer like this:

mysql_data_seek($result,0);

After the first loop through.

-- 
regards,
Tom

--- End Message ---
--- Begin Message ---
In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...

<SNIP>

> //create a list of editible items
> echo "<form method=3Dpost action=3Dedit.php>";
> echo "<select name=3Did>";
> for ($i=3D0; $i <$num_results; $i++)
> {
>       $row =3D mysql_fetch_array($result);
>       echo "<option value=3D$row[id]> $row[id], =
> $row[productname]</option>";
> }
> echo "</select>";
> echo "<input type=3Dsubmit name=3Dsubmit>";
> echo "</form>";
> ?>=00=00
> 
> Everything is good, Everything is fine, so I decide to put the same=20
> snippet of code in again, this time pointing to a different page -- 
> One=20=
> 
> page lets you edit the fields, the other shows you the final output,=20
> the item from the database featured on a web page.
> 
> <p>preview an endpage:</p>
> 
> <?
> //create a list of editible items
> echo "<form method=3Dpost action=3Dpreview.php>";
> echo "<select name=3Did>";
> for ($i=3D0; $i <$num_results; $i++)
> {
>       $row =3D mysql_fetch_array($result);
>       echo "<option value=3D$row[id]> $row[id], =
> $row[productname]</option>";
> }
> echo "</select>";
> echo "<input type=3Dsubmit name=3Dsubmit>";
> echo "</form>";
> ?>=00=00
> 
> The second instance does not work, I get a select with "," as each=20
> option, no population with the id or productname. Clearly, I don't=20
> understand something here, can anyone tell me what?

Each time you invoke mysql_fetch_array (or any of the functions to get 
data) to fetch a row of data from a mysql result set, a pointer is moved 
to the next row, so that the next call to mysql_fetch_array knows where to 
get its next chunk of information. When you reach the last row in the set, 
the pointer is set to 'beyond end of set' and needs to be repositioned 
before it can usefully point to data. Here you ned to use mysql_data_seek 
to reposition the pointer at the first row so you can again cycle through 
the records you have selected.

For future reference, the same principle applies when looping through an 
array with some of the array handling tools.

And just to make your code a bit more 'readable', you might find the 
extract() function handy for grabbing variable values from a result set.

Cheers
-- 
David Robley
Temporary Kiwi!

Quod subigo farinam
--- End Message ---
--- Begin Message ---
Take that to the correct newsgroup.

--
Merci de nous avoir choisi. - Thanks you for your choice.
Nicos - CHAILLAN Nicolas
[EMAIL PROTECTED]
[EMAIL PROTECTED]
www.GroupAKT.com - Hebergement Group.
www.WorldAKT.com - Hebergement de sites Internet
<[EMAIL PROTECTED]> a ecrit dans le message de news:
003201c252cb$ac4f1da0$[EMAIL PROTECTED]
> I'm looking for the approximate solution of mailing out (or doing anything
> else )
> timed by cron(tab) along with use of mysql as means of identification and
> storing
> of the dates in multiuser enviroment.
> Initial date and interval of recurring event is to be set up by a user.
> May you know some open source code as an example to do that or so?
> Thank you,
> Oleg
>


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

Tuesday, September 3, 2002, 7:55:56 AM, you wrote:
aac> I'm looking for the approximate solution of mailing out (or doing anything
aac> else )
aac> timed by cron(tab) along with use of mysql as means of identification and
aac> storing
aac> of the dates in multiuser enviroment.
aac> Initial date and interval of recurring event is to be set up by a user.
aac> May you know some open source code as an example to do that or so?
aac> Thank you,
aac> Oleg

Probably the easiest way is to set up cron to call a php script every
5 mins or whatever the smallest interval you will need and have that
script run through your mysql tables looking for jobs to do. That way
you only need one cron job. If you are on unix type server the
simplest is to use lynx like this

5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/bin/lynx -dump 
http://domain.com/chkjob.php 1> /dev/null 2> /dev/null


-- 
regards,
Tom

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

Tuesday, September 3, 2002, 12:53:22 AM, you wrote:
a> OK, I found the reason, but not the solution yet:

a> The cookie time during setting is the time taken from the server. The time
a> for checking the coockie is the time of the local machine!!

a> So what can I do if I would like to last the coockie for 1 hour and the
a> person is sitting on the other site of the world running 10 hours time
a> difference? Puhh.. maybe I am wrong, but this is how it seems to be.

a> Any ideas?

a> Andy

a> <[EMAIL PROTECTED]> schrieb im Newsbeitrag
a> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>> Hi,
>>     I see really nothing wrong in your example. Did you tried to verify
a> with
>> isset() if the cookie is still here or not?
>>     And well, you should use double quote on setcookie("referrer",
a> $user_id,
>> time()+10);
>>     You call should be also $_COOKIE['referrer'] and not
a> $_COOKIE[referrer].
>>
>> --
>> Merci de nous avoir choisi. - Thanks you for your choice.
>> Nicos - CHAILLAN Nicolas
>> [EMAIL PROTECTED]
>> [EMAIL PROTECTED]
>> www.GroupAKT.com - Hébergement Group.
>> www.WorldAKT.com - Hébergement de sites Internet
>> "Andy" <[EMAIL PROTECTED]> a écrit dans le message de news:
>> [EMAIL PROTECTED]
>> > Hi there,
>> >
>> > I am trying to save a var inside a cookie for a certain time (in this
>> > example 10s):
>> >      setcookie('referrer', $user_id, time()+10); //expires in one hour
>> >
>> > Now I would like to get the value, but only if the coockie is valid (if
>> > cockie not older than 10 s in this example)
>> >     echo 'referrer: '.$_COOKIE[referrer];
>> >
>> > Unfortunatelly this does not work, the cockie value is always valid,
a> even
>> > after expiration time.
>> >
>> > What am I doing wrong?
>> >
>> > Thanx for any help on that,
>> >
>> > Andy
>> >
>> >
>>
>>


According to netscape the cookie date value is expected to be in the
GMT time zone only so that is not the problem. This is more likely the
cause (from Netscape again)

<quote>
The expires header lets the client know when it is safe to purge the mapping
but the client is not required to do so.
A client may also delete a cookie before it's expiration date arrives
if the number of cookies exceeds its internal limits
</quote>

What you will have to do is encode your time in the value passed with
the cookie and do your own checking...ignoring it if it is older than
10 seconds
-- 
regards,
Tom

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

I built a forum from scratch, because I had very specific needs on how it
would work... different to everything I've seen so far.  Sorry to say it
though, the underlying table structure IS determined by the way you want it
to work.

If you're after something stock-standard, I'd recommend checking out the
systems already available for free (it's been discussed many times).

For starters, they're ready to go, so you'll save MANY hours.  Or if they
don't end up being what you want:

a) the underlying db structure & code may give you some ideas for your own
b) you may be able to help/contribute to make the product better, since it's
probably open source, and developed by a community of contributors.


If you some specific ideas on what you want to achieve, I might be able to
make some suggestions.

Cheers,

Justin


on 03/09/02 1:23 AM, Andrian Ivanov ([EMAIL PROTECTED]) wrote:

> Hi,
> 
> I'm looking for a developer who have worked already on some forums. I know
> each forum - depending on it's needs is differnt and then it changes it'
> structure. What I'm asking for is standart information about forum building.
> Not exact code, but tested db structure and php functionallity. I'll be nice
> to have your opinions on that.
> 
> Thanks in advance.
> Andrian Ivanov, Bugaria
> 
> 

--- End Message ---
--- Begin Message ---
Dear Arul & friends,

thanks for your kind helps,
but the problem still exists.

the actual problem is that the 2nd mail() function
does not ever send the mail, no matter what the destination
and the additional header is.

is there a way to debug this problem?

thanks
Daniel

#  -----Original Message-----
#  From: Arul Venkatesh Kandaswamy [mailto:[EMAIL PROTECTED]]
#  Sent: Saturday, August 31, 2002 17:07
#  To: Akhmad D. Sembiring
#  Subject: Re: [PHP] mail() function problem
#  
#  
#  Hello
#  
#  $from  = "MIME-Version: 1.0\r\n";
#   $from .= "Content-type: text/html; charset=iso-8859-1\r\n";
#   $from .= "From: <[EMAIL PROTECTED]>\r\n";
#   $subject="Registration Confirmation";
#   $messge="test mail";
#   mail($mailid,$subject,$message,$from);
#  
#  Thanks and Regards
#  Arul venki
#  
#  ----- Original Message -----
#  From: "Akhmad D. Sembiring" <[EMAIL PROTECTED]>
#  To: <[EMAIL PROTECTED]>
#  Sent: Saturday, August 31, 2002 2:02 PM
#  Subject: [PHP] mail() function problem
#  
#  
#  > Dear All,
#  >
#  > I have a little problem with mail() function,
#  >
#  > PHP Code:
#  >
#  > --------------------------------------
#  > mail($email, "Membership ok", $themsg,
#  > "From: [EMAIL PROTECTED]\r\n");
#  >
#  > mail("[EMAIL PROTECTED]",
#  > "", "", "From: $email\r\n");
#  > --------------------------------------
#  >
#  > Why does the second mail() function did not ever send the email to
#  > yahoogroups?
#  >
#  > I wonder, can the mail() function be put in a loop structure (that
#  traverse
#  > an array of emails) and send all emails successfully?
#  >
#  > Thanks for your advice,
#  >
#  > Daniel

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.381 / Virus Database: 214 - Release Date: 8/2/02

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

On 09/03/2002 12:19 AM, Akhmad D. Sembiring wrote:
> Dear Arul & friends,
> 
> thanks for your kind helps,
> but the problem still exists.
> 
> the actual problem is that the 2nd mail() function
> does not ever send the mail, no matter what the destination
> and the additional header is.
> 
> is there a way to debug this problem?

Most likely you have not configured PHP to use the mail() properly.

First things first. Which platform are you using?

Did you configure php.ini mail options for your platform?

what does var_dump(mail(you arguments here)); return?

-- 

Regards,
Manuel Lemos

--- End Message ---
--- Begin Message ---
#  On 09/03/2002 12:19 AM, Akhmad D. Sembiring wrote:
#  > Dear Arul & friends,
#  > 
#  > thanks for your kind helps,
#  > but the problem still exists.
#  > 
#  > the actual problem is that the 2nd mail() function
#  > does not ever send the mail, no matter what the destination
#  > and the additional header is.
#  > 
#  > is there a way to debug this problem?
#  
#  Most likely you have not configured PHP to use the mail() properly.
#  First things first. Which platform are you using?
#  Did you configure php.ini mail options for your platform?

unfortunately, the script is hosted on a hosting server
so I don't have access to the php.ini file

#  what does var_dump(mail(you arguments here)); return?

bool(true) 

thanks
Daniel
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.381 / Virus Database: 214 - Release Date: 8/2/02

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

On 09/03/2002 12:38 AM, Akhmad D. Sembiring wrote:
 > #  > thanks for your kind helps,
 > #  > but the problem still exists.
 > #  >
 > #  > the actual problem is that the 2nd mail() function
 > #  > does not ever send the mail, no matter what the destination
 > #  > and the additional header is.
 > #  >
 > #  > is there a way to debug this problem?
 > #
 > #  Most likely you have not configured PHP to use the mail() properly.
 > #  First things first. Which platform are you using?
 > #  Did you configure php.ini mail options for your platform?
 >
 > unfortunately, the script is hosted on a hosting server
 > so I don't have access to the php.ini file

But can't you tell if is it Windows or Unix/Linux?


-- 

Regards,
Manuel Lemos

--- End Message ---
--- Begin Message ---
I tried everything and I still have this error. I have this error with  php 4.2.2
on Windows 98  I also have the same problem with Apache, RedHat php 4.2.1.
Well....I'm going to skip this lesson.

Thanks for all the help!

Regards!


Steel wrote:

> Hi Erwin,
>
> Monday, September 2, 2002, 11:28:09 AM, I've got:
>
> E> Voisine wrote:
> >> Hi,
> >>
> >> What is wrong witht his code? Parse error: parse error, unexpected
> >> T_SL in c:\program files\easyphp\www\tutorial\eod.php on line 2
> >>
> >> <?php
> >> $str = <<<EOD
> >> Example of string
> >> spanning multiple lines
> >> using heredoc syntax.
> >> EOD;
> >> ?>
>
> E> To be honest, there is nothing wrong. It works in version 4.2.2 (at least,
> E> here it does) ;-))
>
> E> Grtz Erwin
>
> Why not to try
> <?php
> $str = <<< EOT
> ???
>
> It seems to me, that EOD  -> End Of Data, and EOT -> End Of Text
>
> Silly, but why not to try? :)
>
> --
> The Same,
>  Steel                            mailto:[EMAIL PROTECTED]
>                                        http://www.none.ru

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

I've given myself two black eyes and a bloody nose on this one, and I'm sure
it's a simple solution. I have a form on the php page "entry.php":

<form name="zForm" action="entry.php" method="POST">
<input type="text" name="txt" value="whatever">
</form>

At the top of that page, I have the PHP code:

<?
    echo "$REQUEST_METHOD";
    //other stuff...
?>

With IE 5.2 on Mac, I submit this form and I see "POST" echoed at the top of
the page.

With IE 5.5 on Windows, I submit this form and I see "GET".

How? Why? What the? I've tried playing with different encoding types and
content-types, and nothing changes the results. I also tried setting my IE
5.5 security settings to lowest and enabled everything possible. No matter
what I do, I can't POST the form. Can anyone tell me just what in tarnation
is going on here?

Many many thanks...
Jed

--- End Message ---
--- Begin Message ---
Have you checked the $_POST (or $HTTP_POST_VAR) variable to make sure it IS
using GET?

Martin


-----Original Message-----
From: Jed Verity [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 03, 2002 3:19 PM
To: [EMAIL PROTECTED]
Subject: [PHP] IE won't post on Windows, but will on Mac


Hello, All,

I've given myself two black eyes and a bloody nose on this one, and I'm sure
it's a simple solution. I have a form on the php page "entry.php":

<form name="zForm" action="entry.php" method="POST">
<input type="text" name="txt" value="whatever">
</form>

At the top of that page, I have the PHP code:

<?
    echo "$REQUEST_METHOD";
    //other stuff...
?>

With IE 5.2 on Mac, I submit this form and I see "POST" echoed at the top of
the page.

With IE 5.5 on Windows, I submit this form and I see "GET".

How? Why? What the? I've tried playing with different encoding types and
content-types, and nothing changes the results. I also tried setting my IE
5.5 security settings to lowest and enabled everything possible. No matter
what I do, I can't POST the form. Can anyone tell me just what in tarnation
is going on here?

Many many thanks...
Jed


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hi Martin,

Thanks for responding. I just checked for any post variables and none were
set. The problem revealed itself because I originally had:

<?
    if ($REQUEST_METHOD=="POST") {
        do something
    }
    else { do something else }
?>

And "do something else" was always being done. Any other thoughts?

Thanks again...
Jed

On the threshold of genius, Martin Towell wrote:

> Have you checked the $_POST (or $HTTP_POST_VAR) variable to make sure it IS
> using GET?
> 
> Martin
> 
> 
> -----Original Message-----
> From: Jed Verity [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, September 03, 2002 3:19 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] IE won't post on Windows, but will on Mac
> 
> 
> Hello, All,
> 
> I've given myself two black eyes and a bloody nose on this one, and I'm sure
> it's a simple solution. I have a form on the php page "entry.php":
> 
> <form name="zForm" action="entry.php" method="POST">
> <input type="text" name="txt" value="whatever">
> </form>
> 
> At the top of that page, I have the PHP code:
> 
> <?
>   echo "$REQUEST_METHOD";
>   //other stuff...
> ?>
> 
> With IE 5.2 on Mac, I submit this form and I see "POST" echoed at the top of
> the page.
> 
> With IE 5.5 on Windows, I submit this form and I see "GET".
> 
> How? Why? What the? I've tried playing with different encoding types and
> content-types, and nothing changes the results. I also tried setting my IE
> 5.5 security settings to lowest and enabled everything possible. No matter
> what I do, I can't POST the form. Can anyone tell me just what in tarnation
> is going on here?
> 
> Many many thanks...
> Jed
> 

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

Tuesday, September 3, 2002, 3:19:01 PM, you wrote:
JV> Hello, All,

JV> I've given myself two black eyes and a bloody nose on this one, and I'm sure
JV> it's a simple solution. I have a form on the php page "entry.php":

JV> <form name="zForm" action="entry.php" method="POST">
JV> <input type="text" name="txt" value="whatever">
JV> </form>

JV> At the top of that page, I have the PHP code:

JV> <?
JV>     echo "$REQUEST_METHOD";
JV>     //other stuff...
?>>

JV> With IE 5.2 on Mac, I submit this form and I see "POST" echoed at the top of
JV> the page.

JV> With IE 5.5 on Windows, I submit this form and I see "GET".

JV> How? Why? What the? I've tried playing with different encoding types and
JV> content-types, and nothing changes the results. I also tried setting my IE
JV> 5.5 security settings to lowest and enabled everything possible. No matter
JV> what I do, I can't POST the form. Can anyone tell me just what in tarnation
JV> is going on here?

JV> Many many thanks...
JV> Jed



what does echo $_SERVER['REQUEST_METHOD'] print out?

-- 
regards,
Tom

--- End Message ---
--- Begin Message ---
if I set test = "Y";
then

if ($test == "Y") {echo ("it matches");}

seems to work while

if ($row[24] == "Y") {echo ("it matches");}

does not.
The row[24] mysql variable is char type and 1 char long.

any idea why it is not doing the comparison?
--- End Message ---
--- Begin Message ---
Have you tried single quotes ' '?

"David Banning" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> if I set test = "Y";
> then
>
> if ($test == "Y") {echo ("it matches");}
>
> seems to work while
>
> if ($row[24] == "Y") {echo ("it matches");}
>
> does not.
> The row[24] mysql variable is char type and 1 char long.
>
> any idea why it is not doing the comparison?


--- End Message ---
--- Begin Message ---
try to:
var_dump($row[24])
and see what happens?
it might be that the "Y" is stored as lowercase in MySql's table.

Elias
"David Banning" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> if I set test = "Y";
> then
>
> if ($test == "Y") {echo ("it matches");}
>
> seems to work while
>
> if ($row[24] == "Y") {echo ("it matches");}
>
> does not.
> The row[24] mysql variable is char type and 1 char long.
>
> any idea why it is not doing the comparison?


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

I am using session_start() and
session_register("variablename") . The when I click on
the back button from the browser it shows me the
following error:  "Warning: Page has Expired The page
you requested was created using information you
submitted in a form. This page is no longer available.
As a security precaution, Internet Explorer does not
automatically resubmit your information for you.   To
resubmit your information and view this Web page,
click the Refresh button. "   

How can I remove this. I have used RedHat Linux 7.2
and PHP 4.2.2 with MySQL-Max-3.23.51



=====
Best Regards,
Monil Chheda(INDIA)
http://domains.eliteral.com
===========================
===========================

__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com
--- End Message ---
--- Begin Message ---
I get the following warning which makes no sense to me.

Warning: header() expects parameter 1 to be string, array given in 
/www/htdocs/jc/administration/edit_products/show_products.php on line 96

It's true that I am passing at an array to the function, but what I 
don't understand is why the function expects a string?

How does any function know the type of an incoming var in PHP anyway?

How can I fix my code to get rid of this error (while keeping the var as 
an array)?My code looks like this:

header(array("ID","Name","Maker's Code","Maker Name","Label 
Name","Product Type"));

function header_row($aH) {
   echo "  <TR>";
   foreach ($aH as $h) {
?>
     <TH>
       <?php echo $h; ?>
     </TH>
<?php
   }
   echo "  </TR>";
}

--- End Message ---
--- Begin Message ---
You are trying to set a header() using methods not supported.  But the
really interesting bit is that you appear to be using it NOT for sending
HTTP headers, but for setting header information on a TABLE????

read http://php.net/header

...this isn't what it does.

<?
function header_row($values)
    {
    $output = "<TR>";
    foreach($values as $key => $value)
        {
        $output .= "<TH>";
        $output .= $value;
        $output .= "</TH>";
        }
    $output .= "</TR>";
    return $output;
    }

$myheaders = array("ID","Name","Maker's Code","Maker Name","Label
Name","Product Type");

echo header_row($myheaders);
?>

The above should (untested) echo the following HTML:

<TR><TH>ID</TH><TH>Name</TH><TH>Maker's Code</TH><TH>Maker
Name</TH><TH>Label Name</TH><TH>Product Type</TH></TR>

... which is what I think you're after... althoug it seems a little weird :)


Justin


    




on 03/09/02 6:20 PM, Jean-Christian Imbeault ([EMAIL PROTECTED])
wrote:

> I get the following warning which makes no sense to me.
> 
> Warning: header() expects parameter 1 to be string, array given in
> /www/htdocs/jc/administration/edit_products/show_products.php on line 96
> 
> It's true that I am passing at an array to the function, but what I
> don't understand is why the function expects a string?
> 
> How does any function know the type of an incoming var in PHP anyway?
> 
> How can I fix my code to get rid of this error (while keeping the var as
> an array)?My code looks like this:
> 
> header(array("ID","Name","Maker's Code","Maker Name","Label
> Name","Product Type"));
> 
> function header_row($aH) {
> echo "  <TR>";
> foreach ($aH as $h) {
> ?>
> <TH>
> <?php echo $h; ?>
> </TH>
> <?php
> }
> echo "  </TR>";
> }
> 

--- End Message ---
--- Begin Message ---
On Tue, 3 Sep 2002, Jean-Christian Imbeault wrote:

> Warning: header() expects parameter 1 to be string, array given in
> /www/htdocs/jc/administration/edit_products/show_products.php on line 96
>
> How can I fix my code to get rid of this error (while keeping the var as
> an array)?My code looks like this:
>
> header(array("ID","Name","Maker's Code","Maker Name","Label Name","Product Type"));

header() is a PHP function.  You're calling it with an invalid arguement.
(I think you're just calling the function you want by the wrong name, tho.)

> function header_row($aH) {

Try calling header_row(), instead of header(), with your array argument,
since it seems that you already have the proper function defined.

        g.luck,
        ~Chris

--- End Message ---
--- Begin Message ---
Justin French wrote:
> But the
> really interesting bit is that you appear to be using it NOT for sending
> HTTP headers, but for setting header information on a TABLE????

Oops!!

I had defined my own function called header() without even stopping to 
think there was already a PHP header() function.

Silly me ...

Jc

--- End Message ---
--- Begin Message ---
hi there i was wondering if there was a way to limit the ammount of items in
a loop to execute sleep then execute the rest of the items to prevent server
load ?


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

Op dinsdag 03 september 2002 10:46, schreef u:
> hi there i was wondering if there was a way to limit the ammount of items
> in a loop to execute sleep then execute the rest of the items to prevent
> server load ?

for($i=0;.......)
{
if($i>0&&$i%100==0)sleep(10);
}
--- End Message ---
--- Begin Message ---
the mail server is hosted on the mail server. i think thats whats casuing
the problem.
how can i get around this?

i use unix. i remember a command to find out the smtp server.. anyone know?
cheers


"Manuel Lemos" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello,
>
> On 09/02/2002 07:59 AM, :B Nerdy wrote:
> > what is recommended to use instead of mail() then?
>
> It depends on what is your problem. In most cases mail will do taking
> some care that may be platform dependent like the header line break
> issues that have to be \r\n under Windows but under Unix with sendmail
> or wrappers you'd better use \n .
>
> Anyway, if you use the class I mentioned you will be able to choose
> exactly the transport method that suits better your needs and platform
> constraints.
>
> In your case, maybe using the sendmail sub-class will give you enough
> control because it lets you call sendmail program wherever it is in your
> disk passing any command line switches to better control its operation
> without depending on any php.ini (except for safe mode that has to be
off).
>
> Manuel Lemos
>
>
> > cheers
> >
> >
> > "Manuel Lemos" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> >
> >>Hello,
> >>
> >>On 09/01/2002 02:30 AM, Liam Mackenzie wrote:
> >>
> >>>It seems nearly everyone has a problem with this function, probably
> >>
> > because
> >
> >>>it relies on third party software.
> >>
> >>Yes, mail() is probably the most problematic of the frequently used
> >>functions of PHP. That can be for many reasons like the need for manual
> >>configuration of PHP, useless/meaningless or non-existing error messages
> >>produced by mail(), inconsistent documentation of mail() in PHP manual,
> >>installation problems of the MTA, configuration problems of the user
> >>networks, anti-spam measures, etc...
> >>
> >>The main difficulty is that it takes a lot of expertise to figure out
> >>which of these problems are affecting you.
> >>
> >>
> >>
> >>>It doesn't work.  That's my problem!
> >>>I'm using Sendmail as my MTA, not running as a Daemon as I have
> >>
> > POP3/SMTP
> >
> >>>server running on the same
> >>>machine (eXtremail)
> >>>I'm starting Sendmail like this:
> >>>/usr/lib/sendmail -q1h
> >>>
> >>>When I do this:
> >>>$this = mail("[EMAIL PROTECTED]", "Subject", "Message goes here");
> >>>echo $this;
> >>>
> >>>The scripts hangs, and eventually my browser times out.
> >>>Is there any way I can get some error messages?  Or at least get it to
> >>
> > tell
> >
> >>>me what on earth it's doing?
> >>
> >>Adding -v to the configuration of sendmail in php.ini may provide you a
> >>clue. Anyway, my guess is that your machine may not have a reverse DNS
> >>address. What is its IP?
> >>
> >>
> >>
> >>>There's nothing in any of my Apache logs, nothing in eXtremail's logs,
> >>
> > but I
> >
> >>>get this in my syslog...
> >>>
> >>>Sep  1 15:28:01 nudenurd sendmail[19146]: g815S1fW019146: from=nobody,
> >>>size=63, class=0, nrcpts=1,
> >>>msgid=<[EMAIL PROTECTED]>,
> >>>relay=nobody@localhost
> >>
> >>It seems you are missing seting th return-path. Use mail() 5th argument.
> >>
> >>
> >>
> >>>Anyone got any ideas?  Anyone know if there's any docs on this kind of
> >>>thing?  I looked, I failed...
> >>>Or where I can get some information on where to get an alternate MTA
> >>
> > that
> >
> >>>WORKS out of the box (or tar.gz)
> >>
> >>If all else fails, you may want to try this PHP class, with several
> >>variants that let you send messages by several methods besides mail(),
> >>like: using sendmail directly, using qmail-inject or even relay on
> >>specific SMTP server or even the most drastic measure that is to send
> >>messages directly to the receipient SMTP server.
> >>
> >>http://www.phpclasses.org/mimemessage
>
>
> --
>
> Regards,
> Manuel Lemos
>


--- End Message ---
--- Begin Message ---
I try to transform a html file in -php file, but i have errors in it("Error in page.")
Where is mistake?

index.php WRONG
<?
echo <<<END
<HEAD>
<script language="JavaScript" src="date-picker.js"></script>
</HEAD>
<BODY>
<center>
<form name=calform>
<input type=text name="datebox" size=15><a 
href="javascript:show_calendar('calform.datebox');" onmouseover="window.status='Date 
Picker';return true;" onmouseout="window.status='';return true;"><img 
src="show-calendar.gif" width=24 height=22 border=0></a>
</form>
</center>
</BODY>
END;
?>

index.html GOOD:
<HEAD>
<script language="JavaScript" src="date-picker.js"></script>
</HEAD>
<BODY>
<center>
<form name=calform>
<input type=text name="datebox" size=15><a 
href="javascript:show_calendar('calform.datebox');" onmouseover="window.status='Date 
Picker';return true;" onmouseout="window.status='';return true;"><img 
src="show-calendar.gif" width=24 height=22 border=0></a>
</form>
</center>
</BODY>

tx in adv for any help
Ady
--- End Message ---
--- Begin Message ---
hello!

i found a nice function that i would like to use but unfortunately there is
a problem i can not solve.

for my notepool device it would be great to use php's wordwrap function but
because the string that needs to be wordwrapped contains also html tags i
can not use this function like this.

on php.net (manual: wordwrap) i found a user contribution with a wordwrap
function that skips html tags (and forces words to split at a desired
width). the bad thing about it is that in the output some characters are
missing.


example:

as i enter this url into my form:
http://www2.snm-hgkz.ch/~rieger/notepool/addnote.php


that's the output:

h
tp://www2.snm-hgkz
ch/~rieger/notepool/
ddnote.php

(obviously some caracters are missing, the first 't' of http or the 'a' of
addnote.php for instance.)

can you tell me what needs to be modified to get rid of this side effect (or
do you have another idea how to use wordwrap in a way it skips html tags and
forces words to split)?


----------------------------------------------------------------------------
this is the function:

function sheep_wordwrap($str,$cols,$non_prop,$cut,$exclude1,$exclude2){
$count=0; 
$tagcount=0; 
$str_len=strlen($str);
//$cut=" $cut "; 
$calcwidth=0; 

for ($i=1; $i<=$str_len;$i++){
$str_len=strlen($str);
if ($str[$i]==$exclude1)
$tagcount++; 
elseif ($str[$i]==$exclude2){
if ($tagcount>0) 
$tagcount--; 
} 
else{ 
if (($tagcount==0)){
if (($str[$i]==' ') || ($str[$i]=="\n"))
$calcwidth=0; 
else{ 
if ($non_prop){ 
if (ereg("([QWOSDGCM#@m%w]+)",$str[$i],$matches))
$calcwidth=$calcwidth+7;
elseif (ereg("([I?\|()\"]+)",$str[$i],$matches))
$calcwidth=$calcwidth+4;
elseif (ereg("([i']+)",$str[$i],$matches))
$calcwidth=$calcwidth+2;
elseif (ereg("([!]+)",$str[$i],$matches))
$calcwidth=$calcwidth+3;
else{ 
$calcwidth=$calcwidth+5;
} 
} 
else{ 
$calcwidth++; 
} 
if ($calcwidth>$cols){
$str=substr($str,0,$i-1).$cut.substr($str,$i,$str_len-1);
$calcwidth=0; 
} 
} 
} 
} 
} 
return $str; 
//moby rules at 5am! :)
}

----------------------------------------------------------------------------
and here i call it:

$str = $message;
$cols = 100;
$cut = "\n";
$non_prop = "true";
$exclude1 = "<";
$exclude2 = ">";

$str = sheep_wordwrap($str,$cols,$non_prop,$cut,$exclude1,$exclude2);
echo $str;



thanks a lot for your help!

philipp



----------------------------------------------------------------------------
* http://www2.snm-hgkz.ch/~rieger/

--- End Message ---
--- Begin Message ---
I would like to know how many PHP page apache generates in one thread at the
same time.

For example, two clients share the same thread of the apache web server.
they request at the same time a php page. Does apache process them one by
one?

I use persistant database connections and I wonder, if one connection is
always in use by one page or by more?

Heiko


--- End Message ---

Reply via email to