OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general Digest 17 Aug 2006 01:48:20 -0000 Issue 4297

php-general-digest-helplists.php.net
Date: Wed Aug 16 2006 - 20:48:20 CDT


php-general Digest 17 Aug 2006 01:48:20 -0000 Issue 4297

Topics (messages 240764 through 240791):

Re: simple scrip to stop email injection
        240764 by: Ivo F.A.C. Fokkema
        240782 by: Richard Lynch

Re: Espanol en esto lista
        240765 by: Peter Lauri
        240766 by: Dave Goodchild
        240767 by: Mario de Frutos
        240768 by: Rory Browne
        240769 by: Andrei
        240772 by: Peter Lauri
        240773 by: Rory Browne
        240776 by: tedd
        240781 by: Richard Lynch

Static Member Variables holding objects w/methods
        240770 by: Gabe
        240779 by: Gabe
        240786 by: Richard Lynch
        240790 by: Gabe

Cookie Variables Maxing Out Using IE6
        240771 by: dpgirago.mdanderson.org
        240774 by: Adam Zey
        240777 by: dpgirago.mdanderson.org
        240783 by: dpgirago.mdanderson.org
        240787 by: Richard Lynch

fwrite fopen problem
        240775 by: Jeremy Schreckhise
        240778 by: Programmer

Re: array problems
        240780 by: John Wells
        240785 by: Richard Lynch

Re: Max File Upload
        240784 by: Richard Lynch

Re: readdir() question
        240788 by: Richard Lynch

Re: Easier way to get the name of a variable?
        240789 by: Richard Lynch

PHPSESSID used sporatically
        240791 by: Michael B Allen

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

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

attached mail follows:


On Wed, 16 Aug 2006 10:53:30 +0100, Ross wrote:

>
> Been having loads of problems with this and have solved it using the
> phpmailer. The only problem is I cannot get the class working on the remote
> host I am working on. I am back to using mail() but need to drop in script
> that checks my fields $fname, $sname, $email, $subject, $message.

Couldn't you do a preg_match on \n, \r or \r\n for the $fname, $sname,
$email and $subject? Checking $message would not be necessary, as it would
probably contain linebreaks and it's not included in the message header
anyway...

HTH!

Ivo

attached mail follows:


On Wed, August 16, 2006 4:53 am, Ross wrote:
>
> Been having loads of problems with this and have solved it using the
> phpmailer. The only problem is I cannot get the class working on the
> remote
> host I am working on. I am back to using mail() but need to drop in
> script
> that checks my fields $fname, $sname, $email, $subject, $message.

Checking for a NEWLINE in all but $message will stop MOST of the email
injection.

if (preg_match("/\r\n/", array($fname, $sname, $email, $subject))){
  die("Spammer!");
}

I think preg_match allows array for 2nd arg...

Details.

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


I have no clue what he is saying, but I believe he is asking if there is any
list in Spanish he can join. But I might be wrong :)

-----Original Message-----
From: Dave Goodchild [mailto:buddhamagnetgmail.com]
Sent: Wednesday, August 16, 2006 5:20 PM
To: Rory Browne
Cc: php-generallists.php.net
Subject: Re: [PHP] Espanol en esto lista

