[PHP] owner of files created by fopen() become wrong?

2005-09-06 Thread Wong HoWang
Hi all,

I am so sorry that I have a lot of questions... This time I got a special 
issue... I have set up a VirtualHost for the domain that have problem. Since 
I am using Apache/1.3.33 , I have set the User  Group inside  outside the 
VirtualHost ... ... /VirtualHost  tags. As you know, the user  group 
set outside VirtualHost will be the user  group that the main server run 
with. And the one inside will be used for that domain only. The question 
comes, when I trying to run a script that use fopen('.xxx','w'); to 
create a file(or even create a dir), the file owner  group is 'apache', 
that is the user  group I run apache with, but NOT the one inside the 
VirtualHost!!! I have tried to restart my server and make sure the 
httpd.conf loaded corrrectly, but the question is still there, can anyone 
tell me how to solve this problem? Plesae help!

Thx! 

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



[PHP] disable safe_mode with .htaccess ?

2005-09-05 Thread Wong HoWang
Hello everyone,

I have a special question and want to ask here, hope anyone can answer me.

My server is Apache/1.3.33 with PHP/4.3.10
I have AllowOverride All in my httpd.conf and safe_mode = On in php.ini , I 
want to turn off safe_mode in one folder by .htaccess , is it possiable? I 
don't want to make changes to my httpd.conf or php.ini because that is a 
productive server and shouldn't restart it.

Please help, thank you!

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



[PHP] Help: Get the value of pi up to 200+ digits?

2005-09-01 Thread Wong HoWang
Dear all,

I'm trying to do like this but failed:

?php
ini_set('precision',16);
echo pi();
?

How can I get more digits after . ?

Can anyone help? Thx!

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



[PHP] Help: Get the value of pi up to 200+ digits?

2005-09-01 Thread Wong HoWang
Dear all,

I'm trying to do like this but failed:

?php
ini_set('precision',16);
echo pi();
?

How can I get more digits after . ?

Can anyone help? Thx!

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



Re: [PHP] Help: Get the value of pi up to 200+ digits?

2005-09-01 Thread Wong HoWang
but my server configure don't have bcmath enabled, is there any other way to 
do so?

Torgny Bjers [EMAIL PROTECTED] wrote:[EMAIL PROTECTED]
 Wong HoWang wrote:
 Dear all,

 I'm trying to do like this but failed:

 ?php
 ini_set('precision',16);
 echo pi();
 ?

 How can I get more digits after . ?

 I am fairly sure that you have to use BCMath for this:
 http://www.php.net/manual/en/ref.bc.php

 Give it a go and see what happens! :)

 Regards,
 Torgny 

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



Re: [PHP] Help: Get the value of pi up to 200+ digits?

2005-09-01 Thread Wong HoWang
Dear Jordan,

I know what you mean. But you may try this one and you will know:
?php
ini_set('precision',200);
echo pi();
?
the result is the same as 16!!!

So that's why I ask this question! I am not stupid like that!

Please help, thx!


Jordan Miller [EMAIL PROTECTED] 
wrote:[EMAIL PROTECTED]
 http://us3.php.net/manual/en/ini.core.php#ini.precision

 precision sets the number of significant digits, *NOT* the number of 
 digits displayed after the decimal point.

 If you want to get pi out to 16 decimal places you need a precision  of 
 *17* because the beginning 3 is a significant digit.

 Your code does exactly this, displaying pi with 15 decimal places.

 Jordan



 On Sep 1, 2005, at 8:06 AM, Wong HoWang wrote:

 Dear all,

 I'm trying to do like this but failed:

 ?php
 ini_set('precision',16);
 echo pi();
 ?

 How can I get more digits after . ?

 Can anyone help? Thx!

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



 

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



[PHP] Re: Saturdays and Sundays

2005-09-01 Thread Wong HoWang
the answer is simply yes!
You can have a simple for looping to do so.

?php
// for example, 02/2005
$year = 2005;
$month = 02;

for ($i = 1; $i = 31 ; $i++) {
 if (checkdate($month,$i,$year)) {
  if (date(w,mktime(0,0,0,$month,$i,$year)) == '0') // it is Sunday
   echo $i . '/' . $month . '/' . $year . \n;
  if (date(w,mktime(0,0,0,$month,$i,$year)) == '6') // it is Saturday
   echo $i . '/' . $month . '/' . $year . \n;
 }
}
/** Sample output:
5/2/2005
6/2/2005
12/2/2005
13/2/2005
19/2/2005
20/2/2005
26/2/2005
27/2/2005
**/
?

hope this help!


Shaun [EMAIL PROTECTED] 
wrote:[EMAIL PROTECTED]
 Hi,

 Is it possible to get the number of saturdays and sundays for a given 
 month / year?

 Thanks for your help. 

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



