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 31 Aug 2004 22:40:06 -0000 Issue 2969

php-general-digest-helplists.php.net
Date: Tue Aug 31 2004 - 17:40:06 CDT


php-general Digest 31 Aug 2004 22:40:06 -0000 Issue 2969

Topics (messages 195260 through 195349):

Re: Form Spoofing - How?
        195260 by: Marek Kilimajer
        195261 by: Nick Wilson
        195262 by: Marek Kilimajer
        195264 by: Nick Wilson
        195290 by: Michal Migurski
        195344 by: Manuel Lemos

writing a pdf file to the filesystem
        195263 by: Merlin
        195265 by: Stut

[PHP5]__get, __set and isset()
        195266 by: Frédéric Hardy
        195281 by: Daniel Schierbeck
        195284 by: Frédéric Hardy
        195298 by: Catalin Trifu
        195299 by: M. Sokolewicz
        195300 by: Daniel Schierbeck
        195304 by: Frédéric Hardy
        195305 by: Frédéric Hardy
        195306 by: Catalin Trifu
        195309 by: Greg Beaver
        195310 by: Daniel Schierbeck

Re: Closing my Window after Download
        195267 by: PHP Junkie
        195268 by: PHP Junkie
        195316 by: Jasper Howard
        195323 by: Curt Zirzow
        195339 by: PHP Junkie

Re: Storing image in database
        195269 by: raditha dissanayake
        195342 by: Dre
        195343 by: Dre
        195345 by: Jay Blanchard
        195346 by: Jason Wong

Re: [Newbie Guide] For the benefit of new members
        195270 by: raditha dissanayake

Re: quoted_printable_encode
        195271 by: raditha dissanayake

Re: Time consumed in microseconds
        195272 by: raditha dissanayake

Re: Problems with writing a stream wrapper to regular fopen/close functions...
        195273 by: John Holmes

Help with Strings Please
        195274 by: Nick Wilson
        195276 by: Marek Kilimajer
        195277 by: Justin French
        195278 by: John Holmes
        195280 by: Nick Wilson

Re: open_basedir "/" not working after upgrade
        195275 by: Federico Petronio

Authors and Instructors Needed
        195279 by: Keystone Learning Systems
        195283 by: John Holmes
        195285 by: Nick Wilson
        195292 by: Jim Grill
        195294 by: Keystone Learning Systems

Dealer Locater web app
        195282 by: Sam

Re: PHP Oficial Certification
        195286 by: Dan Joseph

Re: Bitwise operations criticism needed
        195287 by: Gerard Samuel
        195289 by: Marek Kilimajer
        195301 by: Gerard Samuel

$_SERVER['HTTP_HOST'] without the 'www.'
        195288 by: Shaun
        195291 by: Michal Migurski
        195293 by: Nick Wilson
        195295 by: Greg Donald
        195297 by: Torsten Roehr
        195302 by: John Nichel

Re: DOM loadXML not loading doctype as expected in PHP5
        195296 by: David Numan

RPM package for PHP5
        195303 by: Denis Gerasimov

enabling mail function/mail functions help
        195307 by: AceZero2790.aol.com

Weblog -Blog software wrtten in PHP and My SQL
        195308 by: Bestman4unowwa.aol.com
        195311 by: Ed Lazor
        195312 by: Xongoo!com: Central unit
        195313 by: Justin Palmer
        195314 by: eoghan
        195315 by: Vail, Warren
        195317 by: Saqib.N.Ali.seagate.com
        195318 by: Chris Shiflett
        195319 by: Xongoo!com: Central unit
        195327 by: Vail, Warren

Parsing large file
        195320 by: Adrian Teasdale
        195325 by: Pablo Gosse
        195328 by: Jay Blanchard
        195329 by: William Moore
        195337 by: Adrian Teasdale
        195341 by: Michal Migurski

Re: List of cities
        195321 by: Harlequin

Broken data within an Array
        195322 by: Harlequin
        195331 by: Jason Barnett
        195333 by: Jason Wong

Re: Weblog -Blog software wrtten in PHP and My SQL -- Thank you!!
        195324 by: Bestman4unowwa.aol.com

instanceof / __CLASS__ question
        195326 by: Jason Barnett
        195336 by: Greg Beaver

help with crc32
        195330 by: Jason Barnett

Re: help with crc32 [SOLVED]
        195332 by: Jason Barnett

PHP Cached Templates
        195334 by: rogue

running php script from batch file
        195335 by: Trent DeCamp

is_a (WAS: Re: instanceof / __CLASS__ question [SOLVED])
        195338 by: Jason Barnett

Cannot load modules
        195340 by: Bronislav Klucka

mail functions help
        195347 by: AceZero2790.aol.com
        195348 by: Pahlevanzadeh Mohsen
        195349 by: Jason Wong

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:


Nick Wilson wrote:
> Hi everyone
>
> I've been asked to make a php script to automatically fill out and
> submit a form on a remote site. I know this is possible, but have no
> idea where to begin....
>
> So, my question is: What functions/theories/etc should I start looking
> at in order to get started on this?
>
> Much thanks for your help ;-)

Check out the various HTTP classes, they have features for submiting forms.

attached mail follows:


* and then Marek Kilimajer declared....
> >So, my question is: What functions/theories/etc should I start looking
> >at in order to get started on this?
 
> Check out the various HTTP classes, they have features for submiting forms.

Great, where do I find them?

thanks!

--
Nick W

attached mail follows:


Nick Wilson wrote:
> * and then Marek Kilimajer declared....
>
>>>So, my question is: What functions/theories/etc should I start looking
>>>at in order to get started on this?
>
>
>
>>Check out the various HTTP classes, they have features for submiting forms.
>
>
>
> Great, where do I find them?
>
> thanks!
>

google ... pear, phpclasses.org

attached mail follows:


* and then Marek Kilimajer declared....
> >>>So, my question is: What functions/theories/etc should I start looking
> >>>at in order to get started on this?
> >
> >>Check out the various HTTP classes, they have features for submiting
> >>forms.
> >
> >Great, where do I find them?
>
> google ... pear, phpclasses.org

hehe, i know how to google, sorry, badly phrased! I meant where is the
best place, i found phpclasses and am *trying* to download what looks
like the exact thing I need the "advanced http client" class. Comes with
a nice example script for posting forms too, luvverly! ;)

Thanks very much m8

--
Nick W

attached mail follows:


> I've been asked to make a php script to automatically fill out and
> submit a form on a remote site. I know this is possible, but have no
> idea where to begin....

SimpleTest can do this quite elegantly.

---------------------------------------------------------------------
michal migurski- contact info and pgp key:
sf/ca http://mike.teczno.com/contact.html

attached mail follows:


Hello,

On 08/31/2004 07:47 AM, Nick Wilson wrote:
> I've been asked to make a php script to automatically fill out and
> submit a form on a remote site. I know this is possible, but have no
> idea where to begin....
>
> So, my question is: What functions/theories/etc should I start looking
> at in order to get started on this?

You may want to try this HTTP client class. I let you submit forms
including uploading files if necessary. It can collect and send back
cookies as well handle redirection automatically for you.

http://www.phpclasses.org/httpclient

--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

attached mail follows:


Hi there,

I am trying to write a pdf file which is created by a php script to the
filesystem.

Here is the end of the php file which creates the pdf document:

.
.
.
$pdf_close($pdf);
$data = pdf_get_buffer($pdf);

Can anybody tell me how to save the file instead of printing it out
directly?

Thank you for any hint,

Merlin

attached mail follows:


On Tue, 31 Aug 2004 12:58:49 +0200, Merlin <news.groupsweb.de> wrote:
> I am trying to write a pdf file which is created by a php script to the
> filesystem.
>
> Here is the end of the php file which creates the pdf document:
>
> $pdf_close($pdf);
> $data = pdf_get_buffer($pdf);

$fp = fopen('file.pdf', 'w');
if ($fp)
{
    fwrite($fp, $data);
    fclose($fp);
}
else
    print 'Failed to open file for writing';

--
Stut

attached mail follows:


Is it possible to do something like this :

class foo
{
        private $array = array();

        function __construct()
        {
                ...
        }

        function __get($key)
        {
                return (isset($this->array[$key]) == false ? null : $this->array[$key]);
        }

        function __set($key, $value)
        {
                $this->array[$key] = $value;
        }
}

$foo = new foo();

if (isset($foo->bar) == false)
        $foo->bar = 'bar';
else
        echo $foo->bar;

It seems that isset($foo->bar) return ALWAYS false.
Bug ?

Fred.

attached mail follows:


Frédéric hardy wrote:
> Is it possible to do something like this :
>
> class foo
> {
> private $array = array();
>
> function __construct()
> {
> ...
> }
>
> function __get($key)
> {
> return (isset($this->array[$key]) == false ? null :
> $this->array[$key]);
> }
>
> function __set($key, $value)
> {
> $this->array[$key] = $value;
> }
> }
>
> $foo = new foo();
>
> if (isset($foo->bar) == false)
> $foo->bar = 'bar';
> else
> echo $foo->bar;
>
> It seems that isset($foo->bar) return ALWAYS false.
> Bug ?
>
> Fred.
It seems that you are right. I've tried off this code:

        <?php

        class OO
        {
                private $elem = array("a" => 1);
        
                public function __get ($prop)
                {
                        if (isset($this->elem[$prop])) {
                                return $this->elem[$prop];
                        } else {
                                return NULL;
                        }
                }
        
                public function __set ($prop, $val)
                {
                        $this->elem[$prop] = $val;
                }
        }

        $o = new OO();

        echo isset($o->a) ? "yes\n" : "no\n";
        echo isset($o->b) ? "yes\n" : "no\n";

        echo is_null($o->a) ? "yes\n" : "no\n";
        echo is_null($o->b) ? "yes\n" : "no\n";

        ?>

I expected something like this:

        yes
        no
        no
        yes

But got this:

        no
        no
        no
        yes

It looks like isset() can't handle object properties correctly. I'll
post the bug on php.net.

--
Daniel Schierbeck

attached mail follows:


Bug Id is 29917.

Fred.

Daniel Schierbeck wrote:

> Frédéric hardy wrote:
>
>> Is it possible to do something like this :
>>
>> class foo
>> {
>> private $array = array();
>>
>> function __construct()
>> {
>> ...
>> }
>>
>> function __get($key)
>> {
>> return (isset($this->array[$key]) == false ? null :
>> $this->array[$key]);
>> }
>>
>> function __set($key, $value)
>> {
>> $this->array[$key] = $value;
>> }
>> }
>>
>> $foo = new foo();
>>
>> if (isset($foo->bar) == false)
>> $foo->bar = 'bar';
>> else
>> echo $foo->bar;
>>
>> It seems that isset($foo->bar) return ALWAYS false.
>> Bug ?
>>
>> Fred.
>
> It seems that you are right. I've tried off this code:
>
> <?php
>
> class OO
> {
> private $elem = array("a" => 1);
>
> public function __get ($prop)
> {
> if (isset($this->elem[$prop])) {
> return $this->elem[$prop];
> } else {
> return NULL;
> }
> }
>
> public function __set ($prop, $val)
> {
> $this->elem[$prop] = $val;
> }
> }
>
> $o = new OO();
>
> echo isset($o->a) ? "yes\n" : "no\n";
> echo isset($o->b) ? "yes\n" : "no\n";
>
> echo is_null($o->a) ? "yes\n" : "no\n";
> echo is_null($o->b) ? "yes\n" : "no\n";
>
> ?>
>
> I expected something like this:
>
> yes
> no
> no
> yes
>
> But got this:
>
> no
> no
> no
> yes
>
> It looks like isset() can't handle object properties correctly. I'll
> post the bug on php.net.
>

