php-general Digest 4 Mar 2001 09:04:25 -0000 Issue 546

Topics (messages 42465 through 42493):

help gurus: multi-dimensional array problem.
        42465 by: andrew
        42467 by: php3.developersdesk.com
        42468 by: andrew

Re: Inane ereg_replace question
        42466 by: mailing_list.gmx.at

=週末特別号=
        42469 by: randy.iris.ocn.ne.jp

(URL Translating) Apache, PHP, and the love of it all.... well, maybe not.
        42470 by: Jenni &/or Patrick
        42475 by: Yasuo Ohgaki
        42479 by: Aaron Tuller

Re: Converting String to Variable
        42471 by: Chris Adams

Re: any way to count subscribers to PHP lists?
        42472 by: Brian Clark
        42477 by: Jim Winstead

Re: Hide Include-Files from the Web
        42473 by: Yasuo Ohgaki
        42493 by: mailing_list.gmx.at

Static Classes
        42474 by: ADnoctum

Re: [PHP-DEV] pspell/aspell breaking
        42476 by: Mike Robinson

stumped on mailing a complete page
        42478 by: Brett
        42480 by: Lewis Bergman
        42481 by: Philip Murray
        42484 by: kevin1
        42487 by: Simon Garner

Problems with IIS4 (Win2k)
        42482 by: Josh McDonald
        42483 by: Ernest E Vogelsinger
        42485 by: Josh McDonald

Re: PHP and printing
        42486 by: fano

Re: IE 5.5,authentication,PHP sessions: IE never stops running?
        42488 by: Ken

Content-Type: image/gif and send the image in hex
        42489 by: Eelco de Vries

How big is too big?
        42490 by: Joe Sheble (Wizaerd)

Re: [PHP-WIN] Re: IE 5.5,authentication,PHP sessions: IE never stops running?
        42491 by: John Henckel

Re: Stripping HTML selectively?
        42492 by: Erick Papadakis

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]


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


help! :)>

I'm trying to return a list of links under associated categories from a
database table that has the fields: "linkID, category, name, url".

I'm selecting the fields and then trying to construct a multi-dimensional
array so that the correct items get put into it (and then printed out):

//connect to database, get results.
$link_id = mysql_connect($host, $usr, $pass) or die (mysql_error());
mysql_select_db($database, $link_id);
$sql="select category, name, url from links";
$result = mysql_query($sql, $link_id) or die ("no results");

//buil multi-dimensional array where $category[$name[$url]]

while($row=mysql_fetch_array($result)) //read a row into array
    {
    extract($row); //populate $category, $name, $url variables
    $links = array($category => array($name, $url)); //build multi-D array.
    }

// print list of categories with local anchors
// and under each category print link name and url
        
while (list($category) = each($links))
    {
    echo ("<a href=\"$PHP_SELF?#$category\">$category</font></a>");
                
        while (list($name, $url) = each ($links[$category]))
        {
        echo ("<a href=\"$url\">$name</a>");
        }
    }

right now this is only printing ONE category, and numerical index values
that contain $name and $url at the same level.

thanks for ANY suggestions!
cheers,
andrew





Addressed to: andrew <[EMAIL PROTECTED]>
              [EMAIL PROTECTED]

** Reply to note from andrew <[EMAIL PROTECTED]> Sat, 03 Mar 2001 14:26:30 -0500
>
> help! :)>
>
> I'm trying to return a list of links under associated categories from a
> database table that has the fields: "linkID, category, name, url".
>
> I'm selecting the fields and then trying to construct a multi-dimensional
> array so that the correct items get put into it (and then printed out):
>

Why build an array, and store ANOTHER copy of all the data in memory
while the script runs?  That is just a waste of memory...


   SELECT Category, Name, URL FROM Links ORDER BY Category, Name;



To display them:

$OldCategory = '';

while( list( $Category, $Name, $URL ) = mysql_fetch_row( $Result )) {

   if( $OldCategory != $Category ) {
      print "Category Header $Category<BR>\n";

      $OldCategory = $Category;
      }

   print "<A href=\"$URL\">$Name</a><BR>\n";
   }





Rick Widmer
Internet Marketing Specialists
http://www.developersdesk.com




Because I want to display it like this:


category1 (href anchor to category1 below)
category2
category3


category1
    link1
    link2
    link3

category2
    link1
    etc...



On 3/3/01 2:49 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:

> Addressed to: andrew <[EMAIL PROTECTED]>
>             [EMAIL PROTECTED]
> 
> ** Reply to note from andrew <[EMAIL PROTECTED]> Sat, 03 Mar 2001 14:26:30
> -0500
>>   
>> help! :)>
>>   
>> I'm trying to return a list of links under associated categories from a
>> database table that has the fields: "linkID, category, name, url".
>>   
>> I'm selecting the fields and then trying to construct a multi-dimensional
>> array so that the correct items get put into it (and then printed out):
>>   
> 
> Why build an array, and store ANOTHER copy of all the data in memory
> while the script runs?  That is just a waste of memory...
> 
> 
>  SELECT Category, Name, URL FROM Links ORDER BY Category, Name;
> 
> 
> 
> To display them:
> 
> $OldCategory = '';
> 
> while( list( $Category, $Name, $URL ) = mysql_fetch_row( $Result )) {
> 
>  if( $OldCategory != $Category ) {
>     print "Category Header $Category<BR>\n";
> 
>     $OldCategory = $Category;
>     }
> 
>  print "<A href=\"$URL\">$Name</a><BR>\n";
>  }
> 
> 
> 
> 
> 
> Rick Widmer
> Internet Marketing Specialists
> http://www.developersdesk.com





