php-general Digest 6 Nov 2008 07:46:37 -0000 Issue 5775

Topics (messages 282944 through 282972):

Re: Random number generator
        282944 by: TG
        282945 by: WEISD
        282946 by: Gary M. Josack
        282947 by: Gary M. Josack
        282951 by: Nitsan Bin-Nun
        282959 by: Ashley Sheridan

Re: removing text from a string
        282948 by: Jim Lucas
        282949 by: ceo.l-i-e.com
        282957 by: Ashley Sheridan
        282961 by: Micah Gersten
        282962 by: Micah Gersten
        282972 by: Ashley Sheridan

two mysql installations php_mysql.dll extension and libmysql.dll question
        282950 by: Daniel Kolbo
        282952 by: Daniel Kolbo
        282953 by: Chris
        282954 by: Daniel Kolbo
        282960 by: Chris

Re: Recursive Directory Listing
        282955 by: Ashley Sheridan

Re: basic php question...
        282956 by: Ashley Sheridan

Re: ??????????? ??????? 648-67-61 ??? ?????? ? ???? ?????? ? ??????
        282958 by: Ashley Sheridan

Re: COOKIE¡¡or coding
        282963 by: Zhao chunliang[chunliang.zhao]
        282964 by: Micah Gersten
        282967 by: Zhao chunliang[chunliang.zhao]
        282968 by: Chris

find a word in a string
        282965 by: Richard Kurth
        282969 by: Micah Gersten
        282970 by: Jim Lucas

Re: PHP screenshot capture code needed
        282966 by: Shelley

Simplexml encodes output xml
        282971 by: Manoj Singh

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 ---
Here's how you generate a random number:
http://us.php.net/manual/en/function.rand.php

There are a number of things you can do with that to select a random file and 
include it.  Have an associative array where the random number matches an 
array key and the value is the filename you want, is one method.

Just starting out with PHP or is this a homework assignment?   :)

-TG

----- Original Message -----
From: "WEISD" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Date: Wed, 5 Nov 2008 12:41:21 -0600
Subject: [PHP] Random number generator

> 
> On a php web page I want to generate a random number  between say 1 and 10 
> and then use that number to reference a particular file in an include tag.
> 
> <?php include('GeneratedNumber.html'); ?>
> 
> Is there an easy way to do this?
> 
> Thanks 


--- End Message ---
--- Begin Message ---
Just starting out, thanks.

So,

<?php

$number = rand(1, 10);

include('$number.html'); ?>


I should have prefaced the question with,  New to PHP...





""TG"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
Here's how you generate a random number:
http://us.php.net/manual/en/function.rand.php

There are a number of things you can do with that to select a random file and
include it.  Have an associative array where the random number matches an
array key and the value is the filename you want, is one method.

Just starting out with PHP or is this a homework assignment?   :)

-TG

----- Original Message -----
From: "WEISD" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Date: Wed, 5 Nov 2008 12:41:21 -0600
Subject: [PHP] Random number generator


On a php web page I want to generate a random number between say 1 and 10 and then use that number to reference a particular file in an include tag.

<?php include('GeneratedNumber.html'); ?>

Is there an easy way to do this?

Thanks


--- End Message ---
--- Begin Message ---
Stephen wrote:
On a php web page I want to generate a random number between say 1 and 10 and then use that number to reference a particular file in
an include tag.

<?php include('GeneratedNumber.html'); ?>

Is there an easy way to do this?

Get the time and use the last digit converting 0 to 10.

Stephen

rand(1, 10);

--- End Message ---
--- Begin Message ---
WEISD wrote:
Just starting out, thanks.

So,

<?php

$number = rand(1, 10);

include('$number.html'); ?>


I should have prefaced the question with,  New to PHP...





""TG"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
Here's how you generate a random number:
http://us.php.net/manual/en/function.rand.php

There are a number of things you can do with that to select a random file and include it. Have an associative array where the random number matches an
array key and the value is the filename you want, is one method.

Just starting out with PHP or is this a homework assignment?   :)

-TG

----- Original Message -----
From: "WEISD" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Date: Wed, 5 Nov 2008 12:41:21 -0600
Subject: [PHP] Random number generator


On a php web page I want to generate a random number between say 1 and 10 and then use that number to reference a particular file in an include tag.

<?php include('GeneratedNumber.html'); ?>

Is there an easy way to do this?

Thanks