>
> Hablo espanol, pero lo que Rory dice es verdad, hay otra lista en espanol.
> Pero, si quieres, you tratare entender tu palabra.
>
>
> In short, speaking a language other than English on this list( especially
> considering that there is a php.general.es -
> http://news.php.net/php.general.es ), is similar to whispering in company.
> Most of us don't understand what you're saying.
>
> Rory
>
>

--
http://www.web-buddha.co.uk
http://www.projectkarma.co.uk

attached mail follows:


>
> I don't speak enough Spanish to understand it all, but tratare according
> to altavista is "to treat" - not really sure I get it.
>
> Sorry, should be 'yo tratare', tratar also means to try - I will try and
> understand...
>

--
http://www.web-buddha.co.uk
http://www.projectkarma.co.uk

attached mail follows:


Hi everyone!

I'm spanish and i don't have any problem to answer his questions.

Cheers

Peter Lauri escribió:
> I have no clue what he is saying, but I believe he is asking if there is any
> list in Spanish he can join. But I might be wrong :)
>
> -----Original Message-----
> From: Dave Goodchild [mailto:buddhamagnetgmail.com]
> Sent: Wednesday, August 16, 2006 5:20 PM
> To: Rory Browne
> Cc: php-generallists.php.net
> Subject: Re: [PHP] Espanol en esto lista
>
>> Hablo espanol, pero lo que Rory dice es verdad, hay otra lista en espanol.
>> Pero, si quieres, you tratare entender tu palabra.
>>
>>
>> In short, speaking a language other than English on this list( especially
>> considering that there is a php.general.es -
>> http://news.php.net/php.general.es ), is similar to whispering in company.
>> Most of us don't understand what you're saying.
>>
>> Rory
>>
>>
>
>

--
**********************************************************************
                 FUNDACIÓN CARTIF

  MARIO DE FRUTOS DIEGUEZ - Email: marfrucartif.es
 División de Ingeniería del Software y Comunicaciones

   Parque Tecnológico de Boecillo, Parcela 205
   47151 - Boecillo (Valladolid) España
  Tel. (34) 983.54.88.21 Fax (34) 983.54.65.21
**********************************************************************
Este mensaje se dirige exclusivamente a su destinatario y puede contener
información CONFIDENCIAL sometida a secreto profesional o cuya
divulgación esté prohibida en virtud de la legislación vigente. Si ha
recibido este mensaje por error, le rogamos que nos lo comunique
inmediatamente por esta misma vía y proceda a su destrucción.

Nótese que el correo electrónico via Internet no permite asegurar ni la
confidencialidad de los mensajes que se transmiten ni la correcta
recepción de los mismos. En el caso de que el destinatario de este
mensaje no consintiera la utilización del correo electrónico vía
Internet, rogamos lo ponga en nuestro conocimiento de manera inmediata.
***********************************************************************
This message is intended exclusively for its addressee and may contain
information that is CONFIDENTIAL and protected by a professional
privilege or whose disclosure is prohibited by law. If this message has
been received in error, please immediately notify us via e-mail and
delete it.

Please note that Internet e-mail neither guarantees the confidentiality
nor the proper receipt of the messages sent. If the addressee of this
message does not consent to the use of Internet e-mail, please
communicate it to us immediately.
************************************************************************

attached mail follows:


I have a clue what he's saying - just not much of a one:

Hablo espanol, pero lo que Rory dice es verdad, hay otra lista en espanol.
> Pero, si quieres, you tratare entender tu palabra.

  ( I speak spanish, but what Rory says is true, there is another list in
spanish, But, if you want you **something** understand your word. )

I don't speak enough Spanish to understand it all, but tratare according to
altavista is "to treat" - not really sure I get it.

On 8/16/06, Peter Lauri <listsdwsasia.com> wrote:
>
> I have no clue what he is saying, but I believe he is asking if there is
> any
> list in Spanish he can join. But I might be wrong :)
>
> -----Original Message-----
> From: Dave Goodchild [mailto:buddhamagnetgmail.com]
> Sent: Wednesday, August 16, 2006 5:20 PM
> To: Rory Browne
> Cc: php-generallists.php.net
> Subject: Re: [PHP] Espanol en esto lista
>
> >
> > Hablo espanol, pero lo que Rory dice es verdad, hay otra lista en
> espanol.
> > Pero, si quieres, you tratare entender tu palabra.
> >
> >
> > In short, speaking a language other than English on this list(
> especially
> > considering that there is a php.general.es -
> > http://news.php.net/php.general.es ), is similar to whispering in
> company.
> > Most of us don't understand what you're saying.
> >
> > Rory
> >
> >
>
>
> --
> http://www.web-buddha.co.uk
> http://www.projectkarma.co.uk
>
>

attached mail follows:


        Cool now we learn Spanish too. :)

        j/k
        Andy

Dave Goodchild wrote:
>>
>> I don't speak enough Spanish to understand it all, but tratare according
>> to altavista is "to treat" - not really sure I get it.
>>
>> Sorry, should be 'yo tratare', tratar also means to try - I will try and
>> understand...
>>
>
>
>

attached mail follows:


But I was almost correct. The "hay otra lista en espanol" looks like
something with "list" and spanish :)

Great stuff... let us learn some Thai too:

