php-general Digest 20 Dec 2007 10:25:54 -0000 Issue 5191

Topics (messages 266123 through 266144):

Re: Change case of HTML tags
        266123 by: Daniel Brown
        266124 by: Jim Lucas
        266125 by: Daniel Brown

Re: About PHP Implements
        266126 by: Chris

building PHP5.2.5 on Mac OS X Leopard (anyone know how to build a just an 
extension)
        266127 by: Jochem Maas

Re: Command-line PHP script CPU usage goes sky-high, stays there--why?
        266128 by: René Fournier
        266140 by: Per Jessen

Re: Using require instead of redirect architecture
        266129 by: Robert Cummings

Assign variable to a block of html code
        266130 by: php mail
        266131 by: Stephen Johnson
        266137 by: Xavier de Lapeyre
        266141 by: Darren Whitlen
        266142 by: Darren Whitlen
        266143 by: Peter Ford

Re: a bit OT - Does XMLHTTP work with Digest Authentication?
        266132 by: Casey

Profiling PHP App
        266133 by: php mail
        266135 by: Paul Scott
        266136 by: Chris

Re: [PHP-DB] Credit Card Encryption
        266134 by: Robert Erbaron

Chisimba Release
        266138 by: Paul Scott

about __get,__set Overloading, read-only properties
        266139 by: ked

Re: Just to confirm...
        266144 by: Richard Heyes

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
On Dec 19, 2007 4:10 PM, Christoph Boget <[EMAIL PROTECTED]> wrote:
> I've been looking through the docs but haven't found an internal function
> that does what I'm looking for.  Perhaps I missed it?  Or perhaps someone
> can point me in the right direction?  I'm looking for a routine that will
> convert tags to lower case.  For example, if I have
>
> <HTML>
>   <HEAD>
>     <TITLE>This is the Page Title</TITLE>
>   </HEAD>
>   <Body>
>     Here is the Page Text
>   </Body>
> </HTML>
>
> I want to convert only the tags to lower case.  So <HTML> becomes <html> and
> so on; I don't want anything else touched.  This may seem kind of silly but
> I'm working with an XMLDocument object in javascript and when I serialize it
> to string format, for some reason all the tags are made into uppercase.  I'm
> taking the serialized string, posting it back to the server and using it on
> the back end.  I figure that since I can make it so that the serialized
> string is lower case on the front end, perhaps I can convert it on the back.
>
> Any ideas/pointers?
>
> thnx,
> Christoph
>


<?
$s = <<<EOD
<HTML>
 <HEAD>
   <TITLE>This is the Page Title</TITLE>
 </HEAD>
 <Body>
   Here is the Page Text
 </Body>
</HTML>
EOD;

$s = preg_replace('/<(.*)>/Ue',"strtolower('<$1>')",$s);

echo $s."\n";
?>


-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

--- End Message ---
--- Begin Message ---
Daniel Brown wrote:
> On Dec 19, 2007 4:10 PM, Christoph Boget <[EMAIL PROTECTED]> wrote:
>> I've been looking through the docs but haven't found an internal function
>> that does what I'm looking for.  Perhaps I missed it?  Or perhaps someone
>> can point me in the right direction?  I'm looking for a routine that will
>> convert tags to lower case.  For example, if I have
>>
>> <HTML>
>>   <HEAD>
>>     <TITLE>This is the Page Title</TITLE>
>>   </HEAD>
>>   <Body>
>>     Here is the Page Text
>>   </Body>
>> </HTML>
>>
>> I want to convert only the tags to lower case.  So <HTML> becomes <html> and
>> so on; I don't want anything else touched.  This may seem kind of silly but
>> I'm working with an XMLDocument object in javascript and when I serialize it
>> to string format, for some reason all the tags are made into uppercase.  I'm
>> taking the serialized string, posting it back to the server and using it on
>> the back end.  I figure that since I can make it so that the serialized
>> string is lower case on the front end, perhaps I can convert it on the back.
>>
>> Any ideas/pointers?
>>
>> thnx,
>> Christoph
>>
> 
> 
> <?
> $s = <<<EOD
> <HTML>
>  <HEAD>
>    <TITLE>This is the Page Title</TITLE>
>  </HEAD>
>  <Body>
>    Here is the Page Text
>  </Body>
> </HTML>
> EOD;
> 
> $s = preg_replace('/<(.*)>/Ue',"strtolower('<$1>')",$s);