[PHP] Super globals ?

2005-08-20 Thread Wong HoWang
Dear all,

Hello, I want to know that is there any way to create a super global in PHP?

Please help!
Thanks. 

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



[PHP] Super globals ?

2005-08-20 Thread Wong HoWang
Dear all,

Hello, I want to know that is there any way to create a super global in PHP?

Please help!
Thanks.

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



Re: [PHP] Super globals ?

2005-08-20 Thread Wong HoWang
yes, I am asking how to start my own super global...
And even a PHP beginner know that $GLOBALS is a array containing all the 
global variables and it is used in a function or a class. So I think no one 
will ask a question here which the answer is simply $GLOBALS.

Any finally, thanks Jasper for the answer.

Jasper Bryant-Greene [EMAIL PROTECTED] 
wrote:[EMAIL PROTECTED]
 Kevin Waterson wrote:
 This one time, at band camp, Jasper Bryant-Greene 
 [EMAIL PROTECTED] wrote:


Because he asked for superglobals, not globals. $GLOBALS (not $_GLOBALS)

 meh, force of habit

happens to be an example of a superglobal.


 and variable can be set within its scope, so why not use it?
 As we see in the manual at $GLOBALS _is_ a super global and available
 to all scopes within the script.
 http://www.php.net/manual/en/reserved.variables.php#reserved.variables.globals
 it refers to $GLOBALS as  This is a 'superglobal', or automatic global, 
 variable. 

 gotta love the php manual

 Exactly Kevin. What the OP wanted was to create another superglobal, just 
 like $GLOBALS. The contents of $GLOBALS refer to the global variables, 
 which are *not* all superglobals. The only superglobals by default in PHP 
 (apart from $GLOBALS) are $_SERVER, $_GET, $_POST, and so on.

 He asked a question, and I provided the answer. Why he wants to do it is 
 another question, but telling him to use $GLOBALS isn't answering his 
 question, it's answering a different question, namely how to access the 
 global variables.

 Jasper 

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



[PHP] Problem when encoding non-english into UTF-8

2005-08-15 Thread Wong HoWang
Dear all,

When I try to encode non-english char. such as big5 to UTF-8 with 
utf8_encode(), it always generate a wrong result, which is not readable. 
What can I do?

Please help! 

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



[PHP] curl?

2005-08-13 Thread Wong HoWang
Hi, Everybody!

I got this when I execute the script:
Fatal error: Call to undefined function: curl_init() in msnp9.class.php on 
line 259

is there anyway to solve it? 

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



[PHP] How to start a global variable within a function?

2005-08-08 Thread Wong HoWang
as title, how to start a global variable within a function?


[PHP] How to start a global variable within a function?

2005-08-08 Thread Wong HoWang
as title, how to do that? 

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



[PHP] How to start a global variable within a function?

2005-08-08 Thread Wong HoWang
as title, how to do that?

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



Re: [PHP] How to start a global variable within a function?

2005-08-08 Thread Wong HoWang
but, I mean I haven't start the global variable BEFORE the function is 
called...
Jasper Bryant-Greene [EMAIL PROTECTED] 
wrote:[EMAIL PROTECTED]
 ?php
 $someGlobalVariable = 'foo';

 function myFunction() {
 global $someGlobalVariable;

 // do stuff with $someGlobalVariable
 }
 ?

 Jasper

 Wong HoWang wrote:
 as title, how to start a global variable within a function? 

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



Re: [PHP] How to start a global variable within a function?

2005-08-08 Thread Wong HoWang
but, I mean I haven't start the global variable BEFORE the function is
called...
Jasper Bryant-Greene [EMAIL PROTECTED]
wrote:[EMAIL PROTECTED]
 ?php
 $someGlobalVariable = 'foo';

 function myFunction() {
 global $someGlobalVariable;

 // do stuff with $someGlobalVariable
 }
 ?

 Jasper

 Wong HoWang wrote:
 as title, how to start a global variable within a function?

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



Re: [PHP] How to start a global variable within a function?

2005-08-08 Thread Wong HoWang
That is something like:
?php
fubction myfunc(){
$foo = 'bar'; // I want this $foo can access outside
}
myfunc();
echo $foo;
?

Can I write like this?

?php
function myfunc(){
$GLOBALS['foo'] = 'bar';
}
myfunc();
echo $foo;
?
Jasper Bryant-Greene [EMAIL PROTECTED] 
wrote:[EMAIL PROTECTED]
 ?php
 $someGlobalVariable = 'foo';

 function myFunction() {
 global $someGlobalVariable;

 // do stuff with $someGlobalVariable
 }
 ?

 Jasper

 Wong HoWang wrote:
 as title, how to start a global variable within a function? 

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