Mee mailing list php pasa Thai mai?

Or Swedish:

Finns det någon phplista på svenska?

/Peter

-----Original Message-----
From: Mario de Frutos [mailto:marfrucartif.es]
Sent: Wednesday, August 16, 2006 6:11 PM
To: php-generallists.php.net
Subject: Re: [PHP] Espanol en esto lista

Hi everyone!

I'm spanish and i don't have any problem to answer his questions.

Cheers

Peter Lauri escribió:
> I have no clue what he is saying, but I believe he is asking if there is
any
> list in Spanish he can join. But I might be wrong :)
>
> -----Original Message-----
> From: Dave Goodchild [mailto:buddhamagnetgmail.com]
> Sent: Wednesday, August 16, 2006 5:20 PM
> To: Rory Browne
> Cc: php-generallists.php.net
> Subject: Re: [PHP] Espanol en esto lista
>
>> Hablo espanol, pero lo que Rory dice es verdad, hay otra lista en
espanol.
>> Pero, si quieres, you tratare entender tu palabra.
>>
>>
>> In short, speaking a language other than English on this list( especially
>> considering that there is a php.general.es -
>> http://news.php.net/php.general.es ), is similar to whispering in
company.
>> Most of us don't understand what you're saying.
>>
>> Rory
>>
>>
>
>

--
**********************************************************************
                 FUNDACIÓN CARTIF

  MARIO DE FRUTOS DIEGUEZ - Email: marfrucartif.es
 División de Ingeniería del Software y Comunicaciones

   Parque Tecnológico de Boecillo, Parcela 205
   47151 - Boecillo (Valladolid) España
  Tel. (34) 983.54.88.21 Fax (34) 983.54.65.21
**********************************************************************
Este mensaje se dirige exclusivamente a su destinatario y puede contener
información CONFIDENCIAL sometida a secreto profesional o cuya
divulgación esté prohibida en virtud de la legislación vigente. Si ha
recibido este mensaje por error, le rogamos que nos lo comunique
inmediatamente por esta misma vía y proceda a su destrucción.

Nótese que el correo electrónico via Internet no permite asegurar ni la
confidencialidad de los mensajes que se transmiten ni la correcta
recepción de los mismos. En el caso de que el destinatario de este
mensaje no consintiera la utilización del correo electrónico vía
Internet, rogamos lo ponga en nuestro conocimiento de manera inmediata.
***********************************************************************
This message is intended exclusively for its addressee and may contain
information that is CONFIDENTIAL and protected by a professional
privilege or whose disclosure is prohibited by law. If this message has
been received in error, please immediately notify us via e-mail and
delete it.

Please note that Internet e-mail neither guarantees the confidentiality
nor the proper receipt of the messages sent. If the addressee of this
message does not consent to the use of Internet e-mail, please
communicate it to us immediately.
************************************************************************

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

attached mail follows:


On 8/16/06, Mario de Frutos <marfrucartif.es> wrote:
>
> Hi everyone!
>
> I'm spanish and i don't have any problem to answer his questions.

And I don't have any problem with you answering his questions, provided
they're either

(a) posted in English, or (b) posted on the Spanish list, or (c) Posted with
a Translation in English.

Cheers
>
> Peter Lauri escribió:
> > I have no clue what he is saying, but I believe he is asking if there is
> any
> > list in Spanish he can join. But I might be wrong :)
> >
> > -----Original Message-----
> > From: Dave Goodchild [mailto:buddhamagnetgmail.com]
> > Sent: Wednesday, August 16, 2006 5:20 PM
> > To: Rory Browne
> > Cc: php-generallists.php.net
> > Subject: Re: [PHP] Espanol en esto lista
> >
> >> Hablo espanol, pero lo que Rory dice es verdad, hay otra lista en
> espanol.
> >> Pero, si quieres, you tratare entender tu palabra.
> >>
> >>
> >> In short, speaking a language other than English on this list(
> especially
> >> considering that there is a php.general.es -
> >> http://news.php.net/php.general.es ), is similar to whispering in
> company.
> >> Most of us don't understand what you're saying.
> >>
> >> Rory
> >>
> >>
> >
> >
>
>
> --
> **********************************************************************
> FUNDACIÓN CARTIF
>
> MARIO DE FRUTOS DIEGUEZ - Email: marfrucartif.es
> División de Ingeniería del Software y Comunicaciones
>
> Parque Tecnológico de Boecillo, Parcela 205
> 47151 - Boecillo (Valladolid) España
> Tel. (34) 983.54.88.21 Fax (34) 983.54.65.21
> **********************************************************************
> Este mensaje se dirige exclusivamente a su destinatario y puede contener
> información CONFIDENCIAL sometida a secreto profesional o cuya
> divulgación esté prohibida en virtud de la legislación vigente. Si ha
> recibido este mensaje por error, le rogamos que nos lo comunique
> inmediatamente por esta misma vía y proceda a su destrucción.
>
> Nótese que el correo electrónico via Internet no permite asegurar ni la
> confidencialidad de los mensajes que se transmiten ni la correcta
> recepción de los mismos. En el caso de que el destinatario de este
> mensaje no consintiera la utilización del correo electrónico vía
> Internet, rogamos lo ponga en nuestro conocimiento de manera inmediata.
> ***********************************************************************
> This message is intended exclusively for its addressee and may contain
> information that is CONFIDENTIAL and protected by a professional
> privilege or whose disclosure is prohibited by law. If this message has
> been received in error, please immediately notify us via e-mail and
> delete it.
>
> Please note that Internet e-mail neither guarantees the confidentiality
> nor the proper receipt of the messages sent. If the addressee of this
> message does not consent to the use of Internet e-mail, please
> communicate it to us immediately.
> ************************************************************************
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


At 9:20 PM +0700 8/16/06, Peter Lauri wrote:
>But I was almost correct. The "hay otra lista en espanol" looks like
>something with "list" and spanish :)
>
>Great stuff... let us learn some Thai too:
>
>Mee mailing list php pasa Thai mai?
>
>Or Swedish:
>
>Finns det någon phplista på svenska?