--
===================================================================
Frederic HARDY Email: fchhexanet.fr
HEXANET SARL URL: http://www.hexanet.fr/
ZAC Les Charmilles Tel: +33 (0)3 26 79 30 05
3, allée Thierry Sabine Direct: +33 (0)3 26 61 77 84
BP 202 - 51686 REIMS CEDEX 2 FRANCE
===================================================================

attached mail follows:


        Hi,

    Is this really a bug. I think not.
    There is no variable $o->a or $a->b in the class OO
there is only the variable $elem and $a and $b is a member
of that array
    So ...
    The fact that PHP5 provides __set and __get magic
functions does not mean that the actual variables exist with
that particular name in the class ?
    Perhaps it would be nice to have a __isset magic function ?

Cheers
Catalin

> <?php
>
> class OO
> {
> private $elem = array("a" => 1);
>
> public function __get ($prop)
> {
> if (isset($this->elem[$prop])) {
> return $this->elem[$prop];
> } else {
> return NULL;
> }
> }
>
> public function __set ($prop, $val)
> {
> $this->elem[$prop] = $val;
> }
> }
>
> $o = new OO();
>
> echo isset($o->a) ? "yes\n" : "no\n";
> echo isset($o->b) ? "yes\n" : "no\n";
>
> echo is_null($o->a) ? "yes\n" : "no\n";
> echo is_null($o->b) ? "yes\n" : "no\n";
>
> ?>
>
> I expected something like this:
>
> yes
> no
> no
> yes
>
> But got this:
>
> no
> no
> no
> yes
>
> It looks like isset() can't handle object properties correctly. I'll post
> the bug on php.net.
>
> --
> Daniel Schierbeck

attached mail follows:


next time, please read the isset documentation carefully. I quote:
[quote]isset() will return FALSE if testing a variable that has been set
to NULL.[/quote]

Catalin Trifu wrote:
> Hi,
>
> Is this really a bug. I think not.
> There is no variable $o->a or $a->b in the class OO
> there is only the variable $elem and $a and $b is a member
> of that array
> So ...
> The fact that PHP5 provides __set and __get magic
> functions does not mean that the actual variables exist with
> that particular name in the class ?
> Perhaps it would be nice to have a __isset magic function ?
>
> Cheers
> Catalin
>
>
>
>><?php
>>
>>class OO
>>{
>>private $elem = array("a" => 1);
>>
>>public function __get ($prop)
>>{
>>if (isset($this->elem[$prop])) {
>>return $this->elem[$prop];
>>} else {
>>return NULL;
>>}
>>}
>>
>>public function __set ($prop, $val)
>>{
>>$this->elem[$prop] = $val;
>>}
>>}
>>
>>$o = new OO();
>>
>>echo isset($o->a) ? "yes\n" : "no\n";
>>echo isset($o->b) ? "yes\n" : "no\n";
>>
>>echo is_null($o->a) ? "yes\n" : "no\n";
>>echo is_null($o->b) ? "yes\n" : "no\n";
>>
>>?>
>>
>>I expected something like this:
>>
>>yes
>>no
>>no
>>yes
>>
>>But got this:
>>
>>no
>>no
>>no
>>yes
>>
>>It looks like isset() can't handle object properties correctly. I'll post
>>the bug on php.net.
>>
>>--
>>Daniel Schierbeck

attached mail follows:


M. Sokolewicz wrote:
> next time, please read the isset documentation carefully. I quote:
> [quote]isset() will return FALSE if testing a variable that has been set
> to NULL.[/quote]
>
> Catalin Trifu wrote:
>
>> Hi,
>>
>> Is this really a bug. I think not.
>> There is no variable $o->a or $a->b in the class OO
>> there is only the variable $elem and $a and $b is a member
>> of that array
>> So ...
>> The fact that PHP5 provides __set and __get magic
>> functions does not mean that the actual variables exist with
>> that particular name in the class ?
>> Perhaps it would be nice to have a __isset magic function ?
>>
>> Cheers
>> Catalin
>>
>>
>>
>>> <?php
>>>
>>> class OO
>>> {
>>> private $elem = array("a" => 1);
>>>
>>> public function __get ($prop)
>>> {
>>> if (isset($this->elem[$prop])) {
>>> return $this->elem[$prop];
>>> } else {
>>> return NULL;
>>> }
>>> }
>>>
>>> public function __set ($prop, $val)
>>> {
>>> $this->elem[$prop] = $val;
>>> }
>>> }
>>>
>>> $o = new OO();
>>>
>>> echo isset($o->a) ? "yes\n" : "no\n";
>>> echo isset($o->b) ? "yes\n" : "no\n";
>>>
>>> echo is_null($o->a) ? "yes\n" : "no\n";
>>> echo is_null($o->b) ? "yes\n" : "no\n";
>>>
>>> ?>
>>>
>>> I expected something like this:
>>>
>>> yes
>>> no
>>> no
>>> yes
>>>
>>> But got this:
>>>
>>> no
>>> no
>>> no
>>> yes
>>>
>>> It looks like isset() can't handle object properties correctly. I'll
>>> post the bug on php.net.
>>>
>>> --
>>> Daniel Schierbeck
Next time, please read my post carefully. $a is not NULL, it is 1.
Therefore, isset($a) should return TRUE, which it does normally, just
not when $a is returned via __get().

catalin: Yes, a __isset() method would be ideal, but i still can't see
why isset() shouldn't support the overloaded variables - after all, if
you are able to access such a variable using the __get() method, why
shouldn't you be able to check whether or not it has been set?
Currently, if you want to check whether a variable in the $elem array is
set, you would have to use this:

        $a = $o->a;
        echo isset($a) ? "yes\n" : "no\n";

Which in my opinion isn't optimal.

Bottom line - if you can access a variable through property overloading
you should be able to use isset() on them as well.

--
Daniel Schierbeck

attached mail follows:


Yes.... but not :-).

With you use these magic functions, when you write $o->a = 'foo', you
create a property in the object. Not ? Even if it is stored in an array
member, __set() create a property and __get() retrieve its value.

Doc says :

>The $name parameter used is the name of the variable that should
> be set or retrieved.
>The __set() method's $value parameter specifies the value that
> the object should set set the $name.

Conclusion :

class OO
{
    private $elem = array();
    public function __get ($prop)
    {
       if (isset($this->elem[$prop])) {
          return $this->elem[$prop];
    }
    else
    {
       return NULL;
    }

    public function __set ($prop, $val)
    {
       $this->elem[$prop] = $val;
    }
}

$o = new OO();
echo isset($o->a) ? "yes\n" : "no\n"; # Must return false and return
false effectively, cool
$o->a = 'foo';
echo isset($o->a) ? "yes\n" : "no\n"; # Must return false and return
false effectively, NOT COOL

Fred.

Catalin Trifu wrote:

> Hi,
>
> Is this really a bug. I think not.
> There is no variable $o->a or $a->b in the class OO
> there is only the variable $elem and $a and $b is a member
> of that array
> So ...
> The fact that PHP5 provides __set and __get magic
> functions does not mean that the actual variables exist with
> that particular name in the class ?
> Perhaps it would be nice to have a __isset magic function ?
>
> Cheers
> Catalin
>
>
>
>><?php
>>
>>class OO
>>{
>>private $elem = array("a" => 1);
>>
>>public function __get ($prop)
>>{
>>if (isset($this->elem[$prop])) {
>>return $this->elem[$prop];
>>} else {
>>return NULL;
>>}
>>}
>>
>>public function __set ($prop, $val)
>>{
>>$this->elem[$prop] = $val;
>>}
>>}
>>
>>$o = new OO();
>>
>>echo isset($o->a) ? "yes\n" : "no\n";
>>echo isset($o->b) ? "yes\n" : "no\n";
>>
>>echo is_null($o->a) ? "yes\n" : "no\n";
>>echo is_null($o->b) ? "yes\n" : "no\n";
>>
>>?>
>>
>>I expected something like this:
>>
>>yes
>>no
>>no
>>yes
>>
>>But got this:
>>
>>no
>>no
>>no
>>yes
>>
>>It looks like isset() can't handle object properties correctly. I'll post
>>the bug on php.net.
>>
>>--
>>Daniel Schierbeck
>
>

--
===================================================================
Frederic HARDY Email: fchhexanet.fr
HEXANET SARL URL: http://www.hexanet.fr/
ZAC Les Charmilles Tel: +33 (0)3 26 79 30 05
3, allée Thierry Sabine Direct: +33 (0)3 26 61 77 84
BP 202 - 51686 REIMS CEDEX 2 FRANCE
===================================================================

attached mail follows:


But there is no property set to NULL !!

Fred.

M. Sokolewicz wrote:

> next time, please read the isset documentation carefully. I quote:
> [quote]isset() will return FALSE if testing a variable that has been set
> to NULL.[/quote]
>
> Catalin Trifu wrote:
>
>> Hi,
>>
>> Is this really a bug. I think not.
>> There is no variable $o->a or $a->b in the class OO
>> there is only the variable $elem and $a and $b is a member
>> of that array
>> So ...
>> The fact that PHP5 provides __set and __get magic
>> functions does not mean that the actual variables exist with
>> that particular name in the class ?
>> Perhaps it would be nice to have a __isset magic function ?
>>
>> Cheers
>> Catalin
>>
>>
>>
>>> <?php
>>>
>>> class OO
>>> {
>>> private $elem = array("a" => 1);
>>>
>>> public function __get ($prop)
>>> {
>>> if (isset($this->elem[$prop])) {
>>> return $this->elem[$prop];
>>> } else {
>>> return NULL;
>>> }
>>> }
>>>
>>> public function __set ($prop, $val)
>>> {
>>> $this->elem[$prop] = $val;
>>> }
>>> }
>>>
>>> $o = new OO();
>>>
>>> echo isset($o->a) ? "yes\n" : "no\n";
>>> echo isset($o->b) ? "yes\n" : "no\n";
>>>
>>> echo is_null($o->a) ? "yes\n" : "no\n";
>>> echo is_null($o->b) ? "yes\n" : "no\n";
>>>
>>> ?>
>>>
>>> I expected something like this:
>>>
>>> yes
>>> no
>>> no
>>> yes
>>>
>>> But got this:
>>>
>>> no
>>> no
>>> no
>>> yes
>>>
>>> It looks like isset() can't handle object properties correctly. I'll
>>> post the bug on php.net.
>>>
>>> --
>>> Daniel Schierbeck
>
>

--
===================================================================
Frederic HARDY Email: fchhexanet.fr
HEXANET SARL URL: http://www.hexanet.fr/
ZAC Les Charmilles Tel: +33 (0)3 26 79 30 05
3, allée Thierry Sabine Direct: +33 (0)3 26 61 77 84
BP 202 - 51686 REIMS CEDEX 2 FRANCE
===================================================================

attached mail follows:


