OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
php-general Digest 22 May 2008 16:57:25 -0000 Issue 5473

php-general-digest-helplists.php.net
Date: Thu May 22 2008 - 11:57:25 CDT


php-general Digest 22 May 2008 16:57:25 -0000 Issue 5473

Topics (messages 274623 through 274633):

Help preg_replace with Non-English character
        274623 by: Shelley
        274624 by: Richard Heyes
        274626 by: Shelley

Re: A Little Something.
        274625 by: Robin Vickery
        274627 by: Stut
        274632 by: Philip Thompson
        274633 by: Robin Vickery

Unzipping file through PHP
        274628 by: Suamya Srivastava
        274629 by: Gabriel Sosa
        274630 by: Wolf
        274631 by: TG

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


Hi all,

Just a question, I want to replace some Chinese characters with
preg_replace().

But it does not work.

The string is

$str = 'test<<你好>>http://www.phparch.cn/ 完成';

The ideal output is :
test<a href="http://www.phparch.cn">你好</a> 完成

Any suggestion will be greatly appreciated.

--
Regards,
Shelley

attached mail follows:


> Just a question, I want to replace some Chinese characters with
> preg_replace().
>
> But it does not work.
>
> The string is
>
> $str = 'test<<你好>>http://www.phparch.cn/ 完成';
>
> The ideal output is :
> test<a href="http://www.phparch.cn">你好</a> 完成
>
> Any suggestion will be greatly appreciated.

Have a look to see if the mb_* functions will help.

http://uk3.php.net/manual/en/book.mbstring.php

--
               Richard Heyes

          In Cambridge? Employ me
         http://www.phpguru.org/cv

+----------------------------------------+
| Access SSH with a Windows mapped drive |
| http://www.phpguru.org/sftpdrive |
+----------------------------------------+

attached mail follows:


Yes, I have checked and tried that.
And I have successfully tested it with GB2312 encoding, but when turned to
UTF8. It does not work any more.
The server is using UTF8 encoding, and also the database.
Weird.

On Thu, May 22, 2008 at 4:51 PM, Richard Heyes <richardhphpguru.org> wrote:

> Just a question, I want to replace some Chinese characters with
>> preg_replace().
>>
>> But it does not work.
>>
>> The string is
>>
>> $str = 'test<<你好>>http://www.phparch.cn/ 完成';
>>
>> The ideal output is :
>> test<a href="http://www.phparch.cn">你好</a> 完成
>>
>> Any suggestion will be greatly appreciated.
>>
>
> Have a look to see if the mb_* functions will help.
>
> http://uk3.php.net/manual/en/book.mbstring.php
>
>
> --
> Richard Heyes
>
> In Cambridge? Employ me
> http://www.phpguru.org/cv
>
> +----------------------------------------+
> | Access SSH with a Windows mapped drive |
> | http://www.phpguru.org/sftpdrive |
> +----------------------------------------+
>

--
Regards,
Shelley

attached mail follows:


2008/5/21 Stut <stuttlegmail.com>:
> I was going to ignore this, but I'm in a confrontational mood today, so
> please accept my apologies for the noise.
>
> On 21 May 2008, at 14:08, Michelle Konzack wrote:
>
>> Am 2008-05-12 15:40:54, schrieb Stut:
>> Note: I am working for the french Ministry of Defense.
>
> Ooh, give 'em a peanut. I live and work in the UK and every site I work on
> that uses Google Analytics has nothing specific about Google Analytics in
> the privacy policy. They all talk about use of cookies, IP addresses and
> server logs and I've never had any complaints.

http://www.google.com/analytics/tos.html