this will work:
ereg_replace(" *: *",":",$b);
I don't know why you use an OR!
If you only wanted to know WHY this doesn't work:
the searchstrings overlap (abc is poisitioned BEFORE cde - so the parser
only will see abc in abcdefghiabcdefghi but not cde in XdefghiXdefghi!!

$a="abcdefghi";
$a.=$a;
echo ereg_replace("abc|def","X",$a)."\n";
echo ereg_replace("def|abc","X",$a)."\n";
echo ereg_replace("abc|cde","X",$a)."\n";
echo ereg_replace("cde|abc","X",$a)."\n";

OUTPUT:
XXghiXXghi
XXghiXXghi
XdefghiXdefghi
XdefghiXdefghi

michi
> php 3.xx
> 
> $a="to be or not      :    to to be";
> 
> $b=ereg_replace(" *:",":",$b);
>   $b=ereg_replace(": *",":",$b);
> 
> works and
> 
> $b=ereg_replace(" *:|: *",":",$b); 
> 
> does not work. I've had this problem before and ended
> up using two or more statments rather than one.

-- 
Sent through GMX FreeMail - http://www.gmx.net




------- ☆★ IBMフォーラム2001開催 ★☆ ------- 2001.03.03 ----- 週末を楽しく過ごすためのサイトをお知らせ致します。 http://www9.xdsl.ne.jp/~jmp/index.html -------------------------------------------------------------- 情報提供企業からのご依頼によりこのメールを配信しております。 受信メールのカテゴリー変更・アドレス変更・今後このメールが不要の場合 このメールを「返信扱い」にてメイルイン宛までお送りください。 (新規作成でのメール送信では削除できません) メイルイン [EMAIL PROTECTED]



I'm going to start with a nice simple, hopefully, questions.

Some of you may have seen PCWorld.com - and its urls that are like
http://www.pcworld.com/news/view/0,aid,3911,00.asp. This is achieved with a
product called XCache (for IIS, visit www.xcache.com), wich translates this
url into http://www.pcworld.com/news/view.asp?aid=3911.

Now, you can probably do this in regex, and use the mod_rewrite, but this is
not available to me, so we can all forget that one right away ;-).

I have created a 404-processor that does the conversion (and even checks if
the resultant page exsists, by using a simple file_exists();).

Apache (or was it PHP? Or a combination of the above?) used to, when you
said Header ("Location: /localpath"), just serve up the content, without
doing a redirect. Under Apache/1.3.17 & PHP/4.0.4 this does not happen.

Is there a way to do this redirect internally - ie. the browser is not even
aware that the URL is different from the one it requested, let alone the
visitor.

And no, frames are not really an option: because it would defeat one of the
reasons I want  to do this internally, which is to prevent the need to do
two requests.

Hopefully someone will understand this (I'm sure there will be many), and be
able to guide towards something that will work.

Thanks,
Patrick.





> I'm going to start with a nice simple, hopefully, questions.
>
> Some of you may have seen PCWorld.com - and its urls that are like
> http://www.pcworld.com/news/view/0,aid,3911,00.asp. This is achieved with
a
> product called XCache (for IIS, visit www.xcache.com), wich translates
this
> url into http://www.pcworld.com/news/view.asp?aid=3911.
>
> Now, you can probably do this in regex, and use the mod_rewrite, but this
is
> not available to me, so we can all forget that one right away ;-).
>
> I have created a 404-processor that does the conversion (and even checks
if
> the resultant page exsists, by using a simple file_exists();).
>
> Apache (or was it PHP? Or a combination of the above?) used to, when you
> said Header ("Location: /localpath"), just serve up the content, without
> doing a redirect. Under Apache/1.3.17 & PHP/4.0.4 this does not happen.

How about  include()? Instead of redirect.

FYI.
Location: header must be absolute URI. (Content-Location: can be relative
URI)
Most browsers accept relative URI, though.

> Is there a way to do this redirect internally - ie. the browser is not
even
> aware that the URL is different from the one it requested, let alone the
> visitor.
>
> And no, frames are not really an option: because it would defeat one of
the
> reasons I want  to do this internally, which is to prevent the need to do
> two requests.

If you want to prevent multiple requests to server, you should not use
Location:
header.

>
> Hopefully someone will understand this (I'm sure there will be many), and
be
> able to guide towards something that will work.

Hope I understand your mail.

Regards,

Yasuo Ohgaki

> Thanks,
> Patrick.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>




that's easy.

don't redirect, just do an include() on the PHP file you actually 
want, or if you're using some fancy caching system and alrady have 
the output in a file, do a readfile().

then use Apache's ForceType.

I think it's like:

<Location /news>
ForceType application/x-httpd-php
</Location>

something like that.

then make a file called "news" in the DocumentRoot directory that's like:

$path_array = explode('/', $REQUEST_URI);
$numPathElements = count($path_array);

then loop through the elements and do what you need, you might need 
to use strtok() if you're expecting slashes in your arguments.

put the name of the script in a var, either do a regex or parse_str() 
on the rest of the URI to set the vars you need (like aid=3911)

and then do a include() with the script name.

the URL will never change in the browser, it's one request, and you 
can make a very generic URL parsing script to make your URLs pretty. 
you can set DocumentRoot to this script and then you can have URLs 
like:

http://www.myserver.com/index.html

where actually your script is doing the work.  maybe it includes a 
file called index.html and adds ads on the top or something.  and 
with output buffering you can get even more power, i use output 
buffering to change all my image tags on the fly to a different 
server, but for the people who write the HTML code, they don't need 
to care about it.  PHP is good stuff.

ask if you need more help.

-aaron

At 9:13 AM +1300 3/4/01, Jenni &/or Patrick wrote:
>I'm going to start with a nice simple, hopefully, questions.
>
>Some of you may have seen PCWorld.com - and its urls that are like
>http://www.pcworld.com/news/view/0,aid,3911,00.asp. This is achieved with a
>product called XCache (for IIS, visit www.xcache.com), wich translates this
>url into http://www.pcworld.com/news/view.asp?aid=3911.
>
>Now, you can probably do this in regex, and use the mod_rewrite, but this is
>not available to me, so we can all forget that one right away ;-).
>
>I have created a 404-processor that does the conversion (and even checks if
>the resultant page exsists, by using a simple file_exists();).
>
>Apache (or was it PHP? Or a combination of the above?) used to, when you
>said Header ("Location: /localpath"), just serve up the content, without
>doing a redirect. Under Apache/1.3.17 & PHP/4.0.4 this does not happen.
>
>Is there a way to do this redirect internally - ie. the browser is not even
>aware that the URL is different from the one it requested, let alone the
>visitor.
>
>And no, frames are not really an option: because it would defeat one of the
>reasons I want  to do this internally, which is to prevent the need to do
>two requests.
>
>Hopefully someone will understand this (I'm sure there will be many), and be
>able to guide towards something that will work.
>
>Thanks,
>Patrick.
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]