        Actually i think no property is created; not in the sense of
real object property.
    The only "real" property of the object is $elem.
    The $o->a, and $o->b are, IMHO, not object properties;
It is true that one can access $o->a and $o->b, but what is actually
returned is a member of the array $elem, and only because of the
implementation of the magic functions __set and __get.
    isset() does test for an "actual" variable beeing set, which is
definetely
not the case.
    I agree however that this is confusing. I am definetely puzzled by the
usefullness of these methods since i consider this to be a real error trap;
it would be so easy to fill up an object with values without knowing
what they are and what they are supposed to do and when developing some
kinda library, things can get really messy.
    On my part I would stick with the usual declaration of properties and
not
use __set() and __get().
    I think it's much cleaner to say:
class OO {
    /** this is variable a and means ... */
    public $a;
    /** this is variable a and means ... */
    public $b;
}

cheers,
Catalin

""Frédéric hardy"" <f.hardyhexanet.fr> wrote in message
news:4134AB04.5060609hexanet.fr...
> Yes.... but not :-).
>
> With you use these magic functions, when you write $o->a = 'foo', you
> create a property in the object. Not ? Even if it is stored in an array
> member, __set() create a property and __get() retrieve its value.
>
> Doc says :
>
> >The $name parameter used is the name of the variable that should
> > be set or retrieved.
> >The __set() method's $value parameter specifies the value that
> > the object should set set the $name.
>
> Conclusion :
>
> class OO
> {
> private $elem = array();
> public function __get ($prop)
> {
> if (isset($this->elem[$prop])) {
> return $this->elem[$prop];
> }
> else
> {
> return NULL;
> }
>
> public function __set ($prop, $val)
> {
> $this->elem[$prop] = $val;
> }
> }
>
> $o = new OO();
> echo isset($o->a) ? "yes\n" : "no\n"; # Must return false and return false
> effectively, cool
> $o->a = 'foo';
> echo isset($o->a) ? "yes\n" : "no\n"; # Must return false and return false
> effectively, NOT COOL
>
> Fred.
>
>
> Catalin Trifu wrote:
>
>> Hi,
>>
>> Is this really a bug. I think not.
>> There is no variable $o->a or $a->b in the class OO
>> there is only the variable $elem and $a and $b is a member
>> of that array
>> So ...
>> The fact that PHP5 provides __set and __get magic
>> functions does not mean that the actual variables exist with
>> that particular name in the class ?
>> Perhaps it would be nice to have a __isset magic function ?
>>
>> Cheers
>> Catalin
>>
>>
>>
>>><?php
>>>
>>>class OO
>>>{
>>>private $elem = array("a" => 1);
>>>
>>>public function __get ($prop)
>>>{
>>>if (isset($this->elem[$prop])) {
>>>return $this->elem[$prop];
>>>} else {
>>>return NULL;
>>>}
>>>}
>>>
>>>public function __set ($prop, $val)
>>>{
>>>$this->elem[$prop] = $val;
>>>}
>>>}
>>>
>>>$o = new OO();
>>>
>>>echo isset($o->a) ? "yes\n" : "no\n";
>>>echo isset($o->b) ? "yes\n" : "no\n";
>>>
>>>echo is_null($o->a) ? "yes\n" : "no\n";
>>>echo is_null($o->b) ? "yes\n" : "no\n";
>>>
>>>?>
>>>
>>>I expected something like this:
>>>
>>>yes
>>>no
>>>no
>>>yes
>>>
>>>But got this:
>>>
>>>no
>>>no
>>>no
>>>yes
>>>
>>>It looks like isset() can't handle object properties correctly. I'll post
>>>the bug on php.net.
>>>
>>>--
>>>Daniel Schierbeck
>>
>>
>
> --
> ===================================================================
> Frederic HARDY Email: fchhexanet.fr
> HEXANET SARL URL: http://www.hexanet.fr/
> ZAC Les Charmilles Tel: +33 (0)3 26 79 30 05
> 3, allée Thierry Sabine Direct: +33 (0)3 26 61 77 84
> BP 202 - 51686 REIMS CEDEX 2 FRANCE
> ===================================================================

attached mail follows:


Frédéric hardy wrote:

> Is it possible to do something like this :
>
> class foo
> {
> private $array = array();
>
> function __construct()
> {
> ...
> }
>
> function __get($key)
> {
> return (isset($this->array[$key]) == false ? null :
> $this->array[$key]);
> }
>
> function __set($key, $value)
> {
> $this->array[$key] = $value;
> }
> }
>
> $foo = new foo();
>
> if (isset($foo->bar) == false)
> $foo->bar = 'bar';
> else
> echo $foo->bar;
>
> It seems that isset($foo->bar) return ALWAYS false.
> Bug ?

Not a bug, __get() and __set() are called only if !isset($foo->var).

The purpose of __get and __set is to implement transparent getters and
setters without forcing users to do

function setVal($val)
{
     $this->val = $val;
}

function getVal()
{
     return $this->val;
}

If you are not sure which properties even exist, you probably shouldn't
be using __get()/__set(), or should refactor so that you can rely upon
certain values existing. If absolutely necessary, you can always provide

function ifexists($name)
{
     return isset($this->array[$name]);
}

and then you can if ($o->ifexists('a')) instead of if (isset($o->a))

Greg

attached mail follows:


Catalin Trifu wrote:
> Actually i think no property is created; not in the sense of
> real object property.
> The only "real" property of the object is $elem.
> The $o->a, and $o->b are, IMHO, not object properties;
> It is true that one can access $o->a and $o->b, but what is actually
> returned is a member of the array $elem, and only because of the
> implementation of the magic functions __set and __get.
> isset() does test for an "actual" variable beeing set, which is
> definetely
> not the case.
> I agree however that this is confusing. I am definetely puzzled by the
> usefullness of these methods since i consider this to be a real error trap;
> it would be so easy to fill up an object with values without knowing
> what they are and what they are supposed to do and when developing some
> kinda library, things can get really messy.
> On my part I would stick with the usual declaration of properties and
> not
> use __set() and __get().
> I think it's much cleaner to say:
> class OO {
> /** this is variable a and means ... */
> public $a;
> /** this is variable a and means ... */
> public $b;
> }
>
> cheers,
> Catalin
>
>
> ""Frédéric hardy"" <f.hardyhexanet.fr> wrote in message
> news:4134AB04.5060609hexanet.fr...
>
>>Yes.... but not :-).
>>
>>With you use these magic functions, when you write $o->a = 'foo', you
>>create a property in the object. Not ? Even if it is stored in an array
>>member, __set() create a property and __get() retrieve its value.
>>
>>Doc says :
>>
>>
>>>The $name parameter used is the name of the variable that should
>>>be set or retrieved.
>>>The __set() method's $value parameter specifies the value that
>>>the object should set set the $name.
>>
>>Conclusion :
>>
>>class OO
>>{
>> private $elem = array();
>> public function __get ($prop)
>> {
>> if (isset($this->elem[$prop])) {
>> return $this->elem[$prop];
>> }
>> else
>> {
>> return NULL;
>> }
>>
>> public function __set ($prop, $val)
>> {
>> $this->elem[$prop] = $val;
>> }
>>}
>>
>>$o = new OO();
>>echo isset($o->a) ? "yes\n" : "no\n"; # Must return false and return false
>>effectively, cool
>>$o->a = 'foo';
>>echo isset($o->a) ? "yes\n" : "no\n"; # Must return false and return false
>>effectively, NOT COOL
>>
>>Fred.
>>
>>
>>Catalin Trifu wrote:
>>
>>
>>> Hi,
>>>
>>> Is this really a bug. I think not.
>>> There is no variable $o->a or $a->b in the class OO
>>>there is only the variable $elem and $a and $b is a member
>>>of that array
>>> So ...
>>> The fact that PHP5 provides __set and __get magic
>>>functions does not mean that the actual variables exist with
>>>that particular name in the class ?
>>> Perhaps it would be nice to have a __isset magic function ?
>>>
>>>Cheers
>>>Catalin
>>>
>>>
>>>
>>>
>>>><?php
>>>>
>>>>class OO
>>>>{
>>>>private $elem = array("a" => 1);
>>>>
>>>>public function __get ($prop)
>>>>{
>>>>if (isset($this->elem[$prop])) {
>>>>return $this->elem[$prop];
>>>>} else {
>>>>return NULL;
>>>>}
>>>>}
>>>>
>>>>public function __set ($prop, $val)
>>>>{
>>>>$this->elem[$prop] = $val;
>>>>}
>>>>}
>>>>
>>>>$o = new OO();
>>>>
>>>>echo isset($o->a) ? "yes\n" : "no\n";
>>>>echo isset($o->b) ? "yes\n" : "no\n";
>>>>
>>>>echo is_null($o->a) ? "yes\n" : "no\n";
>>>>echo is_null($o->b) ? "yes\n" : "no\n";
>>>>
>>>>?>
>>>>
>>>>I expected something like this:
>>>>
>>>>yes
>>>>no
>>>>no
>>>>yes
>>>>
>>>>But got this:
>>>>
>>>>no
>>>>no
>>>>no
>>>>yes
>>>>
>>>>It looks like isset() can't handle object properties correctly. I'll post
>>>>the bug on php.net.
>>>>
>>>>--
>>>>Daniel Schierbeck
>>>
>>>
>>--
>>===================================================================
>>Frederic HARDY Email: fchhexanet.fr
>>HEXANET SARL URL: http://www.hexanet.fr/
>>ZAC Les Charmilles Tel: +33 (0)3 26 79 30 05
>>3, allée Thierry Sabine Direct: +33 (0)3 26 61 77 84
>>BP 202 - 51686 REIMS CEDEX 2 FRANCE
>>===================================================================

I personally find the __get() and __set() methods very usefull,
especially when constructing object hierarchies. But, as Frédéric said,
they're not sufficient. Either make isset() work with the __get() method
or add a __isset() magic method.

--
Daniel Schierbeck

attached mail follows:


Ave,

I hear you... Even I feel it's a different problem but I don't know what.
My first thought was that HTML or anything doesn't work after the
Force-Download script in general.... But since you seem to use it, I guess
it does.

Now I don't know what to do, how to make it work. I can't understand what
exactly is causing the problem.

Thanks though.

On 8/30/04 7:13 PM, "Jasper Howard" <jaspervelocity7.com> wrote:

> if you're not getting any html after your php script, then there's a
> different problem. I do the same thing and all I use is:
>
> <?php
> ...
> ?>
> <script language="javascript">
> <!--
> window.close();
> //-->
> </script>
>
> and I've never had a problem with it not closing...

attached mail follows:


Ave,

I didn't quite understand what you meant.
The kind of files being saved by this script range from ZIP files to DBF
files to JPG files etcetera. Where will the HTML be in those saved files?

Any suggestions on what I need to do to make this work?

On 8/30/04 8:31 PM, "Curt Zirzow" <php-generalzirzow.dyndns.org> wrote:

> * Thus wrote PHP Junkie:
>> Ave,
>>
>> It still doesn't work. Not only that, I put up a "close window" button in
>> the page and even that doesn't show up. Although that's still not what I
>> want. What I want is the window to close automatically.
>>
>> Here's my page:
>>
>> <?php
>> $file = "$P/$F";
>> header("Content-Description: File Transfer");
>> header("Content-Type: application/force-download");
>> header("Content-Disposition: attachment; filename=".basename($file));
>> readfile($file);
>> ?>
>> <html>
>> <head>
>> <title>D/L Window</title>
>> <script language="javascript">
>> function close_opener()
>
> Take a look at the end of the file you saved, you'll see your html
> there.
>
> Curt

attached mail follows:


try this, after you force download of the file, use:

header("Location: close_window_script.php");

where the only code in that file is something like this:

<script language="javascript">
<!--
window.close();
//-->
</script>

this is a total workaround, but since its the only thing in the document,
its very possible that it'll work, it won't take any more time to load
either because you're using the header() function to forward, so the user
has to download the same amount of info.

--

-------------------------------------------------------------->>
Jasper Howard :: Database Administration
Velocity7
1.530.470.9292
http://www.Velocity7.com/
<<--------------------------------------------------------------
"Php Junkie" <phpjunkiemjimm.com> wrote in message
news:BD59E3C0.1D03%phpjunkiemjimm.com...
> Ave,
>
> I hear you... Even I feel it's a different problem but I don't know what.
> My first thought was that HTML or anything doesn't work after the
> Force-Download script in general.... But since you seem to use it, I guess
> it does.
>
> Now I don't know what to do, how to make it work. I can't understand what
> exactly is causing the problem.
>
> Thanks though.
>
>
>
> On 8/30/04 7:13 PM, "Jasper Howard" <jaspervelocity7.com> wrote:
>
> > if you're not getting any html after your php script, then there's a
> > different problem. I do the same thing and all I use is:
> >
> > <?php
> > ...
> > ?>
> > <script language="javascript">
> > <!--
> > window.close();
> > //-->
> > </script>
> >
> > and I've never had a problem with it not closing...
>
>

attached mail follows:


* Thus wrote Jasper Howard:
> try this, after you force download of the file, use:
>
> header("Location: close_window_script.php");
>
> where the only code in that file is something like this:
>
> <script language="javascript">
> <!--
> window.close();
> //-->
> </script>
>
>
> this is a total workaround, but since its the only thing in the document,
> its very possible that it'll work, it won't take any more time to load
> either because you're using the header() function to forward, so the user
> has to download the same amount of info.

This will *not* work. you can't send a file and close a window in
the same request.

Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!

attached mail follows:


    Ave,

Indeed, it didn't work. Anymore suggestions?

On 8/31/04 2:09 PM, "Jasper Howard" <jaspervelocity7.com> wrote:

> try this, after you force download of the file, use:
>
> header("Location: close_window_script.php");
>
> where the only code in that file is something like this:
>
> <script language="javascript">
> <!--
> window.close();
> //-->
> </script>
>
>
> this is a total workaround, but since its the only thing in the document,
> its very possible that it'll work, it won't take any more time to load
> either because you're using the header() function to forward, so the user
> has to download the same amount of info.

attached mail follows:


Dre wrote:

>Hi ..
>
>I'm trying to save and view image files in a MySQL database, I made the save
>operation successfully, I stored the image file name, type, size and the
>image file itself
>the problem occurred when I tried to retrieve the image data I've previously
>stored, in specific when I tried to preview the image file
>
>I tried to make something like the following but it did not work
>
>
while solutions are being offered, may i bring to your kind attention
the fact that storing images in a database is woefully inefficient.

--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.

attached mail follows:


I got the idea .. and I will work on it
thanks a lot
"Jim Grill" <jgrillweb-1hosting.net> wrote in message
news:004801c48f01$61f211d0$0301a8c0necronomicon...
> > Dre wrote:
> > > line 8 is <?php
> > >
> > > just that .. and the code before it is the following
> > >
> > > //==================================================
> > > <html>
> > > <head>
> > > <title>Untitled Document</title>
> > > <meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
> > > </head>
> > >
> > > <body>
> > > //==================================================
> > >
> >
> > That is the output I mentioned.
> >
> > And output either html OR image, you cannot output both. Try yourself,
> > open a image file (gif, jpg...) in a text editor and put html code in
> > it, then save it. Obviosly, you'll get broken image file.
> >
>
> As others have mentioned, you cannot output *anything* at all before
> modifying headers. If your script outputs even a space, headers are sent.
> Headers can only ever be sent one time per request. The solution: make a
> separate request for the image.
>
> To get around this problem put your image fetching code into a separate
> script and call it with an image tag. Ideally, you would have saved the
> image sizes in a separate column so you might select only the id (or name
of
> the image) and the size in your main script and then call the second image
> fetching script like so:
> <img src="image.php?img_id=$id" width="$width" height="$height" border="0"
> />
>
> The $id, $width, and $height would have come from your db. Save the actual
> fetching of the image itself for image.php.
>
> Good luck and have fun!
>
> Jim Grill
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >

attached mail follows:


may I ask why is it inefficient ??

thanks in advance
"Raditha Dissanayake" <jabberraditha.com> wrote in message
news:41347B6D.8020902raditha.com...
> Dre wrote:
>
> >Hi ..
> >
> >I'm trying to save and view image files in a MySQL database, I made the
save
> >operation successfully, I stored the image file name, type, size and the
> >image file itself
> >the problem occurred when I tried to retrieve the image data I've
previously
> >stored, in specific when I tried to preview the image file
> >
> >I tried to make something like the following but it did not work
> >
> >
> while solutions are being offered, may i bring to your kind attention
> the fact that storing images in a database is woefully inefficient.
>
> --
> Raditha Dissanayake.
> ------------------------------------------------------------------------
> http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
> Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
> Graphical User Inteface. Just 128 KB | with progress bar.
>

attached mail follows:


[snip]
may I ask why is it inefficient ??
[/snip]

Because BLOB data requires tremendous overhead and cannot usually be
indexed by itself. You are better storing the image somewhere in your
system and then storing a pointer (URL, whatever) to the image.

attached mail follows:


On Wednesday 01 September 2004 05:18, Dre wrote:
> may I ask why is it inefficient ??

Yes.

Also you can goggle around a bit for the pros and cons.

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
"You'll pay to know what you really think."
-- J.R. "Bob" Dobbs
*/

attached mail follows:


Jason Wong wrote:

>On Tuesday 31 August 2004 07:06, Brent Clements wrote:
>
>
>
>>Damn, I just felt the wrath of the list even though I completely agree with
>>you guys, I was just pointing out some employers requirements.
>>
>>
>
>Wrath? What wrath? You ain't seen nuthin yet. I think all we're pointing out
>is that it takes just a little common sense and a little common courtesy to
>both comply with your employee's requirements AND and the same time not annoy
>the list.
>
>

you aint seen nothing yet.
You will wrath when you gently point out to someone that this is not
the place for javascript questions, or apache questions, or mysql
questions or questions about where to pay your traffic fine.

--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.

attached mail follows:


Bambero wrote:

>
> What do you think about this function ?
>
nothing much.

--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.

attached mail follows:


Karam Chand wrote:

>Darn missed it. Looking into the docs I am using code
>somthing like this:
>
>
If you are really keen about chaning +1 to ++ and double quotes to
single quotes in the hope of shaving off a few milliseconds in execution
time you might want to try something like xdebug.

--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.

attached mail follows:


From: "Curt Zirzow" <php-generalzirzow.dyndns.org>

> change return to:
> return ($this->fp? true: false);
>
> technically, internally the function is treated as
> function &stream_open(...)
>
> and will convert the value to a boolean value as you were
> experiencing.

Dammit... I knew that whole "this method should return TRUE or FALSE" would
come back to bite me on the ass... Thanks for the tip, it works now, of
course.

---John Holmes...

attached mail follows:


Hi,

I have a string like this, read from an html file: ' VALUE="16">'
The value could be any number. I am trying to get that number.

I have this so far, i was hoping someone might tell me how to get that
number:

<?php

  $handle = fopen("page.php", "r");
  while (!feof($handle)) {
    $buffer .= fgets($handle, 4096);
  }
  fclose($handle);

  $result = stristr($buffer, 'NAME="c"');
  print ("Result:<br />".$result);

?>

Im not very good at regex, is there an function that would help me?
(couldnt see one...)

thx...

--
Nick W

attached mail follows:


Nick Wilson wrote:
> Hi,
>
> I have a string like this, read from an html file: ' VALUE="16">'
> The value could be any number. I am trying to get that number.
>
> I have this so far, i was hoping someone might tell me how to get that
> number:
>
>
> <?php
>
> $handle = fopen("page.php", "r");
> while (!feof($handle)) {
> $buffer .= fgets($handle, 4096);
> }
> fclose($handle);
>
> $result = stristr($buffer, 'NAME="c"');
> print ("Result:<br />".$result);
>
> ?>
>
> Im not very good at regex, is there an function that would help me?
> (couldnt see one...)
>
> thx...
>

preg_match('/value\s*=\s*"([0-9]+)"/i', $buffer, $result);
print ("Result:<br />".$result[1]);

attached mail follows:


Nick,

Nick wrote:

> I have a string like this, read from an html file: ' VALUE="16">'
> The value could be any number. I am trying to get that number.

If you have that exact string and you want to extract just the number,
then a simple regex to delete all non-numeric characters should
suffice.

> I have this so far, i was hoping someone might tell me how to get that
> number:
>
>
> <?php
>
> $handle = fopen("page.php", "r");
> while (!feof($handle)) {
> $buffer .= fgets($handle, 4096);
> }
> fclose($handle);
>
> $result = stristr($buffer, 'NAME="c"');
> print ("Result:<br />".$result);
>
> ?>

Ok, so I don't see ' VALUE="16">' in here anywhere -- I think you need
to be a lot more descriptive about the source content and what exactly
you want to extract, and provide a few examples, so that we can cover
all your bases.

Regular Expressions are _probably_ what you need, but you REALLY need
to provide a decent description and multiple examples of what you want,
otherwise we're just wasting time.

---
Justin French
http://indent.com.au

attached mail follows:


From: "Marek Kilimajer" <listskilimajer.net>
>> $handle = fopen("page.php", "r");
>> while (!feof($handle)) {
>> $buffer .= fgets($handle, 4096);
>> }
>> fclose($handle);

file_get_contents() could be helpful here, too...

---John Holmes...

attached mail follows:


* and then Marek Kilimajer declared....
> >Im not very good at regex, is there an function that would help me?
> >(couldnt see one...)
> >
>
> preg_match('/value\s*=\s*"([0-9]+)"/i', $buffer, $result);
> print ("Result:<br />".$result[1]);

Marek, you're a star ;-)

I *hate* having to ask someone to do my work, "mastering regular
expressions' in going on my christmas wish list! hehe...

thanks again...

PS: Justin, got it covered. Thanks..

--
Nick W

attached mail follows:


Ed Lazor wrote:
>
>><Directory /apache2/htdocs/horde >
>> php_admin_flag safe_mode off
>> php_admin_value upload_tmp_dir /tmp
>> php_admin_value open_basedir "/"
>></Directory>
>>.....
>>But after setting
>> php_admin_value open_basedir none
>>instead of
>> php_admin_value open_basedir "/"
>>
>>the problem disappeared.
>>
>>I just want to know the exact meaning of that directive.
>
>
>>From php.ini
>
>
> Are you assuming that "/" refers to /apache2/htdocs/horde ?

No. As I understand it means:

"All php scripts inside '/apache2/htdocs/horde' could access to any file
inside '/'". Which is the same as letting the webmail access any file it
needs in the filesystem.

Since each virtualhost is restricted to its home directory, and webmail
is common for all the virtualhosts (http://<virtualhost>/webmail), I
needed to define a rule in a directory basis to let the webmail system
access more than just the file inside the virtualhost home.

Currently I only want to know the exact meaning of:
        open_basedir none

--
                                         Federico Petronio
                                         fpetronioactivesec.biz
                                         Linux User #129974

---
There are only 10 types of people in the world:
               Those who understand binary and those who don't.

attached mail follows:


KeyStone Learning Systems (www.keystonelearning.com) is currently seeking subject matter experts to work with us to author future courseware titles delivered via CD-ROM, VHS, DVD and the Web.
 

Are you a leading expert or trainer in your field? Do you have a passion or desire to teach others?
 
Have you always wanted to be a published author but haven't had the time or opportunity to pursue your goal?
 

KeyStone has been working with leading experts for more than 15 years in the areas of desktop software, development, programming and certification topics to develop computer and video-based courseware.
 
Our products are used by more than 500,000 active professional users and sold along with more than 1,200 course titles in some of the following categories:
 
  - Professional Certifications, such as MCSE and CCNA
  - Application and Web Developers, such as Java, SQL and VB.Net
  - Desktop Applications, such as Microsoft Office, QuickBooks and Publisher
  - Digital Media Applications, such as Macromedia Flash and Adobe Photoshop
  - Professional Soft skills, such as Project Management and Accounting
  - Other Information Technology, Communications and development related courses
 
 
 
If you are interested in joining our team of leading experts, we encourage you to visit our site at http://www.keystonelearning.com/keystone/sme for additional information.
 

Thank you.
 
The KeyStone Team

attached mail follows:


> Are you a leading expert or trainer in your field? Do you have a passion
> or desire to teach others?

Hi. I am a SME (subject matter expert) at detecting spam and desire to teach
others to do the same. I have included a sample of what I detected below as
proof of my expertise. You can contact me at:

*&hn[foo]h&l!$s(_2_)littler$dpsar%[foo]c&!

replacing:
$ with e
& with o
[foo] with .
(_2_) with
ps with sp
little with big
% with k
! with m
* with j

---John Holmes...

----- Original Message -----
From: "Keystone Learning Systems" <instructorskeystonelearning.com>
To: <php-generallists.php.net>
Sent: Monday, August 30, 2004 5:43 PM
Subject: [PHP] Authors and Instructors Needed

> KeyStone Learning Systems (www.keystonelearning.com) is currently seeking
> subject matter experts to work with us to author future courseware titles
> delivered via CD-ROM, VHS, DVD and the Web.
>
>
> Are you a leading expert or trainer in your field? Do you have a passion
> or desire to teach others?
>
> Have you always wanted to be a published author but haven't had the time
> or opportunity to pursue your goal?
>
>
> KeyStone has been working with leading experts for more than 15 years in
> the areas of desktop software, development, programming and certification
> topics to develop computer and video-based courseware.
>
> Our products are used by more than 500,000 active professional users and
> sold along with more than 1,200 course titles in some of the following
> categories:
>
> - Professional Certifications, such as MCSE and CCNA
> - Application and Web Developers, such as Java, SQL and VB.Net
> - Desktop Applications, such as Microsoft Office, QuickBooks and
> Publisher
> - Digital Media Applications, such as Macromedia Flash and Adobe
> Photoshop
> - Professional Soft skills, such as Project Management and Accounting
> - Other Information Technology, Communications and development related
> courses
>
>
>
> If you are interested in joining our team of leading experts, we encourage
> you to visit our site at http://www.keystonelearning.com/keystone/sme for
> additional information.
>
>
> Thank you.
>
> The KeyStone Team
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


* and then Keystone Learning Systems declared....
> Have you always wanted to be a published author but haven't had the time or opportunity to pursue your goal?
>

No, but i've always wanted to be a teapot. Does that count?

--
Nick W

attached mail follows:


I can hold my pee for hours

Jim Grill
----- Original Message -----
From: "Keystone Learning Systems" <instructorskeystonelearning.com>
To: <php-generallists.php.net>
Sent: Monday, August 30, 2004 4:43 PM
Subject: [PHP] Authors and Instructors Needed

> KeyStone Learning Systems (www.keystonelearning.com) is currently seeking
subject matter experts to work with us to author future courseware titles
delivered via CD-ROM, VHS, DVD and the Web.
>
>
> Are you a leading expert or trainer in your field? Do you have a passion
or desire to teach others?
>
> Have you always wanted to be a published author but haven't had the time
or opportunity to pursue your goal?
>
>
> KeyStone has been working with leading experts for more than 15 years in
the areas of desktop software, development, programming and certification
topics to develop computer and video-based courseware.
>
> Our products are used by more than 500,000 active professional users and
sold along with more than 1,200 course titles in some of the following
categories:
>
> - Professional Certifications, such as MCSE and CCNA
> - Application and Web Developers, such as Java, SQL and VB.Net
> - Desktop Applications, such as Microsoft Office, QuickBooks and
Publisher
> - Digital Media Applications, such as Macromedia Flash and Adobe
Photoshop
> - Professional Soft skills, such as Project Management and Accounting
> - Other Information Technology, Communications and development related
courses
>
>
>
> If you are interested in joining our team of leading experts, we encourage
you to visit our site at http://www.keystonelearning.com/keystone/sme for
additional information.
>
>
> Thank you.
>
> The KeyStone Team
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

attached mail follows:


All,

We apologize if this posting was interpreted as spam. Our intentions
were not to spam and we posted this message to your list, as it has many
professional PHP developers that may be interested in working with us on
course development.

Regards,

KeyStone Learning Systems

----- Original Message -----
From: "Keystone Learning Systems" <instructorskeystonelearning.com>
To: <php-generallists.php.net>
Sent: Monday, August 30, 2004 4:43 PM
Subject: [PHP] Authors and Instructors Needed

> KeyStone Learning Systems (www.keystonelearning.com) is currently
> seeking
subject matter experts to work with us to author future courseware
titles delivered via CD-ROM, VHS, DVD and the Web.
>
>
> Are you a leading expert or trainer in your field? Do you have a
> passion
or desire to teach others?
>
> Have you always wanted to be a published author but haven't had the
> time
or opportunity to pursue your goal?
>
>
> KeyStone has been working with leading experts for more than 15 years
> in
the areas of desktop software, development, programming and
certification topics to develop computer and video-based courseware.
>
> Our products are used by more than 500,000 active professional users
> and
sold along with more than 1,200 course titles in some of the following
categories:
>
> - Professional Certifications, such as MCSE and CCNA
> - Application and Web Developers, such as Java, SQL and VB.Net
> - Desktop Applications, such as Microsoft Office, QuickBooks and
Publisher
> - Digital Media Applications, such as Macromedia Flash and Adobe
Photoshop
> - Professional Soft skills, such as Project Management and
Accounting
> - Other Information Technology, Communications and development
> related
courses
>
>
>
> If you are interested in joining our team of leading experts, we
> encourage
you to visit our site at http://www.keystonelearning.com/keystone/sme
for additional information.
>
>
> Thank you.
>
> The KeyStone Team
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

attached mail follows:


Anyone know of a Dealer Locater PHP app that I can buy (or get for free)
other than the one at YourPHPpro
<http://phpdealerlocator.yourphppro.com/demo/>?

They guys software is great but I've been trying to buy it for a week and
can't get a response from him.

attached mail follows:


Hi,

> As a PHP security advocate for the last few years, I can tell you that
> Curt is absolutely correct. In fact, poor open source applications written
> in PHP are the top reason why PHP is considered insecure by the
> programming community at large. This is a myth that is very difficult to
> dispel, and it shows how powerful perception can be.

        Myth it is for sure. We've passed 7 security audits in a row here.
All PHP systems.

-Dan Joseph

attached mail follows:


Marek Kilimajer wrote:
> Gerard Samuel wrote:
>
>> The situation.
>> Im currently using a home brewed groups permission code in my site,
>> but for limited users/groups its ok. Beyond that, the code will take
>> the fast road to hell.
>> I started to look in depth at bitwise operations today,
>> and after much googling, and looking at other code, came up with this
>> mock up, of a basic permissions routine (not neccessarilly the final
>> product), that utilizes bitwise operations.
>>
>> Im looking for advise, to see if Im heading in the right way, and/or
>> improvements with this.
>> Thanks for your time...
>>
>> -- start code --
>> <?php
>>
>> $perm = $user = array();
>> $perm_total = 0;
>>
>> // Permissions from some source like a database/file
>> $perm['execute'] = 1;
>> $perm['write'] = 2;
>> $perm['read'] = 4;
>>
>> // User permissions (predetermined) from sessions maybe
>> $user['tom'] = 7; // rwx
>> $user['joe'] = 5; // rx
>> $user['dirty_harry'] = 9; // illegal in this case??
>
>
> 9 is 1001, so if you ignore fourth bit, it's equal to 1. Some day you
> might want to add other permission rights using other bits.
>

Yes I may use it some day. I was trying to simulate an illegal
permission. So how should I handle this, if I should handle this???

>> $user['whats_his_face'] = 6; // rw
>>
>> // Set the sum of "source" permissions
>> foreach($perm as $value)
>> {
>> $perm_total |= $value;
>> }
>>
>> echo "<ul>";
>>
>> // Loop over the users
>> foreach($user as $id => $user_perm)
>> {
>
>
> These 2 pieces of code:
>
>> // User permissions should be between 1 & 7, else set it to 0
>> if ($user_perm > $perm_total || $user_perm < 0)
>> {
>> $user_perm = 0;
>> }
>
>
> and
>
>> // Compare user bits to permission bits
>> $compare = $perm_total & $user_perm;
>
>
> do the same thing, and are quite useless, the code will work without it.
> If you extend the rights one day, you would have to modify it.

Ok, I understand what you mean about the if() statement, as its related
to your previous comment above.
But isn't $compare = $perm_total & $user_perm; needed for this to work?

>
>> // Make it an even 4 bit string (for visual effect)
>> $bits_string = sprintf("%03d", decbin( $compare ));
>>
>> echo "<li>User: " . $id . "</li>";
>>
>> // Check to see if the comparision contains any permission bits
>> $can_read = (($compare & $perm['read']) == $perm['read']) ===
>> TRUE ? "TRUE" : "FALSE";
>> $can_write = (($compare & $perm['write']) == $perm['write']) ===
>> TRUE ? "TRUE" : "FALSE";
>> $can_execute = (($compare & $perm['execute']) == $perm['execute'])
>> === TRUE ? "TRUE" : "FALSE";
>>
>> echo "<ul>";
>> echo "<li>" . $user_perm . ' -> ' . $bits_string . "</li>";
>> echo "<li>Can Read: $can_read</li>";
>> echo "<li>Can Write: $can_write</li>";
>> echo "<li>Can Execute: $can_execute</li>";
>>
>> echo "</ul>";
>> }
>>
>> echo "</ul>";
>>
>> ?>
>> -- end code --
>>
>

attached mail follows:


Gerard Samuel wrote:
> Marek Kilimajer wrote:
>
>> Gerard Samuel wrote:
>>
>>> The situation.
>>> Im currently using a home brewed groups permission code in my site,
>>> but for limited users/groups its ok. Beyond that, the code will take
>>> the fast road to hell.
>>> I started to look in depth at bitwise operations today,
>>> and after much googling, and looking at other code, came up with this
>>> mock up, of a basic permissions routine (not neccessarilly the final
>>> product), that utilizes bitwise operations.
>>>
>>> Im looking for advise, to see if Im heading in the right way, and/or
>>> improvements with this.
>>> Thanks for your time...
>>>
>>> -- start code --
>>> <?php
>>>
>>> $perm = $user = array();
>>> $perm_total = 0;
>>>
>>> // Permissions from some source like a database/file
>>> $perm['execute'] = 1;
>>> $perm['write'] = 2;
>>> $perm['read'] = 4;
>>>
>>> // User permissions (predetermined) from sessions maybe
>>> $user['tom'] = 7; // rwx
>>> $user['joe'] = 5; // rx
>>> $user['dirty_harry'] = 9; // illegal in this case??
>>
>>
>>
>> 9 is 1001, so if you ignore fourth bit, it's equal to 1. Some day you
>> might want to add other permission rights using other bits.
>>
>
> Yes I may use it some day. I was trying to simulate an illegal
> permission. So how should I handle this, if I should handle this???

Your checks are something like
if($user['tom'] & $perm['read']) echo 'Tom can read';

Only the 3rd bit is checked, all others are ignored and won't do any harm.

Anyway, the "clean" way of setting permissions is:
$user['tom'] = $perm['execute'] | $perm['write'] | $perm['read'];

>
>>> $user['whats_his_face'] = 6; // rw
>>>
>>> // Set the sum of "source" permissions
>>> foreach($perm as $value)
>>> {
>>> $perm_total |= $value;
>>> }
>>>
>>> echo "<ul>";
>>>
>>> // Loop over the users
>>> foreach($user as $id => $user_perm)
>>> {
>>
>>
>>
>> These 2 pieces of code:
>>
>>> // User permissions should be between 1 & 7, else set it to 0
>>> if ($user_perm > $perm_total || $user_perm < 0)
>>> {
>>> $user_perm = 0;
>>> }
>>
>>
>>
>> and
>>
>>> // Compare user bits to permission bits
>>> $compare = $perm_total & $user_perm;
>>
>>
>>
>> do the same thing, and are quite useless, the code will work without
>> it. If you extend the rights one day, you would have to modify it.
>
>
> Ok, I understand what you mean about the if() statement, as its related
> to your previous comment above.
> But isn't $compare = $perm_total & $user_perm; needed for this to work?

$compare = $perm_total & $user_perm; unsets all bits other than 1, 2 and
4, so 0 =< $compare =< 7. However, your first condition already did this.

>
>>
>>> // Make it an even 4 bit string (for visual effect)
>>> $bits_string = sprintf("%03d", decbin( $compare ));
>>>
>>> echo "<li>User: " . $id . "</li>";
>>>
>>> // Check to see if the comparision contains any permission bits
>>> $can_read = (($compare & $perm['read']) == $perm['read']) ===
>>> TRUE ? "TRUE" : "FALSE";
>>> $can_write = (($compare & $perm['write']) == $perm['write'])
>>> === TRUE ? "TRUE" : "FALSE";
>>> $can_execute = (($compare & $perm['execute']) ==
>>> $perm['execute']) === TRUE ? "TRUE" : "FALSE";
>>>
>>> echo "<ul>";
>>> echo "<li>" . $user_perm . ' -> ' . $bits_string . "</li>";
>>> echo "<li>Can Read: $can_read</li>";
>>> echo "<li>Can Write: $can_write</li>";
>>> echo "<li>Can Execute: $can_execute</li>";
>>>
>>> echo "</ul>";
>>> }
>>>
>>> echo "</ul>";
>>>
>>> ?>
>>> -- end code --
>>>
>>
>

attached mail follows:


Marek Kilimajer wrote:
> Your checks are something like
> if($user['tom'] & $perm['read']) echo 'Tom can read';
>
> Only the 3rd bit is checked, all others are ignored and won't do any harm.
>
> Anyway, the "clean" way of setting permissions is:
> $user['tom'] = $perm['execute'] | $perm['write'] | $perm['read'];
>

Understood. It cant be illegal if its set as you described.

> $compare = $perm_total & $user_perm; unsets all bits other than 1, 2 and
> 4, so 0 =< $compare =< 7. However, your first condition already did this.
>

Ok.

So here is the updated code ->

-- start code --
<?php

$perm = $user = array();
$perm_total = 0;

// Permissions from some source like a database/file
$perm['execute'] = 1;
$perm['write'] = 2;
$perm['read'] = 4;

// User permissions (predetermined) from sessions maybe
$user['tom'] = $perm['read'] | $perm['write'] |
$perm['execute']; // rwx
$user['joe'] = $perm['read'] | $perm['execute']; // rx
$user['whats_his_face'] = $perm['read'] | $perm['write']; // rw

// Set the sum of "source" permissions
foreach($perm as $value)
{
     $perm_total |= $value;
}

echo "<ul>";

// Loop over the users
foreach($user as $id => $user_perm)
{
     // Compare user bits to permission bits
     $compare = $perm_total & $user_perm;

     // Make it an even 4 bit string (for visual effect)
     $bits_string = sprintf("%03d", decbin( $compare ));

     echo "<li>User: " . $id . "</li>";

     // Check to see if the comparision contains any permission bits
     $can_read = (($compare & $perm['read']) == $perm['read']) ===
TRUE ? "TRUE" : "FALSE";
     $can_write = (($compare & $perm['write']) == $perm['write']) ===
TRUE ? "TRUE" : "FALSE";
     $can_execute = (($compare & $perm['execute']) == $perm['execute'])
=== TRUE ? "TRUE" : "FALSE";

     echo "<ul>";
     echo "<li>" . $user_perm . ' -> ' . $bits_string . "</li>";
     echo "<li>Can Read: $can_read</li>";
     echo "<li>Can Write: $can_write</li>";
     echo "<li>Can Execute: $can_execute</li>";

     echo "</ul>";
}

echo "</ul>";

?>
-- end code --

So if thats it, now its time to expand on this idea on my end...
Thanks

attached mail follows:


Hi,

How can I get the URL of the page I am on without the 'www.' i.e. just
mydomain.com? I need to enurse this is correct in case the user types in the
domain without using the 'www.'.

I have looked at using substr but if the user leaves out the 'www.' then
substr($_SERVER['HTTP_HOST'], 4) would return 'main.com', is there a better
function to use in this instance?

Thanks for your help

attached mail follows:


> How can I get the URL of the page I am on without the 'www.' i.e. just
> mydomain.com? I need to enurse this is correct in case the user types in
> the domain without using the 'www.'.

This should be Apache's job - you can configure the webserver to redirect
requests from example.com to www.example.com without PHP's involvement, if
that's what you're interested in.

> I have looked at using substr but if the user leaves out the 'www.' then
> substr($_SERVER['HTTP_HOST'], 4) would return 'main.com', is there a
> better function to use in this instance?

preg_match() should get you started.
/(\w+\.\w+)$/ ought to match just the primary domain.

---------------------------------------------------------------------
michal migurski- contact info and pgp key:
sf/ca http://mike.teczno.com/contact.html

attached mail follows:


* and then Shaun declared....
> Hi,
>
> How can I get the URL of the page I am on without the 'www.' i.e. just
> mydomain.com? I need to enurse this is correct in case the user types in the
> domain without using the 'www.'.

parse_url() ;-)

--
Nick W

attached mail follows:


On Tue, 2004-08-31 at 09:38, Shaun wrote:
> Hi,
>
> How can I get the URL of the page I am on without the 'www.' i.e. just
> mydomain.com? I need to enurse this is correct in case the user types in the
> domain without using the 'www.'.
>
> I have looked at using substr but if the user leaves out the 'www.' then
> substr($_SERVER['HTTP_HOST'], 4) would return 'main.com', is there a better
> function to use in this instance?

str_replace()

You can replace the www. with an empty string.

--
Greg Donald

attached mail follows:


"Shaun" <shaunthornburghhotmail.com> wrote in message
news:20040831143844.62569.qmailpb1.pair.com...
> Hi,
>
> How can I get the URL of the page I am on without the 'www.' i.e. just
> mydomain.com? I need to enurse this is correct in case the user types in
the
> domain without using the 'www.'.
>
> I have looked at using substr but if the user leaves out the 'www.' then
> substr($_SERVER['HTTP_HOST'], 4) would return 'main.com', is there a
better
> function to use in this instance?
>
> Thanks for your help

Does your Apache provide $_SERVER['SERVER_NAME']? For me it outputs the
domain like "google.com".

Regards, Torsten Roehr

attached mail follows:


Torsten Roehr wrote:
>
>
> Does your Apache provide $_SERVER['SERVER_NAME']? For me it outputs the
> domain like "google.com".
>
> Regards, Torsten Roehr
>

Server name from Apache is not guaranteed to be sans 'www'. Server name
will return whatever the web server is configured as in the httpd.conf

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
johnkegworks.com

attached mail follows:


It worked! Thank you so much!

I couldn't find documentation for this anywhere. I think I will add a
note on the DOM Function page in the php docs.

-dave

On Tue, 2004-08-31 at 01:23, Christian Stocker wrote:
> On Tue, 31 Aug 2004 00:27:25 -0400, David Numan <daveguidedvision.com> wrote:
> > Hi
> >
> > I'm working on a project using PHP5 and I'm using the DOM extension
> > quite heavily. I need to be able to store various character entities
> > such as $nbsp; and &eacute; Note: this is for a custom XML document, not
> > standard (X)HTML.
> >
> > When I load my XML string into my domDocument I've been trying
> > variations of $doctype1 and $doctype2 below. Here is my code:
> >
> > $doctype1 = <<<EODT
> > <!DOCTYPE page [
> > <!ENTITY % ISOlat1 PUBLIC "-//W3C//ENTITIES Latin1 for XHTML//EN"
> > "http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent">
> > %ISOlat1;
> > <!ENTITY % ISOsymbol PUBLIC "-//W3C//ENTITIES Symbols for XHTML//EN"
> > "http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent">
> > %ISOsymbol;
> > <!ENTITY % ISOspecial PUBLIC "-//W3C//ENTITIES Special for XHTML//EN"
> > "http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent">
> > %ISOspecial;
> > ]>
> > EODT;
> >
> > $doctype2 = '<!DOCTYPE page PUBLIC "-"
> > "http://gv.ca/dtd/character-entities.dtd">';
> >
> > $xml = '<?xml version="1.0" encoding="UTF-8"?>'.$doctype1.
> > '<page>&nbsp;</page>';
> > $dom = new domDocument();
> > $dom->loadXML($xml);
> > echo $dom->saveXML();
> >
> > The above code works as-is and the &nbsp; is present in the huge output.
> > However, when I change it to use $doctype2 the &nbsp; is no longer there
> > and returns the warning "Entity 'nbsp' not defined in Entity, line 1".
> > Of course the $doctype2 string is the one I need.
> >
> > What am I doing wrong? Why isn't it loading the external entities? Is
> > there some other way of doing this that I somehow missed? I tested the
> > exact same xml code using "xmllint -format -loaddtd file.xml" and it
> > worked fine.
>
> try if it works with
>
> $dom->resolveExternals = true:
>
> before $dom->load()
>
> not tested, but I assume it has something to do with not loading
> external entities
>
> chregu
> >
> > Tested on Gentoo with PHP 5.0.0 and 5.0.1 with libxml 2.6.11.
> >
> > Any ideas would be appreciated.
> > Thanks,
> > --
> > David Numan <daveguidedvision.com>
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
--
David H. Numan, Software Architect
Guided Vision: Internet Application Construction
(905) 528-3095 http://guidedvision.com

attached mail follows:


Hello all,

Is there any RMP package for PHP 5.0.1 available?
(Our server runs under RedHat Linux Fedora Core 1 (RedHat Linux 10))

Best regards, Denis Gerasimov
Outsourcing Services Manager,
VEKOS, Ltd.
www.vekos.ru

attached mail follows:


I'm trying to use the eFiction fanction/story archiving script for my website
(view the script here: http://www.thesonicworld.net/efiction/), but the
registration process is giving me trouble. It's one of those where you fill in your
email and username and they send you a default password. Well, I'm not
getting that e-mail.

I was told I need to make sure my mail functions are active. Furthermore I
have been told lots of things about SMTP servers and webservers and localhost
and I'm really not following.

What is my SMTP server? How do I enable it/make sure its working? If it isn't
working, how do I get it to work?

-Andrew

attached mail follows:


Does anyone know of Blog sw available in the marketplace written in PHP and
maybe MySQL?

attached mail follows:


> -----Original Message-----
> Does anyone know of Blog sw available in the marketplace written in PHP
> and
> maybe MySQL?

Go to Google and search for "blog php". I just did and there were several
options available.

-Ed

attached mail follows:


Current trend in my opinion:
http://wordpress.org/

--
Tadas Talaikis
infoxongoo.com
http://www.xongoo.com

----- Original Message -----
From: <Bestman4unowwaaol.com>
To: <php-generallists.php.net>
Sent: Tuesday, August 31, 2004 8:28 PM
Subject: [PHP] Weblog -Blog software wrtten in PHP
and My SQL

> Does anyone know of Blog sw available in the
marketplace written in PHP and
> maybe MySQL?
>

attached mail follows:


WordPress
Wordpress.org - PHP/MySQL Lots of skins and support.

Justin

-----Original Message-----
From: Bestman4unowwaaol.com [mailto:Bestman4unowwaaol.com]
Sent: Tuesday, August 31, 2004 10:28 AM
To: php-generallists.php.net
Subject: [PHP] Weblog -Blog software wrtten in PHP and My SQL

Does anyone know of Blog sw available in the marketplace written in PHP
and
maybe MySQL?

attached mail follows:


wordpress

Bestman4unowwaaol.com wrote:

> Does anyone know of Blog sw available in the marketplace written in PHP and
> maybe MySQL?
>

attached mail follows:


PHP Nuke includes BLOG's and a lot more (referred to as Journals in the
App).

http://www.phpnuke.org

Warren Vail

-----Original Message-----
From: Bestman4unowwaaol.com [mailto:Bestman4unowwaaol.com]
Sent: Tuesday, August 31, 2004 10:28 AM
To: php-generallists.php.net
Subject: [PHP] Weblog -Blog software wrtten in PHP and My SQL

Does anyone know of Blog sw available in the marketplace written in PHP and
maybe MySQL?

attached mail follows:


http://cafelog.com/ (PHP + mysql)

a very light weight (simple and primitive) blog:
http://www.xml-dev.com/blog/

Thanks.
Saqib Ali
https://validate.sf.net

Bestman4unowwaaol.com wrote on 08/31/2004 10:28:09 AM:

> Does anyone know of Blog sw available in the marketplace written in PHP
and
> maybe MySQL?

attached mail follows:


--- Bestman4unowwaaol.com wrote:
> Does anyone know of Blog sw available in the marketplace written in
> PHP and maybe MySQL?

http://www.s9y.org/

Chris

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

PHP Security - O'Reilly
     Coming Fall 2004
HTTP Developer's Handbook - Sams
     http://httphandbook.org/
PHP Community Site
     http://phpcommunity.org/

attached mail follows:


I've used nuike for a year or so, it was hacked 3
times, blog script there is ugly. Wordpress rocks!

----- Original Message -----
From: "Vail, Warren" <Warren.Vailschwab.com>
To: <Bestman4unowwaaol.com>;
<php-generallists.php.net>
Sent: Tuesday, August 31, 2004 9:04 PM
Subject: RE: [PHP] Weblog -Blog software wrtten in
PHP and My SQL

> PHP Nuke includes BLOG's and a lot more
(referred to as Journals in the
> App).
>
> http://www.phpnuke.org
>
>
> Warren Vail
>
>
> -----Original Message-----
> From: Bestman4unowwaaol.com
[mailto:Bestman4unowwaaol.com]
> Sent: Tuesday, August 31, 2004 10:28 AM
> To: php-generallists.php.net
> Subject: [PHP] Weblog -Blog software wrtten in
PHP and My SQL
>
>
> Does anyone know of Blog sw available in the
marketplace written in PHP and
> maybe MySQL?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit:
http://www.php.net/unsub.php
>
>
>
>

attached mail follows:


Hmmm, I had one also that was hacked half dozen times (and a half dozen
sites that were never touched) till I installed security patches from
release 7.4, works great now. What do you like about Wordpress? Are the
themes changeable?

Warren Vail

-----Original Message-----
From: Xongoo!com: Central unit [mailto:infoxongoo.com]
Sent: Tuesday, August 31, 2004 11:31 AM
To: php-generallists.php.net
Subject: Re: [PHP] Weblog -Blog software wrtten in PHP and My SQL

I've used nuike for a year or so, it was hacked 3
times, blog script there is ugly. Wordpress rocks!

----- Original Message -----
From: "Vail, Warren" <Warren.Vailschwab.com>
To: <Bestman4unowwaaol.com>;
<php-generallists.php.net>
Sent: Tuesday, August 31, 2004 9:04 PM
Subject: RE: [PHP] Weblog -Blog software wrtten in
PHP and My SQL

> PHP Nuke includes BLOG's and a lot more
(referred to as Journals in the
> App).
>
> http://www.phpnuke.org
>
>
> Warren Vail
>
>
> -----Original Message-----
> From: Bestman4unowwaaol.com
[mailto:Bestman4unowwaaol.com]
> Sent: Tuesday, August 31, 2004 10:28 AM
> To: php-generallists.php.net
> Subject: [PHP] Weblog -Blog software wrtten in
PHP and My SQL
>
>
> Does anyone know of Blog sw available in the
marketplace written in PHP and
> maybe MySQL?
>
> --
> 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

attached mail follows:


Hi there

We have a text file that is 2.2gb in size that we are trying to parse
using PHP to put the content into a mysql database. This file contains
40 million individual lines of data. Basically PHP isn't parsing it.
Any suggestions of how we could do this?

Thanks

Ade

attached mail follows:


Adrian Teasdale wrote:
> Hi there
>
> We have a text file that is 2.2gb in size that we are trying to parse
> using PHP to put the content into a mysql database. This file
> contains 40 million individual lines of data. Basically PHP isn't
> parsing it. Any suggestions of how we could do this?
>
> Thanks
>
> Ade

Use split to break the file down into parts of manageable size, and then
process those.

split -b nM <filename> (where n is the number of Megs you wish each part
to be).

man split

HTH.

Pablo

attached mail follows:


[snip]
We have a text file that is 2.2gb in size that we are trying to parse
using PHP to put the content into a mysql database. This file contains
40 million individual lines of data. Basically PHP isn't parsing it.
Any suggestions of how we could do this?
[/snip]

Post some code and we'll see if we can help.

attached mail follows:


> We have a text file that is 2.2gb in size that we are trying to parse
> using PHP to put the content into a mysql database. This file contains
> 40 million individual lines of data. Basically PHP isn't parsing it.
> Any suggestions of how we could do this?

Without knowing more information (eg: Any errors, does the script run
completely, partially, or not at all?) I would say that you could
running into the script execution timeout. Check your php.ini file
for max_execution_time and adjust accordingly.

If you are surpassing max_execution_time then you will notice that the
script runs correctly, but it will not finish parsing all of the data.
 If you check the DB, do some of the records show up there?

-William

attached mail follows:


Hi everyone.

Thanks for advice so far. Going to try that split command (looks
useful). IN the meantime, here is the code:

<?php

include "config.php";

// open database
if (!mysql_connect($config['db']['host'], $config['db']['user'],
$config['db']['password'])) {
    die ('Can\' connect to DB!');
}

if (!mysql_select_db($config['db']['dbname'])) {
    die ('Can\' work with DB! Try do FLUSH PRIVILEGES.');
}

// clear table
mysql_query('TRUNCATE TABLE '.$config['table_name']);

$pattern = '/^([a-z0-9]+[a-z0-9-]*[a-z0-9]) NS [a-z0-9.-]+$/i';

$handle = fopen($config['parsefile'], 'r');

$count = 0;
while (!feof($handle)) {
  
        $sql = '';
    $buffer = fgets($handle);

        $count++;
    if ($count>$config['max_count']) break;

     // parse string
     if (preg_match($pattern, $buffer, $match)) {
        $sql .= '("'.$match[1].'")';
     }

     if ($sql) {
        $sql = 'INSERT IGNORE '.$config['table_name'].' (domain) VALUES
'.$sql;
        echo $sql."<br>";
        mysql_query($sql);
        }

}
fclose($handle);

?>

Any ideas? Works 100% ok on a smaller file

Thanks

Ade

> -----Original Message-----
> From: Jay Blanchard [mailto:jay.blanchardniicommunications.com]
> Sent: 31 August 2004 20:29
> To: adrianeuropeantenders.com; php-generallists.php.net
> Subject: RE: [PHP] Parsing large file
>
>
> [snip]
> We have a text file that is 2.2gb in size that we are trying
> to parse using PHP to put the content into a mysql database.
> This file contains 40 million individual lines of data.
> Basically PHP isn't parsing it. Any suggestions of how we
> could do this? [/snip]
>
> Post some code and we'll see if we can help.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


> We have a text file that is 2.2gb in size that we are trying to parse
> using PHP to put the content into a mysql database. This file contains
> 40 million individual lines of data. Basically PHP isn't parsing it.
> Any suggestions of how we could do this?

Process the file line-by-line instead of all-at-once, using fgets().
Check your max execution time, as William suggests.
Post a little example code or an error message.

----------------------------------------------------------------
michal migurski- contact info and pgp key:
sf/ca http://mike.teczno.com/contact.html

attached mail follows:


I scoured the web. begged borrowed and stole and eventually ended up with a
list of over 1,600 cities and towns in the UK.

--
-----------------------------
 Michael Mason
 Arras People
 www.arraspeople.co.uk
-----------------------------
"Harlequin" <michael.masonarraspeople.co.uk> wrote in message
news:20040829083353.85518.qmailpb1.pair.com...
> Morning...
>
> Does anyone know of a site that or resource available where I could pull a
> list of ALL UK cities and towns for an option list...?
>
> I started out with 100+, then expanded this list to over 200 but still get
> complaints that certain towns are not listed.
>
> --
> -----------------------------
> Michael Mason
> Arras People
> www.arraspeople.co.uk
> -----------------------------

attached mail follows:


Hi all.

Having a problem echoing a broken date. Here's where I'm at:

$DateAdvertisedBroken = explode("-", $DateAdvertised);

later, in a table, I use:

$result[DateAdvertised]

How can I change this so I can call the broken date...?

I've tried datebroken [2] etc but no joy.

--
-----------------------------
 Michael Mason
 Arras People
 www.arraspeople.co.uk
-----------------------------

attached mail follows:


Harlequin wrote:

> Hi all.
>
> Having a problem echoing a broken date. Here's where I'm at:
>
> $DateAdvertisedBroken = explode("-", $DateAdvertised);

So this contains an array of (year, month, day) or something similar? You
should be able to grab the values here if that's the case.

>
> later, in a table, I use:
>
> $result[DateAdvertised]
>
> How can I change this so I can call the broken date...?

implode(' ', $DateAdvertisedBroken)
or use &nbsp; if needed.
Or did you mean $DateAdvetisedBroken[2] ?

attached mail follows:


On Wednesday 01 September 2004 02:45, Harlequin wrote:

> Having a problem echoing a broken date. Here's where I'm at:
>
> $DateAdvertisedBroken = explode("-", $DateAdvertised);
>
> later, in a table, I use:
>
> $result[DateAdvertised]
>
> How can I change this so I can call the broken date...?
>
> I've tried datebroken [2] etc but no joy.

I've no idea what you're trying to ask here. If you're asking how to access
the individual elements in the array $DateAdvertisedBroken, then

1) Know what you're doing by print_r($DateAdvertisedBroken)
2) Then $DateAdvertisedBroken[n], when 'n' is the element you want.

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
/*
 * Should be panic but... (Why are BSD people panic obsessed ??)
 */
        2.0.38 /usr/src/linux/net/ipv4/ip_fw.c