7. PRIVACY . You will not (and will not allow any third party to) use
the Service to track or collect personally identifiable information of
Internet users, nor will You (or will You allow any third party to)
associate any data gathered from Your website(s) (or such third
parties' website(s)) with any personally identifying information from
any source as part of Your use (or such third parties' use) of the
Service. You will have and abide by an appropriate privacy policy and
will comply with all applicable laws relating to the collection of
information from visitors to Your websites. You must post a privacy
policy and that policy must provide notice of your use of a cookie
that collects anonymous traffic data.

So yeah, you don't need to specifically mention google-analytics. And
you're definitely
not allowed to link it to any personally identifying information. On
pain of Lawyers.

> But, at risk of labouring the point, I don't have an issue if you decide to
> worry about inconsequential things like websites gathering anonymous usage
> data so they can improve the experience for you. I couldn't care less if you
> disable Javascript to prevent evil popup ads. I don't really give a damn if
> you decide to use lynx as the ultimate surfer condom.

Really, I've no problem with sites gathering anonymous usage data. I only get
a little more wary when it's a third-party collecting the data as I
have no relationship
with them.

On the other hand, it really does depend who the third party is: I'm not that
bothered about Google. But I would block anything and everything from
Phorm or the like without a second thought.

> My issue is purely and simply that if someone decides to remove half the
> code for something they should not feel they have the right to complain to
> the developers when they see errors. You wouldn't expect a car to work if
> you removed all the cylinders, would you? But I'd love to see the persons
> face when you take it back and complain.

I don't think that's an accurate metaphor. In this case they were
allowing all the
code from the originating web server to run, but were blocking an independent
third party server.

It's more like expecting a car to work when you remove the trailer.

> Sometimes I wonder why I bother.

Pure contrariness? That's certainly my major motivation.

-robin

attached mail follows:


On 22 May 2008, at 09:56, Robin Vickery wrote:
> 2008/5/21 Stut <stuttlegmail.com>:
>> I was going to ignore this, but I'm in a confrontational mood
>> today, so
>> please accept my apologies for the noise.
>>
>> On 21 May 2008, at 14:08, Michelle Konzack wrote:
>>
>>> Am 2008-05-12 15:40:54, schrieb Stut:
>>> Note: I am working for the french Ministry of Defense.
>>
>> Ooh, give 'em a peanut. I live and work in the UK and every site I
>> work on
>> that uses Google Analytics has nothing specific about Google
>> Analytics in
>> the privacy policy. They all talk about use of cookies, IP
>> addresses and
>> server logs and I've never had any complaints.
>
> http://www.google.com/analytics/tos.html
>
> 7. PRIVACY . You will not (and will not allow any third party to) use
> the Service to track or collect personally identifiable information of
> Internet users, nor will You (or will You allow any third party to)
> associate any data gathered from Your website(s) (or such third
> parties' website(s)) with any personally identifying information from
> any source as part of Your use (or such third parties' use) of the
> Service. You will have and abide by an appropriate privacy policy and
> will comply with all applicable laws relating to the collection of
> information from visitors to Your websites. You must post a privacy
> policy and that policy must provide notice of your use of a cookie
> that collects anonymous traffic data.
>
> So yeah, you don't need to specifically mention google-analytics. And
> you're definitely
> not allowed to link it to any personally identifying information. On
> pain of Lawyers.

I think that's what I said, but thanks for the clarification.

>> But, at risk of labouring the point, I don't have an issue if you
>> decide to
>> worry about inconsequential things like websites gathering
>> anonymous usage
>> data so they can improve the experience for you. I couldn't care
>> less if you
>> disable Javascript to prevent evil popup ads. I don't really give a
>> damn if
>> you decide to use lynx as the ultimate surfer condom.
>
> Really, I've no problem with sites gathering anonymous usage data. I
> only get
> a little more wary when it's a third-party collecting the data as I
> have no relationship
> with them.

I can kinda understand that, especially since Google could, if they
wanted to, combine data from your travels around different sites to
build a better picture of you, but since it's all anonymous the only
use it would have is to provide better targeted advertising. I
personally have no issue with that since if I have to see ads on the
sites I visit I'd rather they were relevant to me.

> On the other hand, it really does depend who the third party is: I'm
> not that
> bothered about Google. But I would block anything and everything from
> Phorm or the like without a second thought.

Indeed, but Phorm is a completely different beast. In fact it's likely
to be impossible to block content coming from Phorm since their system
can potentially inject arbitrary code into pages before they reach you
- you may not even know it's coming from them unless you read a sites
privacy policy.

The only way to block it will be to change to an ISP that doesn't use
them. I wouldn't worry about it though, if it's going to be an opt-in
service (which it looks like it will) I don't see enough people doing
that to make it financially viable.

>> My issue is purely and simply that if someone decides to remove
>> half the
>> code for something they should not feel they have the right to
>> complain to
>> the developers when they see errors. You wouldn't expect a car to
>> work if
>> you removed all the cylinders, would you? But I'd love to see the
>> persons
>> face when you take it back and complain.
>
> I don't think that's an accurate metaphor. In this case they were
> allowing all the
> code from the originating web server to run, but were blocking an
> independent
> third party server.
>
> It's more like expecting a car to work when you remove the trailer.

Not really since the car doesn't need the trailer to function
properly. Maybe a better metaphor would be removing the aerial and
then complaining that the radio reception is very poor.

>> Sometimes I wonder why I bother.
>
> Pure contrariness? That's certainly my major motivation.

I do like disagreeing with people, especially when I think/know I'm
right.

-Stut

--
http://stut.net/

attached mail follows:


I'm sure Stut (and others) have said enough, but I can no longer
resist...

On May 21, 2008, at 8:08 AM, Michelle Konzack wrote:

> Am 2008-05-12 15:40:54, schrieb Stut:
>> CSS, but I may not be understanding what you mean by blunt.
>> Javascript
>> can be written such that it eats CPU and/or memory but this is of no
>> benefit to anyone so unless you're running on a prehistoric machine I
>> can't see that being an issue. And it's worth noting that even if a
>> script starts hammering the machine most browsers these days will
>> notice that, suspend it and offer to kill it.
>
> About yu "prehistoric machine" :
>
> My Devel-Station is a "AMD Phenom Quad 9800", running Debian GNU/
> Linux
> Unstable, Testing and Stable in Xen-DomU and I know a couple of
> Websites
> where Mozilla/Iceape locks up to one minute, consuming 100% of CPU-
> Time
> and then showing a Message Box, that a Script is consuming very
> much
> esources and if I continue, my Computer would not more responsive...
>
> WTF?
>
>> It is causing the error since it has blocked loading the external
>> file
>> but not the call to the code it contains. This, to me at least, seems
>> half-arsed. The error only exists on the page if you deny it
>> something
>> that it needs to run correctly. IMHO the assumption that if the call
>
> So forcing peoples to do things they do not want to do?

By holding a gun to your head?

> I do not know, what this urchinTacker() does, but since it is
> named
> "Tracker", I asume it is a tool, which collect infos about
> Websiteusers.
> A thing I do not like since it is violation of my privacy.

This statement appears to be one of ignorance. You claim that because
you don't know what it does and it has a certain name, it MUST be a
violation of your privacy. A violation of your privacy would be
gaining *personally-identifiable* information w/o your knowledge -
G.A. can't tell a web admin my first, middle, last names and DOB from
my browser. Do some reading about the product and then make an
educated statement.

>> to the urchinTracker function can run then so can the script tag to
>> pull in that code is pretty reasonable. In fact I make it all the
>> time
>> in the code I write and I think the same would go for 99.999% of
>> developers using Javascript.
>
> Ehm you mean, that I am one of those 0.001%?
>
> Hmmm, I do not know a singel JavaScript Developer here in Strasbourg
> who
> use it...

Either you're really popular to know lots of JS developers, or this is
just another statement based on little or no facts. Asking the 3 guys
next to you doesn't accurately summarize a city.

>> Urchin Tracker is a simple(!) analytics package and poses no danger
>> to
>> you or your computer. In fact I would suggest it's anti-productive to
>> block it since it prevents the sites you visit from using the data it
>> provides to modify their site to make the experience better for you.
>
> So collecting privacy infos about me? -- No thanks!

Again, no personally-identifiable information being sent...

>> That error is caused by your use of selective Javascript-blocking
>> technology, and while I work very hard to ensure the sites I develop
>> work as well as possible without Javascript I think it's unreasonable
>> to expect them to work with selective blocking.
>
> Selective because urchinTacker() tracker is collecting infos
> about me
> which I do not want to give out! -- Privacy violation!
>
> If you use such tools, you have to warn users of your website, that
> you
> are collecting data otherwise you could be run into trouble...

These statements are what really made me want to respond. From this
statement, you are basically saying that a majority of the sites out
there would have to have disclaimers. I know! Why don't we just
require web developers to reveal the secrets!(TM) of their sites and
give the source code so we can verify that they're not trying to find
the name of my cat when I was 8? I mean, come on. "[W]arn users of
your website"?? Don't get me wrong - I am all about security, but this
appears to be taking it a bit far. As a web surfer, one should be
aware of the potential risks and prepare reasonably!(TM) However, I
must question if you should even be on the web... how do you sleep at
night with all those javascript functions and cookies just parading
around the 'net?!

>> Well, some of his pages do but that's complicating the issue. As far
>> as I can tell the only bit of Javascript common to all Tedd's pages
>> is
>> the Google Analytics code which is not required for you to use the
>> site, it just enhances the ability for Tedd to analyse how people are
>> using it.
>
> Ahh, -- urchinTracker() is from Google. :-)
>
> And if used without informing users, it is definitivly a
> privacy
> violation. At least in most EU countries like Germany and France.

I must say that I can't speak for other countries (non-US), but I
don't see how this is a privacy violation - no personally-identifiable
information is being transmitted. If you consider an IP or web browser
as personally-identifiable, then I say you're wrong.

If we informed users about every tool we used to develop a site, I
guarantee we'd lose their interest very quickly and they would go on
to the next page that is not going to bombard them with information
they could care less about.

>> It can and I care greatly about security, but Javascript is very well
>> locked down these days, and it's fairly difficult to get it to do
>> anything malicious. Can it do annoying things, yes (but rarely these
>> days, and usually only on 'special' sites), but I've not come across
>> anything malicious for quite some time.
>
> Since I am working mobile with my ThinkPad, I do not like to be
> tracked
> by this urchinTracker() crap since this mean, Google will track
> ANY of
> my customers where I am working if I use the Internet...

...and provide them a better experience on the web.

> This is not only a privacy violation, it is spionage...

Prove it.

> This is HOW secret services (the NSA is using Google) are working.

Oh neat. You worked for Secret Services before you worked for the
French Ministry of Defense. You must be quite the security-guru. ;)

>> In summary I can understand where you're coming from, and it's
>> totally
>> your choice to use something that modifies your browsing experience,
>> but to then complain that it's causing errors on the sites you visit
>> is, to me, beyond ridiculous. That's all I was trying to point out.
>
> I do not know in which country you are, but all peoples worldwide
> should
> block such shit coming from at least the USA/GB/IL.

If you used Google Analytics, you could find where I'm typing this
email... =P

Ok, enough said from me - must get back to writing malicious code that
will tell me what IP you're ISP has given you!

~Philip

> Note: I am working for the french Ministry of Defense.
>
>
> Thanks, Greetings and nice Day
> Michelle Konzack
> Systemadministrator
> 24V Electronic Engineer
> Tamay Dogan Network
> Debian GNU/Linux Consultant

"Personally, most of my web applications do not have to factor 13.7
billion years of space drift in to the calculations, so PHP's rand
function has been great for me..." ~S. Johnson

attached mail follows:


2008/5/22 Philip Thompson <philthathrilgmail.com>:
> I'm sure Stut (and others) have said enough, but I can no longer resist...
>
> On May 21, 2008, at 8:08 AM, Michelle Konzack wrote:
>
>> Am 2008-05-12 15:40:54, schrieb Stut:
>>
>> I do not know, what this urchinTacker() does, but since it is named
>> "Tracker", I asume it is a tool, which collect infos about Websiteusers.
>> A thing I do not like since it is violation of my privacy.
>
> This statement appears to be one of ignorance. You claim that because you
> don't know what it does and it has a certain name, it MUST be a violation of
> your privacy. A violation of your privacy would be gaining
> *personally-identifiable* information w/o your knowledge - G.A. can't tell a
> web admin my first, middle, last names and DOB from my browser. Do some
> reading about the product and then make an educated statement.

Playing devils advocate here:

Firstly, you're mischaracterising her statement. She says she's
assuming it's a tool which collects information about users (which is
true) and she says she doesn't like such tools because she sees them
as a violation of her privacy (which is a matter of her opinion). She
does not say that it must be a violation of her privacy *because* she
doesn't know what it does and has a certain name.

Secondly, personally identifiable information doesn't have to be as
obvious as firstname/lastname/dob as Brian Clifton (European Head of
Web Analytics at Google) wrote in his book 'Advanced Web Metrics with
Google Analytics':

"Note: On the internet, IP addresses are classed as personally
identifiable information."

And Google Analytics is most definitely getting IP addresses, even if
they say they discard them when they no longer need them.

>> If you use such tools, you have to warn users of your website, that you
>> are collecting data otherwise you could be run into trouble...
>
> These statements are what really made me want to respond. From this
> statement, you are basically saying that a majority of the sites out there
> would have to have disclaimers.

Well, actually section 7 of their terms of service with google
analytics requires them to have notices.

 I know! Why don't we just require web
> developers to reveal the secrets!(TM) of their sites and give the source
> code so we can verify that they're not trying to find the name of my cat
> when I was 8? I mean, come on. "[W]arn users of your website"?? Don't get me
> wrong - I am all about security, but this appears to be taking it a bit far.
> As a web surfer, one should be aware of the potential risks and prepare
> reasonably!(TM) However, I must question if you should even be on the web...
> how do you sleep at night with all those javascript functions and cookies
> just parading around the 'net?!

Have you had a little too much coffee today?

-robin

attached mail follows:


Hi,

I am writing a code to upload multiple files on the server using PHP. I
zipped the folder containing these files, uploaded the zipped file through
my application on the server. Now,I am trying to unzip the .zip file using
PHP. I tried it in different ways using:
1. `unzip filename.zip`
2. system ("unzip filename.zip")
3. system (`unzip filename.zip`)

but it doesnt seem to work. However, the same commands work from command
line. anybody has any ideas what might be wrong here?

Thanks,
Suamya.

 
-----------------------------------------------------------------------------
DISCLAIMER:-
          "The information in this e-mail is confidential, and is intended
solely for the addressee or addressees. If you are not the intended recipient,
 please delete the mail and kindly notify the sender of misdelivery. Any
unauthorised use or disclosure of the contents of the mail is not permitted
and may be unlawful."
-----------------------------------------------------------------------------

                         "Scanned By MailScanner"

attached mail follows:


try using something like

http://www.theserverpages.com/php/manual/en/ref.zip.php

http://www.theserverpages.com/php/manual/en/ref.zip.php

On Thu, May 22, 2008 at 9:56 AM, Suamya Srivastava
<suamya.srivastavaconnexios.com> wrote:
> Hi,
>
> I am writing a code to upload multiple files on the server using PHP. I
> zipped the folder containing these files, uploaded the zipped file through
> my application on the server. Now,I am trying to unzip the .zip file using
> PHP. I tried it in different ways using:
> 1. `unzip filename.zip`
> 2. system ("unzip filename.zip")
> 3. system (`unzip filename.zip`)
>
> but it doesnt seem to work. However, the same commands work from command
> line. anybody has any ideas what might be wrong here?
>
> Thanks,
> Suamya.
>
>
> -----------------------------------------------------------------------------
> DISCLAIMER:-
> "The information in this e-mail is confidential, and is intended
> solely for the addressee or addressees. If you are not the intended recipient,
> please delete the mail and kindly notify the sender of misdelivery. Any
> unauthorised use or disclosure of the contents of the mail is not permitted
> and may be unlawful."
> -----------------------------------------------------------------------------
>
> "Scanned By MailScanner"
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
Los sabios buscan la sabidura; los necios creen haberla encontrado.
Gabriel Sosa

attached mail follows:


---- Suamya Srivastava <suamya.srivastavaconnexios.com> wrote:
> Hi,
>
> I am writing a code to upload multiple files on the server using PHP. I
> zipped the folder containing these files, uploaded the zipped file through
> my application on the server. Now,I am trying to unzip the .zip file using
> PHP. I tried it in different ways using:
> 1. `unzip filename.zip`
> 2. system ("unzip filename.zip")
> 3. system (`unzip filename.zip`)
>
> but it doesnt seem to work. However, the same commands work from command
> line. anybody has any ideas what might be wrong here?
>
> Thanks,
> Suamya.
>

RTFM is a GREAT place to start. http://us3.php.net/zip

What errors show up in your logs?

Wolf

attached mail follows:


Last night I was looking around at frameworks and such and I found "ez Components" which has an 'archive' module that assists in handling Zip files: http://ezcomponents.org/docs/api/latest/introduction_Archive.html ----- Original Message ----- From: "Gabriel Sosa" <sosagabrielgmail.com> To: suamya.srivastavaconnexios.com Cc: php-generallists.php.net Date: Thu, 22 May 2008 10:46:01 -0300 Subject: Re: [PHP] Unzipping file through PHP > try using something like > > http://www.theserverpages.com/php/manual/en/ref.zip.php > > > > > http://www.theserverpages.com/php/manual/en/ref.zip.php > > On Thu, May 22, 2008 at 9:56 AM, Suamya Srivastava > <suamya.srivastavaconnexios.com> wrote: > > Hi, > > > > I am writing a code to upload multiple files on the server using PHP. I > > zipped the folder containing these files, uploaded the zipped file through > > my application on the server. Now,I am trying to unzip the .zip file using > > PHP. I tried it in different ways using: > > 1. `unzip filename.zip` > > 2. system ("unzip filename.zip") > > 3. system (`unzip filename.zip`) > > > > but it doesnt seem to work. However, the same commands work from command > > line. anybody has any ideas what might be wrong here? > > > > Thanks, > > Suamya. > > > > > > ----------------------------------------------------------------------------- > > DISCLAIMER:- > > "The information in this e-mail is confidential, and is intended > > solely for the addressee or addressees. If you are not the intended recipient, > > please delete the mail and kindly notify the sender of misdelivery. Any > > unauthorised use or disclosure of the contents of the mail is not permitted > > and may be unlawful." > > ----------------------------------------------------------------------------- > > > > "Scanned By MailScanner" > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > -- > Los sabios buscan la sabidura; los necios creen haberla encontrado. > Gabriel Sosa > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >