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 11 May 2007 02:13:37 -0000 Issue 4784

php-general-digest-helplists.php.net
Date: Thu May 10 2007 - 21:13:37 CDT


php-general Digest 11 May 2007 02:13:37 -0000 Issue 4784

Topics (messages 254717 through 254769):

Re: getting $_ENV variables
        254717 by: Daniel Brown
        254720 by: C.R.Vegelin
        254721 by: Richard Davey
        254722 by: Daniel Brown
        254723 by: Daniel Brown
        254726 by: C.R.Vegelin
        254727 by: Richard Davey
        254729 by: Zoltán Németh
        254732 by: Richard Davey
        254735 by: C.R.Vegelin

Re: SESSION LOST!
        254718 by: Oliver Block

Re: faridjamegmail.com
        254719 by: Tom Rogers

Re: Ajax?
        254724 by: Robert Cummings

One class, many methods: PHP4.x: Q's
        254725 by: Micky Hulse
        254728 by: Richard Davey
        254730 by: Eric Butera
        254731 by: Micky Hulse
        254733 by: Micky Hulse
        254734 by: Richard Davey
        254736 by: Micky Hulse
        254769 by: Micky Hulse

WSDL Generator class
        254737 by: Brice
        254767 by: Daevid Vincent

Re: Upload problem - final size is different
        254738 by: Eric Trahan

scrolling HTML tables
        254739 by: C.R.Vegelin
        254740 by: Daniel Brown
        254741 by: Richard Davey

Re: session cookies enabled?
        254742 by: ccspencer.softhome.net
        254743 by: Richard Davey
        254744 by: Edward Vermillion
        254745 by: Richard Davey

sorting via PHP or MySQL?
        254746 by: James Tu
        254747 by: Brad Fuller
        254748 by: Robert Cummings

GET variable unexpectedly assigned to session variable
        254749 by: Armando Acosta
        254750 by: Robert Cummings
        254751 by: Daniel Brown
        254752 by: Dave Goodchild

PHP sorting csv array output
        254753 by: Anna Vester
        254754 by: Daniel Brown
        254755 by: Anna Vester
        254756 by: tg-php.gryffyndevelopment.com

Need a new shared host with php
        254757 by: Al
        254759 by: Edward Kay
        254760 by: Afan Pasalic
        254761 by: Matthew Powell
        254763 by: Myron Turner
        254764 by: Richard Davey

sqlite if query changes to empty on a loop
        254758 by: chris.aquanuke.com

PHP & MySQL
        254762 by: Jason Pruim

Re: Scalable Site Architecture
        254765 by: Chris Shiflett
        254766 by: bruce

PHP on the AS400 (now i5)
        254768 by: Mark 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:


    Cor,

    If it's suggesting that it's an array, that's a little baffling, because
that means there are multiple entries (at least two), but they appear to
either be null or otherwise unable to display.

    Did you get that result when running the script from the CLI or via the
web?

On 5/10/07, C.R.Vegelin <cr.vegelinhetnet.nl> wrote:
>
> Thanks Daniel, Greg, Richard,
>
> I made a script with:
> <?php
> print_r($_ENV);
> ?>
> and it results only into: "Array ( )" nothing else ...
> So it must be caused by a "different" environment ?
> All I want is to check the $_ENV['OS'] within PHP scripts.
>
> Regards, Cor
>
> ----- Original Message -----
> *From:* Daniel Brown <parasanegmail.com>
> *To:* C.R.Vegelin <cr.vegelinhetnet.nl>
> *Cc:* php-generallists.php.n
> *Sent:* Wednesday, May 09, 2007 5:26 PM
> *Subject:* Re: [PHP] getting $_ENV variables
>
>
> When I print_r($_ENV); from the CLI on 5.0.4 I get a bunch of results,
> no problem.... but no $_ENV['OS'] variable. Further, when I check my
> phpinfo(); output, there are even fewer $_ENV variables printed than the CLI
> offers.
>
> I'm not certain about this, Cor, but my guess is that PHP 5.x.x may
> have altered the default $_ENV output to hide some of this information ---
> which is a good thing, in my opinion, because then you won't just have some
> run-of-the-mill script kiddie checking out the details of a box for known
> security holes.
>
> Of course, that doesn't necessarily stop <? passthru('uname -a')."\n";
> ?> or checking the $_SERVER['SERVER_SIGNATURE'] variable for the OS
> information.... so perhaps this response is just one of those white-bread
> responses. Something to chew on, but you really don't get anything from it.
>
>
>
> On 5/9/07, C.R.Vegelin <cr.vegelinhetnet.nl> wrote:
> >
> > Hi All,
> >
> > I get nothing when using: echo $_ENV['OS'];
> > Also nothing when using: print_r($_ENV);
> > However, phpinfo(); show a full list of ENV settings.
> > How to get $_ENV variables ?
> > I am using PHP version 5.2.0.
> >
> > TIA, Cor
>
>
>
>
> --
> Daniel P. Brown
> [office] (570-) 587-7080 Ext. 272
> [mobile] (570-) 766-8107
>
>

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

attached mail follows:


Daniel,

I did get the result via the web / IE with the address: http://127.0.0.1/test/ENVtest.php
with ENVtest.php having:
<?php
print_r($_ENV);
?>
using Windows XP, PHP 5.2.0
  ----- Original Message -----
  From: Daniel Brown
  To: C.R.Vegelin
  Cc: php-generallists.php.n
  Sent: Thursday, May 10, 2007 2:24 PM
  Subject: Re: [PHP] getting $_ENV variables

      Cor,

      If it's suggesting that it's an array, that's a little baffling, because that means there are multiple entries (at least two), but they appear to either be null or otherwise unable to display.

      Did you get that result when running the script from the CLI or via the web?

  On 5/10/07, C.R.Vegelin < cr.vegelinhetnet.nl> wrote:
    Thanks Daniel, Greg, Richard,

    I made a script with:
    <?php
    print_r($_ENV);
    ?>
    and it results only into: "Array ( )" nothing else ...
    So it must be caused by a "different" environment ?
    All I want is to check the $_ENV['OS'] within PHP scripts.

    Regards, Cor
      ----- Original Message -----
      From: Daniel Brown
      To: C.R.Vegelin
      Cc: php-generallists.php.n
      Sent: Wednesday, May 09, 2007 5:26 PM
      Subject: Re: [PHP] getting $_ENV variables

          When I print_r($_ENV); from the CLI on 5.0.4 I get a bunch of results, no problem.... but no $_ENV['OS'] variable. Further, when I check my phpinfo(); output, there are even fewer $_ENV variables printed than the CLI offers.

          I'm not certain about this, Cor, but my guess is that PHP 5.x.x may have altered the default $_ENV output to hide some of this information --- which is a good thing, in my opinion, because then you won't just have some run-of-the-mill script kiddie checking out the details of a box for known security holes.

          Of course, that doesn't necessarily stop <? passthru('uname -a')."\n"; ?> or checking the $_SERVER['SERVER_SIGNATURE'] variable for the OS information.... so perhaps this response is just one of those white-bread responses. Something to chew on, but you really don't get anything from it.

      On 5/9/07, C.R.Vegelin <cr.vegelinhetnet.nl > wrote:
        Hi All,

        I get nothing when using: echo $_ENV['OS'];
        Also nothing when using: print_r($_ENV);
        However, phpinfo(); show a full list of ENV settings.
        How to get $_ENV variables ?
        I am using PHP version 5.2.0.

        TIA, Cor

      --
      Daniel P. Brown
      [office] (570-) 587-7080 Ext. 272
      [mobile] (570-) 766-8107

  --
  Daniel P. Brown
  [office] (570-) 587-7080 Ext. 272
  [mobile] (570-) 766-8107

attached mail follows:


Daniel Brown wrote:

> If it's suggesting that it's an array, that's a little baffling, because
> that means there are multiple entries (at least two), but they appear to
> either be null or otherwise unable to display.