On 3 Mar 2001 08:02:16 -0800, Randy Johnson <[EMAIL PROTECTED]> wrote:
>Is there anyway to convert a string to a variable
>
>example
>
>$str="monday"; 
>
>I would like to then do this:
>
>$monday="blah";

extract() does something like that for arrays. There's no way to write the code
the way you have it, but you could use this syntax, which is equivalent:
        $$str = "blah";
        $GLOBALS[$str] = "blah";





Hi Ned,

@ 9:27:57 AM on 3/3/2001, Ned Lilly wrote:

> Hi, I'm wondering if there's an ezmlm equivalent of the "lists-full"
> command for majordomo.   That command returns data like the
> following (from the PostgreSQL list):

While not exactly what you wanted, this may provide some of those
statistics:

http://www.zend.com/cgi-bin/m_stats.pl?list=php-general&date=200101
http://www.zend.com/cgi-bin/m_stats.pl?list=php-general&date=200102
http://www.zend.com/cgi-bin/m_stats.pl?list=php-general&date=200103

January 2001, February 2001, and March 2001 respectively.

-Brian
--
 Please do not carbon copy me on list replies.






In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
wrote:
> Hi, I'm wondering if there's an ezmlm equivalent of the "lists-full"
> command for majordomo.   That command returns data like the following
> (from the PostgreSQL list):

no ezmlm equivalent that i'm aware of, but here's the subscription
figures for the php lists:

php-announce   3031
php-beta    333
php-cvs    134
php-cvs-digest      1
php-cvs-daily    525
php-cvs-daily-digest      3
php-cvsroot      4
php-db   1167
php-db-digest    577
php-dev    659
php-general   1914
php-general-digest    974
php-gtk    187
php-gtk-digest      1
php-i18n    168
php-i18n-digest     82
php-install    627
php-install-digest    366
php-kb   2556
php-lang     23
php-lang-digest      0
php-migration    133
php-migration-digest     49
php-mirrors     33
php-notes      8
php-notes-digest      0
php-pear    377
php-qa     60
php-qa-digest      0
php-template    126
php-template-digest     15
php-test      3
php-windows    544
php-windows-digest    329
phpdoc    244

jim




> Hi!
>
> I want my include-files not be seen from outside AND not be executed!!!
> I don't have access to a directory outside DOCUMENT_ROOT and I don't have
> .htaccess!!!
>
> I think about something like:
> 1.
> name: <file>.inc.php
> 2.
> add code:
> if ($PHP_SELF==MY_NAME) exit;
> as first line in the inluded script.
> so, if the script is being included from another script, the code will be
> executed - but if the file will be called directly, no code is executed!
> BUT - how do I get the include-file's name?
>
> or is it safe enough, to use something like
> if (substr($SCRIPT_URL,-8)==".inc.php") exit;

I'm not sure what is your $SCIRPT_URL is.
It could be not safe if user request like,

test.inc.php?abc=123
test.inc.php?SCRIPT_URL=123

Since it is comparing last 8 chars and it is not using
$HTTP_SERVER_VARS['SCRIPT_NAME']
(SCRIPT_URL is a typo of SCRIPT_NAME or SCRIPT_FILENAME??)

If I were you, I will put

if (substr($HTTP_SERVER_VARS['SCRIPT_NAME'], -8) == '.inc.php' )) {
   log_error('Bad request from '.HTTP_SERVER_VARS['REMOTE_ADDR']);
    header('400: Bad Request');
//  header('403: Forbidden'); // You might use this header instead or
redirect to your own warning page.
  exit;
}


If you can use $HTTP_SERVER_VARS, using it is safer.

Regards,

Yasuo Ohgaki

>
> thanks
> michi
>
> --
> Sent through GMX FreeMail - http://www.gmx.net
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>