*/

attached mail follows:


Thanks to everyone that responded. This will keep me busy. I'll look into
these -- wordpress, php nuke journals, cafelog, etc.

Do any of you have any experience with these or others? Care to share your
opinions?

attached mail follows:


It's only a minor nuisance, but in order to use __CLASS__ with instanceof I have
to assign __CLASS__ to a variable first. Should I bother submitting a bug
report for this? Or am I perhaps missing something...

<?php

class Test {
   function checkObj2()
   {
     //workaround
     $class = __CLASS__;
     if ($this instanceof $class) {
       return TRUE;
     } else {
       return FALSE;
     }
   }

   function checkObj()
   {
     // this causes a parsing error
     // return ($this instanceof __CLASS__);
   }
}

$t = new Test();
echo $t->checkObj2() ? 'TRUE' : 'FALSE';
echo $t->checkObj(); // can't even test it

?>

attached mail follows:


Hi,

I'm not sure I understand why you would use instanceof on $this. Try
this code:

<?php

class a1 {
}

class a2 extends a1 {
}

echo new a1 instanceof a1; // true
echo new a2 instanceof a1; // true
?>

instanceof defines whether an object is or descends from a class (like
is_a()).

If you want to check whether $this is the Test class or a descendant
class, the simplest way I know is

if (get_class($this) == 'Test')