The $_ENV superb-global contains an array of environment settings, so
it's not totally baffling that print_r() on it should return an array.

The reason it is empty is because the variables_order setting in the
php.ini has had it disabled.

The default is:

variables_order = "EGPCS"

But it must have been changed to:

variables_order = "GPCS"

Dropping the E (Environment variables) will cause a print_r($_ENV) to be
totally empty. Some hosts do this in order to hide the environment
settings because they can contain sensitive information such as the CPU
identifiers, etc. I've seen the 'cheaper' hosts (especially those
hosting on Windows and/or Virtual Servers) disable this so you can't
tell what kind of CPU they're using, or where their system drive is.

Cheers,

Rich
--
Zend Certified Engineer
http://www.corephp.co.uk

"Never trust a computer you can't throw out of a window"

attached mail follows:


    What HTTP server are you using, Apache, IIS, AnalogX SimpleServer?

    That last one is actually one of my favorites for simple desktop page
hosting. Tiny, no installation.... boom, there you go.

    http://www.analogx.com/ --- There's a bunch of stuff there. No, I'm not
affiliated with them, or advertising for them. Just linking.

On 5/10/07, C.R.Vegelin <cr.vegelinhetnet.nl> wrote:
>
> Daniel,
>
> I did get the result via the web / IE with the address:
> http://127.0.0.1/test/ENVtest.php
> with ENVtest.php having:
> <?php
> print_r($_ENV);
> ?>
> using Windows XP, PHP 5.2.0
>
> ----- Original Message -----
> *From:* Daniel Brown <parasanegmail.com>
> *To:* C.R.Vegelin <cr.vegelinhetnet.nl>
> *Cc:* php-generallists.php.n
> *Sent:* Thursday, May 10, 2007 2:24 PM
> *Subject:* Re: [PHP] getting $_ENV variables
>
>
> Cor,
>
> If it's suggesting that it's an array, that's a little baffling,
> because that means there are multiple entries (at least two), but they
> appear to either be null or otherwise unable to display.
>
> Did you get that result when running the script from the CLI or via
> the web?
>
> On 5/10/07, C.R.Vegelin < cr.vegelinhetnet.nl> wrote:
> >
> > Thanks Daniel, Greg, Richard,
> >
> > I made a script with:
> > <?php
> > print_r($_ENV);
> > ?>
> > and it results only into: "Array ( )" nothing else ...
> > So it must be caused by a "different" environment ?
> > All I want is to check the $_ENV['OS'] within PHP scripts.
> >
> > Regards, Cor
> >
> > ----- Original Message -----
> > *From:* Daniel Brown <parasanegmail.com>
> > *To:* C.R.Vegelin <cr.vegelinhetnet.nl>
> > *Cc:* php-generallists.php.n
> > *Sent:* Wednesday, May 09, 2007 5:26 PM
> > *Subject:* Re: [PHP] getting $_ENV variables
> >
> >
> > When I print_r($_ENV); from the CLI on 5.0.4 I get a bunch of
> > results, no problem.... but no $_ENV['OS'] variable. Further, when I check
> > my phpinfo(); output, there are even fewer $_ENV variables printed than the
> > CLI offers.
> >
> > I'm not certain about this, Cor, but my guess is that PHP 5.x.x may
> > have altered the default $_ENV output to hide some of this information ---
> > which is a good thing, in my opinion, because then you won't just have some
> > run-of-the-mill script kiddie checking out the details of a box for known
> > security holes.
> >
> > Of course, that doesn't necessarily stop <? passthru('uname
> > -a')."\n"; ?> or checking the $_SERVER['SERVER_SIGNATURE'] variable for the
> > OS information.... so perhaps this response is just one of those white-bread
> > responses. Something to chew on, but you really don't get anything from it.
> >
> >
> >
> > On 5/9/07, C.R.Vegelin <cr.vegelinhetnet.nl > wrote:
> > >
> > > Hi All,
> > >
> > > I get nothing when using: echo $_ENV['OS'];
> > > Also nothing when using: print_r($_ENV);
> > > However, phpinfo(); show a full list of ENV settings.
> > > How to get $_ENV variables ?
> > > I am using PHP version 5.2.0.
> > >
> > > TIA, Cor
> >
> >
> >
> >
> > --
> > Daniel P. Brown
> > [office] (570-) 587-7080 Ext. 272
> > [mobile] (570-) 766-8107
> >
> >
>
>
> --
> Daniel P. Brown
> [office] (570-) 587-7080 Ext. 272
> [mobile] (570-) 766-8107
>
>

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

attached mail follows:


    I guess I really didn't understand that myself before either. So
Richard, even though it's disabling data output, it still exists as an
array?

    Well, damn.... you really DO learn something new every day.

On 5/10/07, Richard Davey <richcorephp.co.uk> wrote:
>
> Daniel Brown wrote:
>
> > If it's suggesting that it's an array, that's a little baffling,
> because
> > that means there are multiple entries (at least two), but they appear to
> > either be null or otherwise unable to display.
>
> The $_ENV superb-global contains an array of environment settings, so
> it's not totally baffling that print_r() on it should return an array.
>
> The reason it is empty is because the variables_order setting in the
> php.ini has had it disabled.
>
> The default is:
>
> variables_order = "EGPCS"
>
> But it must have been changed to:
>
> variables_order = "GPCS"
>
> Dropping the E (Environment variables) will cause a print_r($_ENV) to be
> totally empty. Some hosts do this in order to hide the environment
> settings because they can contain sensitive information such as the CPU
> identifiers, etc. I've seen the 'cheaper' hosts (especially those
> hosting on Windows and/or Virtual Servers) disable this so you can't
> tell what kind of CPU they're using, or where their system drive is.
>
> Cheers,
>
> Rich
> --
> Zend Certified Engineer
> http://www.corephp.co.uk
>
> "Never trust a computer you can't throw out of a window"
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

attached mail follows:


Yes, my PHPinfo shows under configuration: variables_order = GPCS
I will test EGPCS setting in php.ini
But that also means that code using $_ENV cannot be run with hosts hiding
the environment settings ?!
And I assume that EGPCS will also affect: <?php print_r($_FILES); ?>
Now with GPCS this script shows also only: Array ( )
So also potential problems with $_FILES with hosts hiding the environment
settings ?!

Regards, Cor

----- Original Message -----
From: "Richard Davey" <richcorephp.co.uk>
To: "php-generallists.php.n" <php-generallists.php.net>
Sent: Thursday, May 10, 2007 2:44 PM
Subject: Re: [PHP] getting $_ENV variables

> Daniel Brown wrote:
>
>> If it's suggesting that it's an array, that's a little baffling,
>> because
>> that means there are multiple entries (at least two), but they appear to
>> either be null or otherwise unable to display.
>
> The $_ENV superb-global contains an array of environment settings, so it's
> not totally baffling that print_r() on it should return an array.
>
> The reason it is empty is because the variables_order setting in the
> php.ini has had it disabled.
>
> The default is:
>
> variables_order = "EGPCS"
>
> But it must have been changed to:
>
> variables_order = "GPCS"
>
> Dropping the E (Environment variables) will cause a print_r($_ENV) to be
> totally empty. Some hosts do this in order to hide the environment
> settings because they can contain sensitive information such as the CPU
> identifiers, etc. I've seen the 'cheaper' hosts (especially those hosting
> on Windows and/or Virtual Servers) disable this so you can't tell what
> kind of CPU they're using, or where their system drive is.
>
> Cheers,
>
> Rich
> --
> Zend Certified Engineer
> http://www.corephp.co.uk
>
> "Never trust a computer you can't throw out of a window"
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


Daniel Brown wrote:

> I guess I really didn't understand that myself before either. So
> Richard, even though it's disabling data output, it still exists as an
> array?