use double quotes instead of single quotes, else you will be trying to literally include '$number.html'
--- End Message ---
--- Begin Message ---
Umm I must notify you, just in case you don't know this, that you have to be
aware of the fact that the humanity haven't found a way to get a random
number (yet..... they are working on it while I'm writing this..) (;

On Wed, Nov 5, 2008 at 9:43 PM, Gary M. Josack <[EMAIL PROTECTED]> wrote:

> WEISD wrote:
>
>> Just starting out, thanks.
>>
>> So,
>>
>> <?php
>>
>> $number = rand(1, 10);
>>
>> include('$number.html'); ?>
>>
>>
>> I should have prefaced the question with,  New to PHP...
>>
>>
>>
>>
>>
>> ""TG"" <[EMAIL PROTECTED]> wrote in message
>> news:[EMAIL PROTECTED]
>>
>>> Here's how you generate a random number:
>>> http://us.php.net/manual/en/function.rand.php
>>>
>>> There are a number of things you can do with that to select a random file
>>> and
>>> include it.  Have an associative array where the random number matches an
>>> array key and the value is the filename you want, is one method.
>>>
>>> Just starting out with PHP or is this a homework assignment?   :)
>>>
>>> -TG
>>>
>>> ----- Original Message -----
>>> From: "WEISD" <[EMAIL PROTECTED]>
>>> To: [EMAIL PROTECTED]
>>> Date: Wed, 5 Nov 2008 12:41:21 -0600
>>> Subject: [PHP] Random number generator
>>>
>>>
>>>> On a php web page I want to generate a random number  between say 1 and
>>>> 10
>>>> and then use that number to reference a particular file in an include
>>>> tag.
>>>>
>>>> <?php include('GeneratedNumber.html'); ?>
>>>>
>>>> Is there an easy way to do this?
>>>>
>>>> Thanks
>>>>
>>>
>>>
>>  use double quotes instead of single quotes, else you will be trying to
> literally include '$number.html'
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
On Wed, 2008-11-05 at 12:41 -0600, WEISD wrote:

> On a php web page I want to generate a random number  between say 1 and 10 
> and then use that number to reference a particular file in an include tag.
> 
> <?php include('GeneratedNumber.html'); ?>
> 
> Is there an easy way to do this?
> 
> Thanks 
> 

include "manual.php";
lesson = new manual();
lesson->math->rand->read();


Ash
www.ashleysheridan.co.uk

--- End Message ---
--- Begin Message ---
Thodoris wrote:
> 
>> Boyd, Todd M. wrote:
>>  
>>>> -----Original Message-----
>>>> From: Ashley Sheridan [mailto:[EMAIL PROTECTED]
>>>> Sent: Tuesday, November 04, 2008 1:40 PM
>>>> To: Adam Williams
>>>> Cc: PHP General list
>>>> Subject: Re: [PHP] removing text from a string
>>>>
>>>> On Tue, 2008-11-04 at 08:04 -0600, Adam Williams wrote:
>>>>      
>>>>> I have a file that looks like:
>>>>>
>>>>> 1. Some Text here
>>>>> 2. Another Line of Text
>>>>> 3. Yet another line of text
>>>>> 340. All the way to number 340
>>>>>
>>>>> And I want to remove the Number, period, and blank space at the
>>>>>         
>>>> begining
>>>>      
>>>>> of each line.  How can I accomplish this?
>>>>>
>>>>> Opening the file to modify it is easy, I'm just lost at how to
>>>>>         
>>> remove
>>>    
>>>>> the text.:
>>>>>
>>>>> <?php
>>>>> $filename = "results.txt";
>>>>>
>>>>> $fp = fopen($filename, "r") or die ("Couldn't open $filename");
>>>>> if ($fp)
>>>>> {
>>>>> while (!feof($fp))
>>>>>         {
>>>>>         $thedata = fgets($fp);
>>>>>         //Do something to remove the "1. "
>>>>>         //print the modified line and \n
>>>>>         }
>>>>> fclose($fp);
>>>>> }
>>>>> ?>
>>>>>
>>>>>         
>>>> I'd go with a regular expression any day for something like this.
>>>> Something like:
>>>>
>>>> "/$[0-9]{1,3}\.\ .*^/g"
>>>>
>>>> should do what you need. Note the space before the last period.
>>>>       
>>> That would only work for files with 1-999 lines, and will wind up
>>> matching the entire line (since you used $ and ^ and a greedy .*
>>> inbetween... also... $ is "end-of-line" and ^ is "beginning-of-line" :))
>>> rather than just the "line number" part. I would stick with my
>>> originally-posted regex ("/^\d+\.\s/"), but I would modify yours like
>>> this if I were to use it instead:
>>>
>>> "/^[0-9]+\.\ (.*)$/" (What was the "g" modifier for, anyway?)
>>>
>>> Then, you could grab the capture group made with (.*) and use it as the
>>> "clean" data. (It would be group 1 in the match results and "$1" in a
>>> preg_replace() call, I believe. Group 0 should be the entire match.)
>>>
>>>
>>> Todd Boyd
>>> Web Programmer
>>>
>>>     
>>
>>
>> Personally, I would go this route if you wanted to stick with a regex.
>>
>> <?php
>>
>> $lines[] = '01. asdf';
>> $lines[] = '02. 323 asdf';
>> $lines[] = '03.2323 asdf';
>> $lines[] = '04. asdf 23';
>> $lines[] = '05.        asdf'; /* tabs used here */
>> $lines[] = '06. asdf';
>>
>> foreach ( $lines AS $line ) {
>>     echo preg_replace('/^[0-9]+\.\s*/', '', $line), "\n";
>> }
>>
>> ?>
>>
>> This takes care of all possible issues related to the char after the
>> first period.  Maybe it is there maybe not.
>>
>> Could be that it is a tab and not a space.  Could even be multiple
>> tabs or spaces.
>>
>>   
> 
> There it goes again.
> 
> Every time someone asks a simple question (like the kind it's solved
> with a simple trim, ltrim or rtrim) the discussion about which is the
> best regular expression for this problem, makes a thread get "elephant"
> sized :-) .
> 
> I love this list!!
> 

Your not going to be able to get it with any of the xtrim() functions.  you 
would end up with various nested ltrim() calls that, IMO, would be a
nightmare to manage.

So, a top to bottom comparison here

If $line is this:
$line = '01. asdf';

And you use either one of these:
A) ltrim(ltrim(ltrim($line, '0123456789'), '.'));
B) preg_replace('/^[0-9]+\.\s*/', '', $line);

Which do you prefer?

A's Pros:
        Not a regex
A's Cons:
        A little slower then B
        multiple function calls

B's Pros:
        Slightly faster then A
        Single Function call
B's Cons:
        Regex



-- 
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 ---
Seems to me that this would work, assuming at least one space after the '.' in 
every line:



$string = ltrim($string, "0123456789.");

if ($string[0] == ' ') $string = substr($string, 1);



But perhaps I'm missing something...



I dunno if the OP can guarantee at least one space or not.



I may have missed a followup with that detail.

--- End Message ---
--- Begin Message ---
On Wed, 2008-11-05 at 11:52 -0500, Wolf wrote:
> > >>> 1. Some Text here
> > >>> 2. Another Line of Text
> > >>> 3. Yet another line of text
> > >>> 340. All the way to number 340
> > >>>
> > >>> And I want to remove the Number, period, and blank space at the
> > >> begining
> > >>> of each line.  How can I accomplish this?
> > >>>
> > >>> Opening the file to modify it is easy, I'm just lost at how to
> > > remove
> > >>> the text.:
> > >>>
> > >>> <?php
> > >>> $filename = "results.txt";
> > >>>
> > >>> $fp = fopen($filename, "r") or die ("Couldn't open $filename");
> > >>> if ($fp)
> > >>> {
> > >>> while (!feof($fp))
> > >>>         {
> > >>>         $thedata = fgets($fp);
> > >>>         //Do something to remove the "1. "
> > >>>         //print the modified line and \n
> > >>>         }
> > >>> fclose($fp);
> > >>> }
> > >>> ?>
> > >>>
> > >> I'd go with a regular expression any day for something like this.
>  *groan*
> 
> <?php 
>  $filename = "results.txt"; 
> 
>  $fp = fopen($filename, "r") or die ("Couldn't open $filename"); 
>  if ($fp) 
>  { 
>   while (!feof($fp)) 
>   { 
>    $thedata = fgets($fp); 
>    //Do something to remove the "1. " 
>    $findme=" ";
>    $pos=strpos($thedata,$findme);
>    $thedata_fixed=trim(substr($thedata,$findme));
>     //print the modified line and \n 
>    echo $thedata_fixed."\n";
>   } 
>   fclose($fp); 
>  } 
> ?> 
> 
> See, no regex needed and no matter the size of the '######. ' it will always 
> find the first " " and then chop it from there to the end, then you trim it 
> up and you get the text.
> 
> Wolf
> 
Thats a lot of code when a couple of lines and a regex will do ;)


Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
Ashley Sheridan wrote:
> On Wed, 2008-11-05 at 11:52 -0500, Wolf wrote:
>   
>>>>>> 1. Some Text here
>>>>>> 2. Another Line of Text
>>>>>> 3. Yet another line of text
>>>>>> 340. All the way to number 340
>>>>>>
>>>>>> And I want to remove the Number, period, and blank space at the
>>>>>>             
>>>>> begining
>>>>>           
>>>>>> of each line.  How can I accomplish this?
>>>>>>
>>>>>> Opening the file to modify it is easy, I'm just lost at how to
>>>>>>             
>>>> remove
>>>>         
>>>>>> the text.:
>>>>>>
>>>>>> <?php
>>>>>> $filename = "results.txt";
>>>>>>
>>>>>> $fp = fopen($filename, "r") or die ("Couldn't open $filename");
>>>>>> if ($fp)
>>>>>> {
>>>>>> while (!feof($fp))
>>>>>>         {
>>>>>>         $thedata = fgets($fp);
>>>>>>         //Do something to remove the "1. "
>>>>>>         //print the modified line and \n
>>>>>>         }
>>>>>> fclose($fp);
>>>>>> }
>>>>>> ?>
>>>>>>
>>>>>>             
>>>>> I'd go with a regular expression any day for something like this.
>>>>>           
>>  *groan*
>>
>> <?php 
>>  $filename = "results.txt"; 
>>
>>  $fp = fopen($filename, "r") or die ("Couldn't open $filename"); 
>>  if ($fp) 
>>  { 
>>   while (!feof($fp)) 
>>   { 
>>    $thedata = fgets($fp); 
>>    //Do something to remove the "1. " 
>>    $findme=" ";
>>    $pos=strpos($thedata,$findme);
>>    $thedata_fixed=trim(substr($thedata,$findme));
>>     //print the modified line and \n 
>>    echo $thedata_fixed."\n";
>>   } 
>>   fclose($fp); 
>>  } 
>> ?> 
>>
>> See, no regex needed and no matter the size of the '######. ' it will always 
>> find the first " " and then chop it from there to the end, then you trim it 
>> up and you get the text.
>>
>> Wolf
>>
>>     
> Thats a lot of code when a couple of lines and a regex will do ;)
>
>
> Ash
> www.ashleysheridan.co.uk
>
>
>   

Yep, with a regex, it's real easy (untested code):

<?php

$fileData = file_get_contents("text,txt");
$newFileData = preg_replace('/^\d+?\.\s?(.*$)/m','/$1/', $fileData);
file_put_contents("newfile.txt", $newFileData);

?>

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com




--- End Message ---
--- Begin Message ---
> Yep, with a regex, it's real easy (untested code):
>
> <?php
>
> $fileData = file_get_contents("text,txt");
> $newFileData = preg_replace('/^\d+?\.\s?(.*$)/m','/$1/', $fileData);
> file_put_contents("newfile.txt", $newFileData);
>
> ?>
>
> Thank you,
> Micah Gersten
> onShore Networks
> Internal Developer
> http://www.onshore.com
>
>
>   

I guess I forgot to proofread also.
filename should have a period, not a comma.

--- End Message ---
--- Begin Message ---
On Wed, 2008-11-05 at 18:50 -0600, Micah Gersten wrote:
> > Yep, with a regex, it's real easy (untested code):
> >
> > <?php
> >
> > $fileData = file_get_contents("text,txt");
> > $newFileData = preg_replace('/^\d+?\.\s?(.*$)/m','/$1/', $fileData);
> > file_put_contents("newfile.txt", $newFileData);
> >
> > ?>
> >
> > Thank you,
> > Micah Gersten
> > onShore Networks
> > Internal Developer
> > http://www.onshore.com
> >
> >
> >   
> 
> I guess I forgot to proofread also.
> filename should have a period, not a comma.
> 
You did say it was untested code ;)


Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
Hello PHP community,

This question may be more for the MySQL community. If so, my apologies, please let me know.

I am using php v 5.2.6.

I have two versions of MySQL running on my server (windows xp home sp3).

MySQL v6 is running on localhost:3306
MySQL v5.0.41 is running on localhost:3307

I have two installations of phpmyadmin (latest version 3.0.1.1) to manage both of these (i am running a local apache 2.2 server on the same machine on port 8080). Let's call these two installations phpmy5admin and phpmy6admin.

I am able to login and create tables on both versions of mysql. Thus, i suspect the installation of both of these is okay.

When i view both phpmyadmin installations it gives me the correct corresponding mysql version number on the homepage.

However, the phpmy6admin gives me a warning saying:
"Your PHP MySQL library version 5.0.51a differs from your MySQL server version 6.0.7. This may cause unpredictable behavior."

When i copy the libmysql.dll from the mysql 6 installation directory into the php directory i get a pop up saying apache must shutdown when any php script invokes the mysql module.

my windows path variables have
C:\php;C:\Program Files\MySQL
in that order.

my mysql installations are at
C:\Program Files\MySQL\MySQL Server 5.0
C:\Program Files\MySQL\MySQL Server 6.0

I do suspect the c:\php is being read first, as when i change the libmysql.dll in this folder, i experience different results.

I do not have any libmysql.dll files in my system path.

My question are:
1) Is there a libmysql.dll for version 6?  If so, where do i get it?
2) Does libmysql.dll for version 6 only function properly with an updated php_mysql.dll extension? If so, where do i get this updated extension? 3) If I get the correct library for version 6 working, will i then have issues running version 5?
4) Perhaps I can ignore the warning? (i don't like this option ;)

Thanks for helping me,
dK

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


Daniel Kolbo wrote:
Hello PHP community,

This question may be more for the MySQL community. If so, my apologies, please let me know.

I am using php v 5.2.6.

I have two versions of MySQL running on my server (windows xp home sp3).

MySQL v6 is running on localhost:3306
MySQL v5.0.41 is running on localhost:3307

I have two installations of phpmyadmin (latest version 3.0.1.1) to manage both of these (i am running a local apache 2.2 server on the same machine on port 8080). Let's call these two installations phpmy5admin and phpmy6admin.

I am able to login and create tables on both versions of mysql. Thus, i suspect the installation of both of these is okay.

When i view both phpmyadmin installations it gives me the correct corresponding mysql version number on the homepage.

However, the phpmy6admin gives me a warning saying:
"Your PHP MySQL library version 5.0.51a differs from your MySQL server version 6.0.7. This may cause unpredictable behavior."

When i copy the libmysql.dll from the mysql 6 installation directory into the php directory i get a pop up saying apache must shutdown when any php script invokes the mysql module.

my windows path variables have
C:\php;C:\Program Files\MySQL
in that order.

my mysql installations are at
C:\Program Files\MySQL\MySQL Server 5.0
C:\Program Files\MySQL\MySQL Server 6.0

I do suspect the c:\php is being read first, as when i change the libmysql.dll in this folder, i experience different results.

I do not have any libmysql.dll files in my system path.

My question are:
1) Is there a libmysql.dll for version 6?  If so, where do i get it?
2) Does libmysql.dll for version 6 only function properly with an updated php_mysql.dll extension? If so, where do i get this updated extension? 3) If I get the correct library for version 6 working, will i then have issues running version 5?
4) Perhaps I can ignore the warning? (i don't like this option ;)

Thanks for helping me,
dK

I removed the mysql5 installation and I still get the warning when viewing the phpmysql6admin.
thanks,
dK

--- End Message ---
--- Begin Message ---
Daniel Kolbo wrote:


Daniel Kolbo wrote:
Hello PHP community,

This question may be more for the MySQL community. If so, my apologies, please let me know.

I am using php v 5.2.6.

I have two versions of MySQL running on my server (windows xp home sp3).

MySQL v6 is running on localhost:3306
MySQL v5.0.41 is running on localhost:3307

I have two installations of phpmyadmin (latest version 3.0.1.1) to manage both of these (i am running a local apache 2.2 server on the same machine on port 8080). Let's call these two installations phpmy5admin and phpmy6admin.

I am able to login and create tables on both versions of mysql. Thus, i suspect the installation of both of these is okay.

When i view both phpmyadmin installations it gives me the correct corresponding mysql version number on the homepage.

However, the phpmy6admin gives me a warning saying:
"Your PHP MySQL library version 5.0.51a differs from your MySQL server version 6.0.7. This may cause unpredictable behavior."

When i copy the libmysql.dll from the mysql 6 installation directory into the php directory i get a pop up saying apache must shutdown when any php script invokes the mysql module.

my windows path variables have
C:\php;C:\Program Files\MySQL
in that order.

my mysql installations are at
C:\Program Files\MySQL\MySQL Server 5.0
C:\Program Files\MySQL\MySQL Server 6.0

I do suspect the c:\php is being read first, as when i change the libmysql.dll in this folder, i experience different results.

I do not have any libmysql.dll files in my system path.

My question are:
1) Is there a libmysql.dll for version 6?  If so, where do i get it?
2) Does libmysql.dll for version 6 only function properly with an updated php_mysql.dll extension? If so, where do i get this updated extension? 3) If I get the correct library for version 6 working, will i then have issues running version 5?
4) Perhaps I can ignore the warning? (i don't like this option ;)

Thanks for helping me,
dK

I removed the mysql5 installation and I still get the warning when viewing the phpmysql6admin.

because as you suspect, the libraries are different. There will be new stuff in mysql 6 compared to mysql 5.

shouldn't libmysql.dll come with the mysql server?

php_mysql.dll comes from php and since mysql 6 is alpha, I highly doubt that anyone from the php side of things would have put in any effort to "fix" any issues.

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


--- End Message ---
--- Begin Message ---
Chris wrote:
Daniel Kolbo wrote:


Daniel Kolbo wrote:
Hello PHP community,

This question may be more for the MySQL community. If so, my apologies, please let me know.

I am using php v 5.2.6.

I have two versions of MySQL running on my server (windows xp home sp3).

MySQL v6 is running on localhost:3306
MySQL v5.0.41 is running on localhost:3307

I have two installations of phpmyadmin (latest version 3.0.1.1) to manage both of these (i am running a local apache 2.2 server on the same machine on port 8080). Let's call these two installations phpmy5admin and phpmy6admin.

I am able to login and create tables on both versions of mysql. Thus, i suspect the installation of both of these is okay.

When i view both phpmyadmin installations it gives me the correct corresponding mysql version number on the homepage.

However, the phpmy6admin gives me a warning saying:
"Your PHP MySQL library version 5.0.51a differs from your MySQL server version 6.0.7. This may cause unpredictable behavior."

When i copy the libmysql.dll from the mysql 6 installation directory into the php directory i get a pop up saying apache must shutdown when any php script invokes the mysql module.

my windows path variables have
C:\php;C:\Program Files\MySQL
in that order.

my mysql installations are at
C:\Program Files\MySQL\MySQL Server 5.0
C:\Program Files\MySQL\MySQL Server 6.0

I do suspect the c:\php is being read first, as when i change the libmysql.dll in this folder, i experience different results.

I do not have any libmysql.dll files in my system path.

My question are:
1) Is there a libmysql.dll for version 6?  If so, where do i get it?
2) Does libmysql.dll for version 6 only function properly with an updated php_mysql.dll extension? If so, where do i get this updated extension? 3) If I get the correct library for version 6 working, will i then have issues running version 5?
4) Perhaps I can ignore the warning? (i don't like this option ;)

Thanks for helping me,
dK

I removed the mysql5 installation and I still get the warning when viewing the phpmysql6admin.

because as you suspect, the libraries are different. There will be new stuff in mysql 6 compared to mysql 5.

shouldn't libmysql.dll come with the mysql server?

php_mysql.dll comes from php and since mysql 6 is alpha, I highly doubt that anyone from the php side of things would have put in any effort to "fix" any issues.

Hello Chris,

libmysql.dll does come with the mysql server as well as with the php download. I tried replacing the libmysql.dll from php with the one shipped with mysql6 as mentioned in the original post without success.

To confirm, are you saying that php_mysql.dll would need to be updated in order for libmysql.dll (version for mysql6) to work correctly?

Thanks,
dK

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

libmysql.dll does come with the mysql server as well as with the php download. I tried replacing the libmysql.dll from php with the one shipped with mysql6 as mentioned in the original post without success.

To confirm, are you saying that php_mysql.dll would need to be updated in order for libmysql.dll (version for mysql6) to work correctly?

That's what I suspect, yes. You'd probably have to ask on the -internals list to confirm. The folks who develop the drivers for mysql (and others) are on that list, not this one usually.

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


--- End Message ---
--- Begin Message ---
On Wed, 2008-11-05 at 09:11 -0500, Joe Schaeffer wrote:
> >> I would say to do that with CSS, not building it into the output.
> 
> That's actually how I've got things set up now -- I just rarely trust
> the house-of-cards that is nested lists in CSS (and I've gone and
> complicated things with first-child selectors all over the place)!
> 
> Thanks, all, for the great help!
> 
> --joe
> 
Don't bother with first-child selectors, as the vast majority of IE
versions out there will ignore them. Go with what has been suggested so
far, using css to set the layout for all the lists, and more css to
override lists that occur within lists.


Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
On Wed, 2008-11-05 at 18:48 +0200, Thodoris wrote:
> > Richard Heyes a écrit :
> >>> users who browse without Javascript enabled,
> >>
> >> Heretics!
> >>
> >
> >   No, paranoid :D
> >
> 
> Do these people really exist? I though that their extinction happened 
> the same with the dinosaurs.
> 
> -- 
> Thodoris
> 
> 
Lots of reasons:

* some proxy servers (e.g. at work) strip out some scripts
* some mobile/text browsers don't have that option
* some people do _really_ browse with it turned off!


Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
On Wed, 2008-11-05 at 19:13 +0200, Thodoris wrote:
> > Command unkown. Make sure you typed it right.
> >
> >   
> 
> Do you think that this cryptic number 648-67-61 has to do with the 
> answer of all things? Like 42 for e.g.?
> 
> My russian (or whatever this is) suck more then  my English. That's a 
> new experience, never felt it before.
> 
> -- 
> Thodoris
> 
> 
I like how your email client has decimated the subject line! :p


Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
First thanks for Todd 's help

        I do have some questions.

        1.Open the url : http://127.0.0.1/showCookie.php
ShowCookie.php   code:
        <?php
      echo "<script>alert('" . $_COOKIE['TCSPUBLICJAUTHM'] ."');</script>"; 
        ?>
                it's pop-up show :
                [TCSPUBLICJAUTHM] => USER_ID=/zhW/2QXY/GUtIN7m4 dNQ==

        2. The same window, input the string
           "javascript:alert(document.cookie);" and enter, 
            it's pop-up show:
                [TCSPUBLICJAUTHM] => USER_ID=/zhW/2QXY/GUtIN7m4+dNQ==

So, I think it's being changed by PHP, not be HTML Decoded by Browser.

And the string in Cookie , we should be reluctant to change.








> -----Original Message-----
> From: Zhao chunliang[chunliang.zhao]
> [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, November 05, 2008 3:52 AM
> To: [EMAIL PROTECTED]
> Subject: 答复: [PHP]COOKIE or coding
> 
>                    1.Open the url : http://127.0.0.1/showCookie.php
> 
>                             ShowCookie.php   code:
> 
>                                      <?php
>                                                var_dump($_COOKIE);
>                                      ?>
> 
>                             That's print:
>                                                [TCSPUBLICJAUTHM] =>
> USER_ID=/zhW/2QXY/GUtIN7m4 dNQ==
> 
>                    2. The same window, input the string
> "javascript:alert(document.cookie);" and enter, it's show :
> 
>                            That's print:
>                                             [TCSPUBLICJAUTHM] =>
> USER_ID=/zhW/2QXY/GUtIN7m4+dNQ==

Notice the "+". In certain situations in PHP, it will be HTML Decoded. This
means the "+" will turn into whitespace. Try this for an example:

index.php:
<?php
  echo $_GET['d'];
?>

Then visit http://yourhost/yourdirectory/index.php?d=Hello+World  ... it
should display "Hello World" instead of "Hello+World".

>                    3. now , I change the showCookie.php
> 
>                                      <?php
>                                                echo "<script>alert('" .
> $_COOKIE['TCSPUBLICJAUTHM'] . "');</script>";
>                                                var_dump($_COOKIE);
>                                      ?>
> 
>                              That's print:
>                                              [TCSPUBLICJAUTHM] =>
> USER_ID=/zhW/2QXY/GUtIN7m4 dNQ==

As you can see, the only difference is the "+" has been replaced by
whitespace.
 
>                    I think the cookie in php being changed.

It is, but it's not as drastic as you would think. There is an expected
behavior ("+" to " ") that you can deal with in your algorithm via
substitution, encoding, etc.

HTH,


Todd Boyd
Web Programmer

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



--- End Message ---
--- Begin Message ---
As Todd said, PHP is decoding the URL encoded cookie. The cookie has a
'+' in it, because the HTTP headers cannot submit a space. That's why
when you use Javascript, it shows you what's in the cookie, but when you
use PHP, it shows the space. Which behavior do you prefer? If you want
to see the +, the use this:
http://us3.php.net/urlencode

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Zhao chunliang[chunliang.zhao] wrote:
> First thanks for Todd 's help
>
>       I do have some questions.
>
>       1.Open the url : http://127.0.0.1/showCookie.php
> ShowCookie.php   code:
>       <?php
>       echo "<script>alert('" . $_COOKIE['TCSPUBLICJAUTHM'] ."');</script>"; 
>       ?>
>               it's pop-up show :
>               [TCSPUBLICJAUTHM] => USER_ID=/zhW/2QXY/GUtIN7m4 dNQ==
>
>       2. The same window, input the string
>            "javascript:alert(document.cookie);" and enter, 
>           it's pop-up show:
>               [TCSPUBLICJAUTHM] => USER_ID=/zhW/2QXY/GUtIN7m4+dNQ==
>
> So, I think it's being changed by PHP, not be HTML Decoded by Browser.
>
> And the string in Cookie , we should be reluctant to change.
>
>
>
>
>
>
>
>
>   
>> -----Original Message-----
>> From: Zhao chunliang[chunliang.zhao]
>> [mailto:[EMAIL PROTECTED]
>> Sent: Wednesday, November 05, 2008 3:52 AM
>> To: [EMAIL PROTECTED]
>> Subject: 答复: [PHP]COOKIE or coding
>>
>>                    1.Open the url : http://127.0.0.1/showCookie.php
>>
>>                             ShowCookie.php   code:
>>
>>                                      <?php
>>                                                var_dump($_COOKIE);
>>                                      ?>
>>
>>                             That's print:
>>                                                [TCSPUBLICJAUTHM] =>
>> USER_ID=/zhW/2QXY/GUtIN7m4 dNQ==
>>
>>                    2. The same window, input the string
>> "javascript:alert(document.cookie);" and enter, it's show :
>>
>>                            That's print:
>>                                             [TCSPUBLICJAUTHM] =>
>> USER_ID=/zhW/2QXY/GUtIN7m4+dNQ==
>>     
>
> Notice the "+". In certain situations in PHP, it will be HTML Decoded. This
> means the "+" will turn into whitespace. Try this for an example:
>
> index.php:
> <?php
>   echo $_GET['d'];
> ?>
>
> Then visit http://yourhost/yourdirectory/index.php?d=Hello+World  ... it
> should display "Hello World" instead of "Hello+World".
>
>   
>>                    3. now , I change the showCookie.php
>>
>>                                      <?php
>>                                                echo "<script>alert('" .
>> $_COOKIE['TCSPUBLICJAUTHM'] . "');</script>";
>>                                                var_dump($_COOKIE);
>>                                      ?>
>>
>>                              That's print:
>>                                              [TCSPUBLICJAUTHM] =>
>> USER_ID=/zhW/2QXY/GUtIN7m4 dNQ==
>>     
>
> As you can see, the only difference is the "+" has been replaced by
> whitespace.
>  
>   
>>                    I think the cookie in php being changed.
>>     
>
> It is, but it's not as drastic as you would think. There is an expected
> behavior ("+" to " ") that you can deal with in your algorithm via
> substitution, encoding, etc.
>
> HTH,
>
>
> Todd Boyd
> Web Programmer
>
>   

--- End Message ---
--- Begin Message ---
        
I'll use the string to decrypt, so that I want to they are the same.

When I use 'urlencode', some other string will be changed. Like '/'


Thanks very much!!



>> -----Original Message-----
As Todd said, PHP is decoding the URL encoded cookie. The cookie has a
'+' in it, because the HTTP headers cannot submit a space. That's why
when you use Javascript, it shows you what's in the cookie, but when you
use PHP, it shows the space. Which behavior do you prefer? If you want
to see the +, the use this:
http://us3.php.net/urlencode

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Zhao chunliang[chunliang.zhao] wrote:
> First thanks for Todd 's help
>
>       I do have some questions.
>
>       1.Open the url : http://127.0.0.1/showCookie.php
> ShowCookie.php   code:
>       <?php
>       echo "<script>alert('" . $_COOKIE['TCSPUBLICJAUTHM']
."');</script>"; 
>       ?>
>               it's pop-up show :
>               [TCSPUBLICJAUTHM] => USER_ID=/zhW/2QXY/GUtIN7m4 dNQ==
>
>       2. The same window, input the string
>            "javascript:alert(document.cookie);" and enter, 
>           it's pop-up show:
>               [TCSPUBLICJAUTHM] => USER_ID=/zhW/2QXY/GUtIN7m4+dNQ==
>
> So, I think it's being changed by PHP, not be HTML Decoded by Browser.
>
> And the string in Cookie , we should be reluctant to change.
>
>
>
>
>
>
>
>
>   
>> -----Original Message-----
>> From: Zhao chunliang[chunliang.zhao]
>> [mailto:[EMAIL PROTECTED]
>> Sent: Wednesday, November 05, 2008 3:52 AM
>> To: [EMAIL PROTECTED]
>> Subject: 答复: [PHP]COOKIE or coding
>>
>>                    1.Open the url : http://127.0.0.1/showCookie.php
>>
>>                             ShowCookie.php   code:
>>
>>                                      <?php
>>                                                var_dump($_COOKIE);
>>                                      ?>
>>
>>                             That's print:
>>                                                [TCSPUBLICJAUTHM] =>
>> USER_ID=/zhW/2QXY/GUtIN7m4 dNQ==
>>
>>                    2. The same window, input the string
>> "javascript:alert(document.cookie);" and enter, it's show :
>>
>>                            That's print:
>>                                             [TCSPUBLICJAUTHM] =>
>> USER_ID=/zhW/2QXY/GUtIN7m4+dNQ==
>>     
>
> Notice the "+". In certain situations in PHP, it will be HTML Decoded.
This
> means the "+" will turn into whitespace. Try this for an example:
>
> index.php:
> <?php
>   echo $_GET['d'];
> ?>
>
> Then visit http://yourhost/yourdirectory/index.php?d=Hello+World  ... it
> should display "Hello World" instead of "Hello+World".
>
>   
>>                    3. now , I change the showCookie.php
>>
>>                                      <?php
>>                                                echo "<script>alert('" .
>> $_COOKIE['TCSPUBLICJAUTHM'] . "');</script>";
>>                                                var_dump($_COOKIE);
>>                                      ?>
>>
>>                              That's print:
>>                                              [TCSPUBLICJAUTHM] =>
>> USER_ID=/zhW/2QXY/GUtIN7m4 dNQ==
>>     
>
> As you can see, the only difference is the "+" has been replaced by
> whitespace.
>  
>   
>>                    I think the cookie in php being changed.
>>     
>
> It is, but it's not as drastic as you would think. There is an expected
> behavior ("+" to " ") that you can deal with in your algorithm via
> substitution, encoding, etc.
>
> HTH,
>
>
> Todd Boyd
> Web Programmer
>
>   


--- End Message ---
--- Begin Message ---
Zhao chunliang[chunliang.zhao] wrote:
>       
> I'll use the string to decrypt, so that I want to they are the same.
> 
> When I use 'urlencode', some other string will be changed. Like '/'

see also http://php.net/rawurlencode

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


--- End Message ---
--- Begin Message --- is the a php function to find a word in a string and report back that it was found
--- End Message ---
--- Begin Message ---
http://php.net/strstr

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Richard Kurth wrote:
> is the a php function to find a word in a string and report back that
> it was found
>

--- End Message ---
--- Begin Message ---
Richard Kurth wrote:
is the a php function to find a word in a string and report back that it was found


Did you even look at the string section of the php manual?

http://us3.php.net/manual/en/ref.strings.php

Start here, it will get you all the information you are wanting.

you have strstr() or strpos() (both case-sensitive) use stristr() and stripos() if you are looking to be case insensitive. You could even use substr_count().

You have a number of options.

--
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 Wed, Nov 5, 2008 at 10:13 PM, Boyd, Todd M. <[EMAIL PROTECTED]> wrote:

> > -----Original Message-----
> > From: Shelley [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, November 05, 2008 4:19 AM
> > To: Aschwin Wesselius
> > Cc: php List
> > Subject: Re: [PHP] PHP screenshot capture code needed
> >
> > yes, saw that.
> > but that's not what I wanted. :)
> >
> > On Wed, Nov 5, 2008 at 6:04 PM, Aschwin Wesselius
> > <[EMAIL PROTECTED]>wrote:
> >
> > >  Shelley wrote:
> > >
> > > Hi all,
> > >
> > > Do you know how to generate the screenshot of some URL with PHP?
> > >
> > > Fyi,
> > > should work under linux environment.
> > >
> > > Thanks in advance.
> > >
> > >
> > >
> > >  Hi,
> > >
> > > I suggest you first look in the archives of this list for possible
> > answers
> > > before asking a question of any kind.
> > >
> > > Hint: this topic has been handled just a few weeks ago on this list.
>
> It may not be what you wanted, but regardless, the suggestions in those
> previous discussions are the best we could come up with. I don't think
> anything's changed in the "screenshot from a web browser" market in the last
> couple of weeks.

Yes. you are right. I appreciate the help in the previous thread very much.
With their help, I managed to find a perl script  and am working on it now.
Thanks.

>
>
> Maybe it has. STFW.
>
>
> Todd Boyd
> Web Programmer
>



-- 
With best regards,
Shelley Shyan
http://phparch.cn

--- End Message ---
--- Begin Message ---
Hi All,
I am using PHP's senderxml library to generate the xml. My problem is that
xml generated by this library encode some characters like >, & etc. Since i
have to give the output xml to the device so i don't want to encode these
characters.

I know there is html_entity_decode method which can decode these characters.
But I want to confirm that whether this method is decoding all characters or
i need to use some other method for that? Also if there any parameter in
senderxml library which tells this library not to encode the output xml.

Any help will be appreciated.

Regards,
Manoj Kumar Singh

--- End Message ---

Reply via email to