Or php, or mysql, or js, or ajax, or xml, or
jquery... my "languages to learn" meter is
pegged at the moment.

tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com

attached mail follows:


On Wed, August 16, 2006 9:20 am, Peter Lauri wrote:
> But I was almost correct. The "hay otra lista en espanol" looks like
> something with "list" and spanish :)
>
> Great stuff... let us learn some Thai too:
>
> Mee mailing list php pasa Thai mai?
>
> Or Swedish:
>
> Finns det någon phplista på svenska?

Bork, bork, bork!

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


I'm trying to use the following method of a class (DbConnector):

public function closeConnector() {
      //
      echo "<p>in closeConnector()";
      var_dump(DbConnector::$connector);
      echo "</p>";
        
         //make sure the db object is cleaned up properly
         if ( gettype(DbConnector::$connector) == 'object' ) {
          echo "<br><br>close the ADOdb connection<br><br>";
          DbConnector::$connector->Close();
        
         }

      //put things back the way they were found
      $this->connector = false;
    }

DbConnector is meant to be a singleton class that manages an ADOdb
object. However, when the code executes and it gets to this line:

DbConnector::$connector->Close();

the script fails and says "Call to undefined method
DbConnector::Close()" Is trying to call the Close() method of the
static member var (which holds an ADOdb object) not possible?

attached mail follows:


Gabe wrote:
> I'm trying to use the following method of a class (DbConnector):
>
> public function closeConnector() {
> //
> echo "<p>in closeConnector()";
> var_dump(DbConnector::$connector);
> echo "</p>";
>
> //make sure the db object is cleaned up properly
> if ( gettype(DbConnector::$connector) == 'object' ) {
> echo "<br><br>close the ADOdb connection<br><br>";
> DbConnector::$connector->Close();
>
> }
>
> //put things back the way they were found
> $this->connector = false;
> }
>
> DbConnector is meant to be a singleton class that manages an ADOdb
> object. However, when the code executes and it gets to this line:
>
> DbConnector::$connector->Close();
>
> the script fails and says "Call to undefined method
> DbConnector::Close()" Is trying to call the Close() method of the
> static member var (which holds an ADOdb object) not possible?

I think I thought of a better way to ask my question. :)

Is it possible for a static member to hold an object? If so, is it
possible for me to access the members and methods of that object like
so: myClass::myStaticVarHoldingTheObject->methodOfTheObject