The array ($_ENV) exists, it is just the population of it that has been
disabled, thus it's empty. Just in the same way that doing a
print_r($_GET) will always display an empty array even if the query
string is totally blank, or print_r($_POST) does the same, even though
you didn't post a thing to the script.

The super-globals I guess must just be created at run-time, and
populated later on in the process, by which time the php.ini settings
have been taken into account and stopped the action.

Cheers,

Rich
--
Zend Certified Engineer
http://www.corephp.co.uk

"Never trust a computer you can't throw out of a window"

attached mail follows:


2007. 05. 10, csütörtök keltezéssel 16.05-kor C.R.Vegelin ezt írta:
> Yes, my PHPinfo shows under configuration: variables_order = GPCS
> I will test EGPCS setting in php.ini
> But that also means that code using $_ENV cannot be run with hosts hiding
> the environment settings ?!
> And I assume that EGPCS will also affect: <?php print_r($_FILES); ?>
> Now with GPCS this script shows also only: Array ( )
> So also potential problems with $_FILES with hosts hiding the environment
> settings ?!

$_FILES is only available when you upload a file to the script with a
form whose enctype is set to multipart/form-data

otherwise it is empty of course
I think this has nothing to do with $_ENV and the above situation...

greets
Zoltán Németh

>
> Regards, Cor
>
> ----- Original Message -----
> From: "Richard Davey" <richcorephp.co.uk>
> To: "php-generallists.php.n" <php-generallists.php.net>
> Sent: Thursday, May 10, 2007 2:44 PM
> Subject: Re: [PHP] getting $_ENV variables
>
>
> > Daniel Brown wrote:
> >
> >> If it's suggesting that it's an array, that's a little baffling,
> >> because
> >> that means there are multiple entries (at least two), but they appear to
> >> either be null or otherwise unable to display.
> >
> > The $_ENV superb-global contains an array of environment settings, so it's
> > not totally baffling that print_r() on it should return an array.
> >
> > The reason it is empty is because the variables_order setting in the
> > php.ini has had it disabled.
> >
> > The default is:
> >
> > variables_order = "EGPCS"
> >
> > But it must have been changed to:
> >
> > variables_order = "GPCS"
> >
> > Dropping the E (Environment variables) will cause a print_r($_ENV) to be
> > totally empty. Some hosts do this in order to hide the environment
> > settings because they can contain sensitive information such as the CPU
> > identifiers, etc. I've seen the 'cheaper' hosts (especially those hosting
> > on Windows and/or Virtual Servers) disable this so you can't tell what
> > kind of CPU they're using, or where their system drive is.
> >
> > Cheers,
> >
> > Rich
> > --
> > Zend Certified Engineer
> > http://www.corephp.co.uk
> >
> > "Never trust a computer you can't throw out of a window"
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>

attached mail follows:


C.R.Vegelin wrote:

> Yes, my PHPinfo shows under configuration: variables_order = GPCS
> I will test EGPCS setting in php.ini

> But that also means that code using $_ENV cannot be run with hosts
> hiding the environment settings ?!

Correct. Sucks I know, but some hosts just do this.

> And I assume that EGPCS will also affect: <?php print_r($_FILES); ?>

No, $_FILES isn't part of the Environment list, it's created again at
run-time when a file upload occurs. It would be worth running a test to
see if they have tied it to the $_POST array, i.e. remove the 'P' from
EGPCS and see if $_FILES gets lost with it.

I would be curious to know, although I can't think of a single host that
would be stupid enough to disable $_POST :)

Cheers,

Rich
--
Zend Certified Engineer
http://www.corephp.co.uk

"Never trust a computer you can't throw out of a window"

attached mail follows:


Okay, I will use getenv() and keep variables_order = GPCS in php.ini
Thanks all and
with regards, Cor

----- Original Message -----
From: "Richard Davey" <richcorephp.co.uk>
To: "php-generallists.php.n" <php-generallists.php.net>
Sent: Thursday, May 10, 2007 3:34 PM
Subject: Re: [PHP] getting $_ENV variables

> C.R.Vegelin wrote:
>
>> Yes, my PHPinfo shows under configuration: variables_order = GPCS
>> I will test EGPCS setting in php.ini
>
>> But that also means that code using $_ENV cannot be run with hosts
>> hiding the environment settings ?!
>
> Correct. Sucks I know, but some hosts just do this.
>
>> And I assume that EGPCS will also affect: <?php print_r($_FILES); ?>
>
> No, $_FILES isn't part of the Environment list, it's created again at
> run-time when a file upload occurs. It would be worth running a test to
> see if they have tied it to the $_POST array, i.e. remove the 'P' from
> EGPCS and see if $_FILES gets lost with it.
>
> I would be curious to know, although I can't think of a single host that
> would be stupid enough to disable $_POST :)
>
> Cheers,
>
> Rich
> --
> Zend Certified Engineer
> http://www.corephp.co.uk
>
> "Never trust a computer you can't throw out of a window"
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


Am Donnerstag, 10. Mai 2007 08:59 schrieb Sascha Braun:
> but after a little
> time, the session is just lost.

That doesn't say anything to me. Could you be more verbose on what you mean by
"the sessin is lost"?

Regards,

Oliver

attached mail follows:


Hi,

Could be stray carriage returns in your include files, good idea to
remove any '?>>" in the include files as they are not needed.

Perhaps I should have said:

remove any '?>' at the END of the include file as they are not needed,
of course any escaping to html in the middle will still be needed. :)

--
regards,
Tom

attached mail follows:


On Thu, 2007-05-10 at 08:52 -0300, Rangel Reale wrote:
> JavaScript (and AJAX) took the fun out of programming.
>
> Before AJAX, programming for web was easy and fast. Now its the oposite.

Maybe you're doing it wrong :|

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


Hi,

This might be a real obvious question/answer... but I have been up all
night geeking on code, so my mind is kinda mushy -- please be kind. :)

I have a class called Randimg. Within that class, I have several
methods. Within a few of those methods, I use the below code snippet:

$_SERVER['DOCUMENT_ROOT']

What would be the best way to assign the above code to a global
variable/constant within the class?

Also, within each method, I am returning error strings... I would like
to create these as class constants... Or something... What is best way
to setup static strings within my class? Basically, I would like to have
these strings at the top of my class so potential users can easily
change the "settings." ;)

Lol, sorry is stoooopid questions... I am still kinda new to PHP OOP.

Many TIA's!
Cheers,
Micky

--
Wishlists: <http://snipurl.com/1gqpj>
    Switch: <http://browsehappy.com/>
      BCC?: <http://snipurl.com/w6f8>
        My: <http://del.icio.us/mhulse>

attached mail follows:


Micky Hulse wrote:

> I have a class called Randimg. Within that class, I have several
> methods. Within a few of those methods, I use the below code snippet:
>
> $_SERVER['DOCUMENT_ROOT']
>
> What would be the best way to assign the above code to a global
> variable/constant within the class?

Within the constructor for Randimg you could set a local protected variable:

class Randimg
{
   var $docroot = false;

   function Randimg ()
   {
     $this->docroot = $_SERVER['DOCUMENT_ROOT'];
   }

and then you can just reference $this->docroot from any of the Randimg
methods.

In PHP 5 could you create $docroot as a protected class constant, but in
PHP 4 the above will have to do.

Cheers,

Rich
--
Zend Certified Engineer
http://www.corephp.co.uk

"Never trust a computer you can't throw out of a window"

attached mail follows:


On 5/10/07, Micky Hulse <mickyambiguism.com> wrote:
> Hi,
>
> This might be a real obvious question/answer... but I have been up all
> night geeking on code, so my mind is kinda mushy -- please be kind. :)
>
> I have a class called Randimg. Within that class, I have several
> methods. Within a few of those methods, I use the below code snippet:
>
> $_SERVER['DOCUMENT_ROOT']
>
> What would be the best way to assign the above code to a global
> variable/constant within the class?
>
> Also, within each method, I am returning error strings... I would like
> to create these as class constants... Or something... What is best way
> to setup static strings within my class? Basically, I would like to have
> these strings at the top of my class so potential users can easily
> change the "settings." ;)
>
> Lol, sorry is stoooopid questions... I am still kinda new to PHP OOP.
>
> Many TIA's!
> Cheers,
> Micky
>
> --
> Wishlists: <http://snipurl.com/1gqpj>
> Switch: <http://browsehappy.com/>
> BCC?: <http://snipurl.com/w6f8>
> My: <http://del.icio.us/mhulse>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