> > Hi!
> >
> > I want my include-files not be seen from outside AND not be executed!!!
> > I don't have access to a directory outside DOCUMENT_ROOT and I don't
> have
> > .htaccess!!!
> >
> > I think about something like:
> > 1.
> > name: <file>.inc.php
> > 2.
> > add code:
> > if ($PHP_SELF==MY_NAME) exit;
> > as first line in the inluded script.
> > so, if the script is being included from another script, the code will
> be
> > executed - but if the file will be called directly, no code is executed!
> > BUT - how do I get the include-file's name?
> >
> > or is it safe enough, to use something like
> > if (substr($SCRIPT_URL,-8)==".inc.php") exit;
> 
> I'm not sure what is your $SCIRPT_URL is.
> It could be not safe if user request like,
> 
> test.inc.php?abc=123
> test.inc.php?SCRIPT_URL=123
> 
> Since it is comparing last 8 chars and it is not using
> $HTTP_SERVER_VARS['SCRIPT_NAME']
> (SCRIPT_URL is a typo of SCRIPT_NAME or SCRIPT_FILENAME??)
> 
> If I were you, I will put
> 
> if (substr($HTTP_SERVER_VARS['SCRIPT_NAME'], -8) == '.inc.php' )) {
>    log_error('Bad request from '.HTTP_SERVER_VARS['REMOTE_ADDR']);
>     header('400: Bad Request');
> //  header('403: Forbidden'); // You might use this header instead or
> redirect to your own warning page.
>   exit;
> }
> 
> 
> If you can use $HTTP_SERVER_VARS, using it is safer.

Many thanks!
I found the following Variables, that hold the scriptname, but no
Get-Variables (as QUERY_STRING would do!)
- and calling script.inc.php?SCRIPT_NAME=xxx.php doesn't change the
Variable!!!
HTTP_SERVER_VARS["SCRIPT_FILENAME"]
HTTP_SERVER_VARS["SCRIPT_URI"]
HTTP_SERVER_VARS["SCRIPT_URL"]
HTTP_SERVER_VARS["SCRIPT_NAME"]
HTTP_SERVER_VARS["PATH_TRANSLATED"]
HTTP_SERVER_VARS["PHP_SELF"]

So - which one should I use???

Thanks
michi

-- 
Sent through GMX FreeMail - http://www.gmx.net




Hello to everyone. First time here and already I have a question: PHP has
static classes?. In C++ I could write:

class {
    void hello(void) {
        cout << "Hello, world!";
    }
} Test;

Test.hello();

Now I have a variable "Test" wich is a class that canot be instantiated nor
inherited. Can I do that in PHP?.

Thanks






FWIW, I have this setup working fine on a stock rhl7.0 box.
It still says 'indices' is spelt wrong though.  ;>

Mike Robinson

> 
> Setup:
> aspell-.32.6
> pspell-.11.2
> php-4.0.4pl1
> apache_1.3.14
> RH 7.0
> glibc 2.2-12
> gcc-2.96-69
> 
> Procedure:
> ./pspell-.11.2/configure 
> make && make install
> 
> ./aspell-.32.6/configure 
> make && make install
> 
> ./php-4.0.4pl1/configure --without-gd --with-mysql
> --with-config-file-path=/usr/local/apache/etc --enable-debug=no
> --with-pspell --with-apache=/usr/local/src/apache_1.3.14
> make && make install
> 
> ./apache_1.3.14/configure --prefix=/usr/local/apache --with-layout=GNU
> --disable-module=userdir --disable-module=include
> --activate-module=src/modules/php4/libphp4.a
> make && make install
> 
> Results in:
> Warning: PSPELL couldn't open the dictionary. reason: Unable to load the
> "aspell" module. in foo.inc on line 564
> 
> Aspell works great on the command line.  Am I missing something? 
> 
> Incidently, I can't even get php to compile with pspell-.12
> 
> Ideas?
> Seth
> 
> 
> -- 
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 




This question may have been asked a million times, but I have had no luck
searching for a difinitive answer.

I want to send a confirmation email upon receiving an order, and would like
to send the page that I display on the browser to the user.

I can not figure out how to send a page, like the links that let you mail a
page to a friend on some sites.  Any help would be much appreciated.

Thanks,
Brett





> This question may have been asked a million times, but I have had no
> luck searching for a difinitive answer.
> 
> I want to send a confirmation email upon receiving an order, and would
> like to send the page that I display on the browser to the user.
> 
> I can not figure out how to send a page, like the links that let you
> mail a page to a friend on some sites.  Any help would be much
> appreciated.
> 
> Thanks,
> Brett
Lets be clear. Do you want to send the page or just the important values 
from the page?

One way I do this is like this:
$successPage =<<<EOF
<center><h1>SUCCESS!!</h1></center>
lots of 
stuff
here.
A whole html page.
EOF

then you mail it like this
   mail('order.money.com', $headers, $successPage);

or you just loop through all the post vars and build a body from that and 
mail it.





Hi,

This might help, its a script that'll suck in a page from your site and send
it as an HTML email.

Its NOWHERE near perfect, and needs alot of fixing. But it works. It relys
on HTML Mime Mail class from http://www.heyes-computing.net/scripts/. But I
had to make a few changes to the class to make it work in Windows clients.
You have to remove all the \r's and .chr(13)'s.

I hope this helps, I've attached the script I wrote

Cheers

Philip Murray
[EMAIL PROTECTED]


----- Original Message -----
From: "Brett" <[EMAIL PROTECTED]>
To: "PHP" <[EMAIL PROTECTED]>
Sent: Sunday, March 04, 2001 2:22 PM
Subject: [PHP] stumped on mailing a complete page


> This question may have been asked a million times, but I have had no luck
> searching for a difinitive answer.
>
> I want to send a confirmation email upon receiving an order, and would
like
> to send the page that I display on the browser to the user.
>
> I can not figure out how to send a page, like the links that let you mail
a
> page to a friend on some sites.  Any help would be much appreciated.
>
> Thanks,
> Brett
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>




use

$filearray = 
file("http://www.yourstite.com/yourscript.php?some_vars=whatever");

then

$body = join (" ",$filearray);

