php-general Digest 19 Mar 2005 17:53:02 -0000 Issue 3347

Topics (messages 211086 through 211105):

fopen
        211086 by: John Taylor-Johnston
        211087 by: John Taylor-Johnston
        211088 by: John Taylor-Johnston
        211089 by: Christopher Evans
        211097 by: John Taylor-Johnston

send email sample
        211090 by: issin
        211091 by: david joffrin
        211092 by: Burhan Khalid
        211096 by: John Taylor-Johnston

Re: does your mail() base64 encode messages?
        211093 by: Burhan Khalid
        211094 by: John W. List

sessioncookies?
        211095 by: Ken

Re: How from an html/web form I may go to a php script output(of form values)
        211098 by: Leonidas Savvides
        211099 by: Forest Liu
        211102 by: Philip Olson

Re: Setting cookies for other domains
        211100 by: Jason Wong

PHP 5 DOM, XPath, UTF-8, and Form Input
        211101 by: C Drozdowski

Re: [PHP-WIN] setting php for accepting the urls... 
phpinfo.php/extra/information/
        211103 by: Leif Gregory

looking for address finder..uk
        211104 by: AndreaD

Re: Referer checking is able to be referer spoofed
        211105 by: Dan Rossi

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:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Hi,
FOpen question. My script is dying. "Our results file could not be opened for 
writing"

What can I add to get more info from the die? Do I «have» to specify a pathname 
in $defaultfile?

John

 $defaultfile = "ffmail.txt"; #default file to write to
@ $results = fopen($datafilename, "a");  #open file and supress errors
 #print custom error if file doesn't exist or improper permissions
 if (!$results) { die ("Our results file could not be opened for writing."); }

--- End Message ---
--- Begin Message ---
P.S., I've checked the doc and tried "a+". It still does not create ffmail.txt.

@ $results = fopen($datafilename, "a+");
# Open for reading and writing; place the file pointer at the end of the file.
#If the file does not exist, attempt to create it

It does not create it.

John


> FOpen question. My script is dying. "Our results file could not be opened for 
> writing"
> What can I add to get more info from the die? Do I «have» to specify a 
> pathname in $defaultfile?
>
> John
>
>  $defaultfile = "ffmail.txt"; #default file to write to
> @ $results = fopen($datafilename, "a");  #open file and supress errors
>  #print custom error if file doesn't exist or improper permissions
>  if (!$results) { die ("Our results file could not be opened for writing."); }

--
John Taylor-Johnston
-----------------------------------------------------------------------------
"If it's not Open Source, it's Murphy's Law."

  ' ' '    Collège de Sherbrooke:
 ô¿ô    http://www.collegesherbrooke.qc.ca/languesmodernes/
    -     819-569-2064

  °v°   Bibliography of Comparative Studies in Canadian, Québec and Foreign 
Literatures
 /(_)\  Université de Sherbrooke
  ^ ^   http://compcanlit.ca/ T: 819.569.2064

--- End Message ---
--- Begin Message ---
I could use:
 or die($php_errormsg);
but it is turned off in my php.ini and I can't modify it myself.

John


> FOpen question. My script is dying. "Our results file could not be opened for 
> writing"
>
> What can I add to get more info from the die?
>
>  $defaultfile = "ffmail.txt"; #default file to write to
> @ $results = fopen($datafilename, "a");  #open file and supress errors
>  #print custom error if file doesn't exist or improper permissions
>  if (!$results) { die ("Our results file could not be opened for writing."); }

--- End Message ---
--- Begin Message ---
try $results = fopen($datafilename, "w+");

I am newbie at php so that may not work.

--
--chris
1-916-501-1423
<a href="http://bbx.flnet.org/nxdos/";>http://bbx.flnet.org/nxdos/</a>

--- End Message ---
--- Begin Message ---
Hi,
W+ does not work either.
I have resorted to adding a blank, 0 byte text file.
But it needs chmod 666.
Interesting, I add this line:

 chmod($defaultfile, 666);

and it send back an illegal error, but it appears to work anyway - the data is 
written!

What does the at_sign mean at the start of this line?

@ $results = fopen($datafilename, "w+");


> try $results = fopen($datafilename, "w+");

