php-general Digest 22 Nov 2001 11:16:44 -0000 Issue 1009
Topics (messages 75456 through 75496):
Re: Deleting from MySQL with more than one 'where' variable?
75456 by: Mike Eheler
Re: Different syntax = different performance (concatenating assignment)
75457 by: Martin Towell
Re: array_merge();
75458 by: Edgardo Rossetto
Re: AddType x-httpd-php to Root Dir ...Solution
75459 by: Jeff Hill
75460 by: Fred
How to run php files on windows millenium?
75461 by: Joelmon2001.aol.com
75463 by: T B
PHP Arrays conflicting with Javascript, PLease advise?!?
75462 by: Steve Maroney
75466 by: Martin Towell
Flash programming
75464 by: Martin Towell
75474 by: John Monfort
75483 by: Caspar Kennerdale
75488 by: Richard Black
Need a job done
75465 by: Marts
mail smtp class file
75467 by: Michael P. Carel
75473 by: Michael P. Carel
Need regular match help - possibly
75468 by: Gaylen Fraley
75469 by: Martin Towell
75482 by: liljim
75490 by: liljim
reseting cookie_lifetime
75470 by: Justin England
Re: php- cgi
75471 by: Michael Sims
Re: Authentication Options: Was AddType x-httpd-php ...
75472 by: Jeff Hill
75477 by: Fred
header("Location:...") much faster then http-equiv="refresh"? too fast?
75475 by: Avi Schwartz
75478 by: Fred
75480 by: Roko Roic
Re: Installing PHP with windows
75476 by: Nicolas Guilhot
SQL in Function
75479 by: Oosten, Sjoerd van
PHP code organization...
75481 by: Navid Yar
75494 by: Dimitris Kossikidis
parent:: constructor
75484 by: James Stewart
75485 by: Roko Roic
75492 by: CC Zona
GD, PNG
75486 by: Yamin Prabudy
begineer + coolsite
75487 by: Carry Ian
75489 by: Carry Ian
Cannot add header information...
75491 by: Per Waagen
75493 by: George Pitcher
75495 by: Jon Haworth
75496 by: Daniel Roperto - Ação Direta
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 ---
Are you getting an error, or is it simply not deleting the fields that
should match that criteria?
Mike
cosmin laslau wrote:
> Ok, there's a table with 4 fields, I want to delete from it when two
> of the variables passed (through the function below) match up with the
> table's contents. However, I have only been able to get it to work
> with one 'where' clause, not two.
>
> Here's my code for one:
>
> function delete_one_sub($sel, $field, $update)
> {
> $query = "delete from usr_stats where sel='$sel'";
> $result = mysql_db_query("f6", $query);
> }
>
> This was code for two variables:
>
>
> function delete_one_sub($sel, $field, $update)
> {
> $query = "delete from usr_stats where sel='$sel' and spec='$field'";
> $result = mysql_db_query("f6", $query);
> }
>
> However, that doesn't work. Help?
>
> Thanks.
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at
> http://explorer.msn.com/intl.asp
>
>
--- End Message ---
--- Begin Message ---
I don't know if this happens in PHP, but this is similar to C's "add one to
variable".
ie. You have three ways of adding one to a variable
1) a = a + 1
2) a += 1
3) a++ or ++a
from what I was told, 1) is slower than 2) which is slower than 3).
So it would seem that this is the same sort of thing for strings in PHP.
Martin
-----Original Message-----
From: George Whiffen [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 21, 2001 11:39 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Different syntax = different performance (concatenating
assignment)
Dear All,
I had always thought of concatenating assignment and concatenation +
assignment to the same variable
as really just syntatical variations i.e. I thought that
$data = $data . <some strings>;
and
$data .= <some strings>;
were just alternate syntaxes for the same operation. I've always tended to
use the long format on
the grounds that it was more readable and maintainable.
How wrong I was! It seems the performance on big strings can be hugely
different. I think I know
why but I'd appreciate confirmation.
I came across this when investigating a performance issue with writing out a
gz-encoded csv file
from an SQL table. The code is something like:
$data = '';
while ($row_product = mysql_fetch_array($cur_product))
{
$data = $data .
'"'.str_pad(strip_tags(strtr($row_product[product_code],'"\',','
')),40)
.'","'.str_pad(strip_tags(strtr($row_product[product_name],'"\',','
')),60)
.'","'.str_pad(strip_tags(strtr($row_product[product_desc],'"\',','
')),120)
.'"'."\r\n";
}
$Size = strlen($data);
$Crc = crc32($data);
$data = gzcompress($data);
$data = "\x1f\x8b\x08\x00\x00\x00\x00\x00" . substr($data,0,strlen($data)
-4)
. pack("V",$Crc). pack("V",$Size);
fwrite($handle,$data);
fclose($handle);
There seemed to be plenty of reasons why this ran slow (5 seconds plus on
only a couple of thousand
product rows). I suspected each of the strtr, strip_tags, str_pad and
gzcompress in turn but it
turned out that a simple change:-
$data = $data .
into
$data .=
ran an order of magnitude faster (i.e. less than 0.5s).
I guess that in the first case a working copy of $data has to be made,
whereas in the second, the
concatenation is done directly on the existing copy of data i.e. the
performance difference is just
the price of creating and throwing away two thousand copies of $data.
Does that make sense? Anyone know of other cases where alternate syntaxes
can make such a
difference to performance?
If I get some confirmation of this analysis I'll bung a note on the manual
at
http://www.php.net/manual/en/language.operators.string.php
Humbled,
George
--
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]
--- End Message ---
--- Begin Message ---
It works, thanks.
Edgardo
"Brian Clark" <[EMAIL PROTECTED]> escribió en el mensaje
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi Edgardo,
>
> @ 8:09:26 AM on 11/21/01, Edgardo Rossetto wrote:
>
> > I have a problem width array_merge(); in PHP 4 beta 2 (my ISP sucks,
sorry)
> > and i need to know if there's a similar function o way to do this.
>
> There's probably a faster/elegant way to do this, but this should
> work:
>
> <?php
> function arraymerge($one,$two)
> {
> while(list(,$x) = each($one))
> {
> $merged[] = $x;
> }
> while(list(,$y) = each($two))
> {
> $merged[] = $y;
> }
> return $merged;
> }
>
> /* example: */
>
> $one = array('foo','baz','bar');
> $two = array('baz','foo');
> $merged = arraymerge($one,$two);
>
> while(list(,$val) = each($merged))
> {
> print "$val ";
> }
> ?>
>
> --
> -Brian Clark | PGP is spoken here: 0xE4D0C7C8
> Please, DO NOT carbon copy me on list replies.
>
--- End Message ---
--- Begin Message ---
Thanks for the suggestion, but no, it was something else. What else it
was, I don't know. I took the plunge and did the "when in doubt,
upgrade" route -- the server is now:
Apache/1.3.22 -- AuthMySQL/2.30 -- PHP/4.0.6 -- mod_ssl/2.8.5 --
OpenSSL/0.9.6b
Now, 24 hr. of straight work upgrading, the problem has gone away. I
don't know which of these programs had which bug, but I did nothing
other than upgrade, albeit a 24-hr task due to the AuthMySQL issues.
Which now prompts the question, perhaps delusional from lack of sleep,
if hardly anyone is using mod_auth_mysql, as seems to be the case, what
is everyone using to authenticate access? -- especially for larger sites
(I have 70K+ pages).
Regards,
Jeff Hill
Richard Lynch wrote:
>
> Jeff Hill wrote:
>
> > AddType application/x-httpd-php html
> >
> > All users who enter any subdirectory with a .htaccess authentication
> > requirement get a 401 error instead of the pop-up authentication request
> > they should get (I use authmysql). The same thing happens if I try
> > changing my Apache httpd.conf from:
>
> Wild Guess:
> My first guess would be that the version of MySQL you used with authmysql
> and the version of MySQL you compiled into Apache are not matching up, and
> end up tromping on each other somehow.
>
> If you still have the source directories, check the config.log files or
> whatever to see what versions of MySQL got compiled into each package.
>
> --
> Like music? http://l-i-e.com/artists.htm
>
> --
> 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]
--
------------------------------------------------------------
------ HR On-Line: The Network for Workplace Issues ------
http://www.hronline.com - Ph:416-604-7251 - Fax:416-604-4708
------------------------------------------------------------
--- End Message ---
--- Begin Message ---
I always write my own authentication scripts in PHP using PHP's built in
session management. If you want to protect entire directories or sites,
just add the authentication routine to your auto_prepend file and it will
work for any page you are trying to authenticate.
If set up correctly it works really well, because a user can enter the site
from any page (perhaps from a bookmark) and if they are not logged in they
will get a login prompt and once logged in will go directly to whatever page
they were trying to access.
Furthermore, if you write your own authentication script for use in
auto_prepended files, you can use it with little or no modification on any
site you desire.
Fred
Jeff Hill <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Thanks for the suggestion, but no, it was something else. What else it
> was, I don't know. I took the plunge and did the "when in doubt,
> upgrade" route -- the server is now:
>
> Apache/1.3.22 -- AuthMySQL/2.30 -- PHP/4.0.6 -- mod_ssl/2.8.5 --
> OpenSSL/0.9.6b
>
> Now, 24 hr. of straight work upgrading, the problem has gone away. I
> don't know which of these programs had which bug, but I did nothing
> other than upgrade, albeit a 24-hr task due to the AuthMySQL issues.
>
> Which now prompts the question, perhaps delusional from lack of sleep,
> if hardly anyone is using mod_auth_mysql, as seems to be the case, what
> is everyone using to authenticate access? -- especially for larger sites
> (I have 70K+ pages).
>
> Regards,
>
> Jeff Hill
>
>
> Richard Lynch wrote:
> >
> > Jeff Hill wrote:
> >
> > > AddType application/x-httpd-php html
> > >
> > > All users who enter any subdirectory with a .htaccess authentication
> > > requirement get a 401 error instead of the pop-up authentication
request
> > > they should get (I use authmysql). The same thing happens if I try
> > > changing my Apache httpd.conf from:
> >
> > Wild Guess:
> > My first guess would be that the version of MySQL you used with
authmysql
> > and the version of MySQL you compiled into Apache are not matching up,
and
> > end up tromping on each other somehow.
> >
> > If you still have the source directories, check the config.log files or
> > whatever to see what versions of MySQL got compiled into each package.
> >
> > --
> > Like music? http://l-i-e.com/artists.htm
> >
> > --
> > 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]
>
> --
> ------------------------------------------------------------
> ------ HR On-Line: The Network for Workplace Issues ------
> http://www.hronline.com - Ph:416-604-7251 - Fax:416-604-4708
> ------------------------------------------------------------
--- End Message ---
--- Begin Message ---
Hello, my friend has windows ME, but no personal web server
When I use php, I use personal web server on win 98
WHen he downloads php on his pc with windows me,
can he use notepad to make php files, and use
http://localhost still to view them online?
Or must he use personal web server? What can he do to get it up and running
(Php) on his windows millenium?
Thanks
--- End Message ---
--- Begin Message ---
He can either use Personal Web Server, or use another server. I personally
use Xitami (http://www.xitami.com/) it's open source, lightweight, stable,
and easy to configure. PHP's documentation has directions on how to
configure PHP to work with Xitami.
Tiffany
<[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello, my friend has windows ME, but no personal web server
>
> When I use php, I use personal web server on win 98
>
> WHen he downloads php on his pc with windows me,
> can he use notepad to make php files, and use
> http://localhost still to view them online?
>
> Or must he use personal web server? What can he do to get it up and
running
> (Php) on his windows millenium?
>
> Thanks
>
>
--- End Message ---
--- Begin Message ---
Hey guys,
Im have a couple of form elements with the names of php arrays. Instead of
just using <input type=text name=myArray[]>, Im defining the array keys.
Before the form is submitted to the PHP script, Im using javascript to
modify the element values. The array brackets that are part of the element
name are conflicting with JavaScript. I can't figure out how to get
JavaScript to take form elemenets literly. Below is some of my code for
further detail:
// THIS CODE WAS FORMATTED TO FIT YOUR TV SCREEN :)
<script>
<!-- Hide code from Old browsers
function billing_is_shipping() {
if (document.customer_info.shipto_billto.value == "true") {
customer_info.customer_info[shipto_address_line1].value =
customer_info.customer_info[billto_address_line1].value;
customer_info.customer_info[shipto_address_line2].value =
customer_info.customer_info[billto_address_line2].value;
customer_info.customer_info[shipto_city].value =
customer_info.customer_info[billto_city].value;
customer_info.customer_info[shipto_state].value =
customer_info.customer_info[billto_state].value;
customer_info.customer_info[shipto_zipcode].value =
customer_info.customer_info[billto_zipcode].value;
};
};
// Done -->
</script>
<form name="customer_info" action="index.php" method="post"
onSubmit="javascript:billing_is_shipping();">
<input type="hidden" name="check_out_stage" value="1">
<input type="hidden" name="action" value="Check Out">
<center>
<table border="1" width="450" cellpadding="0" cellspacing="0"
bgcolor="#FFFFD2"><tr><td wdith="450" align='center'><font size="4"><b>Billing
Information</b> </font> </t$
<br>
<table border="1" width="450" cellpadding="0" cellspacing="0" bgcolor="#FFFFD2">
<tr>
<td>
<table border="0" cellpadding="2" cellspacing="0" width="450">
<tr><td align='right' width="130"><b>Name:</b></td> <td width="320"><input
type="text" name="customer_info[billto_name]" size="40"></td></tr>
<tr><td align='right' width="130"><b>Address:</b></td> <td width="320"><input
type="text" name="customer_info[billto_address_line1]" size="40"></td></tr>
<tr><td>   </td> <td width="320"><input
type="text" name="customer_info[billto_address_line2]" size="40"></td></tr>
<tr><td align='right' width="130"><b>City:</b></td> <td width="320"><input
type="text" name="customer_info[billto_city]" size="40"></td> </tr>
<tr><td align='right' width="130"><b>State:</b></td> <td width="320"><select
name="customer_info[billto_state]">
<-- OTHER CODE SNIPPED -->
Thank you,
Steve Maroney
--- End Message ---
--- Begin Message ---
use something like:
customer_info["customer_info[shipto_address_line1]"].value =
customer_info["customer_info[billto_address_line1]"].value;
ie. each form element can be referenced by name within the elements array:
frm.name --> frm["name"]
-----Original Message-----
From: Steve Maroney [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 22, 2001 12:48 PM
To: [EMAIL PROTECTED]
Subject: [PHP] PHP Arrays conflicting with Javascript, PLease advise?!?
Hey guys,
Im have a couple of form elements with the names of php arrays. Instead of
just using <input type=text name=myArray[]>, Im defining the array keys.
Before the form is submitted to the PHP script, Im using javascript to
modify the element values. The array brackets that are part of the element
name are conflicting with JavaScript. I can't figure out how to get
JavaScript to take form elemenets literly. Below is some of my code for
further detail:
// THIS CODE WAS FORMATTED TO FIT YOUR TV SCREEN :)
<script>
<!-- Hide code from Old browsers
function billing_is_shipping() {
if (document.customer_info.shipto_billto.value == "true") {
customer_info.customer_info[shipto_address_line1].value =
customer_info.customer_info[billto_address_line1].value;
customer_info.customer_info[shipto_address_line2].value =
customer_info.customer_info[billto_address_line2].value;
customer_info.customer_info[shipto_city].value =
customer_info.customer_info[billto_city].value;
customer_info.customer_info[shipto_state].value =
customer_info.customer_info[billto_state].value;
customer_info.customer_info[shipto_zipcode].value =
customer_info.customer_info[billto_zipcode].value;
};
};
// Done -->
</script>
<form name="customer_info" action="index.php" method="post"
onSubmit="javascript:billing_is_shipping();">
<input type="hidden" name="check_out_stage" value="1">
<input type="hidden" name="action" value="Check Out">
<center>
<table border="1" width="450" cellpadding="0" cellspacing="0"
bgcolor="#FFFFD2"><tr><td wdith="450" align='center'><font
size="4"><b>Billing Information</b> </font> </t$
<br>
<table border="1" width="450" cellpadding="0" cellspacing="0"
bgcolor="#FFFFD2">
<tr>
<td>
<table border="0" cellpadding="2" cellspacing="0" width="450">
<tr><td align='right' width="130"><b>Name:</b></td> <td
width="320"><input type="text" name="customer_info[billto_name]"
size="40"></td></tr>
<tr><td align='right' width="130"><b>Address:</b></td> <td
width="320"><input type="text" name="customer_info[billto_address_line1]"
size="40"></td></tr>
<tr><td>   </td> <td
width="320"><input type="text" name="customer_info[billto_address_line2]"
size="40"></td></tr>
<tr><td align='right' width="130"><b>City:</b></td> <td
width="320"><input type="text" name="customer_info[billto_city]"
size="40"></td> </tr>
<tr><td align='right' width="130"><b>State:</b></td> <td
width="320"><select name="customer_info[billto_state]">
<-- OTHER CODE SNIPPED -->
Thank you,
Steve Maroney
--
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]
--- End Message ---
--- Begin Message ---
Anyone know how one can "import" a flash file into PHP for use with "ming"
or something similar?
It's an easy to make a flash animation with ming, but I'd like to be able to
modify an existing flash file.
thnx
Martin
--- End Message ---
--- Begin Message ---
I've seen several sites that did the opposite--use PHP in Flash.
Try a search for 'php and flash'.
__________John Monfort_________________
_+-----------------------------------+_
P E P I E D E S I G N S
www.pepiedesigns.com
"The world is waiting, are you ready?"
-+___________________________________+-
On Thu, 22 Nov 2001, Martin Towell wrote:
> Anyone know how one can "import" a flash file into PHP for use with "ming"
> or something similar?
>
> It's an easy to make a flash animation with ming, but I'd like to be able to
> modify an existing flash file.
>
> thnx
> Martin
>
--- End Message ---
--- Begin Message ---
I was under the impression you could only edit flash within proprietary
products like flash itself, livemotion
especially if the file has already been exported to swf
-----Original Message-----
From: Martin Towell [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 22, 2001 02:32
To: [EMAIL PROTECTED]
Subject: [PHP] Flash programming
Anyone know how one can "import" a flash file into PHP for use with "ming"
or something similar?
It's an easy to make a flash animation with ming, but I'd like to be able to
modify an existing flash file.
thnx
Martin
--- End Message ---
--- Begin Message ---
Ming comes with a utility called swf2php or something like that, which MAY
be able to convert a SWF file to PHP script that you can then work with. I
say MAY, because the results are sometimes a bit unpredictable, and certain
Flash constructs can cause it to fail miserably.
But you might be lucky......
Richy
-----Original Message-----
From: Martin Towell [SMTP:[EMAIL PROTECTED]]
Sent: 22 November 2001 02:32
To: [EMAIL PROTECTED]
Subject: [PHP] Flash programming
Anyone know how one can "import" a flash file into PHP for use with "ming"
or something similar?
It's an easy to make a flash animation with ming, but I'd like to be able
to
modify an existing flash file.
thnx
Martin
--- End Message ---
--- Begin Message ---
Hay all,
I have been working on a PHP script for a while now, it is due for work by
friday. I am going to need some serious help to get it done. Please let me
know if you can help and also money that you will want. Just email
[EMAIL PROTECTED] for full details and scripts.
Thanks in advance
Marty
--- End Message ---
--- Begin Message ---
Hi there,
I've tried using the SMTP class file that was given by PHPGalaxy.com
previously in the mailing list, and have difficuties in using it. upon the
execution of the script im recieving the mail but the content of the mail
was the HEADER. Here's the script:
<?
function sendmsg($to, $subject, $text, $from, $file, $type) {
$content = fread(fopen($file,"r"),filesize($file));
$content = chunk_split(base64_encode($content));
$uid = strtoupper(md5(uniqid(time())));
$name = basename($file);
$header = "From: $from\nReply-To: $from\n";
$header .= "MIME- Version: 1.0\n";
$header .= "Content-Type: multipart/mixed; boundary=$uid\n";
$header .= "--$uid\n";
$header .= "Content-Type: text/plain;\n";
$header .= "Content-Transfer-Encoding: 7bit\n\n";
$header .= "$text\n";
$header .= "--$uid\n";
$header .= "Content-Type: $type; name=\"$name\"\n";
$header .= "Content-Tranfer-Encoding: base64\n";
$header .= "Content-Disposition: attachment; filename=\"$name\"\n\n";
$header .= "$content\n";
$header .= "--$uid--";
mail($to, $subject, "", $header);
return true;
}
$to = "[EMAIL PROTECTED]";
$subject = "test message";
$text = " This is just a test message from the MIS group";
$from = "[EMAIL PROTECTED]";
$file = "test.zip";
$type = "application/zip";
sendmsg($to, $subject, $text, $from, $file, $type);
print("message sent");
?>
And the email content was this:
MIME- Version: 1.0
Content-Type: multipart/mixed; bountry=4C67EBB57A700797D865BFD2E30B7E01
--4C67EBB57A700797D865BFD2E30B7E01
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
This is just a test message from the MIS group
--4C67EBB57A700797D865BFD2E30B7E01
Content-Type: application/zip; name="test.zip"
Content-Tranfer-Encoding: base64
Content-Disposition: attachment; filename="test.zip"
dGhpcyBpcyBqdXN0IGEgdGVzdCB6aXAgZmlsZSBrdW5vISEhIQ==
--4C67EBB57A700797D865BFD2E30B7E01--
Any idea, im this new in this type of program.
Regards,
Mikecarel
--- End Message ---
--- Begin Message ---
thank you for that but we need a customized mailer system for our
development and im just new with this type of system, i just want to make
sure that i really understand the program flow of the mailer script .This is
just a start and the sample script is very simple to understand for a newbie
like me.
Any idea with my problem?
> You may want to look at something a little more robust.
>
> Try http://phpmailer.sourceforge.net
>
> Adding attachments and numerous other options is extremely easy.
>
> Quoting "Michael P. Carel" <[EMAIL PROTECTED]>:
>
> > Hi there,
> >
> > I've tried using the SMTP class file that was given by PHPGalaxy.com
> > previously in the mailing list, and have difficuties in using it. upon
the
> > execution of the script im recieving the mail but the content of the
mail
> > was the HEADER. Here's the script:
> > <?
> > function sendmsg($to, $subject, $text, $from, $file, $type) {
> > $content = fread(fopen($file,"r"),filesize($file));
> > $content = chunk_split(base64_encode($content));
> > $uid = strtoupper(md5(uniqid(time())));
> > $name = basename($file);
> > $header = "From: $from\nReply-To: $from\n";
> > $header .= "MIME- Version: 1.0\n";
> > $header .= "Content-Type: multipart/mixed; boundary=$uid\n";
> > $header .= "--$uid\n";
> > $header .= "Content-Type: text/plain;\n";
> > $header .= "Content-Transfer-Encoding: 7bit\n\n";
> > $header .= "$text\n";
> > $header .= "--$uid\n";
> > $header .= "Content-Type: $type; name=\"$name\"\n";
> > $header .= "Content-Tranfer-Encoding: base64\n";
> > $header .= "Content-Disposition: attachment; filename=\"$name\"\n\n";
> > $header .= "$content\n";
> > $header .= "--$uid--";
> > mail($to, $subject, "", $header);
> > return true;
> > }
> > $to = "[EMAIL PROTECTED]";
> > $subject = "test message";
> > $text = " This is just a test message from the MIS group";
> > $from = "[EMAIL PROTECTED]";
> > $file = "test.zip";
> > $type = "application/zip";
> > sendmsg($to, $subject, $text, $from, $file, $type);
> > print("message sent");
> > ?>
> >
> > And the email content was this:
> >
> > MIME- Version: 1.0
> > Content-Type: multipart/mixed; bountry=4C67EBB57A700797D865BFD2E30B7E01
> > --4C67EBB57A700797D865BFD2E30B7E01
> > Content-Type: text/plain
> > Content-Transfer-Encoding: 7bit
> >
> > This is just a test message from the MIS group
> > --4C67EBB57A700797D865BFD2E30B7E01
> > Content-Type: application/zip; name="test.zip"
> > Content-Tranfer-Encoding: base64
> > Content-Disposition: attachment; filename="test.zip"
> >
> > dGhpcyBpcyBqdXN0IGEgdGVzdCB6aXAgZmlsZSBrdW5vISEhIQ==
> >
> > --4C67EBB57A700797D865BFD2E30B7E01--
> >
> > Any idea, im this new in this type of program.
> >
> >
> >
> >
> >
> > Regards,
> >
> > Mikecarel
> >
> >
> > --
> > 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]
> >
> >
>
>
>
>
> -------------------------------------------------
> This mail sent through IMP: http://horde.org/imp/
--- End Message ---
--- Begin Message ---
I need a routine that will allow me to trap multiple <br> and/or line feed
characters and convert them to a constant number. As an example, let's say
that you have text that has 10 carriage returns and/or line feeds. I want
to limit this to 3. So, I need to be able to parse the line to detect the
multiple control characters and convert the string to 3. So if the string
looked something like:
This is \n\n\n\n\n\n\n\n\n\n a test.
I would want it converted to
This is \n\n\n a test.
Conceivably, it could be
This is <br><br><br><br><br> a test.
I would want it converted to
This is <br><br><br> a test.
I know I could write a do/while loop, but I was wondering if there is a way
using eregi_replace or something along that line?
Thanks!
--- End Message ---
--- Begin Message ---
for the first case - using "\n", try :
ereg_replace('\n+', '\n\n\n', $str)
for the second case - using "<br>", try :
eregi_replace('(<br>)+', '<br>', $str);
Martin
-----Original Message-----
From: Gaylen Fraley [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 22, 2001 2:56 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Need regular match help - possibly
I need a routine that will allow me to trap multiple <br> and/or line feed
characters and convert them to a constant number. As an example, let's say
that you have text that has 10 carriage returns and/or line feeds. I want
to limit this to 3. So, I need to be able to parse the line to detect the
multiple control characters and convert the string to 3. So if the string
looked something like:
This is \n\n\n\n\n\n\n\n\n\n a test.
I would want it converted to
This is \n\n\n a test.
Conceivably, it could be
This is <br><br><br><br><br> a test.
I would want it converted to
This is <br><br><br> a test.
I know I could write a do/while loop, but I was wondering if there is a way
using eregi_replace or something along that line?
Thanks!
--
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]
--- End Message ---
--- Begin Message ---
Hello Gaylen,
try this:
$string = preg_replace("/\n{3,}/", "\n\n\n", $string);
James
"Gaylen Fraley" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I need a routine that will allow me to trap multiple <br> and/or line feed
> characters and convert them to a constant number. As an example, let's
say
> that you have text that has 10 carriage returns and/or line feeds. I want
> to limit this to 3. So, I need to be able to parse the line to detect the
> multiple control characters and convert the string to 3. So if the string
> looked something like:
>
> This is \n\n\n\n\n\n\n\n\n\n a test.
>
> I would want it converted to
>
> This is \n\n\n a test.
>
>
> Conceivably, it could be
>
> This is <br><br><br><br><br> a test.
>
> I would want it converted to
>
> This is <br><br><br> a test.
>
>
> I know I could write a do/while loop, but I was wondering if there is a
way
> using eregi_replace or something along that line?
>
> Thanks!
>
>
--- End Message ---
--- Begin Message ---
Thinking about it, this would probably be even better:
$string = preg_replace("/(\n|<br>){3,}/i", "\\1\\1\\1", $string);
This:
$string = "This is a
\n\n\n\n\n\n\n\n\n\n\ntest\nTesting\nTesting\n\n123<br><br><br><br><br><br><
br><br><br><br><br>Some more testing<br><br><br><br><br><br><br><br><br>And
a little
more<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br>Even more.";
Then outputs as this:
This is a <br />
<br />
<br />
test<br />
Testing<br />
Testing<br />
<br />
123<br><br><br>Some more testing<br><br><br>And a little
more<br><br><br>Even more.
when echo'd with nl2br()
As a side note, does anyone know what's with the <br> tag changing to <br
/>? That's the way I've always used the line break tag for wml pages, but
hadn't realised that it's being written that way for standard html now. Is
this a change in spec?
James
"Liljim" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello Gaylen,
>
> try this:
>
> $string = preg_replace("/\n{3,}/", "\n\n\n", $string);
>
> James
>
> "Gaylen Fraley" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > I need a routine that will allow me to trap multiple <br> and/or line
feed
> > characters and convert them to a constant number. As an example, let's
> say
> > that you have text that has 10 carriage returns and/or line feeds. I
want
> > to limit this to 3. So, I need to be able to parse the line to detect
the
> > multiple control characters and convert the string to 3. So if the
string
> > looked something like:
> >
> > This is \n\n\n\n\n\n\n\n\n\n a test.
> >
> > I would want it converted to
> >
> > This is \n\n\n a test.
> >
> >
> > Conceivably, it could be
> >
> > This is <br><br><br><br><br> a test.
> >
> > I would want it converted to
> >
> > This is <br><br><br> a test.
> >
> >
> > I know I could write a do/while loop, but I was wondering if there is a
> way
> > using eregi_replace or something along that line?
> >
> > Thanks!
> >
> >
>
>
--- End Message ---
--- Begin Message ---
I have:
session.cookie_lifetime = 1200
in my php.ini. I am using the PHP session functions that are working
fine, except I can't find out how to reset the lifetime timer. For
example, I log in, my script creates the session, and I do my work. After
20 minutes of working, the session expires and I have to re-login. How can
I reset the cookie_lifetime timer so that after each request the 20 minute
lifetime starts over?
Each script starts with:
session_name("mysessionname");
session_start();
And then checks session_is_registered('username')
Thanks,
Justin England [EMAIL PROTECTED]
Network Administrator
E-Net Information Services http://www.enetis.net
Tel: 605-341-3638 Fax: 605-341-8880
--- End Message ---
--- Begin Message ---
At 03:54 PM 11/21/2001 +0000, Caspar Kennerdale wrote:
>I have a script that when I execute via a browser retrieves information.
>
>Ultimately I want this automated. There has been mention on these lists
>about compliling php as cgi, which I think may help
I saw the following somewhere and saved it, but I can't remember where I
got it from. I haven't tested it either, but I can't see why it wouldn't
work if you have either of these programs available in conjunction w/cron:
"...If you don't have php installed as CGI you can use a unix console
program for fetching URLs, we recommend lynx or wget.
Example of using lynx:
0 10 * * * lynx -dump http://fsck.dk/script.php > /dev/null
Example of using wget:
0 10 * * * wget http://fsck.dk/script.php > /dev/null"
--- End Message ---
--- Begin Message ---
Well, your the expert, so I'll look into this further, but do you have
any statistics, or a guess, as to the load auto_prepending an entire
site would add to a server?
I've always been under the impression that adding PHP to every page will
add significant load. I'm not familiar enough with session management,
but it seems like your setup would add a heavy load?
Currently, only a small portion of our pages are PHP -- those linking
into databases and covering the front end negotiation.
Again, your the expert, so I'll just have to do some research. Thanks
for the suggestion.
Jeff
Fred wrote:
>
> I always write my own authentication scripts in PHP using PHP's built in
> session management. If you want to protect entire directories or sites,
> just add the authentication routine to your auto_prepend file and it will
> work for any page you are trying to authenticate.
>
> If set up correctly it works really well, because a user can enter the site
> from any page (perhaps from a bookmark) and if they are not logged in they
> will get a login prompt and once logged in will go directly to whatever page
> they were trying to access.
>
> Furthermore, if you write your own authentication script for use in
> auto_prepended files, you can use it with little or no modification on any
> site you desire.
>
> Fred
--- End Message ---
--- Begin Message ---
I cannot quote any statistics for you, but I think I can answer your
question anyway.
When you use htaccess along with htpassword or authmysql, everytime a person
requests a page in a protected dirtectory apache has to access the htaccess
file, determine the type of authentication to use and then pass
authentication on to (for example) authmysql. Just because you only see a
login prompt one time does not mean that this happens only once. With every
new page request this proceedure is called into play over and over again.
Although I have no statistical evidence to back uo this assertion, I can
tell you from experience and common sense that there is no way that
autoprepending a simply session script is going to take more system
resources than the apache authentication method outlined above.
Fred
Jeff Hill <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Well, your the expert, so I'll look into this further, but do you have
> any statistics, or a guess, as to the load auto_prepending an entire
> site would add to a server?
>
> I've always been under the impression that adding PHP to every page will
> add significant load. I'm not familiar enough with session management,
> but it seems like your setup would add a heavy load?
>
> Currently, only a small portion of our pages are PHP -- those linking
> into databases and covering the front end negotiation.
>
> Again, your the expert, so I'll just have to do some research. Thanks
> for the suggestion.
>
> Jeff
>
> Fred wrote:
> >
> > I always write my own authentication scripts in PHP using PHP's built in
> > session management. If you want to protect entire directories or sites,
> > just add the authentication routine to your auto_prepend file and it
will
> > work for any page you are trying to authenticate.
> >
> > If set up correctly it works really well, because a user can enter the
site
> > from any page (perhaps from a bookmark) and if they are not logged in
they
> > will get a login prompt and once logged in will go directly to whatever
page
> > they were trying to access.
> >
> > Furthermore, if you write your own authentication script for use in
> > auto_prepended files, you can use it with little or no modification on
any
> > site you desire.
> >
> > Fred
--- End Message ---
--- Begin Message ---
Hi,
I have a strange problem. I have a page that displays a list of records.
When the user clicks on the delete link by one of the records, a php script
is taking care to delete that specific record and then redirects back to
the record list.
I use PEAR::DB with MySQL.
When I use header("Location: ...") to redirect the user back to the record
list page, many times the screen still displays the old list and I have to
refresh the page so see that the record was deleted. At first I thought
that the page is redisplayed from the cache so I added the appropriate meta
tags to make sure that the page will not be cached by the browser. Since
sometimes it worked and sometimes it didn't, I started suspecting the the
problem may be with the fact that the database (mysql) may have not removed
the record yet by the time the record list is redisplayed. I decided to
try to use the http-equiv="refresh" meta tag with a delay of 1 second, and
suddenly the problem has disappeared. I also worked by setting the delay
to 0.
Does the above suspicion I have even make sense? Why would mysql not
complete the delete when the delete is executed?
Avi
--
Avi Schwartz
[EMAIL PROTECTED]
"I have to share the credit. I invented it, but Bill made it
famous." - IBM engineer Dave Bradley describing the
control-alt-delete reboot sequence
--- End Message ---
--- Begin Message ---
How and when mysql performs a delete depends on several things including,
the type of table that is used, configuration parameters and the wording of
the delete query. There are some situations in which deletes are put into a
que and performed only after there are no connections to the table. Since I
am not familiar with your set up or code, you will need to read the mysql
docs to determine if this is in fact the situation you find yourself in.
Fred
Avi Schwartz <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi,
>
> I have a strange problem. I have a page that displays a list of records.
> When the user clicks on the delete link by one of the records, a php
script
> is taking care to delete that specific record and then redirects back to
> the record list.
>
> I use PEAR::DB with MySQL.
>
> When I use header("Location: ...") to redirect the user back to the record
> list page, many times the screen still displays the old list and I have to
> refresh the page so see that the record was deleted. At first I thought
> that the page is redisplayed from the cache so I added the appropriate
meta
> tags to make sure that the page will not be cached by the browser. Since
> sometimes it worked and sometimes it didn't, I started suspecting the the
> problem may be with the fact that the database (mysql) may have not
removed
> the record yet by the time the record list is redisplayed. I decided to
> try to use the http-equiv="refresh" meta tag with a delay of 1 second, and
> suddenly the problem has disappeared. I also worked by setting the delay
> to 0.
>
> Does the above suspicion I have even make sense? Why would mysql not
> complete the delete when the delete is executed?
>
> Avi
> --
> Avi Schwartz
> [EMAIL PROTECTED]
>
> "I have to share the credit. I invented it, but Bill made it
> famous." - IBM engineer Dave Bradley describing the
> control-alt-delete reboot sequence
--- End Message ---
--- Begin Message ---
> When I use header("Location: ...") to redirect the user back to the record
Send a Header(pragma no-cache) before Header(Location) and it will work.
Roko
--- End Message ---
--- Begin Message ---
You can also have a look to EasyPhp http://www.easyphp.org/ which installs
Apache, PHP and MySQL on Windows box.
-----Message d'origine-----
De : Rob Bennion [mailto:[EMAIL PROTECTED]]
Envoye : mercredi 21 novembre 2001 21:55
A : [EMAIL PROTECTED]
Objet : [PHP] Installing PHP with windows
Hi
I want to try out PHP and wanted to know if it is possible to install it
on a windows machine and use it with personal web server.
Any help would be appreciated.
thanks
Rob
--
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]
--- End Message ---
--- Begin Message ---
Hello, im a newbie in writing functions but right now im trying to.
I have made the following function
// FUNCTION TO DECIDE WHETHER A PROJECT IS IN BETWEEN PROJECTBEGIN AND
PROJECTEND , YES OR NO
function Activeyesno($month,$day,$year,$Project_id){
$dayactief = mktime(0, 0, 0, $month, $day, $year);
$daytemp = date("Y-m-d", $dayactief);
$resultactive = mysql_query("SELECT * FROM EIAProjecten WHERE
((Project_begindatum >= '$daytemp' AND Project_id = '$Project_id') OR
(Project_einddatum <= '$daytemp' AND Project_id = '$Project_id'))",$db);
$num_rows = mysql_num_rows($resultactive);
if ($num_rows == '1'){
return "red"; }
}
AND i'm calling this function in an while loop
<? echo Activeyesno($month,$day,$year,$Project_id); ?>
(I translated it into english so maybe some mistakes!)
When i try to call the function i get a mysql error every time, even when i
make $resultactive ("SELECT * FROM EIAProjecten") // NO DATE
1. Is it possible to make a sql connection in my function
2. did i do something wrong?
Can somebody help me?
Sjoerd
________________________________________
Sjoerd van Oosten
Digitaal vormgever [EMAIL PROTECTED]
Datamex E-sites B.V.
http://www.esites.nl
Minervum 7368 Telefoon: (076) 5 730 730
4817 ZH BREDA Telefax: (076) 5 877 757
_______________________________________
--- End Message ---
--- Begin Message ---
Ok, this is very important to me, but
I'm not sure how to explain it well. I
am working on a project using PHP that
supports about 6 different browsers and
browser versions. All the code is in one
single file for now, but I will
eventually split the code up and call
them using several include files. The
problem is that when I start writing the
code and it doesn't support a specific
browser version, I customize the code
with some browser sniffing...for
example:
<table>
<tr>
<td width='100'>
first column
</td>
<?php if ($browser == "ns4") { ?>
<td bgcolor="ff0000">
second column
</td>
<?php } elseif ($browser == "ns6")
{ ?>
// using different field-color for
this browser version...
<td bgcolor='0000ff'>
second column
</td>
<?php } else { ?>
// using different field-color for
this browser version...
<td bgcolor='00ff00'>
second column
</td>
<?php } ?>
</tr>
</table>
This is not a real-world example, but it
works for trying to explain my problem.
The code is messy. The sniffing is done
earlier and is set by $browser, which
holds a value depending on which browser
the user is using at the moment they
access the page. I want this code to
look as normal as html can possibly
look, with a less ambiguous tree-like
flow, in the following format for
example:
<table>
<tr>
<td width='100'>
first column
</td>
<td bgcolor="some_color">
second column
</td>
</tr>
</table>
How would you guys organize the code to
where it makes the best use of whichever
browser is being used, but with less
messy code? I probably haven't explained
it well, but if you have any questions
please let me know and I'll be more than
happy to answer them. By the way, I'm a
newbie at PHP, and so far I think it's
the best thing that has ever happened to
the web. Thanks in advance. :)
Navid
--- End Message ---
--- Begin Message ---
Try to break up html into different files for each browser type.
Switch ($browser)
{
case "ns4" :
include ns4.html; break;
case "ie5" :
include ie5.html; break;
.
.
.
default :
include ie6.html;
}
> -----Original Message-----
> From: Navid Yar [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, November 22, 2001 10:19 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] PHP code organization...
> Importance: High
>
>
> Ok, this is very important to me, but
> I'm not sure how to explain it well. I
> am working on a project using PHP that
> supports about 6 different browsers and
> browser versions. All the code is in one
> single file for now, but I will
> eventually split the code up and call
> them using several include files. The
> problem is that when I start writing the
> code and it doesn't support a specific
> browser version, I customize the code
> with some browser sniffing...for
> example:
>
> <table>
> <tr>
> <td width='100'>
> first column
> </td>
> <?php if ($browser == "ns4") { ?>
> <td bgcolor="ff0000">
> second column
> </td>
> <?php } elseif ($browser == "ns6")
> { ?>
> // using different field-color for
> this browser version...
> <td bgcolor='0000ff'>
> second column
> </td>
> <?php } else { ?>
> // using different field-color for
> this browser version...
> <td bgcolor='00ff00'>
> second column
> </td>
> <?php } ?>
> </tr>
> </table>
>
> This is not a real-world example, but it
> works for trying to explain my problem.
> The code is messy. The sniffing is done
> earlier and is set by $browser, which
> holds a value depending on which browser
> the user is using at the moment they
> access the page. I want this code to
> look as normal as html can possibly
> look, with a less ambiguous tree-like
> flow, in the following format for
> example:
>
> <table>
> <tr>
> <td width='100'>
> first column
> </td>
> <td bgcolor="some_color">
> second column
> </td>
> </tr>
> </table>
>
> How would you guys organize the code to
> where it makes the best use of whichever
> browser is being used, but with less
> messy code? I probably haven't explained
> it well, but if you have any questions
> please let me know and I'll be more than
> happy to answer them. By the way, I'm a
> newbie at PHP, and so far I think it's
> the best thing that has ever happened to
> the web. Thanks in advance. :)
>
> Navid
>
>
>
> --
> 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]
>
--- End Message ---
--- Begin Message ---
Hi,
Can anyone point me to a good explanation of how the parent::
constructor works? I've tried searching the php site for it with no
success.
I've been given a set of code to work on, but am getting the error:
"Fatal error: Undefined class name 'parent'"
for one section of it.
cheers. James.
--
James Stewart
http://www.britlinks.co.uk
--- End Message ---
--- Begin Message ---
$parent::constructor()?
Just guessing, I wasn't even aware of this functionality till now :)
Roko
--- End Message ---
--- Begin Message ---
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (Roko Roic) wrote:
> $parent::constructor()?
>
> Just guessing, I wasn't even aware of this functionality till now :)
Is this what you're looking for?
<http://www.php.net/manual/en/keyword.parent.php>
--
CC
--- End Message ---
--- Begin Message ---
Hi there
I try to setup GD and PNG and Zlib to work with my PHP 4.06
but still no sucess
can anyone point me out how to do that, or a website that contain step by
step instruction
in the configure line i used this options --with-gd=/usr/local
--with-png-dir=/usr/local/png --with-zlib=/usr/local
installing those three items i just used make and make install so everthing
must go to /usr/local
thanks for the help
--- End Message ---
--- Begin Message ---
I found this site http://www.Banners4i.com while surfing the net, may be it could be
useful to you.
It has Free Banner / Link Exchange Server, Counter Server and a WAP Counter Server
developed using PHP (may be PHP4, MySQL, WML)
If you know of any cool sites developed using PHP pl. let me know.
--------------------------------------------------------------------------------------------------
Get real solutions to all your problems.
http://www.salahkarindia.com - India's first advisory Portal
Your friend, advisor, healer,companion!!!
Register now to get free advice on all your problems.
--------------------------------------------------------------------------------------------------
--- End Message ---
--- Begin Message ---
I found this site http://www.Banners4i.com while surfing the net, may be it could be
useful to you.
It has Free Banner / Link Exchange Server, Counter Server and a WAP Counter Server
developed using PHP (may be PHP4, MySQL, WML)
If you know of any cool sites developed using PHP pl. let me know.
--------------------------------------------------------------------------------------------------
Get real solutions to all your problems.
http://www.salahkarindia.com - India's first advisory Portal
Your friend, advisor, healer,companion!!!
Register now to get free advice on all your problems.
--------------------------------------------------------------------------------------------------
--- End Message ---
--- Begin Message ---
Need some help here, Im getting this error:
Warning: Cannot add header information - headers already sent by (output
started at /home/p/pe/perphp/public_html/login.php:4) in
/home/p/pe/perphp/public_html/login.php on line 44
...while trying to run the following .PHP code on my server. Any ideas why
this doesnt work?
(Im trying to setup user authentication and found this on the Webmonkey
site)
All tips are appreciated!!
<HTML><HEAD><TITLE>dummy</TITLE></HEAD>
<BODY>
<?php
// File Name: auth02.php
// Check to see if $PHP_AUTH_USER already contains info
if (!isset($PHP_AUTH_USER)) {
// If empty, send header causing dialog box to appear
header('WWW-Authenticate: Basic realm="My Private Stuff"');
header('HTTP/1.0 401 Unauthorized');
echo 'Authorization Required.';
exit;
} else if (isset($PHP_AUTH_USER)) {
if (($PHP_AUTH_USER != "admin") || ($PHP_AUTH_PW != "abc123")) {
header('WWW-Authenticate: Basic realm="My Private Stuff"');
header('HTTP/1.0 401 Unauthorized');
echo 'Authorization Required.';
exit;
} else {
echo "
<P>You're authorized!</p>
";
}
}
?>
</BODY>
</HTML>
--- End Message ---
--- Begin Message ---
Per,
Its a hard rule but you cannot sent any HTML content before the header. Try
reversing the order and see if that works.
George (a newbie, trying to find time to learn more)
----- Original Message -----
From: "Per Waagen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, November 22, 2001 10:19 AM
Subject: [PHP] Cannot add header information...
> Need some help here, Im getting this error:
>
> Warning: Cannot add header information - headers already sent by (output
> started at /home/p/pe/perphp/public_html/login.php:4) in
> /home/p/pe/perphp/public_html/login.php on line 44
>
> ...while trying to run the following .PHP code on my server. Any ideas why
> this doesnt work?
> (Im trying to setup user authentication and found this on the Webmonkey
> site)
>
> All tips are appreciated!!
>
>
> <HTML><HEAD><TITLE>dummy</TITLE></HEAD>
> <BODY>
>
> <?php
>
> // File Name: auth02.php
> // Check to see if $PHP_AUTH_USER already contains info
>
> if (!isset($PHP_AUTH_USER)) {
> // If empty, send header causing dialog box to appear
> header('WWW-Authenticate: Basic realm="My Private Stuff"');
> header('HTTP/1.0 401 Unauthorized');
> echo 'Authorization Required.';
> exit;
> } else if (isset($PHP_AUTH_USER)) {
>
> if (($PHP_AUTH_USER != "admin") || ($PHP_AUTH_PW != "abc123")) {
> header('WWW-Authenticate: Basic realm="My Private Stuff"');
> header('HTTP/1.0 401 Unauthorized');
> echo 'Authorization Required.';
> exit;
>
> } else {
> echo "
> <P>You're authorized!</p>
> ";
> }
> }
> ?>
> </BODY>
> </HTML>
>
>
> --
> 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]
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
--- End Message ---
--- Begin Message ---
You've already sent something to the browser... the line that starts with
<HTML><HEAD>...
Move that below the authentication code and all should be well.
HTH
Jon
-----Original Message-----
From: Per Waagen [mailto:[EMAIL PROTECTED]]
Sent: 22 November 2001 10:20
To: [EMAIL PROTECTED]
Subject: [PHP] Cannot add header information...
Need some help here, Im getting this error:
Warning: Cannot add header information - headers already sent by (output
started at /home/p/pe/perphp/public_html/login.php:4) in
/home/p/pe/perphp/public_html/login.php on line 44
...while trying to run the following .PHP code on my server. Any ideas why
this doesnt work?
(Im trying to setup user authentication and found this on the Webmonkey
site)
All tips are appreciated!!
**********************************************************************
'The information included in this Email is of a confidential nature and is
intended only for the addressee. If you are not the intended addressee,
any disclosure, copying or distribution by you is prohibited and may be
unlawful. Disclosure to any party other than the addressee, whether
inadvertent or otherwise is not intended to waive privilege or confidentiality'
**********************************************************************
--- End Message ---
--- Begin Message ---
output started at /home/p/pe/perphp/public_html/login.php:4
try to look into this line 'cause is where the output started.
The HTTP Header comes before every HTML code because it's where the browser
will know what kind of file it is (for example... it is a image, open it! it
is HTML, show it! it is a zip file, download it!), sends also the file size,
date, etc etc.. so, every header() call must be before any ' echo ' ,
'print' etc ..
hope u understood ... i am taking english classes to improve my speech :P
----- Original Message -----
From: "Jon Haworth" <[EMAIL PROTECTED]>
To: "'Per Waagen'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, November 22, 2001 8:26 AM
Subject: RE: [PHP] Cannot add header information...
> You've already sent something to the browser... the line that starts with
> <HTML><HEAD>...
>
> Move that below the authentication code and all should be well.
>
> HTH
> Jon
>
>
> -----Original Message-----
> From: Per Waagen [mailto:[EMAIL PROTECTED]]
> Sent: 22 November 2001 10:20
> To: [EMAIL PROTECTED]
> Subject: [PHP] Cannot add header information...
>
>
> Need some help here, Im getting this error:
>
> Warning: Cannot add header information - headers already sent by (output
> started at /home/p/pe/perphp/public_html/login.php:4) in
> /home/p/pe/perphp/public_html/login.php on line 44
>
> ...while trying to run the following .PHP code on my server. Any ideas why
> this doesnt work?
> (Im trying to setup user authentication and found this on the Webmonkey
> site)
>
> All tips are appreciated!!
>
>
> **********************************************************************
> 'The information included in this Email is of a confidential nature and is
> intended only for the addressee. If you are not the intended addressee,
> any disclosure, copying or distribution by you is prohibited and may be
> unlawful. Disclosure to any party other than the addressee, whether
> inadvertent or otherwise is not intended to waive privilege or
confidentiality'
>
> **********************************************************************
>
> --
> 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]
--- End Message ---