otherwise, you could use reflection

$z = new ReflectionClass($this);
if ($z->getName() == 'Test')

but that's a bit more cumbersome.

Greg

Jason Barnett wrote:

> It's only a minor nuisance, but in order to use __CLASS__ with
> instanceof I have to assign __CLASS__ to a variable first. Should I
> bother submitting a bug report for this? Or am I perhaps missing
> something...
>
>
> <?php
>
> class Test {
> function checkObj2()
> {
> //workaround
> $class = __CLASS__;
> if ($this instanceof $class) {
> return TRUE;
> } else {
> return FALSE;
> }
> }
>
> function checkObj()
> {
> // this causes a parsing error
> // return ($this instanceof __CLASS__);
> }
> }
>
> $t = new Test();
> echo $t->checkObj2() ? 'TRUE' : 'FALSE';
> echo $t->checkObj(); // can't even test it
>
> ?>

attached mail follows:


I've been able to use md5 / md5_file to verify file integrity. However when I
try to check crc32's I'm running into some problems. As an example I download
and extract the PHP package for Windows, then when I try to crc32() the file
contents I get a totally different value from what I think I should be getting.
  Obviously I'm missing out on some crucial detail(s) here...

<?php

echo '<pre>';

// This is the extracted install.txt from PHP-5.0.1.Win32.zip
$file = 'C:\Downloads\install.txt';
// crc for the file - got from my unzip utility
echo $crc = 'EEED9D44' . "\n";