$defaultfile = "/home/johj2201/public_html/ffmail.txt"; #default file to write 
to
...
chmod($defaultfile, 666);
...
@ $results = fopen($datafilename, "w+");
 if (!$results) { die ("Our results file could not be opened for writing.  Your 
score was not recorded.  Please contact the person responsible and try again 
later."); }
 flock($results, 2); #lock file for writing
 fwrite($results, $filestr); #write $filestr to $results
 flock($results, 3); #unlock file
 fclose($results); #close file

--- End Message ---
--- Begin Message ---
Dear all,

 

           Can you give me a send email sample?

           Thanks!

 

Best Regards,

Issin Yeung



________ Information from NOD32 ________
This message was checked by NOD32 Antivirus System for Linux Mail Server.
http://www.nod32.com

--- End Message ---
--- Begin Message ---
Very simple sample:
                // Send a mail to [EMAIL PROTECTED]
                $headers = "From: \"Webmaster\"<[EMAIL PROTECTED]>";
                $mailtext = trim($_POST["email"]);
                $mailtext .= " is joining the family.\n";
                mail('[EMAIL PROTECTED]', 'New Registration', $mailtext, 
$headers);

I am using the "fake sendmail" windows tool.... very simple to configure, maybe a bit slow though.

David Joffrin
www.bidnplay.com

From: "issin" <[EMAIL PROTECTED]>
To: <php-general@lists.php.net>
Subject: [PHP] send email sample
Date: Sat, 19 Mar 2005 15:25:12 +0800

Dear all,



           Can you give me a send email sample?

           Thanks!



Best Regards,

Issin Yeung



________ Information from NOD32 ________
This message was checked by NOD32 Antivirus System for Linux Mail Server.
http://www.nod32.com

--- End Message ---
--- Begin Message --- issin wrote:
Dear all,



           Can you give me a send email sample?

Thanks!

RTFM : http://www.php.net/manual/en/function.mail.php

--- End Message ---
--- Begin Message ---
Burhan Khalid wrote:

> >            Can you give me a send email sample?
> RTFM : http://www.php.net/manual/en/function.mail.php

Burhan,
That's awfully polite. "RTFM". How are people supposed to get started? Take 
that attitude back over to the Perl newsgroup. One of the joys of PHP has been 
a non-techhead, non-stressful, Open Source spirit of teaching and helping 
others, which in turn helps PHP grow and flourish.

Issin,
Go have a look at:
http://compcanlit.usherbrooke.ca/eslcafe/hotpotatoes/hot-potatoes_102.htm
That will get you started. And yes, by all means you should check the manual: 
http://www.php.net/manual/en/ and this article in particular: 
http://www.php.net/manual/en/function.mail.php
HTH :)
John

--- End Message ---
--- Begin Message --- John W. List wrote:
I have an unexpected and perplexing problem.
PHP's mail() function is base64 encoding all message bodies as an
ill-formed MIME attachment resulting in the recipient seeing an
uninteligable base64 encoded string. This only happens to my account
with my host and neither I or the sysadmin can see why as there are no
special configuration settings for me. The host is running PHP4.3.10.

Here's what is happening:
This code
<?php
mail ( "[EMAIL PROTECTED]", "test script", "Foo!", "");

Try mail("[EMAIL PROTECTED]","test script","Foo!");

Don't send empty headers -- it might be causing the problem. Fwiw, I have never encountered this issue.
--- End Message ---
--- Begin Message ---
> Try mail("[EMAIL PROTECTED]","test script","Foo!");

Thanks very much for your suggestion- It did not fix the problem but
it provided a pointer to a workaround.

It appears that my host base64 encodes message bodies if any sort of
header- even an empty one- is supplied. This is a problem the sysadmin
is looking into but for now I have to live with it.

The empty header caused mail() to put a \n in between the headers and
the MIME headers for the base64 encoded stuff. This in turn caused
mail readers to view the message as a plain text message that happened
to contain a base64 encoded string so the recipient saw gibberish.
Removing the empty header resulted in a plain text message, putting a
valid header in the headers parameter caused the mail to be viewed by
the mail reader as a normal base64 encoded message and thus readable
by the recipient. Unfortunately mail()'s habit of doing this base64
encoding precludes me from doing anything with MIME multipart messages
because all the multipart separators, HTML etc become visible as plain
text, but at least I can send emails containing plain text.

And so to the commercial application which originally showed up this
problem. Its mail code had an extra \n at the end of its headers.
Removing this made it possible for it to send plain text emails,
albeit base64 encoded ones, from this host. I've used this application
from quite a few other customers hosts in the past so this \n is not
normally a problem, but I've never used a host that exhibits this
behaviour. As well as removing this \n I had to comment out the lines
that sent multipart emails but at least now I'm in business.

As to the problem itself, I'm none the wiser. As I see it it can only
be either PHP or Sendmail that is doing this. I've never had this or
any other version of PHP do this to me before but since as I
understand it Sendmail is only being used as a mail relay here I cant
place the blame anywhere else but a possible bug in PHP 4.3.10's
mail() function. It's not a bug, it's a feature!:)