I'm trying to access methods of an object that is stored in a static
variable using that line of code. It keeps spitting out an error that
says "myClass" does not have a defined method "methodOfTheObject".

I hope that's clearer. Sorry about any confusion...

attached mail follows:


On Wed, August 16, 2006 9:13 am, Gabe wrote:
> I'm trying to use the following method of a class (DbConnector):
>
> public function closeConnector() {
> //
> echo "<p>in closeConnector()";
> var_dump(DbConnector::$connector);

What is $connector ???

Perhaps you want DbConnector::connector

> echo "</p>";
>
> //make sure the db object is cleaned up properly
> if ( gettype(DbConnector::$connector) == 'object' ) {
> echo "<br><br>close the ADOdb connection<br><br>";
> DbConnector::$connector->Close();

Try it without the $

If that's not it, try:
$connector = DbConnector::$connector;
$connector->Close();

Sometimes PHP is not so good at -> chasing down a tree...

Or, at least, it used to be not so good at that... I suspect that's
been fixed for ages, but worth a shot.

>
> }
>
> //put things back the way they were found
> $this->connector = false;
> }
>
> DbConnector is meant to be a singleton class that manages an ADOdb
> object. However, when the code executes and it gets to this line:
>
> DbConnector::$connector->Close();
>
> the script fails and says "Call to undefined method
> DbConnector::Close()" Is trying to call the Close() method of the
> static member var (which holds an ADOdb object) not possible?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


Richard Lynch wrote:
> On Wed, August 16, 2006 9:13 am, Gabe wrote:
>> I'm trying to use the following method of a class (DbConnector):
>>
>> public function closeConnector() {
>> //
>> echo "<p>in closeConnector()";
>> var_dump(DbConnector::$connector);
>
> What is $connector ???
>
> Perhaps you want DbConnector::connector
>
>> echo "</p>";
>>
>> //make sure the db object is cleaned up properly
>> if ( gettype(DbConnector::$connector) == 'object' ) {
>> echo "<br><br>close the ADOdb connection<br><br>";
>> DbConnector::$connector->Close();
>
> Try it without the $
>
> If that's not it, try:
> $connector = DbConnector::$connector;
> $connector->Close();
>
> Sometimes PHP is not so good at -> chasing down a tree...
>
> Or, at least, it used to be not so good at that... I suspect that's
> been fixed for ages, but worth a shot.
>
>> }
>>
>> //put things back the way they were found
>> $this->connector = false;
>> }
>>
>> DbConnector is meant to be a singleton class that manages an ADOdb
>> object. However, when the code executes and it gets to this line:
>>
>> DbConnector::$connector->Close();
>>
>> the script fails and says "Call to undefined method
>> DbConnector::Close()" Is trying to call the Close() method of the
>> static member var (which holds an ADOdb object) not possible?
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>

Actually I found that I should use this notation:

self::$connector->Close();

And my class method wasn't static. So I couldn't access the static member.

Details, details.... =)

attached mail follows:


Does IE6 limit somehow/somewhere the number of cookie variables I can
create and store? The following code snippet successfully creates 24
cookie variables when run in FireFox, but in IE6 it is limited to 20. I
can provide the full code with HTML/Javascript if anyone wants to test for
themselves.

David

<?php

// populates a hidden form variable on the second submit
$somevar = "anything";

if (!IsSet($_POST['monitors']) || empty($_POST['monitors'])) {
    $_POST['monitors'] = array();
}

/*********** Manage Monitor CheckBoxes via $_POST & $_Cookie *************/

// code in here only runs the first time the page is displayed
if ($_POST['trakVisit'] == "") {
      if (IsSet($_COOKIE['cookieMeter'])) {
            foreach ($_COOKIE['cookieMeter'] as $key => $value) {
                  if ($value == 'CHECKED') {
                        $checked[$key] = 'CHECKED';
                  }
                  else
                        $checked[$key] = "";
            }
      }
}
// runs on the second and subsequent submits
elseif ($_POST['trakVisit'] == "anything") {
      for ($i=1; $i <= 24; $i++) {
            if (in_array($i, $_POST['monitors'])) {
                  setcookie("cookieMeter[$i]", 'CHECKED', time()
+60*60*24*12, '/', ".mydomain.com", 1);
                  $checked[$i] = 'CHECKED';
            }
            elseif(!in_array($i, $_POST['monitors'])) {
                  $checked[$i] = '';
                  setcookie("cookieMeter[$i]", 'CHECKED', time()-3600, '/',
".mydomain.com", 1);
            }
      }
}