As Rich pointed out you cannot have constants within a class in PHP4.
To answer the second part of your mail, one technique that I have seen
is something like the code below.

define('FOO_FILE_NOT_FOUND', 1);
define('FOO_FILE_NOT_READABLE', 2);
define('FOO_FILE_INVALID PATH', 2);

class Foo {
   function render() {
      if (! is_readable(...)) { return FOO_FILE_NOT_READABLE; }
   }
}

Another way that is nice is Solar's way of handling locales.
Basically it uses strings such as 'SOME_ERROR_MESSAGE' which is
populated by an include file that contains the actual value to it. So
in this include file you create an array that contains key value pairs
of error codes and error messages.

attached mail follows:


Hi Rich! Thanks for the quick reply. I really appreciate your help. :)

Richard Davey wrote:
> In PHP 5 could you create $docroot as a protected class constant, but in
> PHP 4 the above will have to do.

Ahhh! Very interesting. Many thanks for the code example and explanation
-- that approach works for me.

I assume setting basic strings (i.e. "settings") for my error messages
would be best done via:

class Randimg
{

var $msg_1 = 'This is a string';
var $msg_2 = 'This is another string';

function rand_img() { echo $this->msg_1; }
function foo() { echo $this->msg_2; }

}

It just seems so extraneous to declare those strings as vars... A class
constant sounds like the best approach.

I can't wait to start using PHP5! :D

Thanks again Rich! I really appreciate your time and expertise.

Have a great day and/or night.

Cheers,
Micky

--
Wishlists: <http://snipurl.com/1gqpj>
    Switch: <http://browsehappy.com/>
      BCC?: <http://snipurl.com/w6f8>
        My: <http://del.icio.us/mhulse>

attached mail follows:


Hi Eric! Thanks for the fast reply. I really appreciate the help on this
one. :D

Eric Butera wrote:
> As Rich pointed out you cannot have constants within a class in PHP4.
> To answer the second part of your mail, one technique that I have seen
> is something like the code below.

Ahhh, that is interesting! Thanks for sharing the code snippet. I think
I may head this direction. :)

> Another way that is nice is Solar's way of handling locales.
> Basically it uses strings such as 'SOME_ERROR_MESSAGE' which is
> populated by an include file that contains the actual value to it. So
> in this include file you create an array that contains key value pairs
> of error codes and error messages.

Oh, wow! That sounds interesting... I am going to catch some zzZZzz's
and read-up on this in the "morning." :D

Ahhh, and it looks like a cool framework too:

<http://solarphp.com/>

I may have to dip-into that. I have yet to try a PHP framework. Django
was pretty fun, but I think I would have more fun with a PHP framework. :)

Anyway, thanks a billion for sharing different approaches, it is great
to hear how the pros deal with such things.

Have a great day and/or night.
Cheers,
Micky

--
Wishlists: <http://snipurl.com/1gqpj>
    Switch: <http://browsehappy.com/>
      BCC?: <http://snipurl.com/w6f8>
        My: <http://del.icio.us/mhulse>

attached mail follows:


Micky Hulse wrote:

> I assume setting basic strings (i.e. "settings") for my error messages
> would be best done via:
>
> class Randimg
> {
>
> var $msg_1 = 'This is a string';
> var $msg_2 = 'This is another string';
>
> function rand_img() { echo $this->msg_1; }
> function foo() { echo $this->msg_2; }
>
> }

I don't know if that's the *best* way, personally I'd not really do it
like that, but no-one can tell you it is 'right' or 'wrong' because it
depends on your application. For example if you only have a handful of
possible error messages (say < 10) then there is nothing inherently
wrong with the above approach.

If you're talking about lots of error messages then under PHP 4 I'd
declare them as consts in a required() file.

define('APP_ERROR_1', 'This is an error message');

Then just use APP_ERROR_1 in the methods that need it. It's a bit messy
because you are creating consts all over the place, but it's an option
for you and at least it keeps them all in a single file and out of the
header of your class.

Another way might be to create a specific class that does nothing but
handle error messages / responses, then call that.

Cheers,

Rich
--
Zend Certified Engineer
http://www.corephp.co.uk

"Never trust a computer you can't throw out of a window"

attached mail follows:


Richard Davey wrote:
> I don't know if that's the *best* way, personally I'd not really do it
> like that, but no-one can tell you it is 'right' or 'wrong' because it
> ...<snip>...

Perfect answer! Thanks!

I do not have too many error messages to store, but I do like the
constant approach... Looks like I have a bit of testing to do tomorrow
(brain is mush atm.)

Thanks again Rich and Eric. :)

Cheers,
M

--
Wishlists: <http://snipurl.com/1gqpj>
    Switch: <http://browsehappy.com/>
      BCC?: <http://snipurl.com/w6f8>
        My: <http://del.icio.us/mhulse>

attached mail follows:


Richard Davey wrote:
> Within the constructor for Randimg you could set a local protected
> variable:
> class Randimg
> {
> var $docroot = false;
>
> function Randimg ()
> {
> $this->docroot = $_SERVER['DOCUMENT_ROOT'];
> }

Hi Rich and all, just one other quick question...

Which approach below would you choose?

Example 1:

class Randimg {
        # Initialize var variables:
        var $foo1 = FALSE;
        var $foo2 = FALSE;
        var $foo3 = TRUE;
        # Constructor:
        function Randimg {
                $this->foo1 = TRUE;
                $this->foo2 = TRUE;
                $this->foo3 = FALSE;
                return $this->method_foo();
        }
        function method_foo() {
                $x = $this->$foo1;
                $y = $this->$foo2;
                $z = $this->$foo3;
                /* Do stuff... */
                return $x.$y.$z;
        }
}

Example 2:

class Randimg {
        # Constructor:
        function Randimg {
                $foo1 = TRUE;
                $foo2 = TRUE;
                $foo3 = FALSE;
                return $this->method_foo($foo1, $foo2, $foo3);
        }
        function method_foo($x, $y, $z) {
                /* Do stuff... */
                return $x.$y.$z;
        }
}

Hopefully my syntax is decent... I am guessing the approach I take
depends on the needs of my script. Setting local protected variables
seems like it would work well for my latest project, but is that bad
programming practice to rely upon local protected variables when it
comes to passing variables between methods?

Seems like I have always read/heard that it is best to explicitly pass
variables as function parameters... vs throwing around "globals."

Sorry if silly questions. :)
Thanks again!
Cheers,
M

--
Wishlists: <http://snipurl.com/1gqpj>
    Switch: <http://browsehappy.com/>
      BCC?: <http://snipurl.com/w6f8>
        My: <http://del.icio.us/mhulse>

attached mail follows:


Hello all,

I'am looking for an WSDL generator class. The aim is to generate an wsdl
file to use with the soap extension. The generator will look at the included
classes and print all functions (except maybe abstract or private) in a
correct xml format.

I tried this one which is great :
http://www.schlossnagle.org/~george/blog/index.php?/archives/234-WSDL-Generation.htmlbut
i have to modify a lot of code and it appears it's not maintained.

So what do you do in order to create WSD?

Is the soap extension or a PEAR classes will include this kind of function?

Thanks
Brice

attached mail follows:


I'm no big fan of SOAP and certainly think it's silly that I have to use like 8 million lines of WSDL to describe a 20 line function
in PHP. I don't know WSDL - at all - don't want to know it -- shouldn't have to know it. Grrr.

