php-general Digest 30 Mar 2008 04:23:11 -0000 Issue 5375

Topics (messages 272282 through 272298):

Re: How to install PHP 5.x on Windows Server 2000 with IIS5and MySQL 5.x
        272282 by: Shawn McKenzie
        272284 by: edwardspl.ita.org.mo
        272286 by: David Giragosian

Re: character encoding
        272283 by: Bill
        272287 by: Colin Guthrie
        272289 by: Manuel Lemos

page content duration
        272285 by: Alain Roger

Re: optimilize web page loading
        272288 by: Robert Cummings

extract escaped quoted strings
        272290 by: Adam Jacob Muller
        272291 by: Robert Cummings
        272292 by: Adam Jacob Muller
        272293 by: Robert Cummings
        272294 by: Adam Jacob Muller
        272295 by: Casey
        272296 by: Robert Cummings
        272297 by: Adam Jacob Muller

new lines in textareas?
        272298 by: Mary Anderson

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 ---
[EMAIL PROTECTED] wrote:
> Shawn McKenzie wrote:
> 
>> Paul Scott wrote:
>>  
>>
>>> On Thu, 2008-03-27 at 10:32 -0400, Wolf wrote:
>>>    
>>>
>>>> I'd suggest going with a real operating system (linux) which keeps patches 
>>>> updated quicker...
>>>>
>>>>      
>>>>
>>> As much of a Free Software advocate as I am, that is not the answer to
>>> the question. That being said, however, I would replace the IIS with
>>> Apache2 at least...
>>>
>>> I seem to remember someone posting a really good guide to setting this
>>> all up at some stage, so a quick search through the archives should
>>> reveal all.
>>>
>>>
>>> --Paul
>>>
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> All Email originating from UWC is covered by disclaimer 
>>> http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 
>>>    
>>>
>> Download the zip and read the install.txt.  It doesn't get any easier
>> than that. It's very straight forward and has worked for me every time.
>>
>> -Shawn
>>
>>  
>>
> Hello Shawn,
> 
> How to enable php 5.2.5 with MySQL 5.0.51a ?
> 
> Thank for your help !
> 
> Edward.
> 
Make sure your extensions path is correct in php.ini and uncomment the
extension=mysql.ini line in php.ini.

-Shawn

--- End Message ---
--- Begin Message ---
Shawn McKenzie wrote:

>[EMAIL PROTECTED] wrote:
>  
>
>>Shawn McKenzie wrote:
>>
>>    
>>
>>>Paul Scott wrote:
>>> 
>>>
>>>      
>>>
>>>>On Thu, 2008-03-27 at 10:32 -0400, Wolf wrote:
>>>>   
>>>>
>>>>        
>>>>
>>>>>I'd suggest going with a real operating system (linux) which keeps patches 
>>>>>updated quicker...
>>>>>
>>>>>     
>>>>>
>>>>>          
>>>>>
>>>>As much of a Free Software advocate as I am, that is not the answer to
>>>>the question. That being said, however, I would replace the IIS with
>>>>Apache2 at least...
>>>>
>>>>I seem to remember someone posting a really good guide to setting this
>>>>all up at some stage, so a quick search through the archives should
>>>>reveal all.
>>>>
>>>>
>>>>--Paul
>>>>
>>>>
>>>>
>>>>------------------------------------------------------------------------
>>>>
>>>>All Email originating from UWC is covered by disclaimer 
>>>>http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 
>>>>   
>>>>
>>>>        
>>>>
>>>Download the zip and read the install.txt.  It doesn't get any easier
>>>than that. It's very straight forward and has worked for me every time.
>>>
>>>-Shawn
>>>
>>> 
>>>
>>>      
>>>
>>Hello Shawn,
>>
>>How to enable php 5.2.5 with MySQL 5.0.51a ?
>>
>>Thank for your help !
>>
>>Edward.
>>
>>    
>>
>Make sure your extensions path is correct in php.ini and uncomment the
>extension=mysql.ini line in php.ini.
>
>-Shawn
>
>  
>
Hello,

1, I had edited with extension=php_mysql.dll
2, Test the php with mysql by using php page with phpinfo() function,the
result of mysql is enabled.
3, I can edit the db data though the phpmyadmin tools.
4, BUT test the connection with mysql as the following code is fail :