echo "<pre>";
print_r($_COOKIE);
echo "</pre>";

?>

attached mail follows:


dpgiragomdanderson.org wrote:
> Does IE6 limit somehow/somewhere the number of cookie variables I can
> create and store? The following code snippet successfully creates 24
> cookie variables when run in FireFox, but in IE6 it is limited to 20. I
> can provide the full code with HTML/Javascript if anyone wants to test for
> themselves.
>
> David
>
> <?php
>
> // populates a hidden form variable on the second submit
> $somevar = "anything";
>
> if (!IsSet($_POST['monitors']) || empty($_POST['monitors'])) {
> $_POST['monitors'] = array();
> }
>
> /*********** Manage Monitor CheckBoxes via $_POST & $_Cookie *************/
>
> // code in here only runs the first time the page is displayed
> if ($_POST['trakVisit'] == "") {
> if (IsSet($_COOKIE['cookieMeter'])) {
> foreach ($_COOKIE['cookieMeter'] as $key => $value) {
> if ($value == 'CHECKED') {
> $checked[$key] = 'CHECKED';
> }
> else
> $checked[$key] = "";
> }
> }
> }
> // runs on the second and subsequent submits
> elseif ($_POST['trakVisit'] == "anything") {
> for ($i=1; $i <= 24; $i++) {
> if (in_array($i, $_POST['monitors'])) {
> setcookie("cookieMeter[$i]", 'CHECKED', time()
> +60*60*24*12, '/', ".mydomain.com", 1);
> $checked[$i] = 'CHECKED';
> }
> elseif(!in_array($i, $_POST['monitors'])) {
> $checked[$i] = '';
> setcookie("cookieMeter[$i]", 'CHECKED', time()-3600, '/',
> ".mydomain.com", 1);
> }
> }
> }
>
> echo "<pre>";
> print_r($_COOKIE);
> echo "</pre>";
>
> ?>

Why do you need more than one single cookie? If you want to store
multiple pieces of information, serialize the data or something similar.

Regards, Adam Zey.

attached mail follows:


>> Does IE6 limit somehow/somewhere the number of cookie variables I can
>> create and store? The following code snippet successfully creates 24
>> cookie variables when run in FireFox, but in IE6 it is limited to 20. I
>> can provide the full code with HTML/Javascript if anyone wants to test
for
>> themselves.
>>
>> David
>>
>> <?php
>>
>> // populates a hidden form variable on the second submit
>> $somevar = "anything";
>>
>> if (!IsSet($_POST['monitors']) || empty($_POST['monitors'])) {
>> $_POST['monitors'] = array();
>> }
>>
>> /*********** Manage Monitor CheckBoxes via $_POST & $_Cookie
*************/
>>
>> // code in here only runs the first time the page is displayed
>> if ($_POST['trakVisit'] == "") {
>> if (IsSet($_COOKIE['cookieMeter'])) {
>> foreach ($_COOKIE['cookieMeter'] as $key => $value) {
>> if ($value == 'CHECKED') {
>> $checked[$key] = 'CHECKED';
>> }
>> else
>> $checked[$key] = "";
>> }
>> }
>> }
>> // runs on the second and subsequent submits
>> elseif ($_POST['trakVisit'] == "anything") {
>> for ($i=1; $i <= 24; $i++) {
>> if (in_array($i, $_POST['monitors'])) {
>> setcookie("cookieMeter[$i]", 'CHECKED', time()
>> +60*60*24*12, '/', ".mydomain.com", 1);
>> $checked[$i] = 'CHECKED';
>> }
>> elseif(!in_array($i, $_POST['monitors'])) {
>> $checked[$i] = '';
>> setcookie("cookieMeter[$i]", 'CHECKED', time()-3600,
'/',
>> ".mydomain.com", 1);
>> }
>> }
>> }
>>
>> echo "<pre>";
>> print_r($_COOKIE);
>> echo "</pre>";
>>
>> ?>

Adam Zey Asked:
> Why do you need more than one single cookie? If you want to store
> multiple pieces of information, serialize the data or something similar.
>
> Regards, Adam Zey.

Got it. Serialize works just fine.

Thank you, Adam.

David

attached mail follows:


> On Wed, August 16, 2006 9:00 am, dpgiragomdanderson.org wrote:
>> Does IE6 limit somehow/somewhere the number of cookie variables I can
>> create and store?

Richard Lynch wrote:
> Yes.
>
> Read the Cookie spec.
>
> There's no need for any site to ever send more than ONE Cookie anyway.
>
> Just use session_start() and you can store all the stuff in $_SESSION
> and it's all tied to the one Cookie.
>
> Users like me who set the browser to prompt for Cookies will often
> LEAVE a site that is being stupid and sending too many cookies, unless
> we really really really need your content, which is unlikely.
>
> You can Google and find the Cookie spec on Netscape's site -- It's
> very easy to digest, no pun intended, and a very well thought out
> spec.

Thanks, Richard. I'll take a look.

David

attached mail follows:


On Wed, August 16, 2006 9:00 am, dpgiragomdanderson.org wrote:
> Does IE6 limit somehow/somewhere the number of cookie variables I can
> create and store?

Yes.

Read the Cookie spec.

There's no need for any site to ever send more than ONE Cookie anyway.

Just use session_start() and you can store all the stuff in $_SESSION
and it's all tied to the one Cookie.

Users like me who set the browser to prompt for Cookies will often
LEAVE a site that is being stupid and sending too many cookies, unless
we really really really need your content, which is unlikely.

You can Google and find the Cookie spec on Netscape's site -- It's
very easy to digest, no pun intended, and a very well thought out
spec.

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


System Windows XP:

PHP 5

 

I have a folder in which I want to write files. The IUSR_... user has full
control, yet I am still getting failed to open stream and permission dined
errors.

 

Any suggestions?

 

I have done this same task on many XP machines and 2003 servers. I am
totally stumped.

 

 

Jeremy Schreckhise, M.B.A.

 

 

attached mail follows:


Fixed by re-assigning IUSR... to directory security.

Cheers.

-----Original Message-----
From: Jeremy Schreckhise [mailto:jschreckhiseaogc.com]
Sent: Wednesday, August 16, 2006 10:59 AM
To: php-generallists.php.net
Subject: [PHP] fwrite fopen problem

System Windows XP:

PHP 5

 

I have a folder in which I want to write files. The IUSR_... user has full
control, yet I am still getting failed to open stream and permission dined
errors.

 

Any suggestions?

 

I have done this same task on many XP machines and 2003 servers. I am
totally stumped.

 

 

Jeremy Schreckhise, M.B.A.

 

 

attached mail follows:


On 8/16/06, David Tulloh <davidtulloh.id.au> wrote:
> Chris G wrote:
> foreach ($user_input_array as $user_input) {
> $data_member = array(); # Create an empty array
>
> Do SQL query stuff
>
> foreach ($sql_results as $sql_member) {
> $data_member[] = $sql_member;
> }
>
> $data[] = $data_member;
> }
>
> You can now do your function call as
> $gbarplot = new GroupBarPlot($data);

The downside to this approach is that you'll end up making a SQL call
for each value in the array. An alternative would be to build a
comma-delimited string of values and use SQL's IN() check. Example:

[code]
// CAUTION: Validate your data to protect from SQL Injection, like David says!
// Assuming you've done this, $per_ids_array contains valid/clean/safe data
// that was originally submitted through $_GET['per_id'].
// Let's turn that array into a comma-delimited string using implode()
$per_ids_string = implode(',', $per_ids_array);

// Now plug the string into our SQL query:
$query = 'SELECT rep_l_per_id, rep_value_perc FROM report_values WHERE
rep_l_per_id IN (' . $per_ids . ') ORDER BY rep_l_per_id ASC';

// execute
$result = mysql_query($query) or die (mysql_error());

// Before looping through our result set, initialize two variables:
$gbp_data = array(); // this will be the final array to be passed
to GroupBarPlot()
$temp_id = NULL; // use this to determine the result set has moved
to a new rep_|_per_id
while($line = mysql_fetch_array($result)) {
     // IF $temp_id does not match the current rep_|_per_id,
     // create a new element of $gbp_data as an array.
     // Also, set $temp_id to this rep_|_per_id value to use in the
next iteration.
     if ($temp_id != $line['rep_|_per_id']) {
          $temp_id = $line['rep_|_per_id'];
          $gbp_data[$temp_id] = array();
     }

     // Add rep_value_perc as an array element
     $gbp_data[$temp_id][] = $line['rep_value_perc'];
}

// Now pass to your function:
$gbarplot = new GroupBarPlot($gbp_data);
[/code]

It's all untested, but I *think* will work out of the box.

> And now a bit of bonus advice. The SQL query that you provided earlier
> has a giant SQL injection attack problem. I'd recomend reading a little
> about SQL injection attacks and getting it patched up.
>

Yeah, this cannot be stressed enough!!!

HTH,
John W

attached mail follows:


On Wed, August 16, 2006 1:08 am, Chris G wrote:
> while($line = mysql_fetch_array($result)) {
>
> $data1y[] = $line['rep_value_perc'];

$dataly[][] = $line['rep_value_prec'];

>
> }
>
> This gives me just the one array from the above example, $datay1. How
> would
>
> you dynamically create the all of the above arrays?
>
> At present the $_GET[per_id] is only one value $_GET[per_id] = 2
>
> What happens when it becomes more than one, like $_GET[per_id] = array
>
> (1,2,34,4,561,334)

Then you either need to run multiple queries to add to your array of
arrays, or you need to run one query with an ORDER BY the _GET[per_id]
field and then you can build a new sub-array for each new per_id in
your results.

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


On Wed, August 16, 2006 4:11 am, Colin Guthrie wrote:
> I can't rembmer but does Apache have a max size that is independant of
> PHP? Perhaps you'll need to set both?

Apache has a limit on POST size, which is a super-set of your file
upload size limit.

> While on the topic, is there a nice way to show users progress when
> file
> uploads occur?

Get a better browser? :-)

> This could be client side/javascript etc. but to upload
> a
> 20Meg file will take a while so some form of feedback is important
> IMO.

There are hooks in PHP in CVS for this.

There are several source patches on-line for PHP to do this.

To this day, I believe it is on the BROWSER to do this, not the
SERVER, for reasons obvious to anybody who thinks about this for more
than 10 seconds.

> What is the absolute maximum that is sensible to use? Are there any
> other techniques to use (e.g. Applet etc.).

Depends on user's bandwidth (dialup or T1?) and your bandwidth mostly.

I suppose it's possible you have an overwhelemed server where
bandwidth is not the choke-point, but it seems unlikely...

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


On Tue, August 15, 2006 11:00 pm, John Meyer wrote:
> Richard Lynch wrote:
>
>> Do you really mean opendir() or do you mean readdir() ???
>
>
> readdir().
>
> The point is why do you need to put it as
> !==
>
> vs.
> !=

http://us3.php.net/manual/en/language.types.type-juggling.php

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


On Tue, August 15, 2006 7:01 pm, Larry Garfield wrote:
> On Tuesday 15 August 2006 16:50, Richard Lynch wrote:
>
>> If the names are not predictable, the array solution is probably
>> best,
>> as there is movement in the PHP Internals list that may (or may not)
>> make it impossible to dynamically add a property to an object. I've
>> lost track of where that thread ended, so apologies if this is a
>> non-issue.
>
> Gah! Please tell me you're joking. That would kill one of PHP's best
> features, the fact that you can have dynamic data structures.
>
> PHP != Java!!!

I was partly wrong.

This would only apply (if it applies at all) for static vars.

class foo { };
$foo = new foo;
foo->whatever = 5; //ok
foo::something = 5; //E_STRICT error, maybe, depending on Internals
flamewar outcome...

Richard "Swiss cheese memory" Lynch :-)

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


Searching through the logs and browsing my site (see sig) I sometimes see
PHPSESSID is used as opposed to cookies. I know it's not simply that the
client doesn't support cookies because I can see the same IP transition
to and from using PHPSESSID. Can someone explain why this is happening?

I'm using PHP 4.

Thanks,
Mike
--
Michael B Allen
PHP Active Directory SSO
http://www.ioplex.com/