mail($to $subject,$body);

or something like that. Maybe readfile() may be of use here to. You just 
want to read the page in as a string, so make sure that you use some 
method of HTTP GET to grab the file - then you will have the html source 
seen by the browser. Put that into a string and mail it.







From: "Brett" <[EMAIL PROTECTED]>

> This question may have been asked a million times, but I have had no luck
> searching for a difinitive answer.
>
> I want to send a confirmation email upon receiving an order, and would
like
> to send the page that I display on the browser to the user.
>
> I can not figure out how to send a page, like the links that let you mail
a
> page to a friend on some sites.  Any help would be much appreciated.
>
> Thanks,
> Brett


If you want to email them the same page that you sent to the browser, you
can do this using output buffering. In your confirmation page:


<?php
    ob_start(); // turn on output buffering
    echo "<html>";
?>

Thanks for your order!

<?php
    echo "</html>";

    // now mail the page
    $mailto = "[EMAIL PROTECTED]";
    $mailsubject = "Thanks for your order";
    $mailbody = ob_get_contents();
    $mailheaders = "From: [EMAIL PROTECTED]\nContent-Type: text/html";

    mail($mailto, $mailsubject, $mailbody, $mailheaders);

    // and output the page to the browser
    ob_end_flush();
?>


But not all mail clients can read HTML email, so it is a good idea to
provide a plain text version of the email as well. You can put both versions
of the mail in the one message using MIME. Try changing the above code
slightly, as follows:


<?php
    ...

    $mailbody = <<<END
This is a multi-part message in MIME format.

------=_NextPart_
Content-Type: text/plain

(Here goes the plain-text version of the email.)
Dear Customer,

Thanks for your order.

------=_NextPart_
Content-Type: text/html

END;
    $mailbody .= ob_get_contents(); // inserts the HTML version
    $mailbody .= "\n\n------=_NextPart_";

    $mailheaders = "From: [EMAIL PROTECTED]\n"
        . "MIME-Version: 1.0\n"
        . "Content-Type: multipart/alternative;\n"
        . " boundary=\"----=_NextPart_\"";

    mail($mailto, $mailsubject, $mailbody, $mailheaders);

    ...
?>


Have a flick through:
http://www.php.net/manual/en/ref.outcontrol.php
http://www.php.net/manual/en/function.mail.php



Cheers

Simon Garner





Hi,
    I'm having problems with IIS 4 trying to install PHP. If I install the
exe in the application mappings, I get the good old:

"CGI Error
The specified CGI application misbehaved by not returning a complete set of
HTTP headers. The headers it did return are:"

Message, and if I use the php4isapi.dll I get "The specified module could
not be found. " Can somebody tell me what I'm doing wrong?

Cheers,
-Josh







At 21:56 04.03.2001, Josh McDonald said:
--------------------[snip]--------------------
>Hi,
>    I'm having problems with IIS 4 trying to install PHP. If I install the
>exe in the application mappings, I get the good old:
>
>"CGI Error
>The specified CGI application misbehaved by not returning a complete set of
>HTTP headers. The headers it did return are:"
>
>Message, and if I use the php4isapi.dll I get "The specified module could
>not be found. " Can somebody tell me what I'm doing wrong?
--------------------[snip]-------------------- 

Make sure the entry is correct for .php extensions:
    Executable:   %phppath%\php.exe %s %s
Both "%s" must exist, or PHP will do nothing at all.




     ...ebird

   >O     Ernest E. Vogelsinger
   (\)    http://www.1-at-web.at/
    ^     ICQ#   13394035





Yeah after a net stop and net start I've got the cgi version working, but I
still can't
seem to get the PHP isapi module up.

What functionality is missing from the CGI version besides http-auth? can it
handle
uploads?

Gfunk

----- Original Message -----
From: "Ernest E Vogelsinger" <[EMAIL PROTECTED]>
To: "Josh McDonald" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Saturday, March 03, 2001 6:04 PM
Subject: Re: [PHP] Problems with IIS4 (Win2k)


> At 21:56 04.03.2001, Josh McDonald said:
> --------------------[snip]--------------------
> >Hi,
> >    I'm having problems with IIS 4 trying to install PHP. If I install
the
> >exe in the application mappings, I get the good old:
> >
> >"CGI Error
> >The specified CGI application misbehaved by not returning a complete set
of
> >HTTP headers. The headers it did return are:"
> >
> >Message, and if I use the php4isapi.dll I get "The specified module could
> >not be found. " Can somebody tell me what I'm doing wrong?
> --------------------[snip]--------------------
>
> Make sure the entry is correct for .php extensions:
>     Executable:   %phppath%\php.exe %s %s
> Both "%s" must exist, or PHP will do nothing at all.
>
>
>
>
>      ...ebird
>
>    >O     Ernest E. Vogelsinger
>    (\)    http://www.1-at-web.at/
>     ^     ICQ#   13394035
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






Hello php-general,

  Hi, I'm working with php4 and mysql on a suse 6.3
  I made a program for an ISP that creates accounts, clients,
  payments, invoices.
Everymonth they need to print like a quote (a list of every non paid
thing) its ok, I could do that, I mean in the screen... Is it possible
to print it in a printer automatically? I mean.. I dont want to view
it on the screen.. I want it to print all the records alone
Can you help me???

Thanks

-- 
Best regards,
 fano                          mailto:[EMAIL PROTECTED]








Thanks for the idea, John.

I know about the auth logout.  Unfortunately, that means that when a user clicks 
"logout", he gets a "log in" prompt!  And, in IE, he has to deliberately blank out the 
password field, THEN hit enter, THEN the prompt will come again, and he has to hit 
escape.