<?PHP
//remember to change the password to whatever you set
//it to in mysql instance configuration

//first parameter is server name, 2nd username 'root', 3rd is password
$rst = @mysql_connect("localhost","root","root");

if (!$rst){
echo( "<p>Unable to connect to database manager.</p>");
die('Could not connect: ' . mysql_error());
exit();
} else {
echo("<p>Successfully Connected to MySQL Database Manager!</p>");
}

if (! @mysql_select_db("mysql") ){
echo( "<p>Unable to connect database...</p>");
exit();
} else {
echo("<p>Successfully Connected to Database 'MYSQL'!</p>");
}
?>

The warning message is "Access denied...."
So, any more help ?

For the IIS configuration, load the c:\php\php-cgi.exe...

Thanks !

Edward.

--- End Message ---
--- Begin Message ---
On 3/29/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Shawn McKenzie wrote:
>
> >[EMAIL PROTECTED] wrote:
> >
> >
> >>Shawn McKenzie wrote:
> >>
> >>
> >>
> >>>Paul Scott wrote:
> >>>
> >>>
> >>>
> >>>
> >>>>On Thu, 2008-03-27 at 10:32 -0400, Wolf wrote:
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>I'd suggest going with a real operating system (linux) which keeps 
> >>>>>patches updated quicker...
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>As much of a Free Software advocate as I am, that is not the answer to
> >>>>the question. That being said, however, I would replace the IIS with
> >>>>Apache2 at least...
> >>>>
> >>>>I seem to remember someone posting a really good guide to setting this
> >>>>all up at some stage, so a quick search through the archives should
> >>>>reveal all.
> >>>>
> >>>>
> >>>>--Paul
> >>>>
> >>>>
> >>>>
> >>>>------------------------------------------------------------------------
> >>>>
> >>>>All Email originating from UWC is covered by disclaimer
> >>>>http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm
> >>>>
> >>>>
> >>>>
> >>>>
> >>>Download the zip and read the install.txt.  It doesn't get any easier
> >>>than that. It's very straight forward and has worked for me every time.
> >>>
> >>>-Shawn
> >>>
> >>>
> >>>
> >>>
> >>>
> >>Hello Shawn,
> >>
> >>How to enable php 5.2.5 with MySQL 5.0.51a ?
> >>
> >>Thank for your help !
> >>
> >>Edward.
> >>
> >>
> >>
> >Make sure your extensions path is correct in php.ini and uncomment the
> >extension=mysql.ini line in php.ini.
> >
> >-Shawn
> >
> >
> >
> Hello,
>
> 1, I had edited with extension=php_mysql.dll
> 2, Test the php with mysql by using php page with phpinfo() function,the
> result of mysql is enabled.
> 3, I can edit the db data though the phpmyadmin tools.
> 4, BUT test the connection with mysql as the following code is fail :
>
> <?PHP
> //remember to change the password to whatever you set
> //it to in mysql instance configuration
>
> //first parameter is server name, 2nd username 'root', 3rd is password
> $rst = @mysql_connect("localhost","root","root");
>
> if (!$rst){
> echo( "<p>Unable to connect to database manager.</p>");
> die('Could not connect: ' . mysql_error());
> exit();
> } else {
> echo("<p>Successfully Connected to MySQL Database Manager!</p>");
> }
>
> if (! @mysql_select_db("mysql") ){
> echo( "<p>Unable to connect database...</p>");
> exit();
> } else {
> echo("<p>Successfully Connected to Database 'MYSQL'!</p>");
> }
> ?>
>
> The warning message is "Access denied...."
> So, any more help ?

That means that the user "root" with the password "root" does not have
permission to connect to the MySQL server. I'm late to this thread,
but if you have not touched MySQL's user accounts in any way, there
should be a user "root" with an empty password.

Try: $rst = @mysql_connect("localhost","root","");

-- 

-David.

When the power of love
overcomes the love of power,
the world will know peace.

-Jimi Hendrix

--- End Message ---
--- Begin Message ---
Hi Manuel


> You can build mailto: links with a default subject and text, but I am
> not sure you can force Outlook to use specific HTML. It's wiser to not
> rely on mailto: .

Hotmail will accept mail delivery from PHP ?