Nice use of the 'e' modifier, but would it not be safer to use this?

        $s = preg_replace('/<(.*)>/U', strtolower("<$1>"), $s);

This way the arbitrary html is not executed?

> 
> echo $s."\n";
> ?>
> 
> 


-- 
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
       and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
    by William Shakespeare

--- End Message ---
--- Begin Message ---
On Dec 19, 2007 6:08 PM, Jim Lucas <[EMAIL PROTECTED]> wrote:
>
> Daniel Brown wrote:
> > On Dec 19, 2007 4:10 PM, Christoph Boget <[EMAIL PROTECTED]> wrote:
> >> I've been looking through the docs but haven't found an internal function
> >> that does what I'm looking for.  Perhaps I missed it?  Or perhaps someone
> >> can point me in the right direction?  I'm looking for a routine that will
> >> convert tags to lower case.  For example, if I have
> >>
> >> <HTML>
> >>   <HEAD>
> >>     <TITLE>This is the Page Title</TITLE>
> >>   </HEAD>
> >>   <Body>
> >>     Here is the Page Text
> >>   </Body>
> >> </HTML>
> >>
> >> I want to convert only the tags to lower case.  So <HTML> becomes <html> 
> >> and
> >> so on; I don't want anything else touched.  This may seem kind of silly but
> >> I'm working with an XMLDocument object in javascript and when I serialize 
> >> it
> >> to string format, for some reason all the tags are made into uppercase.  
> >> I'm
> >> taking the serialized string, posting it back to the server and using it on
> >> the back end.  I figure that since I can make it so that the serialized
> >> string is lower case on the front end, perhaps I can convert it on the 
> >> back.
> >>
> >> Any ideas/pointers?
> >>
> >> thnx,
> >> Christoph
> >>
> >
> >
> > <?
> > $s = <<<EOD
> > <HTML>
> >  <HEAD>
> >    <TITLE>This is the Page Title</TITLE>
> >  </HEAD>
> >  <Body>
> >    Here is the Page Text
> >  </Body>
> > </HTML>
> > EOD;
> >
> > $s = preg_replace('/<(.*)>/Ue',"strtolower('<$1>')",$s);
>
> Nice use of the 'e' modifier, but would it not be safer to use this?
>
>         $s = preg_replace('/<(.*)>/U', strtolower("<$1>"), $s);
>
> This way the arbitrary html is not executed?
>
> >
> > echo $s."\n";
> > ?>

    That won't work because preg_replace() doesn't know to evaluate
the output of strtolower().

    At least in my test case that's how it works.
        -- PHP 5.2.4 (cli)

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

--- End Message ---
--- Begin Message ---
Andrew Ballard wrote:
On Dec 18, 2007 4:58 PM, Jim Webber <[EMAIL PROTECTED]> wrote:
Hello I have a PHP4 server and I'm trying to figure out how to do
"implements" on classes. Is there an analogous way to do this without
PHP5 installed?


It isn't inheritance in the same sense as PHP5, but you can use the
method_exists() function to check whether a given object has the
method you want to use before you try to use it.

if (method_exists($obj, 'doSomething')) {
    $obj->doSomething();
} else {
    // $obj does not support the required interface
}

but that means you have to change all the calling functions, which becomes a real PITA.

I think you could do something with the constructor but how well it works I don't know :)

class x
{
  function x()
  {
    $required_methods = array('a','b','c');
    foreach ($required_methods as $req)
    {
       if (!method_exists($this, $req))
       {
die("You need to create $req method for class " . get_class($this));
       }
    }
  }
}

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
hi guys,

