php-windows Digest 18 Feb 2007 01:37:28 -0000 Issue 3142
Topics (messages 27494 through 27498):
Re: UTF-8 standard
27494 by: Niel Archer
27498 by: Harpreet
Why are there locale troubles under Windows?
27495 by: Daniele C.
27496 by: Daniele C.
Re: A measre of security
27497 by: bedul
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 ---
Hi
> I wondered if PHP allowed for Unicode character sets (such as by using
> the UTF-8 standard)?
Quick answer: Yes
Longer Answer: Yes but you have to be a little careful as not all parts
and extensions of php support UTF-8 encoding, or require you to specify
UTF-8. PHP itself can be set to use UTF-8 for its output, obviously the
headers of your page need to be set appropriately.
Niel
--- End Message ---
--- Begin Message ---
Would this also require changes to the MSDE tables/fields or global
settings?
We are planning on selling our product into the international markets.
The GUIs of our applications would not change but they would like for
whatever the users type to be in their native language using the
appropriate Unicode character set.
Do we have a rough estimate of how much time it might take to make all
of these changes in PHP and MSDE?
Regards
Harpreet Kaur
-----Original Message-----
From: Niel Archer [mailto:Niel Archer] On Behalf Of Niel Archer
Sent: Friday, February 16, 2007 6:54 PM
To: [email protected]
Subject: Re: [PHP-WIN] UTF-8 standard
Hi
> I wondered if PHP allowed for Unicode character sets (such as by using
> the UTF-8 standard)?
Quick answer: Yes
Longer Answer: Yes but you have to be a little careful as not all parts
and extensions of php support UTF-8 encoding, or require you to specify
UTF-8. PHP itself can be set to use UTF-8 for its output, obviously the
headers of your page need to be set appropriately.
Niel
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
--
I will report a snippet from http://php.net/setlocale
> Warning
>
> The locale information is maintained per process, not per thread. If
> you are running PHP on a multithreaded server api like IIS or Apache
> on Windows you may experience sudden changes of locale settings while
> a script is running although the script itself never called setlocale
> itself. This happens due to other scripts running in different threads
> of the same process at the same time changing the processwide locale
> using setlocale().
>
I spent about 2 seconds before thinking: can it really be? I mean, is
there no way to set locale info per thread? And after a brief web
search I came up with this keyword: _configthreadlocale
Read more at
http://msdn2.microsoft.com/en-us/library//26c0tb7x(VS.80).aspx
(beware, this page is very slow or their servers are anyway).
Looks like this function exists since Windows 95 and guess what it
does: it affects the behaviour of the locale functions so that _each
thread will have indipendent locale settings_.
So, I though: WHY? Why does not PHP use such function in the win32
binding?
Let's be clear, I don't think to have found a solution that (the great)
PHP developers could not find, but I would like to know why they did
not fix the bad behaviour of PHP's setlocale() function using the
_configthreadlocale() win32 function, there must be some reason I
really could not think about up to now.
I really hope somebody can point me to something to read about this
topic (I found pretty nothing up to now) or better directly explain it
to me.
Thank you
--
Daniele C.
--- End Message ---
--- Begin Message ---
I will report a snippet from http://php.net/setlocale
Warning
The locale information is maintained per process, not per thread.
If you are running PHP on a multithreaded server api like IIS or Apache
on Windows you may experience sudden changes of locale settings while a
script is running although the script itself never called setlocale()
itself. This happens due to other scripts running in different threads
of the same process at the same time changing the processwide locale
using setlocale().
I spent about 2 seconds before thinking: can it really be? I mean, is
there no way to set locale info per thread? And after a brief web
search I came up with this keyword: _configthreadlocale
Read more at
http://msdn2.microsoft.com/en-us/library//26c0tb7x(VS.80).aspx (beware,
this page is very slow or their servers are anyway).
Looks like this function exists since Windows 95 and guess what it
does: it affects the behaviour of the locale functions so that _each
thread will have indipendent locale settings_.
So, I though: WHY? Why does not PHP use such function in the windows
binding?
Let's be clear, I don't think to have found a solution that (the great)
PHP developers could not find, but I would like to know why they did
not fix the bad behaviour of PHP's setlocale() function using the
_configthreadlocale() win32 function, there must be some reason I
really could not think about up to now.
I really hope somebody can point me to something to read about this
topic (I found pretty nothing up to now) or better directly explain it
to me.
Thank you
--
Daniele C.
--
We make a steel CMS, Drake CMS
--- End Message ---
--- Begin Message ---
cmiiw
----- Original Message -----
From: "Gustav Wiberg" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, February 14, 2007 6:39 PM
Subject: [PHP-WIN] A measre of security
Hi!
This is a kind of security-question....
I'm starting up a system, where several customers should be able to login
with there own information.
Each company I give unique identity with "hard-coding" and each company has
its own folder...
Harding-coding, something like:
$company -> setIDCompany(1);
$company -> setIDCompany(2);
$company -> setIDCompany(3);
[bedul]
you should not try hardcoding by your self.. is suffer your health.. hehehe
why don't you use an id.. if you enter this using db.. every new record or
company will given a new id..
like you enter new comp anda the new will have 4 and soon
but if this not what you wanted.. just created a random var like this
i enter new comp.. where the var given = a4s43.. this comp will have id
a4s43 and have folder named a4s43
=====================================================
Diffrent folders:
customers/company1
customers/company2
customers/company3
and so on...
This isn't complicated, but when I add a new company.... ...I must be
200% sure that the IDCompany is set correct (There is a chance of setting
the wrong ID for a new company or forgetting to change it)
[bedul]
to search what your id entered .. try use
int mysql_insert_id ( [resource link_identifier] )
Retrieves the ID generated for an AUTO_INCREMENT column by the previous
INSERT query.
=======================================
The companys ARE NOT ALLOWED to see each others information.
[bedul]
try above suggestion.. use random var for folder.. how to get em??
$idFromTable=mysql_insert_id ($handle);
$rndNum=rand(2100);
$randomID="a".$idFromTable."s".$rndNum;
========================================
Is there any good way of solving this with some sort of
comparision-mechanism or something like that? Any thoughts?
[bedul]
interesting. can u explain more about 'sort of comparision-mechanism'??
===================
--- End Message ---