I guess it's all extra experience.
John W. List

--- End Message ---
--- Begin Message ---
if you check your cookies (if you are using firefox) you should see
multiple cookies from many sites. It is allowed and I think you can
set as much as possible. However I wouldn't because you'll probably
end up forgetting some of them and it'll become a hassle. Besides,
some browsers might reject cookies, so don't rely too heavily on
cookies. And then there is the security factor to consider... you
don't want to store too many cookies that might give away
passwords/usernames.

That's all the bad reason I can think of.

Good luck :D


On Fri, 18 Mar 2005 18:30:58 +0200, William Stokes <[EMAIL PROTECTED]> wrote:
> OK. so can I set 2 or more session cookies for the same user? Like this:
> setcookie("sess_id","$sess_id",0,"/");
> setcookie("cookie2","$another_variable",0,"/");
>
> If so is there a limit? Or is it a bad idea for some other reason?
>
> Thanks
> -Will
>
> "Ken" <[EMAIL PROTECTED]> kirjoitti
> viestissä:[EMAIL PROTECTED]
> > No, you'll have to use another cookie name.
> > Alternatively, you can use arrays
> >
> > setcookie('cookiename['arrayname']', $value, time());
> >
> >
> > On Fri, 18 Mar 2005 15:07:34 +0200, William Stokes <[EMAIL PROTECTED]>
> > wrote:
> >> Hello,
> >>
> >> I have a following line in my code to set a session cookie when user logs
> >> in. It works fine.
> >> setcookie("sess_id","$sess_id",0,"/");
> >>
> >> Can I store more information to the session cookie? I mean other
> >> variables.
> >> Like I tried it like this with no success.
> >> setcookie("sess_id","$sess_id",$another_variable,0,"/");
> >>
> >> Thanks
> >> -Will
> >>
> >> --
> >> 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 ---
If is easy please answer and this : when be online AND OPEN A FILE FROM
A WEB LOCATION HOST - MINE WITH NOTEPAD may after I modify it, save it
again to my hosting space WITHOUT save it to my PC first ? Please note
that I mean using NotePad and I mean entering the host username&password
when OPEN / SAVE ...? ATTENTION: I DO NOT MEAN SAVE IT TO MY HDD FIRST
AND AFTER UPLOAD IT !!! Please tell me the same[as for NotePad] but for
Dreamweaver MX ?
[EMAIL PROTECTED] 
-----Original Message-----
From: Forest Liu [mailto:[EMAIL PROTECTED] 
Sent: 18 March 2005 11:51
To: Leonidas Savvides
Cc: php-general@lists.php.net; [EMAIL PROTECTED]; sony-only;
[EMAIL PROTECTED]
Subject: Re: [PHP] How from an html/web form I may go to a php script
output(of form values)

I donot know what happened in Frontpage. I just use Dreamweaver to
design the page layout, and then UltraEdit to add php code.

I think you are asking about the page submit. You can find the exact
example in the php manual, which can be obtained from php.net

a.php:
<form method=post action="b.php">
      <input name=usrinfo value="Input your info here">
      <input type=submit>
</form>

b.php:
echo "your input just now is:".$_POST[usrinfo];

it will work.

On Fri, 18 Mar 2005 10:38:45 +0200, Leonidas Savvides
<[EMAIL PROTECTED]> wrote:
> How from an html/web form I may go to a php script output(of form
> values) ? I mean the programming for the result :
> 
> A visitor to webpage-A.php when press submit of a webform go to a
> webpage-B.php where as a php script uses the previous form data , and
> for example there's output of these data the exactly words the visitor
> enters ?
> 
> May this done in MS-FrontPage2002 ?
> 
> THE SCRIPT IN MS-FrontPage2002 HTML MODE NO EXECUTED BUT IS LIKE NO
> EXIST , UNLIKE THE CODE HAS ALREADY SCRIPT COLOR IN HTML MODE OF
> FRONTPAGE AND ALSO PHP SCRIPT FILE NAME xxx.php IS IN THE WEB FORM
> PROPERTIES ? ... I INSERT PHP SCRIPT IN <SCRIPT> ..... </SCRIPT> TAGS
?
> AND ALSO I TRY DELETE PHP SCRIPT INSERTING ONLY ONE COMMAND THE:
> <Script>
> echo "this operate till here";
> </Script>
> BUT AGAIN THE SAME RESULT .... ?
> After press SUBMIT the php script file shows in address bar and all
> viewed area is white (nothing on screen) ?
> 
> Leonidas Savvides
> [EMAIL PROTECTED]
> 
> 


-- 
          Sincerely,
                    Forest Liu(刘云?)

--- End Message ---
--- Begin Message ---
I am so sorry for my misunderstanding and leading you to anger. But I
am still not so clear yet...about your demand.

I guess you wanna say, a visitor enter his account and password, and
click 'submit', then the browser navigates to b.php to check if all
are correct. Right?

a.php:
<form method=post action="b.php">
    <input name=usrinfo value="Input your info here">
    <input type=submit>
</form>

b.php:
<?php
echo "your input just now is:".$_POST[usrinfo];
?>

it will really work.I promise.

First, make sure your script tag is <?php ... ?>, that's the default
tag for interpreter.
Secondly, HTML page is just a plain text file. You can just use
Notepad to edit it. It's not about Frontpage or Deamweaver, It's about
HTML code. Whichever tool you are using, they all generate a plain
text file named "*.html" on your HDD. Then you should upload them to a
web host space.And , they run on the server side.


On Sat, 19 Mar 2005 17:03:19 +0200, Leonidas Savvides
<[EMAIL PROTECTED]> wrote:
> If is easy please answer and this : when be online AND OPEN A FILE FROM
> A WEB LOCATION HOST - MINE WITH NOTEPAD may after I modify it, save it
> again to my hosting space WITHOUT save it to my PC first ? Please note
> that I mean using NotePad and I mean entering the host username&password
> when OPEN / SAVE ...? ATTENTION: I DO NOT MEAN SAVE IT TO MY HDD FIRST
> AND AFTER UPLOAD IT !!! Please tell me the same[as for NotePad] but for
> Dreamweaver MX ?
> [EMAIL PROTECTED]
> -----Original Message-----
> From: Forest Liu [mailto:[EMAIL PROTECTED]
> Sent: 18 March 2005 11:51
> To: Leonidas Savvides
> Cc: php-general@lists.php.net; [EMAIL PROTECTED]; sony-only;
> [EMAIL PROTECTED]
> Subject: Re: [PHP] How from an html/web form I may go to a php script
> output(of form values)
> 
> I donot know what happened in Frontpage. I just use Dreamweaver to
> design the page layout, and then UltraEdit to add php code.
> 
> I think you are asking about the page submit. You can find the exact
> example in the php manual, which can be obtained from php.net
> 
> a.php:
> <form method=post action="b.php">
>      <input name=usrinfo value="Input your info here">
>      <input type=submit>
> </form>
> 
> b.php:
> echo "your input just now is:".$_POST[usrinfo];
> 
> it will work.
> 
> On Fri, 18 Mar 2005 10:38:45 +0200, Leonidas Savvides
> <[EMAIL PROTECTED]> wrote:
> > How from an html/web form I may go to a php script output(of form
> > values) ? I mean the programming for the result :
> >
> > A visitor to webpage-A.php when press submit of a webform go to a
> > webpage-B.php where as a php script uses the previous form data , and
> > for example there's output of these data the exactly words the visitor
> > enters ?
> >
> > May this done in MS-FrontPage2002 ?
> >
> > THE SCRIPT IN MS-FrontPage2002 HTML MODE NO EXECUTED BUT IS LIKE NO
> > EXIST , UNLIKE THE CODE HAS ALREADY SCRIPT COLOR IN HTML MODE OF
> > FRONTPAGE AND ALSO PHP SCRIPT FILE NAME xxx.php IS IN THE WEB FORM
> > PROPERTIES ? ... I INSERT PHP SCRIPT IN <SCRIPT> ..... </SCRIPT> TAGS
> ?
> > AND ALSO I TRY DELETE PHP SCRIPT INSERTING ONLY ONE COMMAND THE:
> > <Script>
> > echo "this operate till here";
> > </Script>
> > BUT AGAIN THE SAME RESULT .... ?
> > After press SUBMIT the php script file shows in address bar and all
> > viewed area is white (nothing on screen) ?
> >
> > Leonidas Savvides
> > [EMAIL PROTECTED]
> >
> >
> 
> --
>          Sincerely,
>                    Forest Liu(åäè)
> 
> 


-- 
          Sincerely,
                    Forest Liu(åäè)

--- End Message ---
--- Begin Message ---
> If is easy please answer and this : when be online AND OPEN A FILE FROM
> A WEB LOCATION HOST - MINE WITH NOTEPAD may after I modify it, save it
> again to my hosting space WITHOUT save it to my PC first ? Please note
> that I mean using NotePad and I mean entering the host username&password
> when OPEN / SAVE ...? ATTENTION: I DO NOT MEAN SAVE IT TO MY HDD FIRST
> AND AFTER UPLOAD IT !!! Please tell me the same[as for NotePad] but for
> Dreamweaver MX ?

It's difficult to know what you mean exactly but I'll assume
you want to setup FTP access with your text editors as to
edit files remotely. Notepad does not have this option but
dreamweaver does (most text editors do, such as jedit,
ultraedit, editplus, etc.). Here's a tutorial for setting up
FTP with dreamweaver:

 http://macromedia.com/cfusion/knowledgebase/index.cfm?id=tn_14787

Regards,
Philip

--- End Message ---
--- Begin Message ---
On Friday 18 March 2005 10:32, Brian Dunning wrote:
> > I suspect it's
> > for sub-domains of sites you administer and not completely different
> > domains altogether.
>
> If this is true, and it's not possible for a site to set a cookie for a
> completely different domain, then why do browsers have security options
> to allow or prevent this specific action?

When you display a webpage it very often pulls in a load of crap from 
other websites (eg banner ads). These other websites are able set their 
own cookies (for their particular domains). The browser prefs are for 
preventing these 3rd party websites from setting these 3rd party cookies.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
New Year Resolution: Ignore top posted posts

--- End Message ---
--- Begin Message --- I have been doing some testing and need confirmation that the following is correct.

You have a DOMDocument that potentially contains UTF-8 encoded data (it might not however).

You want to search it via DOMXpath->query() using a value that comes from a $_POST value.

If the page that posts the data via a form to the search script IS NOT encoded in UTF-8, then the value must be converted to UTF-8 before it is used in the query expression.

Else, if the posting page IS UTF-8 encoded, then the $_POST data does not need to be converted before being used in the expression.

Is this correct?

Also, if the $_POST data comes from a UTF-8 encoded page, and it needs to be sanitized before use, will the basic PHP string functions work on the data (e.g. htmlentities, stripslashes, trim, preg_replace, etc)?

If not what do I have to do?
--- End Message ---
--- Begin Message ---
Hello Rob,

Saturday, March 19, 2005, 2:39:08 AM, you wrote:
R> could someone possibly point me in the right direction for allow
R> PHP on IIS 6 to accept urls with the query string seperated by
R> slashes..

This is called "slash arguments" and IIS can not natively handle it. I
ran into this issue setting up a Moodle <http://www.moodle.org>
installation for a client. There is a 3rd party app you can install on
an IIS server which will allow you to do this. It is free for a single
website, but if you are virtual hosting, it costs money.

It's called ISAPI Rewrite <http://www.isapirewrite.com/>

I finally ended up building them an Win2K, Apache2, MySQL, PHP5 box so
they could use Moodle to the fullest with slash arguments.


Cheers,
Leif Gregory 

-- 
TB Lists Moderator (and fellow registered end-user)
PCWize Editor  /  ICQ 216395  /  PGP Key ID 0x7CD4926F
Web Site <http://www.PCWize.com>

--- End Message ---
--- Begin Message ---
I'm looking for an address finder where a user types in a postcode and house 
number and then the user is given an option of  to houses to choose from.

Anything like this available for a small charge?


Ross 

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

On 19/03/2005, at 2:36 AM, Marek Kilimajer wrote:

Dan Rossi wrote:
On 19/03/2005, at 2:06 AM, [EMAIL PROTECTED] wrote:


I think you misunderstood me or I wasnt clear, the links are coming from a syndicate site to the main site, so we check on that domain. I am looking at other options, maybe someway of trasparently logging in ?

You were not clear at all. What are you trying to do?



Hi there Marek, here is how the system currently works. Each feed afiliate has a special number, this is used for publishing points on the streaming server aswell as loading refering domains from the database. A link to the video feed player window will happen from their server only, therefore the referer check. What I was trying to say is, one of the customers picked up , that it was using referer checks aswell as a few other things, and worked out referer spoofing software will let you in still. We need to try and avoid this, as each customer's authentication is different we cannot have another login as its not in sync. So we may have to look at other options, possibly someway of transparently logging in I dont know.

--- End Message ---

Reply via email to