// reading all at once - buffer added line by line produced same results
$contents = file_get_contents($file);
printf ("%u\n", crc32($contents));
// result: 4008549700
// by the way, how can we cast to unsigned integer instead of using printf?

?>

attached mail follows:


I hate when this happens.... all I needed was dechex(). *sigh*
I could have sworn I'd tried that already, ah well.

Jason Barnett wrote:

> I've been able to use md5 / md5_file to verify file integrity. However
> when I try to check crc32's I'm running into some problems. As an
> example I download and extract the PHP package for Windows, then when I
> try to crc32() the file contents I get a totally different value from
> what I think I should be getting. Obviously I'm missing out on some
> crucial detail(s) here...
>
>
> <?php
>
> echo '<pre>';
>
> // This is the extracted install.txt from PHP-5.0.1.Win32.zip
> $file = 'C:\Downloads\install.txt';
> // crc for the file - got from my unzip utility
> echo $crc = 'EEED9D44' . "\n";
>
> // reading all at once - buffer added line by line produced same results
> $contents = file_get_contents($file);
> printf ("%u\n", crc32($contents));
> // result: 4008549700
> // by the way, how can we cast to unsigned integer instead of using printf?
>
> ?>

attached mail follows:


Sorry if this is the wrong place for this post. I am having problems
where PHP templates that I modify via ftp are not showing changes for
like 1 minute or so. I assume this is some kind of server caching but I
am not sure how to adjust this (it is my development server). Running
Apache server.