Sadly I had the same frustrating experience you did and ultimately ended up using this WSDL_Gen tool too.

What do you have to modify? It worked fine for me for int, float, string, and array -- although it's kinda wonkey with a hash as it
turns it into an array -- well something does. GRRRR. Not sure if that's a SOAP "feature" or a bug or what.

All the other "solutions" (for lack of a better term) required just as much messaging to even get going. WSDL_Gen was quick and
dirty and got my app up and running in a few hours. We use Ruby to talk to PHP5 via SOAP.

I wish PHP had a generator built in, or there was a better tool actively being developed.

Daevid.

"There are two kinds of people in this world. Top posters and bottom posters."

> -----Original Message-----
> From: Brice [mailto:brice.favregmail.com]
> Sent: Thursday, May 10, 2007 8:10 AM
> To: PHP General List
> Subject: [PHP] WSDL Generator class
>
> Hello all,
>
> I'am looking for an WSDL generator class. The aim is to
> generate an wsdl
> file to use with the soap extension. The generator will look
> at the included
> classes and print all functions (except maybe abstract or
> private) in a
> correct xml format.
>
> I tried this one which is great :
> http://www.schlossnagle.org/~george/blog/index.php?/archives/2
> 34-WSDL-Generation.htmlbut
> i have to modify a lot of code and it appears it's not maintained.
>
> So what do you do in order to create WSD?
>
> Is the soap extension or a PEAR classes will include this
> kind of function?
>
> Thanks
> Brice

attached mail follows:


Thank you all for your tips and solutions !!

I use chmod and my upload form works fine ;)

Eric

Le 2007-05-09 à 10:23, Daniel Brown a écrit :