well having tried for countless hours to build php on leopard I pretty much 
gave up.
apparently it's pretty much impossible unless your name is Marc Liyanage 
(entropy.ch) ...

the problem lies with the fact that you need 64bit libs and the some (most 
notably iconv)
of the libs included with Leopard are borked in respect to the 'universal 
build' stuff (which
I gather means you actually have a number of different [architecture related] 
executables bundled
into a single file ... I probably have that all wrong, to be honest it's a 
little over my head.

Marc L. offers a tarball with a working php5.2.5 (just untar and move the php5 
dir to /usr/local):
         http://www2.entropy.ch/download/php5-5.2.5.leopard.release1.tar.gz

his build does work but it doesn't include one extension that I rely on for 
some of my projects,
namely interbase.

I figured I'd try using Marc' configure line (as given by 
/usr/local/php5/bin/php-config against the
source of php5.2.5 that I downloaded and add the relevant configure option 
(--with-interbase[=DIR])
... in the hope I at least get a couple of usable extensions so that I could 
copy the ibase extension
over into the working php5.2.5 installation ... no joy.

I figure I'm screwed - I have a painfully expensive dev machine I can't 
blooming use. oh well,
at least it is the nicest looking paper weight I've got.

I'm still wondering whether it's possible to build just the interbase extension 
... anyone know
how to do that? or have any tips?

rgds,
Jochem

--- End Message ---
--- Begin Message ---

On 11-Dec-07, at 2:13 PM, Per Jessen wrote:

René Fournier wrote:

However, the number of socket clients connecting in the past 3-4
months has steadily increased, and this seems to have exposed (if not
created) a strange performance "issue" with PHP 5.2.4, MySQL 5.0.45
and/or Mac OS X Server 10.4.11. (I say "and/or" because I am unsure
where the problem's cause really lies.) Basically, after the script
has been running for a day or so (processing essentially the amount
data that used to take two weeks), the CPU usage of the machine goes
from 30% (normal) to 80-90%.

Have you tried stracing it to see what's really happening when the load
goes that high?

Good advice, since I think there's nothing left for me to do but inspect the MySQL process.

Incidentally, I've made some changes to the script a week ago, which has seemed to improve the situation somewhat. Now, the script has run for nearly 7 days without interruption or high CPU load. Problem solved?.... Again this morning, I noticed CPU went up to 90% and is staying there. (Previously, this would happen after 1-2 days.)

The number of distinct MySQL connections remains low, since the script (which runs in a loop, with a sleep(1) and a timeout on the stream_socket_select()), only creates one MySQL connection in the beginning. All MySQL queries run through that.

The script has run for 6-7 days, during which time it's executed 2.7 million queries (mostly SELECTs) and created 105,198 external, short- lived child processes (each lasts about a second or two, then closes after mysql_close())--I don't think this is an issue.

Memory usage seems okay. By the end of 7 days, the script's memory usage has peaked at 4MB (out of 16MB max). Typically it's around 3MB. MySQL memory usage doesn't seem to be a constraint. I'm using my- huge.cnf, and the nature of the queries is fairly regular. I would say that the database structure is not an issue (though I could be wrong!)--everything is pretty well normalized and indexed. I'm logging slow queries, non-indexed SELECTs, etc.

I'm really not sure what to try next. ps -aux shows MySQL as hogging the CPU, not PHP or Terminal:

PID COMMAND %CPU TIME #TH #PRTS #MREGS RPRVT RSHRD RSIZE VSIZE
342 mysqld 83.3% 16:13:19 33 125 139 435M 4.75M 439M 539M
385 Terminal 4.7% 5:36:35 22 184 251 20.1M 33.5M 28.8M+ 256M
1190 php 4.3% 3:13:33 1 15 148 6.51M 8.15M 12.1M 89.0M
0 kernel_tas 1.3% 2:02:40 47 2 619 5.00M- 0B 219M- 1.26G-

It's really strange and strangely consistent. The script will run for a few million cycles, whereupon MySQL suddenly uses 50% more CPU. But for what?

I'm looking at tutorials on ktrace and kdump to see what I can learn from MySQL. I wonder if I would have this problem under Linux...

...Rene 

--- End Message ---
--- Begin Message ---
René Fournier wrote:

> I'm really not sure what to try next. ps -aux shows MySQL as hogging
> the CPU, not PHP or Terminal:

When this happens, do a 'SHOW PROCESSLIST' in mysql to see what it's
doing. 



/Per Jessen, Zürich

--- End Message ---
--- Begin Message ---
On Wed, 2007-12-19 at 14:23 -0700, Dan wrote:
> ""Robert Erbaron"" <[EMAIL PROTECTED]> wrote in message 
> news:[EMAIL PROTECTED]
> >> 1.  p1.php would post to itself.  Do data validation.  After data 
> >> validation
> >>         upon error, include p1.php again with included error messages
> >>         upon success, redirect to p3.php with congrats.
> >
> > Yeah, I could do this, but it uses a redirect, and like you said, it's 
> > gnarly.
> >
> >> 2.  p1.php would post to p2. perform data validation.
> >>         upon error, save data into session variable, redirect back to 
> >> p1.php,
> >>                 display error messages inline
> >>         upon success, redirect to p3.php, display congrats
> >
> > I've already got this working, per thread of a couple days ago. But it
> > uses a redirect.
> >
> >> I personally like the second option.  It is cleaner.  Each page/script 
> >> has a single purpose in life.
> >>  It just makes better sense to my small little mind.
> >
> > I agree as well. But I'm trying to get away from multiple trips to the
> > server for simple page calls, per some pundits on the list. :) So I'm
> > trying to learn a different architecture, and I'm not getting it yet.
> >
> > -- 
> > RE, Chicago
> 
> Well, I would tend to agree with Jim, the second suggestion he had is the 
> way I've seen this problem done the most.  It works, it's simple and this 
> way you have one less PHP file, just enter your data and congratulations. 
> The load to the server shouldn't be any different if you did it the way you 
> suggested.  Oh, well just my opinion.

Sorry, but option one is superior YMMV :B Page posts to itself,
everything is already there, all the values posted, the form
description, associated validation etc. Then if successful you redirect
to the next logical page. Mind you, I assign predefined validation
routines, or custom handlers to the form before it is rendered so it all
makes sense to be in one place. Custom validators are pulled in as
needed from their own separate controller. I used the other technique
many years ago and I found it to be a hassle.

Cheers,
Rob.
-- 
...........................................................
SwarmBuy.com - http://www.swarmbuy.com

    Leveraging the buying power of the masses!
...........................................................

--- End Message ---
--- Begin Message ---
Hi All,

Is it possible to assign variable to a block of html code ?

Something like this :

$myblokvar = "
<table width="487" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><table width="487" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><img src="images/bartitle_login.gif" alt="Login" width="475"
height="30" /></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td class="produk"><table width="100%" border="0" cellpadding="3"
cellspacing="2">
          <tr>
            <td class="katalog">
            <?=$log_info?>
            </td>
          </tr>
          </table></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td class="produk">&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
    </table></td>
  </tr>
</table>
";

Although example above is not working, what I want to achieve is something
like that. Is it possible how can I do that ?

Regards,

Feris

--- End Message ---
--- Begin Message ---
What you have will work, you just need to escape out the double quotes in
the html.  




On 12/19/07 7:38 PM, "php mail" <[EMAIL PROTECTED]> wrote:

> Hi All,
> 
> Is it possible to assign variable to a block of html code ?
> 
> Something like this :
> 
> $myblokvar = "
> <table width="487" border="0" cellspacing="0" cellpadding="0">
>   <tr>
>     <td><table width="487" border="0" cellspacing="0" cellpadding="0">
>       <tr>
>         <td><img src="images/bartitle_login.gif" alt="Login" width="475"
> height="30" /></td>
>         <td>&nbsp;</td>
>       </tr>
>       <tr>
>         <td class="produk"><table width="100%" border="0" cellpadding="3"
> cellspacing="2">
>           <tr>
>             <td class="katalog">
>             <?=$log_info?>
>             </td>
>           </tr>
>           </table></td>
>         <td>&nbsp;</td>
>       </tr>
>       <tr>
>         <td class="produk">&nbsp;</td>
>         <td>&nbsp;</td>
>       </tr>
>     </table></td>
>   </tr>
> </table>
> ";
> 
> Although example above is not working, what I want to achieve is something
> like that. Is it possible how can I do that ?
> 
> Regards,
> 
> Feris

-- 
Stephen Johnson
The Lone Coder

http://www.ouradoptionblog.com
*Join us on our adoption journey*

[EMAIL PROTECTED]
http://www.thelonecoder.com

*Continuing the struggle against bad code*
--

--- End Message ---
--- Begin Message ---
You should try the HEREDOC structure. 
See link: http://php.net/heredoc

It should look to something like:

$myblokvar = <<<EOF
<table blabla>
        <tr>
                <td>
                        Welcome $name to this website! 
                </td>
        </tr>
</table>
<<<EOF;

No need of quotes or php start/end tags when placing a variable.

To use it afterwards simply call the $mylokvar variable.

Hope it helped!

Xavier
Web Developer
Site: www.eds.mu




-----Original Message-----
From: Stephen Johnson [mailto:[EMAIL PROTECTED] 
Sent: jeudi 20 décembre 2007 07:43
To: php mail; PHP General List
Subject: Re: [PHP] Assign variable to a block of html code

What you have will work, you just need to escape out the double quotes in
the html.  




On 12/19/07 7:38 PM, "php mail" <[EMAIL PROTECTED]> wrote:

> Hi All,
> 
> Is it possible to assign variable to a block of html code ?
> 
> Something like this :
> 
> $myblokvar = "
> <table width="487" border="0" cellspacing="0" cellpadding="0">
>   <tr>
>     <td><table width="487" border="0" cellspacing="0" cellpadding="0">
>       <tr>
>         <td><img src="images/bartitle_login.gif" alt="Login" width="475"
> height="30" /></td>
>         <td>&nbsp;</td>
>       </tr>
>       <tr>
>         <td class="produk"><table width="100%" border="0" cellpadding="3"
> cellspacing="2">
>           <tr>
>             <td class="katalog">
>             <?=$log_info?>
>             </td>
>           </tr>
>           </table></td>
>         <td>&nbsp;</td>
>       </tr>
>       <tr>
>         <td class="produk">&nbsp;</td>
>         <td>&nbsp;</td>
>       </tr>
>     </table></td>
>   </tr>
> </table>
> ";
> 
> Although example above is not working, what I want to achieve is something
> like that. Is it possible how can I do that ?
> 
> Regards,
> 
> Feris

-- 
Stephen Johnson
The Lone Coder

http://www.ouradoptionblog.com
*Join us on our adoption journey*

[EMAIL PROTECTED]
http://www.thelonecoder.com

*Continuing the struggle against bad code*
--

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

--- End Message ---
--- Begin Message ---
php mail wrote:
Hi All,

Is it possible to assign variable to a block of html code ?

Something like this :

$myblokvar = "
<table width="487" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><table width="487" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><img src="images/bartitle_login.gif" alt="Login" width="475"
height="30" /></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td class="produk"><table width="100%" border="0" cellpadding="3"
cellspacing="2">
          <tr>
            <td class="katalog">
            <?=$log_info?>
            </td>
          </tr>
          </table></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td class="produk">&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
    </table></td>
  </tr>
</table>
";

Although example above is not working, what I want to achieve is something
like that. Is it possible how can I do that ?

Regards,

Feris


You can use Heredoc quoting for this. (http://uk2.php.net/types.string)

---------
<?php
$log_info = "Your logged";
$myblokvar = <<<html
<table width="487" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><table width="487" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><img src="images/bartitle_login.gif" alt="Login" width="475"
height="30" /></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td class="produk"><table width="100%" border="0" cellpadding="3"
cellspacing="2">
          <tr>
            <td class="katalog">
            $log_info
            </td>
          </tr>
          </table></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td class="produk">&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
    </table></td>
  </tr>
</table>
html;

echo $myblokvar;
?>
---------

Darren

--- End Message ---
--- Begin Message ---
Xavier de Lapeyre wrote:
You should try the HEREDOC structure. See link: http://php.net/heredoc

It should look to something like:

$myblokvar = <<<EOF
<table blabla>
        <tr>
                <td>
Welcome $name to this website! </td>
        </tr>
</table>
<<<EOF;

Xavier,

You should test this before you send it.. it doesn't even parse!
The closing EOF should not start with the "<<<". It should only be the identifier ("EOF") followed by ; and a new line.

-----
$myblokvar = <<<EOF
<table blabla>
        .....
        ....
EOF;
-----

Darren


No need of quotes or php start/end tags when placing a variable.

To use it afterwards simply call the $mylokvar variable.

Hope it helped!

Xavier
Web Developer
Site: www.eds.mu




-----Original Message-----
From: Stephen Johnson [mailto:[EMAIL PROTECTED] Sent: jeudi 20 décembre 2007 07:43
To: php mail; PHP General List
Subject: Re: [PHP] Assign variable to a block of html code

What you have will work, you just need to escape out the double quotes in
the html.



On 12/19/07 7:38 PM, "php mail" <[EMAIL PROTECTED]> wrote:

Hi All,

Is it possible to assign variable to a block of html code ?

Something like this :

$myblokvar = "
<table width="487" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><table width="487" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><img src="images/bartitle_login.gif" alt="Login" width="475"
height="30" /></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td class="produk"><table width="100%" border="0" cellpadding="3"
cellspacing="2">
          <tr>
            <td class="katalog">
            <?=$log_info?>
            </td>
          </tr>
          </table></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td class="produk">&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
    </table></td>
  </tr>
</table>
";

Although example above is not working, what I want to achieve is something
like that. Is it possible how can I do that ?

Regards,

Feris


--- End Message ---
--- Begin Message ---
You could just swap all the double quotes in the HTML tags for single quotes -
that would work in this instance...

$myblokvar = "
<table width='487' border='0' cellspacing='0' cellpadding='0'>
...
</table>
";


Or perhaps a HereDoc syntax:

$myblokvar = <<<EndOfMyHTMLBlock
<table width="487" border="0" cellspacing="0" cellpadding="0">
...
</table>
EndOfMyHTMLBlock;

Then you don't need to worry about what quotes you use, and if you start putting
stuff like onclick events in you can mix quotes up happily ...


I go to great lengths to avoid escaping quotes - it just looks ugly.
That is, however, a personal foible.

Cheers
Pete


Stephen Johnson wrote:
> What you have will work, you just need to escape out the double quotes in
> the html.  
> 
> 
> 
> 
> On 12/19/07 7:38 PM, "php mail" <[EMAIL PROTECTED]> wrote:
> 
>> Hi All,
>>
>> Is it possible to assign variable to a block of html code ?
>>
>> Something like this :
>>
>> $myblokvar = "
>> <table width="487" border="0" cellspacing="0" cellpadding="0">
>>   <tr>
>>     <td><table width="487" border="0" cellspacing="0" cellpadding="0">
>>       <tr>
>>         <td><img src="images/bartitle_login.gif" alt="Login" width="475"
>> height="30" /></td>
>>         <td>&nbsp;</td>
>>       </tr>
>>       <tr>
>>         <td class="produk"><table width="100%" border="0" cellpadding="3"
>> cellspacing="2">
>>           <tr>
>>             <td class="katalog">
>>             <?=$log_info?>
>>             </td>
>>           </tr>
>>           </table></td>
>>         <td>&nbsp;</td>
>>       </tr>
>>       <tr>
>>         <td class="produk">&nbsp;</td>
>>         <td>&nbsp;</td>
>>       </tr>
>>     </table></td>
>>   </tr>
>> </table>
>> ";
>>
>> Although example above is not working, what I want to achieve is something
>> like that. Is it possible how can I do that ?
>>
>> Regards,
>>
>> Feris
> 

--- End Message ---
--- Begin Message ---
On Dec 19, 2007 10:24 AM, Shu-Wai Chow <[EMAIL PROTECTED]> wrote:
> I've been searching all over MSDN for this info, but can't find
> anything.  I have a script under a directory protected by HTTP Digest
> authentication.  This is an Apache server on Linux.
>
> When I try to access the script through ajax using the XMLHttpRequest
> object, everything is fine in all browsers including IE 7, which uses
> XMLHttpRequest.  In IE 6 and below, using Microsoft.XMLHTTP, the
> connection fails.  HttpStatus returns an odd number (it's five digits)
> and the responseText and responseXML properties are empty.
>
> I'm embedding the username and password according to the open() method spec:
>
> xmlhttp.open('GET', 'script/path', true, 'username', 'password');
>
> I originally wrote the responses and checks in PHP using the example
> given in the HTTP Authentication section of the manual, but switched to
> .htaccess, thinking it was a problem.  It didn't help.  However, when I
> switched the AuthType to Basic, IE 6 worked fine.
>
> Does anyone have any experience using XMLHTTP with digest authentication
> that can shed some light on this?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

I've run into this problem before... Try searching Google with the
five-digit status code. It's one of Microsoft's non-standard codes...

-Casey

--- End Message ---
--- Begin Message ---
Hi All,

Is there any tool to profiling PHP app ?

Regards,

Feris

--- End Message ---
--- Begin Message ---
On Thu, 2007-12-20 at 11:21 +0700, php mail wrote:
> Is there any tool to profiling PHP app ?

Yes, there are a few. The best that I have found anyway, is Xdebug 2
(http://pecl.php.net/xdebug). It can also integrate nicely with PHPUnit
as well to do code coverage as well as make your life generally more
enjoyable.

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

--- End Message ---
--- Begin Message ---
php mail wrote:
Hi All,

Is there any tool to profiling PHP app ?

http://www.xdebug.org/docs/profiler

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
> When it comes to liability, who is liable, the merchant running the system, 
> the develper that created the system, or both?
>
> If the develper is included, would that be mitigated in that he created the 
> system to the merchant's specifications?
>
> Also, in terms of the developer, would this be covered under errors and 
> omissions insurance, or would they take the position that
> the developer should have known better and was negligent in creating a 
> non-compliant system leaving the developer on the hook for
> damages?

Unfortunately, I'd argue that "he who has the best lawyers wins".

-- 
RE, Chicago

--- End Message ---
--- Begin Message ---
The next release of the Chisimba PHP5 framework is now available.

Major enhancements included in this release are:

 - Better APC support
 - Improved database performance
 - Bug fixes
 - Better code documentation
 - XML-RPC API for Video conversions module
 - XML-RPC API for the Active Dynamic Mirroring module
 - Context improvements and bug fixes
 
and, of course, new modules to add onto your installation!

Please take a look, download it and give it a test drive! 
 
Chisimba, for those that don't know it already, is a PHP5 framework made
in Africa, for Africa. It is a collaboration between around 16 African
Universities, as well as around 35 active developers from around the
continent.
 
It can be downloaded from AVOIR at:
 

http://cvs2.uwc.ac.za/chisimba_releases/chisimba_framework_1-1-3.zip
http://cvs2.uwc.ac.za/chisimba_releases/chisimba_modules_1-1-3.zip

and the doc wiki can be found at:
 
http://avoir.uwc.ac.za/avoir/index.php?module=wiki

There are server setup instructions, as well as installation
walkthroughs available linking from the main AVOIR site:
 
http://avoir.uwc.ac.za/avoir/index.php?module=cms&action=page&id=gen12Srv48Nme23_207
 
For those interested in developing a module, or just getting some
additional info please take a look at:
 
http://avoir.uwc.ac.za/avoir/index.php?module=cms&action=page&id=gen12Srv48Nme23_208

-- 
------------------------------------------------------------.
| Chisimba PHP5 Framework - http://avoir.uwc.ac.za           |
:------------------------------------------------------------:

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

--- End Message ---
--- Begin Message ---
Hi. all , 

I got a article from php 5.0 manual's comments. It's useful, offer readonly
properties for classes. 

(look at the end of this message for  the article )

find out  function __construct(), I want to modify $this->id in it , then I
got a  "readonly" Exception (defined in "__set" function).  

Distinctly, a read-only property could not be change via "$obj->attribute =
'' " ,
 but is could be change via $this->id='',  inside of  class , isn't it ?

 How to modify __set function ?  

thanks for any advises.

regards!
ked


the article is here: 
----------------------------------------------------------------------------
------------------------
Eric Lafkoff (22-Feb-2006 02:56)

If you're wondering how to create read-only properties for your class, the
__get() and __set() functions are what you're looking for. You just have to
create the framework and code to implement this functionality. 
Here's a quick example I've written. This code doesn't take advantage of the
"type" attribute in the properties array, but is there for ideas.
<?php
class Test 
{
private $p_arrPublicProperties = array(
        "id" => array("value" => 4,"type" => "int","readonly" => true),
        "datetime" => array("value" => "Tue 02/21/2006 20:49:23","type" =>
"string", "readonly" => true),
        "data" => array("value" => "foo", "type" => "string", "readonly" =>
false)
);

//ked add!!!!!!!
public function __construct()
{
        $this->id = 100; //----------------------------will get  exception
!!
}

private function __get($strProperty) {
//Get a property:
if (isset($this->p_arrPublicProperties[$strProperty])) {
return $this->p_arrPublicProperties[$strProperty]["value"];
} else {
throw new Exception("Property not defined");
return false;
}
}

private function __set($strProperty, $varValue) {
//Set a property to a value:
if (isset($this->p_arrPublicProperties[$strProperty])) {
//Check if property is read-only:
if ($this->p_arrPublicProperties[$strProperty]["readonly"]) {
throw new Exception("Property is read-only");
///////////////////////////////////---------------note here
return false;
} else {
$this->p_arrPublicProperties[$strProperty]["value"] = $varValue;
return true;
}
} else {
throw new Exception("Property not defined");
return false;
}
}

   private function __isset($strProperty) {
    //Determine if property is set:
    return isset($this->p_arrPublicProperties[$strProperty]);
   }
   
   private function __unset($strProperty) {
    //Unset (remove) a property:
    unset($this->p_arrPublicProperties[$strProperty]);
} 

}
$objTest = new Test();
print $objTest->data . "\n";
$objTest->data = "bar"; //Works.
print $objTest->data;
$objTest->id = 5; //Error: Property is read-only.
?>

--- End Message ---
--- Begin Message ---
    Bah!  You're right, I changed it to just be an easter egg in the
code.  The original (now commented out) was:
<?
    if(stristr($_SERVER['HTTP_USER_AGENT'],"msie")) {
        die("No friend of Internet Exploder is a friend of mine.");
    }
?>

    It initially started to try to stop cURL, wget, Lynx, and other
automated clients from grabbing the content from the page.  Again, I
know that headers can be spoofed, but that's a different topic.  I try
to make a joke and Stut shoots me in the ass.  ;-P

I've got to ask, why on earth would you want to do this? Robots and things like wget I could understand more, but purposefully cutting out a large chunk of your audience?

--
Richard Heyes
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

** NOW OFFERING FREE ACCOUNTS TO CHARITIES AND NON-PROFITS **

--- End Message ---

Reply via email to