There's another possible path than the above, but it, too, involves a prompt coming up 
when they hit logout, and they have to clear the password field.

If, when they click "logout", and they get the first confusing "log in" prompt, they 
click "cancel", then they won't be logged out.  The browser will continue to remember 
and report their username and password.

Try explaining how to follow these instructions to an inexperienced user!

The point of my system was to use, among other things, the session cookie to determine 
whether the user is in a new session or the same one as before.  The logout button 
sets a flag in the database.  In short, then I know, when the user's browser tries to 
log in again, if he's in the SAME session, and he had previously hit logout, then I 
will have to send an auth header, with a new realm.  But if he's in a NEW session, 
then I can assume his browser no longer remembers his user/pass, so the actual user 
must've typed it, so here I will let the user proceed without sending an auth header.

If IE 5.5 refuses to clear the user/password field, and refuses to clear the session 
cookie, then I can't think of any way of him getting to log out without making him go 
through an annoying second "enter your username and password" prompt...which is most 
disappointing.

It's sounding like, thanks to this terrible behavior of IE 5.5, I may have to switch 
to not using browser authentication at all, and instead deal with the nuisance or 
security risk of passing along authentication information in the session, and 
requiring the user to click "logout" when it's time to logout (forcing a destruction 
of the information stored in the session).

Any suggestions?

- Ken