> PHP has two functions that may help you here, Eric --- chmod() and
> chown().
>
> http://php.net/chmod
> http://php.net/chown
>
> It should be enough to chmod($filename,0644); the file if it's
> just an
> image, or chmod($filename,0755); the file if it's a script.
>
> On 5/9/07, Eric Trahan <eric.trahansc.ca> wrote:
>>
>> After some other tests, I think the problem is with the rights of the
>> file.
>>
>> I made tests on my personnal Mac that runs Apache/1.3.33 (Darwin)
>> PHP/
>> 4.4.4.
>>
>> Settings in PHP:
>> file_uploads: On
>> upload_tmp_dir: no value (so it uploads in /var/tmp/)
>> upload_max_filesize: 2M
>>
>>
>> My destination folder is page5, same as my server (everyone can read
>> and write). But when the files are droped in that folder, with the
>> move_uploaded_file function, the owner is www and group is wheel. So
>> I can't open it... But when I change the rights on the file, I can
>> the see the images.
>>
>> Is there a way to change the owner or the group of a file in PHP.
>>
>> Eric
>>
>> Le 2007-05-08 à 17:52, itoctopus a écrit :
>>
>> > Have you tried your code on another server?
>> >
>> > --
>> > itoctopus - http://www.itoctopus.com
>> > "Eric Trahan" <eric.trahansc.ca> wrote in message
>> > news:1A25BD70-BF03-43C6-8FCB-6A49B34C968Dsc.ca...
>> >> Hi,
>> >>
>> >> I have a form to upload file on my web server, so user can upload
>> >> their
>> >> images.
>> >>
>> >> The upload work. The user file is uploaded to my destination
>> folder
>> >> (page5/) but the file is unreadable and the file size is smaller
>> >> than the
>> >> original file size.
>> >>
>> >> I run Apache with PHP 4.1.2.
>> >>
>> >> Thank you,
>> >>
>> >> Eric.
>> >>
>> >>
>> >> Here is the form code:
>> >>
>> >> <form enctype="multipart/form-data" action="fileupload_bd.php"
>> >> method="post">
>> >> <input type="hidden" name="MAX_FILE_SIZE" value="100000" />
>> >> Une image<br/><input type="file" name="uneimage" />
>> >> <br/><br/>Du texte: <input type="text" name="untexte" />
>> >> <br/><br/><input type="submit" />
>> >> </form>
>> >>
>> >>
>> >> Here is my PHP upload code:
>> >>
>> >> <?php
>> >>
>> >> echo $_POST['untexte'] . "<br/><br/>";
>> >>
>> >> $tmp_name = $_FILES['uneimage']['tmp_name'];
>> >> $type = $_FILES['uneimage']['type'];
>> >> $name = $_FILES['uneimage']['name'];
>> >> $size = $_FILES['uneimage']['size'];
>> >>
>> >> echo $tmp_name . "<br/>" . $type . "<br/>" . $name . "<br/>";
>> >>
>> >> $target_path = "page5/";
>> >>
>> >> $target_path = $target_path . basename( $_FILES['uneimage']
>> ['name']);
>> >>
>> >> echo $target_path;
>> >>
>> >> if(move_uploaded_file($_FILES['uneimage']['tmp_name'],
>> >> $target_path)) {
>> >> echo "The file ". basename( $_FILES['uneimage']['name']).
>> >> " has been uploaded";
>> >> } else{
>> >> echo "There was an error uploading the file, please try
>> again!";
>> >> }
>> >> ?>
>> >
>> > --
>> > PHP General Mailing List (http://www.php.net/)
>> > To unsubscribe, visit: http://www.php.net/unsub.php
>> >
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
> --
> Daniel P. Brown
> [office] (570-) 587-7080 Ext. 272
> [mobile] (570-) 766-8107

attached mail follows:


I hope it's not the wrong place to ask, but has anyone experience with scrolling HTML tables ?

According http://www.w3schools.com/tags/tag_thead.asp
"The thead, tfoot and tbody elements enable you to group rows in a table.
 When you create a table, you might want to have a header row, some rows with data, and a row with totals at bottom.
 This division enables browsers to support scrolling of table bodies independently of the table header and footer."

I don't want to reinvent the wheel in own software.
Or is it better to ignore these tags because of bad browser support ?

Thanks, Cor

attached mail follows:


    That's a CSS question, Cor. Check the web for the CSS property
"overflow".

On 5/10/07, C.R.Vegelin <cr.vegelinhetnet.nl> wrote:
>
> I hope it's not the wrong place to ask, but has anyone experience with
> scrolling HTML tables ?
>
> According http://www.w3schools.com/tags/tag_thead.asp
> "The thead, tfoot and tbody elements enable you to group rows in a table.
> When you create a table, you might want to have a header row, some rows
> with data, and a row with totals at bottom.
> This division enables browsers to support scrolling of table bodies
> independently of the table header and footer."
>
> I don't want to reinvent the wheel in own software.
> Or is it better to ignore these tags because of bad browser support ?
>
> Thanks, Cor

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

attached mail follows:


C.R.Vegelin wrote:

> I hope it's not the wrong place to ask, but has anyone experience with scrolling HTML tables ?

It's not really a PHP question, and while personally I don't care, you
ought to keep on-topic to avoid retribution from the "if it isn't PHP,
it shouldn't be talked about" list nazis.

> According http://www.w3schools.com/tags/tag_thead.asp
> "The thead, tfoot and tbody elements enable you to group rows in a table.
> When you create a table, you might want to have a header row, some rows with data, and a row with totals at bottom.
> This division enables browsers to support scrolling of table bodies independently of the table header and footer."

Sadly no browser works like this. You have to remember that the W3C
recommendations are just that, recommendations, as to how the client
should render the controls. I don't know of any browser that will
automatically keep a table header/footer inline and allow only the
scrolling of the content region. Mind you, I've never seen a browser
allow for pop-out rendering of select list optgroups either.

In short, you'll need to fake it, and CSS is your friend in this regard.
So best to ask on a dedicated CSS list.

Cheers,

Rich
--
Zend Certified Engineer
http://www.corephp.co.uk

"Never trust a computer you can't throw out of a window"

attached mail follows:


Mike,

Thanks for the super clear explanation.

>> This brings up a question. In order to decide whether to use
>> cookies or SID the built-in sessions must be testing to see if
>> the user's browser will accept the session cookies. How do
>> they do that?
>
> By sending it out and checking to see whether it comes back on
> the next page.

...

That being the case I can never find out (using the built-in
sessions) until the second page request and it will always
include the session cookie in the URL. Which means the value
of the seesion cookie will be exposed, even if I am using SSL.

:( Back to the drawing board...

Best,

Craig

 ------------------------------------------------------
 - Virtual Phonecards - Instant Pin by Email -
 - Large Selection - Great Rates -
 - http://speedypin.com/?aff=743&co_branded=1 -
 ------------------------------------------------------

**************************************
* *
* Craig Spencer *
* ccspencerSoftHome.net *
* *
**************************************

attached mail follows:


ccspencersofthome.net wrote:

> That being the case I can never find out (using the built-in
> sessions) until the second page request and it will always
> include the session cookie in the URL. Which means the value
> of the seesion cookie will be exposed, even if I am using SSL.
> :( Back to the drawing board...

While using TRANS IDs are ugly, they will show no more or less
information to the user than a session cookie contains. Most browsers
have built-in support for viewing cookie contents these days. Doing so
will show your PHP Session ID clearly. Trans IDs are no different, just
more 'obvious' being in the URL and all. The actual data displayed is
the same however.

Cheers,

Rich

--
Zend Certified Engineer
http://www.corephp.co.uk

"Never trust a computer you can't throw out of a window"

attached mail follows:


On May 10, 2007, at 11:40 AM, Richard Davey wrote:

> ccspencersofthome.net wrote:
>
>> That being the case I can never find out (using the built-in
>> sessions) until the second page request and it will always
>> include the session cookie in the URL. Which means the value
>> of the seesion cookie will be exposed, even if I am using SSL.
>> :( Back to the drawing board...
>
> While using TRANS IDs are ugly, they will show no more or less
> information to the user than a session cookie contains. Most
> browsers have built-in support for viewing cookie contents these
> days. Doing so will show your PHP Session ID clearly. Trans IDs are
> no different, just more 'obvious' being in the URL and all. The
> actual data displayed is the same however.
>

And the session id is open to being stored in a bookmark or worse,
sent to someone else through a cut and paste of the URL.

Depending on what information that id controls and how long the
sessions are kept around id's in the URL could be a very bad thing
indeed.

Ed

attached mail follows:


Edward Vermillion wrote:

> And the session id is open to being stored in a bookmark or worse, sent
> to someone else through a cut and paste of the URL.
>
> Depending on what information that id controls and how long the sessions
> are kept around id's in the URL could be a very bad thing indeed.

Agreed (depending entirely on how your app was written), my point was
simply that a trans ID will never give away anything more than a cookie
does. In that respect, they're identical.

Cheers,

Rich
--
Zend Certified Engineer
http://www.corephp.co.uk

"Never trust a computer you can't throw out of a window"

attached mail follows:


(I've cross posted at the MySQL list as well)

Here's an example with a simple table:

describe collection;

+------------------+---------------------+------+-----
+---------------------+----------------+
| Field | Type | Null | Key |
Default | Extra |
+------------------+---------------------+------+-----
+---------------------+----------------+
| id | bigint(20) unsigned | | PRI |
NULL | auto_increment |
| receiver_id | bigint(20) unsigned | | MUL |
0 | |
| set_type_id | int(2) unsigned | | |
0 | |
| card_id | int(3) unsigned | | |
0 | |
| completed_set_id | bigint(20) unsigned | | |
0 | |
| created_on_gmt | datetime | | | 0000-00-00
00:00:00 | |
+------------------+---------------------+------+-----
+---------------------+----------------+

I want to end up with two PHP arrays. One for set_type_id = 22 and
one for set_type_id=21.

(1) one query method:
SELECT * from collection WHERE set_type_id=22 OR set_type_id=21;
...do query...
while( $row = $this->db->fetch_array_row() ){
            if ($row['set_type_id'] == 21){
                $array_a[] = $row;
        } else {
                $array_b[] = $row;
        }
}

(2) two query method:
SELECT * from collection WHERE set_type_id=22;
...do query...
while( $row = $this->db->fetch_array_row() ){
        $array_a[] = $row;
}

SELECT * from collection WHERE set_type_id=21;
...do query...
while( $row = $this->db->fetch_array_row() ){
        $array_b[] = $row;
}

Which method is better? Take a hit using MySQL or take a hit using PHP?

-James

attached mail follows:


James Tu wrote:
> (I've cross posted at the MySQL list as well)
>
> Here's an example with a simple table:
>
> describe collection;
>
> +------------------+---------------------+------+-----
> +---------------------+----------------+
>> Field | Type | Null | Key |
> Default | Extra |
> +------------------+---------------------+------+-----
> +---------------------+----------------+
>> id | bigint(20) unsigned | | PRI |
> NULL | auto_increment |
>> receiver_id | bigint(20) unsigned | | MUL |
> 0 | |
>> set_type_id | int(2) unsigned | | |
> 0 | |
>> card_id | int(3) unsigned | | |
> 0 | |
>> completed_set_id | bigint(20) unsigned | | |
> 0 | |
>> created_on_gmt | datetime | | | 0000-00-00
> 00:00:00 | |
> +------------------+---------------------+------+-----
> +---------------------+----------------+
>
>
> I want to end up with two PHP arrays. One for set_type_id = 22 and
> one for set_type_id=21.
>
> (1) one query method:
> SELECT * from collection WHERE set_type_id=22 OR set_type_id=21;
> ...do query... while( $row = $this->db->fetch_array_row() ){
> if ($row['set_type_id'] == 21){
> $array_a[] = $row;
> } else {
> $array_b[] = $row;
> }
> }
>
>
> (2) two query method:
> SELECT * from collection WHERE set_type_id=22;
> ...do query...
> while( $row = $this->db->fetch_array_row() ){
> $array_a[] = $row;
> }
>
> SELECT * from collection WHERE set_type_id=21;
> ...do query...
> while( $row = $this->db->fetch_array_row() ){
> $array_b[] = $row;
> }
>
>
> Which method is better? Take a hit using MySQL or take a hit using
> PHP?
>
> -James

I really don't think you'd notice any difference, unless your table contains
a large amount of data and is not properly indexed. And if that were the
case, you'd notice a hit on just one query anyway.

I'd stick with the 2 query model, but instead of creating arrays, just loop
through the query results to output your data, no sense looping to make an
array when you're just going to end up looping through the array to output;
that seems redundant to me :P

Just my $.02

-B

attached mail follows:


On Thu, 2007-05-10 at 14:00 -0400, James Tu wrote:
> (I've cross posted at the MySQL list as well)
>
> Here's an example with a simple table:
>
> describe collection;
>
> +------------------+---------------------+------+-----
> +---------------------+----------------+
> | Field | Type | Null | Key |
> Default | Extra |
> +------------------+---------------------+------+-----
> +---------------------+----------------+
> | id | bigint(20) unsigned | | PRI |
> NULL | auto_increment |
> | receiver_id | bigint(20) unsigned | | MUL |
> 0 | |
> | set_type_id | int(2) unsigned | | |
> 0 | |
> | card_id | int(3) unsigned | | |
> 0 | |
> | completed_set_id | bigint(20) unsigned | | |
> 0 | |
> | created_on_gmt | datetime | | | 0000-00-00
> 00:00:00 | |
> +------------------+---------------------+------+-----
> +---------------------+----------------+
>
>
> I want to end up with two PHP arrays. One for set_type_id = 22 and
> one for set_type_id=21.
>
> (1) one query method:
> SELECT * from collection WHERE set_type_id=22 OR set_type_id=21;
> ...do query...
> while( $row = $this->db->fetch_array_row() ){
> if ($row['set_type_id'] == 21){
> $array_a[] = $row;
> } else {
> $array_b[] = $row;
> }
> }
>
>
> (2) two query method:
> SELECT * from collection WHERE set_type_id=22;
> ...do query...
> while( $row = $this->db->fetch_array_row() ){
> $array_a[] = $row;
> }
>
> SELECT * from collection WHERE set_type_id=21;
> ...do query...
> while( $row = $this->db->fetch_array_row() ){
> $array_b[] = $row;
> }
>
>
> Which method is better? Take a hit using MySQL or take a hit using PHP?

Single query method is superior in your example.

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


Let's try to make a long story short.

I'm writing a (not too complex) system visible to authorized users only. My users are stored in a MySQL database table with "usr_id" and "usr_typ" (user type) among other fields.

When a user logs in, I retrieve those values from the database and store them into separate session variables:

            $_SESSION["usr_id"] = $rs["usr_id"];

            $_SESSION["usr_typ"] = $rs["usr_typ"];

 

When the user visits a restricted page, I read those session variables to validate the user. So far so good. Problem started when I added a new script named "usr_frm.php".

 

This page accepts the user's id and type from the query string, like this:

 

            $id = (integer)$HTTP_GET_VARS["id"];

            $usr_typ = (integer)$HTTP_GET_VARS["typ"];

 

The call comes from a list of users displayed by another script, "usr_lst.php", like this (within a loop, of course):

 

            print("<a href='usr_frm.php?id=".$row["usr_id"]."&typ=".$row["usr_typ"]."'>");

 

Problem is, that, once the page "usr_frm.php" have been hit, the session variable $_SESSION["usr_type"] gets changed (unexpectedly) to exactly the same value passed to the script via GET variable "typ".

But even worse: this code works perfectly well on my developer machine (Windows) but in doesn't on the actual server (Linux).

I realized that the server uses a different PHP configuration, specially: "register_globals" set to ON. I already got them to change this value to OFF... but this did not solve the problem.

 

I will appreciate any help, suggestion, idea.... currently I am (honestly) clue less...

Thank you in advance.

--Armando--.

 

attached mail follows:


On Thu, 2007-05-10 at 14:51 -0400, Armando Acosta wrote:
> Let's try to make a long story short.
>
> I realized that the server uses a different PHP configuration, specially: "register_globals" set to ON. I already got them to change this value to OFF... but this did not solve the problem.
>
> I will appreciate any help, suggestion, idea.... currently I am (honestly) clue less...

Did they restart the webserver after changing the config?

BTW, what's the point of abbreviating short words like "user" to "usr"
and "type" to "typ"?

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


    Armando;

    First, you can just change these:

$id = (integer)$HTTP_GET_VARS["id"];
$usr_typ = (integer)$HTTP_GET_VARS["typ"];

    .... to:

$id = $_GET['id'];
$usr_typ = $_GET['typ'];

    Second, I see that you're using $row[] variables for your MySQL result
sets.... but where and how are the $rs[] values populated?

On 5/10/07, Robert Cummings <robertinterjinn.com> wrote:
>
> On Thu, 2007-05-10 at 14:51 -0400, Armando Acosta wrote:
> > Let's try to make a long story short.
> >
> > I realized that the server uses a different PHP configuration,
> specially: "register_globals" set to ON. I already got them to change this
> value to OFF... but this did not solve the problem.
> >
> > I will appreciate any help, suggestion, idea.... currently I am
> (honestly) clue less...
>
> Did they restart the webserver after changing the config?
>
> BTW, what's the point of abbreviating short words like "user" to "usr"
> and "type" to "typ"?
>
> Cheers,
> Rob.
> --
> .------------------------------------------------------------.
> | InterJinn Application Framework - http://www.interjinn.com |
> :------------------------------------------------------------:
> | An application and templating framework for PHP. Boasting |
> | a powerful, scalable system for accessing system services |
> | such as forms, properties, sessions, and caches. InterJinn |
> | also provides an extremely flexible architecture for |
> | creating re-usable components quickly and easily. |
> `------------------------------------------------------------'
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

attached mail follows:


Another small and unrelated point - you don't need to use double quotes
inside the array brackets - you're not processing them at all.

attached mail follows:


Hello all,

I have a question concerning .CSV array sorting. I have tried googling
for an answer and have tried different techniques, but nothing seems
to works as I would like it to work. Here is my situation:
Test file is located here: http://veanndesign.com/test.php

I would like to be able to sort the output by the Time Zone (or any
other fields). Here is how my code looks like:
http://veanndesign.com/test.html

I believe that I need to get all the data from the .csv file dumped
into 1 array, and I guess I am struggling at that point. I have tried
using foreach inside of the while loop, but it doesn't seem to work.
So what is the best and/or right way to sort this type of data?

Hopefully, this email makes sense.

Thanks in advance.

--
Anna Vester
Web Designer
http://www.veanndesign.com

attached mail follows:


    One place to start reading, Anna, would be the PHP manual for the
fgetcsv() function, which is specifically for CSV parsing.

    http://www.php.net/fgetcsv

On 5/10/07, Anna Vester <aserevgmail.com> wrote:
>
> Hello all,
>
> I have a question concerning .CSV array sorting. I have tried googling
> for an answer and have tried different techniques, but nothing seems
> to works as I would like it to work. Here is my situation:
> Test file is located here: http://veanndesign.com/test.php
>
> I would like to be able to sort the output by the Time Zone (or any
> other fields). Here is how my code looks like:
> http://veanndesign.com/test.html
>
> I believe that I need to get all the data from the .csv file dumped
> into 1 array, and I guess I am struggling at that point. I have tried
> using foreach inside of the while loop, but it doesn't seem to work.
> So what is the best and/or right way to sort this type of data?
>
> Hopefully, this email makes sense.
>
> Thanks in advance.
>
> --
> Anna Vester
> Web Designer
> http://www.veanndesign.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

attached mail follows:


On 5/10/07, Daniel Brown <parasanegmail.com> wrote:
>
> One place to start reading, Anna, would be the PHP manual for the
> fgetcsv() function, which is specifically for CSV parsing.
>
> http://www.php.net/fgetcsv
>
Thanks for your quick reply Daniel. Yes I've seen that function before
and i am using it to parse the file, which displays fine. I just need
to be able to sort that data (by Time Zone) prior to displaying. Sorry
If I wasn't clear.

Thanks.

--
Anna Vester
Web Designer
http://www.veanndesign.com

attached mail follows:


When you load your data into your array, you can use the timezone (or whatever field you're using to sort) as the array key, then use ksort().

Check the "see also" for a bunch of other types of sorting you can do.

When it comes to the multisorts and user defined sorts, I'm at a bit of a loss..hah.. just never had to use them so they're still a bit mystical to me.

-TG

http://us2.php.net/manual/en/function.ksort.php

= = = Original message = = =

On 5/10/07, Daniel Brown <parasanegmail.com> wrote:
>
> One place to start reading, Anna, would be the PHP manual for the
> fgetcsv() function, which is specifically for CSV parsing.
>
> http://www.php.net/fgetcsv
>
Thanks for your quick reply Daniel. Yes I've seen that function before
and i am using it to parse the file, which displays fine. I just need
to be able to sort that data (by Time Zone) prior to displaying. Sorry
If I wasn't clear.

Thanks.

--
Anna Vester
Web Designer
http://www.veanndesign.com

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

___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

attached mail follows:


I'm looking for a shared host with an up-to-date php5, and one who at least tries to keep it relatively current.

Needs are modest. Just need good ftp access, cgi-bin, shell, etc.

Any suggestions. I'm looking at Host Monster, anyone have experience with them?

Thanks...

attached mail follows:


Al wrote:
> I'm looking for a shared host with an up-to-date php5, and one who at
> least tries to keep it relatively current.
>
> Needs are modest. Just need good ftp access, cgi-bin, shell, etc.
>
> Any suggestions. I'm looking at Host Monster, anyone have experience
> with them?
>
> Thanks...
>
Check out http://www.webhostingtalk.com for both discussions and
searching on any possible hosts before signing up.

If you can stretch your budget a bit more, go for a VPS. Shared hosting
is a real pain when other users write poor code that hog the server. I
use ServInt and would recommend them.

Edward

attached mail follows:


Edward Kay wrote:
> Al wrote:
>> I'm looking for a shared host with an up-to-date php5, and one who at
>> least tries to keep it relatively current.
>>
>> Needs are modest. Just need good ftp access, cgi-bin, shell, etc.
>>
>> Any suggestions. I'm looking at Host Monster, anyone have experience
>> with them?
>>
>> Thanks...

I use host monster for last year and never had a problem with them. Have
one account with 8 domains/web sites. None has big traffic.
Though, one of web sites is my personal site with Gallery2 installed.
When uploading chunk of 10 or 20 images (king size) after is DONE I
would get a message that I'm using processor more then I could and it
will keep me out for couple minutes before I can continue. Though, my
web site is still up, just I can't do anything. And, every time whole
process was finished without interruption or with error. Strange thing
(never had similar before) but it doesn't bother me a lot.

Agree with Edward, VPS is better solution - if possible.

I used pair.com for a while. Pricey but VERY GOOD.

-afan

attached mail follows:


Al wrote:
> I'm looking for a shared host with an up-to-date php5, and one who at
> least tries to keep it relatively current.
>
> Needs are modest. Just need good ftp access, cgi-bin, shell, etc.
>
> Any suggestions. I'm looking at Host Monster, anyone have experience
> with them?
>
> Thanks...
>

I've used http://phpwebhosting.com for several years, they're quite
good, and for $10/month they offer what you're looking for. They're
stuck on php 5.12, though.

I know a guy who knows the guy behind http://dataslab.com. That seems
like a pretty darn good deal($20/month), though I've not really
researched the VPS market.

Matt

attached mail follows:


Afan Pasalic wrote:
> Edward Kay wrote:
>> Al wrote:
>>> I'm looking for a shared host with an up-to-date php5, and one who
>>> at least tries to keep it relatively current.
>>>
>>> Needs are modest. Just need good ftp access, cgi-bin, shell, etc.
>>>
>>> Any suggestions. I'm looking at Host Monster, anyone have experience
>>> with them?
>>>
>>> Thanks...
>
> I use host monster for last year and never had a problem with them.
> Have one account with 8 domains/web sites. None has big traffic.
> Though, one of web sites is my personal site with Gallery2 installed.
> When uploading chunk of 10 or 20 images (king size) after is DONE I
> would get a message that I'm using processor more then I could and it
> will keep me out for couple minutes before I can continue. Though, my
> web site is still up, just I can't do anything. And, every time whole
> process was finished without interruption or with error. Strange thing
> (never had similar before) but it doesn't bother me a lot.
>
> Agree with Edward, VPS is better solution - if possible.
>
> I used pair.com for a while. Pricey but VERY GOOD.
>
> -afan
>
>
You might want to look at Canadawebhosting.com. It's located in
Vancuver and Toronto. If you pay in $US you get the advantage of the
higher US dollar. It's an excellent service for VPS and stand-alone
server access. I've used them for both over a period of about 4 years.

--

_____________________
Myron Turner
http://www.room535.org
http://www.bstatzero.org
http://www.mturner.org/XML_PullParser/

attached mail follows:


Al wrote:

> I'm looking for a shared host with an up-to-date php5, and one who at
> least tries to keep it relatively current.
>
> Needs are modest. Just need good ftp access, cgi-bin, shell, etc.

I'll throw my plug in here for Pair Networks too. Sure, you can get
cheaper, but they run a really tight ship there - great network, great
servers, great support. Have been with them since 1996 (!!) and they've
been brilliant all this time and I've now plans on leaving.

They're about to roll-out PHP 5.2.2 across all of their servers too. And
if their 'usual' accounts are too expensive, they've just launched this:

http://www.pairlite.com

Which is only $10 / month and I'd wager perfect for what you need.

Cheers,

Rich
--
Zend Certified Engineer
http://www.corephp.co.uk

"Never trust a computer you can't throw out of a window"

attached mail follows:


Hello,

I have a loop on an sqlite query which checks $domain until the status of
$domain changes and then it deletes $domain.

However when all the $domain items have been deleted I need the script to
stop.. regardless of how many querys the loop
still has to run. So I want to detect when its empty and then stop.

I have this... which does not work.

<?
$db = sqlite_open("whois.sqlite");

$x = 0;
while ($x < 9000) {

$result = sqlite_query($db, "SELECT * FROM whois ORDER BY id");

// if (!$result) {
if (empty($result)) {

echo "No data";

} else {

while ($row = sqlite_fetch_array($result)) {

$domain = $row['name'];

echo "$domain";

$x++;
usleep(400000);
}
}
}
sqlite_close($db);
?>

Thanks
Chris

attached mail follows:


Hi Everyone,

I know this isn't strictly a PHP question, and I apologize in advance
for that. I'm trying to setup a website for some of my customers that
would allow them to update a database on their schedule, making it
easier for us to have the most up to date info, and taking some of
the work off of us.

Right now, the question I have is, how would I be able to select
certain records to be deleted (Or moved to another table called
"deleted")? Is it as simple as looping through the database, having
them check a checkbox, and then hit a "remove" button?

As I go, I will be adding a login screen to it, and hopefully
protecting against SQL injection attacks... But right now, I'm still
just learning and trying.

The SQL syntax is easy enough for me to figure out, but the php is
throwing me off right now...

I'm running PHP 5.2.0
MySQL 5.0.24A

Any points to the right documents are greatly appreciated as well as
sample code :)

Currently here is the code I'm working with on the page to display it:

$link = mysql_connect($server, $username, $password)
     or die('Could not connect: ' . mysql_error());
echo 'Connected successfully <BR>';
mysql_select_db('legion') or die('Could not select database' .
mysql_error());
echo 'DB selected <BR>';

$result = mysql_query("SELECT * FROM current") or die(mysql_error());
while($row = mysql_fetch_array($result)) {
$FName = $row["FName"];
$LName = $row["LName"];
$Add1 = $row["Add1"];
$Add2 = $row["Add2"];
$City = $row["City"];
$State = $row["State"];
$Zip = $row["Zip"];
$Date = $row["Date"];

echo "$FName, $LName, $Add1, $Add2, $City, $State, $Zip, $Date<BR>";
};

I'm sure there is an easier way to do that as well... But this way
worked :)

Jason

attached mail follows:


Hi Bruce,

> In looking for what's required fo a site, I'm trying to find
> docs/overview/mentors to talk to/etc

You can read all about it from one of the world's leading scalability
experts:

http://www.amazon.com/Scalable-Internet-Architectures-Developers-Library/dp/067232699X

Disclaimer: I work with the author.

Chris

--
Chris Shiflett
http://shiflett.org/

attached mail follows:


hey chris...

thanks for the reply. can you tell me if the author (your friend) has
thought of releasing a complete suite of code/source that would actually
demonstrate an entire app.

i'm talking about website, admin function/site, database function/systems,
load balancing apps, etc....

thanks

-bruce
bedouglasearthlink.net

-----Original Message-----
From: Chris Shiflett [mailto:shiflettphp.net]
Sent: Thursday, May 10, 2007 2:49 PM
To: bedouglasearthlink.net
Cc: php-generallists.php.net
Subject: Re: [PHP] Scalable Site Architecture

Hi Bruce,

> In looking for what's required fo a site, I'm trying to find
> docs/overview/mentors to talk to/etc

You can read all about it from one of the world's leading scalability
experts:

http://www.amazon.com/Scalable-Internet-Architectures-Developers-Library/dp/
067232699X

Disclaimer: I work with the author.

Chris

--
Chris Shiflett
http://shiflett.org/

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

attached mail follows:


Just curious if anybody else is using Zend's PHP port on an AS400/iSeries/i5?