--- End Message ---
--- Begin Message ---
Bill wrote:
>> You can build mailto: links with a default subject and text, but I am
>> not sure you can force Outlook to use specific HTML. It's wiser to not
>> rely on mailto: .
> 
> Hotmail will accept mail delivery from PHP ?

mailto: links have nothing to do with PHP but generally speaking mailto:
is not compatible with webmail unless you have some sort of
extension/url handler installed.



--- End Message ---
--- Begin Message ---
Hello,

on 03/29/2008 12:43 PM Bill said the following:
>> You can build mailto: links with a default subject and text, but I am
>> not sure you can force Outlook to use specific HTML. It's wiser to not
>> rely on mailto: .
> 
> Hotmail will accept mail delivery from PHP ?

Sure. There is nothing specific of PHP that prevents Hotmail from
accepting messages sent by PHP scripts.

-- 

Regards,
Manuel Lemos

PHP professionals looking for PHP jobs
http://www.phpclasses.org/professionals/

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

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

i have a strange behavior on my web page.
i have a form where users can enter their email address to subscribe to
newsletter.
if user already exists the page inform him and allow him to go back thanks a
button.

clicking on this button, load another page (initial page with the form for
newsletter registration).
if user enter another email address and click on the submit button... even
if the email is not registered into DB (as user who want newsletter
registration), the page display the message "user already registered".
it's like it keeps in mind the previous email address...

here is my code :

<div id='newsletter_form'>
>                     <form id='form_email' name='form_newsletter'
> method="POST" action="../newsletter/">
>                         <input id='field_email' type='text' name='email'
> value='<?php print module_msg($welcome,$Lang, 'type_email'); ?>'
>                             onfocus="if(this.value=='<?php print
> module_msg($welcome,$Lang, 'type_email'); ?>'){this.value=''};"
>                             onblur="if (this.value==''){ this.value='<?php
> print module_msg($welcome,$Lang, 'type_email'); ?>' };" />
>                         <input id='btn_signin' type='submit' name='signin'
> value='<?php print module_msg($welcome,$Lang, 'Sign_in'); ?>' />
>                     </form>
> </div>
>

i just added a feature to auto-complete the text field (email) in case of
user already wrote email and clicked on back button of the registration
checking page.... just to avoid him to rewrite email address...
but anyway it should not keep it in mind... there is not $_SESSION variable.

this code works perfectly under FF, but not under Opera, safari and IE 6.

what could it be ?

-- 
Alain
------------------------------------
Windows XP SP2
PostgreSQL 8.2.4 / MS SQL server 2005
Apache 2.2.4
PHP 5.2.4
C# 2005-2008

--- End Message ---
--- Begin Message ---
On Sat, 2008-03-29 at 10:16 +0100, Zoltán Németh wrote:
> >
> >  One last thing though...
> > even if this were escaped and even if there were fifty variables
> > embedded, a good bytecode optimizer (not quite the same as a bytecode
> > cacher) would optimize the bytecode for caching so that the string is
> > broken up according to what needs to be interpolated and what does not.
> 
> could you tell me more about this bytecode optimizer stuff? how does it
> work, how much better/faster is it then APC/EAccelerator/etc?

It really depends on what an optimizer optimizes. TurckMMCache had.has
an optimizer. Zend offers an optimizer too. Optimizer can work in a
number of ways. They may be an explicit part of the bytecode cache
mechanism or possibly plugged as one element in a chain of bytecode
processors... parser -> optmizer -> cacher. I'm not exactly sure how it
works for PHP.

The main difference between a cacher and an optimizer though is that
generally speaking a caher only deals with caching the bytecode. No
processing occurs on the produced bytecode. On the other hand an
optimizer may perform alterates on the bytecodes to enhance speed.

For example... by now most people on the list probably know that:

    ++$i;

Is faster than:

    $i++;

An optmizer might see $i++ and determine that the return value is not
used and thus the operation can be changed from $i++ to ++$i. Smilarly,
the optimizer might encounter the following expression:

    $foo = 1 << 8

And reduce the constant expression (1 << 8) to (256). So the expression
essentially becomes:

    $foo = 256