Thanks

attached mail follows:


Win2k Pro/ IIS

I'm baffled by this one after updating to PHP 5.0

I called a php script through a batch file scheduled in 'at'. Worked
beautifully in 4.x.

In 5.0, the batch file goes off, but the php script doesn't execute.
HOWEVER, if I run the batch file manually from the command line or if I run
the php file from the command line, both work! It's driving me crazy.

Thanks for ANY help!

- Trent (trentthegeniusswitch.com)

attached mail follows:


Greg Beaver wrote:

> Hi,
>
> I'm not sure I understand why you would use instanceof on $this. Try
> this code:

Kind of complicated (so probably not the best way) but I have objects I'm
creating with a factory method - and all of these objects *should* be extending
a parent class. It's in the parent class where I'm using $this instanceof
__CLASS__ and alternatives are welcome. I thought is_a was being deprecated
(correct me if I'm wrong) ?

>
> instanceof defines whether an object is or descends from a class (like
> is_a()).
>
> If you want to check whether $this is the Test class or a descendant
> class, the simplest way I know is
>
> if (get_class($this) == 'Test')

Yes, it probably makes more sense to do it this way. Reflections would be
overkill, all I need is to test for inheritance.

attached mail follows:


Hi,
I'm using Apache2 and PHP5 and mysql on WinXP and I have problem with
loading modules. When starting apache, error occures:

PHP startup: unable to load dynamic library 'c:\Program
files..\php_curl.dll' - Module was not find
PHP startup: unable to load dynamic library 'c:\Program
files..\php_myslq.dll' - Module was not find

I'm loading 4 modules, all at the same location, how is it possible, that
PHP loads 2 of them and 2 of them not???
INI file:

extension_dir = "c:\Program Files\ApachePhpMysql\php\ext\"

extension=php_curl.dll
extension=php_imap.dll
extension=php_mbstring.dll
extension=php_mysql.dll

Thnx for any help...

Brona

attached mail follows:


I'm trying to use the eFiction fanction/story archiving script for my website

(view the script here: http://www.thesonicworld.net/efiction/), but the
registration process is giving me trouble. It's one of those where you fill
in your
email and username and they send you a default password. Well, I'm not
getting that e-mail.

I was told I need to make sure my mail functions are active. Furthermore I
have been told lots of things about SMTP servers and webservers and localhost

and I'm really not following.

What is my SMTP server? How do I enable it/make sure its working? If it isn't

working, how do I get it to work?

-Andrew

attached mail follows:


Dear,Please use following command for test of your
SMTP server:
telnet localhost 25
You must recv following message if your SMTP server is
up:
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 localhost.localdomain ESMTP Sendmail
8.12.10/8.12.10; Tue, 31 Aug 2004 14:44:01 +0430
/////////////////////Mohsen
--- AceZero2790aol.com wrote:

> I'm trying to use the eFiction fanction/story
> archiving script for my website
>
> (view the script here:
> http://www.thesonicworld.net/efiction/), but the
> registration process is giving me trouble. It's one
> of those where you fill
> in your
> email and username and they send you a default
> password. Well, I'm not
> getting that e-mail.
>
> I was told I need to make sure my mail functions are
> active. Furthermore I
> have been told lots of things about SMTP servers and
> webservers and localhost
>
> and I'm really not following.
>
> What is my SMTP server? How do I enable it/make sure
> its working? If it isn't
>
> working, how do I get it to work?
>
> -Andrew
>
>

=====
---------DIGITAL SIGNATURE-------------------
///Mohsen Pahlevanzadeh////////
     Network administrator & programmer
      My home phone is: +98213810146
My email address is
          m_pahlevanzadeh at yahoo dot com
My website is: http://webnegar.net
----------------------------------------------------------------

                
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail

attached mail follows:


On Wednesday 01 September 2004 06:28, AceZero2790aol.com wrote:

> What is my SMTP server? How do I enable it/make sure its working? If it
> isn't working, how do I get it to work?

Between your original post and this one (asking exactly the same thing), did
you manage to fit in some research of your own. Like RTFM, or STFA?

FWIW there was a post very recently which explained pretty much all you needed
to know about configuring PHP so that mail() would function correctly. Find
that post.

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
I have discovered the art of deceiving diplomats. I tell them the truth
and they never believe me.
                -- Camillo Di Cavour
*/