At 09:45 PM 3/3/01 -0600, John Henckel wrote:
>I, too, am using PHP with authentication and IE 5.  However I am using .htaccess to 
>generate the headers instead of PHP.  I found this text...
>
>a quote from PHP manual.....
>>Both Netscape and Internet Explorer will clear the local browser window's 
>authentication cache for the realm upon receiving a server response of 401. This can 
>effectively "log out" a user, forcing them to re-enter their username and password. 
>Some people use this to "time out" logins, or provide a "log-out" button.
>
>This doesn't answer Ken's question, but at least perhaps you can use it to provide a 
>"log-out" button.  Let me know if it works or not.
>
>At 09:57 PM 3/3/01 -0500, kenzo wrote:
>>I'm experiencing strange behavior with my user authentication scheme in my PHP app, 
>with users using IE 5.5.
>>
>>I am using browser authentication (WWW-Authenticate and 401 headers), "no cache" 
>headers, and PHP 4 sessions.
>>
>>I am finding that even when the user totally quits IE, if he then restarts IE, one 
>or both (haven't isolated for sure yet) of the following happen:
>>
>>- The browser still knows the user and password, and so will send it to the server 
>upon an authentication request under the same realm, without prompting the user.  
>(The user does NOT have "save this password" checked on the user/password prompt when 
>it first comes up.)
>>- The session is still active.  A call to session_start() returns the pre-existing 
>session, instead of getting a new one.
>>
>>If the user restarts his machine, IE no longer remembers his user and password, and 
>so a prompt is displayed upon authentication headers being sent.  And I presume (not 
>100% certain) that a new session gets created.
>>
>>Both of these are behaving like IE is still running.  Is this a known issue with IE 
>5.5?  Does it just stay running?  These symptoms make it sound like this, and less 
>like a logic problem in my PHP app.  (I have verified that the username and password 
>are sent when the user gets an authentication prompt, without the user typing 
>anything.  I'm assuming there's no possible way that a PHP session can retain this 
>information; I am reading $PHP_AUTH_USER and $PHP_AUTH_PW...there's no way these can 
>be set unless the browser were already running and the user had previously entered 
>them into their prompts, right?)
>>
>>Has anyone else run into this?  My application works perfectly under Netscape 4, IE 
>4, and Opera 5.
>>
>>Thanks,
>>Ken





Hi all,

I'm trying to make a demonstration script (using PHP) that demonstrates the
use of MIME types in HTTP headers. It should send the Content-Type header
and than sends an image to the browser in hex.
I run the script in my browser and get the bare decimal values displayed and
not the GIF image:

Content-type: image/gif
7173705655977010247000001280001280128128000128128012801281281921921921922201
92166202240643209632012832016032019
--snip--

I also tried to use:
header("Content-type: image/gif");
But no success.
I don't want to use the header() function cause it doesn't help my
demostration script show the workings.
Where does it go wrong? (See script below)

Regards;
Eelco.




<?php

// 7x1 pixel GIF image data
$img = array (
    0x47, 0x49, 0x46, 0x38, 0x37, 0x61, 0x07, 0x00, 0x01, 0x00, 0xF7, 0x00,
0x00, 0x00, 0x00, 0x00,
    0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x80,
0x80, 0x00, 0x80, 0x00,
    0x80, 0x80, 0xC0, 0xC0, 0xC0, 0xC0, 0xDC, 0xC0, 0xA6, 0xCA, 0xF0, 0x40,
0x20, 0x00, 0x60, 0x20,
    0x00, 0x80, 0x20, 0x00, 0xA0, 0x20, 0x00, 0xC0, 0x20, 0x00, 0xE0, 0x20,
0x00, 0x00, 0x40, 0x00,
    0x20, 0x40, 0x00, 0x40, 0x40, 0x00, 0x60, 0x40, 0x00, 0x80, 0x40, 0x00,
0xA0, 0x40, 0x00, 0xC0,
    0x40, 0x00, 0xE0, 0x40, 0x00, 0x00, 0x60, 0x00, 0x20, 0x60, 0x00, 0x40,
0x60, 0x00, 0x60, 0x60,
    0x00, 0x80, 0x60, 0x00, 0xA0, 0x60, 0x00, 0xC0, 0x60, 0x00, 0xE0, 0x60,
0x00, 0x00, 0x80, 0x00,
    0x20, 0x80, 0x00, 0x40, 0x80, 0x00, 0x60, 0x80, 0x00, 0x80, 0x80, 0x00,
0xA0, 0x80, 0x00, 0xC0,
    0x80, 0x00, 0xE0, 0x80, 0x00, 0x00, 0xA0, 0x00, 0x20, 0xA0, 0x00, 0x40,
0xA0, 0x00, 0x60, 0xA0,
    0x00, 0x80, 0xA0, 0x00, 0xA0, 0xA0, 0x00, 0xC0, 0xA0, 0x00, 0xE0, 0xA0,
0x00, 0x00, 0xC0, 0x00,
    0x20, 0xC0, 0x00, 0x40, 0xC0, 0x00, 0x60, 0xC0, 0x00, 0x80, 0xC0, 0x00,
0xA0, 0xC0, 0x00, 0xC0,
    0xC0, 0x00, 0xE0, 0xC0, 0x00, 0x00, 0xE0, 0x00, 0x20, 0xE0, 0x00, 0x40,
0xE0, 0x00, 0x60, 0xE0,
    0x00, 0x80, 0xE0, 0x00, 0xA0, 0xE0, 0x00, 0xC0, 0xE0, 0x00, 0xE0, 0xE0,
0x00, 0x00, 0x00, 0x40,
    0x20, 0x00, 0x40, 0x40, 0x00, 0x40, 0x60, 0x00, 0x40, 0x80, 0x00, 0x40,
0xA0, 0x00, 0x40, 0xC0,
    0x00, 0x40, 0xE0, 0x00, 0x40, 0x00, 0x20, 0x40, 0x20, 0x20, 0x40, 0x40,
0x20, 0x40, 0x60, 0x20,
    0x40, 0x80, 0x20, 0x40, 0xA0, 0x20, 0x40, 0xC0, 0x20, 0x40, 0xE0, 0x20,
0x40, 0x00, 0x40, 0x40,
    0x20, 0x40, 0x40, 0x40, 0x40, 0x40, 0x60, 0x40, 0x40, 0x80, 0x40, 0x40,
0xA0, 0x40, 0x40, 0xC0,
    0x40, 0x40, 0xE0, 0x40, 0x40, 0x00, 0x60, 0x40, 0x20, 0x60, 0x40, 0x40,
0x60, 0x40, 0x60, 0x60,
    0x40, 0x80, 0x60, 0x40, 0xA0, 0x60, 0x40, 0xC0, 0x60, 0x40, 0xE0, 0x60,
0x40, 0x00, 0x80, 0x40,
    0x20, 0x80, 0x40, 0x40, 0x80, 0x40, 0x60, 0x80, 0x40, 0x80, 0x80, 0x40,
0xA0, 0x80, 0x40, 0xC0,
    0x80, 0x40, 0xE0, 0x80, 0x40, 0x00, 0xA0, 0x40, 0x20, 0xA0, 0x40, 0x40,
0xA0, 0x40, 0x60, 0xA0,
    0x40, 0x80, 0xA0, 0x40, 0xA0, 0xA0, 0x40, 0xC0, 0xA0, 0x40, 0xE0, 0xA0,
0x40, 0x00, 0xC0, 0x40,
    0x20, 0xC0, 0x40, 0x40, 0xC0, 0x40, 0x60, 0xC0, 0x40, 0x80, 0xC0, 0x40,
0xA0, 0xC0, 0x40, 0xC0,
    0xC0, 0x40, 0xE0, 0xC0, 0x40, 0x00, 0xE0, 0x40, 0x20, 0xE0, 0x40, 0x40,
0xE0, 0x40, 0x60, 0xE0,
    0x40, 0x80, 0xE0, 0x40, 0xA0, 0xE0, 0x40, 0xC0, 0xE0, 0x40, 0xE0, 0xE0,
0x40, 0x00, 0x00, 0x80,
    0x20, 0x00, 0x80, 0x40, 0x00, 0x80, 0x60, 0x00, 0x80, 0x80, 0x00, 0x80,
0xA0, 0x00, 0x80, 0xC0,
    0x00, 0x80, 0xE0, 0x00, 0x80, 0x00, 0x20, 0x80, 0x20, 0x20, 0x80, 0x40,
0x20, 0x80, 0x60, 0x20,
    0x80, 0x80, 0x20, 0x80, 0xA0, 0x20, 0x80, 0xC0, 0x20, 0x80, 0xE0, 0x20,
0x80, 0x00, 0x40, 0x80,
    0x20, 0x40, 0x80, 0x40, 0x40, 0x80, 0x60, 0x40, 0x80, 0x80, 0x40, 0x80,
0xA0, 0x40, 0x80, 0xC0,
    0x40, 0x80, 0xE0, 0x40, 0x80, 0x00, 0x60, 0x80, 0x20, 0x60, 0x80, 0x40,
0x60, 0x80, 0x60, 0x60,
    0x80, 0x80, 0x60, 0x80, 0xA0, 0x60, 0x80, 0xC0, 0x60, 0x80, 0xE0, 0x60,
0x80, 0x00, 0x80, 0x80,
    0x20, 0x80, 0x80, 0x40, 0x80, 0x80, 0x60, 0x80, 0x80, 0x80, 0x80, 0x80,
0xA0, 0x80, 0x80, 0xC0,
    0x80, 0x80, 0xE0, 0x80, 0x80, 0x00, 0xA0, 0x80, 0x20, 0xA0, 0x80, 0x40,
0xA0, 0x80, 0x60, 0xA0,
    0x80, 0x80, 0xA0, 0x80, 0xA0, 0xA0, 0x80, 0xC0, 0xA0, 0x80, 0xE0, 0xA0,
0x80, 0x00, 0xC0, 0x80,
    0x20, 0xC0, 0x80, 0x40, 0xC0, 0x80, 0x60, 0xC0, 0x80, 0x80, 0xC0, 0x80,
0xA0, 0xC0, 0x80, 0xC0,
    0xC0, 0x80, 0xE0, 0xC0, 0x80, 0x00, 0xE0, 0x80, 0x20, 0xE0, 0x80, 0x40,
0xE0, 0x80, 0x60, 0xE0,
    0x80, 0x80, 0xE0, 0x80, 0xA0, 0xE0, 0x80, 0xC0, 0xE0, 0x80, 0xE0, 0xE0,
0x80, 0x00, 0x00, 0xC0,
    0x20, 0x00, 0xC0, 0x40, 0x00, 0xC0, 0x60, 0x00, 0xC0, 0x80, 0x00, 0xC0,
0xA0, 0x00, 0xC0, 0xC0,
    0x00, 0xC0, 0xE0, 0x00, 0xC0, 0x00, 0x20, 0xC0, 0x20, 0x20, 0xC0, 0x40,
0x20, 0xC0, 0x60, 0x20,
    0xC0, 0x80, 0x20, 0xC0, 0xA0, 0x20, 0xC0, 0xC0, 0x20, 0xC0, 0xE0, 0x20,
0xC0, 0x00, 0x40, 0xC0,
    0x20, 0x40, 0xC0, 0x40, 0x40, 0xC0, 0x60, 0x40, 0xC0, 0x80, 0x40, 0xC0,
0xA0, 0x40, 0xC0, 0xC0,
    0x40, 0xC0, 0xE0, 0x40, 0xC0, 0x00, 0x60, 0xC0, 0x20, 0x60, 0xC0, 0x40,
0x60, 0xC0, 0x60, 0x60,
    0xC0, 0x80, 0x60, 0xC0, 0xA0, 0x60, 0xC0, 0xC0, 0x60, 0xC0, 0xE0, 0x60,
0xC0, 0x00, 0x80, 0xC0,
    0x20, 0x80, 0xC0, 0x40, 0x80, 0xC0, 0x60, 0x80, 0xC0, 0x80, 0x80, 0xC0,
0xA0, 0x80, 0xC0, 0xC0,
    0x80, 0xC0, 0xE0, 0x80, 0xC0, 0x00, 0xA0, 0xC0, 0x20, 0xA0, 0xC0, 0x40,
0xA0, 0xC0, 0x60, 0xA0,
    0xC0, 0x80, 0xA0, 0xC0, 0xA0, 0xA0, 0xC0, 0xC0, 0xA0, 0xC0, 0xE0, 0xA0,
0xC0, 0x00, 0xC0, 0xC0,
    0x20, 0xC0, 0xC0, 0x40, 0xC0, 0xC0, 0x60, 0xC0, 0xC0, 0x80, 0xC0, 0xC0,
0xA0, 0xC0, 0xC0, 0xFF,
    0xFB, 0xF0, 0xA0, 0xA0, 0xA4, 0x80, 0x80, 0x80, 0xFF, 0x00, 0x00, 0x00,
0xFF, 0x00, 0xFF, 0xFF,
    0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0x21, 0xF9, 0x04,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00,
0x01, 0x00, 0x00, 0x08,
    0x07, 0x00, 0x01, 0xFC, 0x13, 0x48, 0x30, 0x20, 0x00, 0x3B
) ;

// Write content type to browser
echo "Content-Type: image/gif\n\n";

// Write GIF image data to browser
foreach ($img as $val){
        echo $val;
}
?>









Is there a practical limit one should make on a php file to be included?
I'm putting all my global variable declarations and function defintitions
into one file to be included across the site.  I had thought about splitting
them different files based on functionality, but then I thought it would be
easier to maintain one singular file broken down into sections.  But I don't
want to overtax anything... so what would be a good size limit on included
files?

Joseph E. Sheble
a.k.a. Wizaerd
Wizaerd's Realm
Canvas, 3D, Graphics,
ColdFusion, PHP, and mySQL
http://www.wizaerd.com
=================================





Ken, I didn't believe you that IE was so stupidly implemented until I tried 
it myself.  You are right, IE 5 rememebers the password even though I hit 
CANCEL on the re-authenticate prompt.  And it remembers the password even 
when I close all browser windows.

If you decide to store authentication in the session, a good way to 
generate a 32 character "token" is md5(uniqid(rand())).  You store a copy 
of this token in your database (with some expiration time) and give a copy 
of it to the user (either in the session or in a plain old cookie).

For me to implement log-out is not so easy because I am using .htaccess.  I 
guess I'll just require the crypt() of the PW to be in a cookie.  Logout 
will just put garbage into the cookie.  Hopefully no one will discover that 
they can hijack someone elses login by just deleting the cookie.  :-(

John Henckel          alt. mailto:[EMAIL PROTECTED]
Zumbro Falls, Minnesota, USA   (507) 753-2216

http://geocities.com/jdhenckel/





Thanks Brian, I have tried the allowable tags, but I need to remove the
ATTRIBUTES of a tag, not the tag itself. STRIP_TAGS totally removes the tag,
and ALLOWABLE_TAGS lets the tag be. WHat I wish to do is let the main tag be
but remove its attributes, as follows:

    Original text:
        <font class="something" style="....">Hi!</font>

    Parsed text:
        <font>Hi!</font>

Thanks/erick


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.230 / Virus Database: 111 - Release Date: 25-Jan-01




Reply via email to