Similarly if you take the following expression:

    $text = "There was an old man from Nantuckit\n"
           ."Who's sole possession was a bucket.\n"
           ."One day with a grin,\n"
           ."While scratching his chin\n"
           ."He thought, \"I think I'll build a rocket.\"\n";

This could be optimized by removing concatenation operations and
producing a single unified string within the bytecode.

These are just basic optimizations obviously. Optimization is not a new
thing, if you've ever used the -O flags when building a C program then
you know that C compilers can also perform optimizations.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


--- End Message ---
--- Begin Message ---
Hi,
Have a potentially interesting question here, wondering if anyone has done this one before and could shed some light for me. I have a bit of PHP code that needs to extract some quoted strings, so, very simply:
"hello"
perfectly fine and works great
but, it should also be able to extract
"hel\"lo"
bit more complex now

Ideally, it would also handle
"hel\\"lo"
properly

it should also handle
"hel\\\"lo"


Any ideason how to do this? attempts to write a PCRE to do this are so- far unsuccessful, i'm sure I could badger some PHP code into doing it perhaps, but i'd love some elegant PCRE solution that thus-far evades me :(


Any ideas are appreciated.

-Adam


--- End Message ---
--- Begin Message ---
On Sat, 2008-03-29 at 19:16 -0400, Adam Jacob Muller wrote:
> Hi,
> Have a potentially interesting question here, wondering if anyone has  
> done this one before and could shed some light for me.
> I have a bit of PHP code that needs to extract some quoted strings,  
> so, very simply:
> "hello"
> perfectly fine and works great
> but, it should also be able to extract
> "hel\"lo"
> bit more complex now
> 
> Ideally, it would also handle
> "hel\\"lo"
> properly
> 
> it should also handle
> "hel\\\"lo"
> 
> 
> Any ideason how to do this? attempts to write a PCRE to do this are so- 
> far unsuccessful, i'm sure I could badger some PHP code into doing it  
> perhaps, but i'd love some elegant PCRE solution that thus-far evades  
> me :(
> 
> 
> Any ideas are appreciated.

Extract quoted strings from what? The source makes a huge difference on
the complexity required to extract the strings.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


--- End Message ---
--- Begin Message --- Assume that you should accept any string that PHP itself would accept, though no processing of the actual escapes is required nor desirable.


On Mar 29, 2008, at 8:34 PM, Robert Cummings wrote:


On Sat, 2008-03-29 at 19:16 -0400, Adam Jacob Muller wrote:
Hi,
Have a potentially interesting question here, wondering if anyone has
done this one before and could shed some light for me.
I have a bit of PHP code that needs to extract some quoted strings,
so, very simply:
"hello"
perfectly fine and works great
but, it should also be able to extract
"hel\"lo"
bit more complex now

Ideally, it would also handle
"hel\\"lo"
properly

it should also handle
"hel\\\"lo"


Any ideason how to do this? attempts to write a PCRE to do this are so-
far unsuccessful, i'm sure I could badger some PHP code into doing it
perhaps, but i'd love some elegant PCRE solution that thus-far evades
me :(


Any ideas are appreciated.

Extract quoted strings from what? The source makes a huge difference on
the complexity required to extract the strings.

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP


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



--- End Message ---
--- Begin Message ---
On Sat, 2008-03-29 at 20:41 -0400, Adam Jacob Muller wrote:
> Assume that you should accept any string that PHP itself would accept,  
> though no processing of the actual escapes is required nor desirable.

Sorry, I wasn't clear enough :) By source I meant more along the lines
of what the text might look like from which these strings are being
pulled... for instance are you looking to pull these strings from PHP
source code? or something simpler?

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


--- End Message ---
--- Begin Message ---
Yes, php source code.


On Mar 29, 2008, at 8:54 PM, Robert Cummings wrote:


On Sat, 2008-03-29 at 20:41 -0400, Adam Jacob Muller wrote:
Assume that you should accept any string that PHP itself would accept,
though no processing of the actual escapes is required nor desirable.

Sorry, I wasn't clear enough :) By source I meant more along the lines
of what the text might look like from which these strings are being
pulled... for instance are you looking to pull these strings from PHP
source code? or something simpler?

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP


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



--- End Message ---
--- Begin Message --- On Mar 29, 2008, at 4:16 PM, Adam Jacob Muller <[EMAIL PROTECTED]> wrote:

Hi,
Have a potentially interesting question here, wondering if anyone has done this one before and could shed some light for me. I have a bit of PHP code that needs to extract some quoted strings, so, very simply:
"hello"
perfectly fine and works great
but, it should also be able to extract
"hel\"lo"
bit more complex now

Ideally, it would also handle
"hel\\"lo"
properly

it should also handle
"hel\\\"lo"


Any ideason how to do this? attempts to write a PCRE to do this are so-far unsuccessful, i'm sure I could badger some PHP code into doing it perhaps, but i'd love some elegant PCRE solution that thus- far evades me :(


Any ideas are appreciated.

-Adam


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


<?php
 $string = "\"he\\\"llo\""; // "he\"llo"
 $parsed = eval('return ' . $string . ';');
 echo $parsed; // he"llo
?>

--- End Message ---
--- Begin Message ---
On Sat, 2008-03-29 at 21:31 -0400, Adam Jacob Muller wrote:
> Yes, php source code.

You will not be able to do this with PCRE. You need something that can
track state because double quotes can appear within HTML outside of PHP
blocks, within HEREDOC, within double-quoted strings when backslashed,
and within single quoted strings. You need to account for each type of
PHP open/close semantic:

    <?php
    <?
    <?=
    <script language="php">

And that's just to determine script context. Then you need to know where
a double quote is. Is it starting a string? Is it within HEREDOC? Is it
within a single quoted string, etc. Your best bet is probably to use the
token_get_all() function:

    http://ca.php.net/manual/en/function.token-get-all.php

Cheers,
Rob.


> 
> 
> On Mar 29, 2008, at 8:54 PM, Robert Cummings wrote:
> 
> >
> > On Sat, 2008-03-29 at 20:41 -0400, Adam Jacob Muller wrote:
> >> Assume that you should accept any string that PHP itself would  
> >> accept,
> >> though no processing of the actual escapes is required nor desirable.
> >
> > Sorry, I wasn't clear enough :) By source I meant more along the lines
> > of what the text might look like from which these strings are being
> > pulled... for instance are you looking to pull these strings from PHP
> > source code? or something simpler?
> >
> > Cheers,
> > Rob.


-- 
http://www.interjinn.com
Application and Templating Framework for PHP


--- End Message ---
--- Begin Message ---
token_get_all, fantastic!
Thanks.

- Adam
On Mar 29, 2008, at 10:02 PM, Robert Cummings wrote:


On Sat, 2008-03-29 at 21:31 -0400, Adam Jacob Muller wrote:
Yes, php source code.

You will not be able to do this with PCRE. You need something that can
track state because double quotes can appear within HTML outside of PHP
blocks, within HEREDOC, within double-quoted strings when backslashed,
and within single quoted strings. You need to account for each type of
PHP open/close semantic:

   <?php
   <?
   <?=
   <script language="php">

And that's just to determine script context. Then you need to know where a double quote is. Is it starting a string? Is it within HEREDOC? Is it within a single quoted string, etc. Your best bet is probably to use the
token_get_all() function:

   http://ca.php.net/manual/en/function.token-get-all.php

Cheers,
Rob.




On Mar 29, 2008, at 8:54 PM, Robert Cummings wrote:


On Sat, 2008-03-29 at 20:41 -0400, Adam Jacob Muller wrote:
Assume that you should accept any string that PHP itself would
accept,
though no processing of the actual escapes is required nor desirable.

Sorry, I wasn't clear enough :) By source I meant more along the lines
of what the text might look like from which these strings are being
pulled... for instance are you looking to pull these strings from PHP
source code? or something simpler?

Cheers,
Rob.


--
http://www.interjinn.com
Application and Templating Framework for PHP


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



--- End Message ---
--- Begin Message ---
Hi all,
I have a php script which produces text which is to be displayed in a textarea. I have the wrap for the text area set to 'hard'. I need to have newlines inserted in the text. "\n" and "<br>" don't work. They just get quoted literally in the text. I suspect I need to use htmlspecialchars , but don't know what special character to feed it.

Apologies if this should go to an HTML forum. I checked several archives and did not find anything useful. (They tended to tell me to put in \n or <br>!)

    Thanks

Mary Anderson

--- End Message ---

Reply via email to