Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Petrus Bastos
Nick,

Thanks again for your worry. So, let's go, here goes my situation. I'm
exporting data to another system. That system have an option to be feed by a
password protected zip file. The export activity will be occur in this way:
the user will generate the file on my application and will put this file
into that another system. So, I need generate that file. Maybe one solution
is to generate the file unzipped and determine that user should zip the file
with password on his Windows or Linux operating system. But, I can't let
that responsibility on user hands. So, because that I need to generate the
file already protected.

PS: Sorry my bad english. I'm Brazilian and I'm not fluent english.

Thanks one more time,
Petrus Bastos.

On Feb 18, 2008 12:26 AM, Nick Stinemates [EMAIL PROTECTED] wrote:

 Petrus Bastos wrote:
  Chris,
 
  Thanks for your help, but I think that package can't make what I
 want.
  But , I appreciate your help anyway and if you have any other ideas,
 please
  let me know! :)
 
  Thanks,
  Petrus Bastos.
 
  On Feb 17, 2008 10:38 PM, Chris [EMAIL PROTECTED] wrote:
 
 
  Petrus Bastos wrote:
 
  Unfortunately I don't have access to this family of methods because
 
  security
 
  policy. Lefting this way out, I didn't find anyway on how to do that.
 If
 
  you
 
  have any idea or know any module can do that, I'll appreciate to know
 
  too!
 
  See if the pear package does what you want:
 
  http://pear.php.net/package/File_Archive
 
  --
  Postgresql  php tutorials
  http://www.designmagick.com/
 
 
 
 
 I'm sure you know what you're doing, but maybe you'd be better off
 letting us know the task / process to better understand what you'd like
 to accomplish. From there, since it's obvious that PHP does not have
 built in password functions, and that exec() is out of the question;
 maybe we can figure out how to move onward.

 --
 ==
 Nick Stinemates ([EMAIL PROTECTED])
 http://nick.stinemates.org

 AIM: Nick Stinemates
 MSN: [EMAIL PROTECTED]
 Yahoo: [EMAIL PROTECTED]
 ==





[PHP] open a secondary window/tab in the browser from php

2008-02-18 Thread julian



Hi,

I have an application that along  filling in some forms, it produces a 
pdf file, as confirmation of all entered data.


I want to send this pdf file to a different window/tab of the browser, 
so it is displayed and can latter be printed.


In the mean time, the original window contains a confirmation message, 
to continue with the work flow.


I would like to do this without use of JavaScript

Any combination of headers ??

Any hints appreciated.

JCG

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



Re: [PHP] open a secondary window/tab in the browser from php

2008-02-18 Thread Børge Holen
On Monday 18 February 2008 13:59:11 julian wrote:
 Hi,

 I have an application that along  filling in some forms, it produces a
 pdf file, as confirmation of all entered data.

 I want to send this pdf file to a different window/tab of the browser,
 so it is displayed and can latter be printed.

html target?


 In the mean time, the original window contains a confirmation message,
 to continue with the work flow.

 I would like to do this without use of JavaScript

 Any combination of headers ??

 Any hints appreciated.

 JCG



-- 
---
Børge Holen
http://www.arivene.net

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



Re: [PHP] open a secondary window/tab in the browser from php

2008-02-18 Thread Zoltán Németh
2008. 02. 18, hétfő keltezéssel 13.59-kor julian ezt írta:
 
 Hi,
 
 I have an application that along  filling in some forms, it produces a 
 pdf file, as confirmation of all entered data.
 
 I want to send this pdf file to a different window/tab of the browser, 
 so it is displayed and can latter be printed.
 
 In the mean time, the original window contains a confirmation message, 
 to continue with the work flow.
 
 I would like to do this without use of JavaScript

I don't think you can do that...

greets
Zoltán Németh

 
 Any combination of headers ??
 
 Any hints appreciated.
 
 JCG
 

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



[PHP] Converting tab delimited file to CSV

2008-02-18 Thread Graham Cossey
I was wondering if someone could offer some advice please.

I'm being sent data in tab delimited files which I'm trying to split
into smaller files and convert to comma delimited using PHP.

Now, I can replace the tabs with commas and opening the resulting
files in a basic text editor all looks fine. However when I open the
files in M$ Excel they're still being treated as tab delimited and all
values are being shoved into a single column.

What can I do in the PHP code to specifically make the file CSV and be
treated as such by M$ Excel?

I'm currently just using fopen for old and new files and fwrite.

-- 
Graham

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



Re: [PHP] open a secondary window/tab in the browser from php

2008-02-18 Thread julian


 not html target, pdf window so it can be saved and printed 
separately form the application.


Børge Holen wrote:

On Monday 18 February 2008 13:59:11 julian wrote:

Hi,

I have an application that along  filling in some forms, it produces a
pdf file, as confirmation of all entered data.

I want to send this pdf file to a different window/tab of the browser,
so it is displayed and can latter be printed.


html target?


In the mean time, the original window contains a confirmation message,
to continue with the work flow.

I would like to do this without use of JavaScript

Any combination of headers ??

Any hints appreciated.

JCG






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



Re: [PHP] open a secondary window/tab in the browser from php

2008-02-18 Thread Neo [GC]

No, this is not possible.

You have to do at least two requests, one to get the PDF, one to get the 
html confirmation message.


Normally you would onle open the pdf in a new window using 
target=_blank for the link. Workflow isn't broken, but you have no 
confirmation message.


There are several ways to do what you want with javascript, but without 
there is none.



julian schrieb:



Hi,

I have an application that along  filling in some forms, it produces a 
pdf file, as confirmation of all entered data.


I want to send this pdf file to a different window/tab of the browser, 
so it is displayed and can latter be printed.


In the mean time, the original window contains a confirmation message, 
to continue with the work flow.


I would like to do this without use of JavaScript

Any combination of headers ??

Any hints appreciated.

JCG



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



Re: [PHP] Converting tab delimited file to CSV

2008-02-18 Thread Hiep Nguyen

On Mon, 18 Feb 2008, Graham Cossey wrote:


I was wondering if someone could offer some advice please.

I'm being sent data in tab delimited files which I'm trying to split
into smaller files and convert to comma delimited using PHP.

Now, I can replace the tabs with commas and opening the resulting
files in a basic text editor all looks fine. However when I open the
files in M$ Excel they're still being treated as tab delimited and all
values are being shoved into a single column.

What can I do in the PHP code to specifically make the file CSV and be
treated as such by M$ Excel?

I'm currently just using fopen for old and new files and fwrite.

--
Graham

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




don't double-click on file_name.csv, instead open MS Excel, then click on 
file open and locate your file, then you'll know what to do from there.


t. hiep

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



Re: [PHP] Converting tab delimited file to CSV

2008-02-18 Thread Graham Cossey
On Feb 18, 2008 1:58 PM, Edward Kay [EMAIL PROTECTED] wrote:

  Now, I can replace the tabs with commas and opening the resulting
  files in a basic text editor all looks fine.

 When you do this, ensure you escape any commas that may exist in the data.

 IIRC, Excel handles this be enclosing the whole field in double quotes.
 Can remember how it handles escaping these though...

 Edward



I know I can Open in Excel and then go through an import process
specifying the delimiter and string enclosure etc, however the files I
used to get were true CSV files and opened fine, I'm wondering if
there's some kind a file header or the like that specifies the kind of
data contained in the file.

I don't have an issue with commas within the data, but thanks for highlighting.

Probably just excel trying to be helpful again and totally scr3wing
things up :-/


-- 
Graham

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



RE: [PHP] Converting tab delimited file to CSV

2008-02-18 Thread Edward Kay

 Now, I can replace the tabs with commas and opening the resulting
 files in a basic text editor all looks fine.

When you do this, ensure you escape any commas that may exist in the data.

IIRC, Excel handles this be enclosing the whole field in double quotes.
Can remember how it handles escaping these though...

Edward

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



RE: [PHP] open a secondary window/tab in the browser from php

2008-02-18 Thread Jay Blanchard
[snip]
  not html target, pdf window so it can be saved and printed 
separately form the application.
[/snip]

You have to use an anchor tag's target attribute to open the new tab or
window (PHP is server-side and cannot do this);

a href=/path/to/my.pdf target=_blank 

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



Re: [PHP] Question about cURL, and iFrames...

2008-02-18 Thread Dan Joseph
 On Feb 15, 2008 9:43 AM, Jason Pruim [EMAIL PROTECTED] wrote:

 I am trying to think through something, I am writing a simple proxy
 script for my own knowledge and to simplify my life :)

 What I want to do is bring in multiple website by going to 1 webpage
 (Think RSS for the entire website) have all the links work properly,
 login to the pages etc. etc. etc. I think I can do this with cURL
 which can pull the page in and display it properly, but I'm wondering
 if I should be displaying in an iFrame to keep my navigation links at
 the top to go around my site?


Well, I think the short answer to that is Yes, curl can do what you want.
You could pull in the page with curl, then go thru it and populate form
fields, then display it.  You wouldn't need an iframe, you'd just pull it in
with curl, run thru and populate the fields, then display the finished
product on the screen.  One thing you may also want to keep in mind is that
I think you'd have to go through and fix the image links and url links if
they don't have the full url path in the html.

-- 
-Dan Joseph

Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life.


Re: [PHP] Converting tab delimited file to CSV

2008-02-18 Thread Andrew Ballard
On Feb 18, 2008 8:58 AM, Edward Kay [EMAIL PROTECTED] wrote:


  Now, I can replace the tabs with commas and opening the resulting
  files in a basic text editor all looks fine.

 When you do this, ensure you escape any commas that may exist in the data.

 IIRC, Excel handles this be enclosing the whole field in double quotes.
 Can remember how it handles escaping these though...

 Edward


If there are double quotes inside a quoted string, they are doubled. eg.

This string contains quoted content in a CSV format that M$ products
can understand.

Andrew


RE: [PHP] Protected ZIP file with password

2008-02-18 Thread Bastien Koert

Hey, what about placing the unzipped folder into a dir that has a process 
watching it that will pick up the file, zip and protect it and then ftp (or 
another delivery mechanism) to the destination?
 
Bastien
 Date: Mon, 18 Feb 2008 08:59:02 -0300 From: [EMAIL PROTECTED] To: [EMAIL 
 PROTECTED] CC: [EMAIL PROTECTED]; php-general@lists.php.net Subject: Re: 
 [PHP] Protected ZIP file with password  Nick,  Thanks again for your 
 worry. So, let's go, here goes my situation. I'm exporting data to another 
 system. That system have an option to be feed by a password protected zip 
 file. The export activity will be occur in this way: the user will generate 
 the file on my application and will put this file into that another system. 
 So, I need generate that file. Maybe one solution is to generate the file 
 unzipped and determine that user should zip the file with password on his 
 Windows or Linux operating system. But, I can't let that responsibility on 
 user hands. So, because that I need to generate the file already protected. 
  PS: Sorry my bad english. I'm Brazilian and I'm not fluent english.  
 Thanks one more time, Petrus Bastos.  On Feb 18, 2008 12:26 AM, Nick 
 Stinemates [EMAIL PROTECTED] wrote:   Petrus Bastos wrote:   Chris, 
 Thanks for your help, but I think that package can't make what I  
 want.   But , I appreciate your help anyway and if you have any other 
 ideas,  please   let me know! :) Thanks,   Petrus Bastos. 
 On Feb 17, 2008 10:38 PM, Chris [EMAIL PROTECTED] wrote:
Petrus Bastos wrote: Unfortunately I don't have access 
 to this family of methods because security policy. 
 Lefting this way out, I didn't find anyway on how to do that.  If
  you have any idea or know any module can do that, I'll 
 appreciate to know too! See if the pear package does 
 what you want: http://pear.php.net/package/File_Archive
  --   Postgresql  php tutorials   http://www.designmagick.com/  
 I'm sure you know what you're doing, but maybe you'd be 
 better off  letting us know the task / process to better understand what 
 you'd like  to accomplish. From there, since it's obvious that PHP does not 
 have  built in password functions, and that exec() is out of the question; 
  maybe we can figure out how to move onward.   --  == 
  Nick Stinemates ([EMAIL PROTECTED])  http://nick.stinemates.org   
 AIM: Nick Stinemates  MSN: [EMAIL PROTECTED]  Yahoo: [EMAIL PROTECTED]  
 ==   
_



Re: [PHP] open a secondary window/tab in the browser from php

2008-02-18 Thread Daniel Brown
On Feb 18, 2008 8:55 AM, Jay Blanchard [EMAIL PROTECTED] wrote:
 [snip]
   not html target, pdf window so it can be saved and printed
 separately form the application.
 [/snip]

 You have to use an anchor tag's target attribute to open the new tab or
 window (PHP is server-side and cannot do this);

 a href=/path/to/my.pdf target=_blank

You can also do what sites like HR Block do - create an IFRAME
with the PDF displayed therein.  As long as the user has the Adobe
Acrobat plugin, the PDF will display inline, complete with all
toolbars and scrollbars, allowing them to save and print fine.

-- 
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?

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



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Petrus Bastos
Bastien,

I thank your help, but I think that your idea doesn't resolve my problem
because I need generate that file online when user clicks on a link.The file
must be obtained at the time he clicks.

Thanks anyway,
Petrus Bastos.

On Feb 18, 2008 12:18 PM, Bastien Koert [EMAIL PROTECTED] wrote:


 Hey, what about placing the unzipped folder into a dir that has a process
 watching it that will pick up the file, zip and protect it and then ftp (or
 another delivery mechanism) to the destination?

 Bastien
  Date: Mon, 18 Feb 2008 08:59:02 -0300 From: [EMAIL PROTECTED] To:
 [EMAIL PROTECTED] CC: [EMAIL PROTECTED]; php-general@lists.php.net
 Subject: Re: [PHP] Protected ZIP file with password  Nick,  Thanks again
 for your worry. So, let's go, here goes my situation. I'm exporting data to
 another system. That system have an option to be feed by a password
 protected zip file. The export activity will be occur in this way: the user
 will generate the file on my application and will put this file into that
 another system. So, I need generate that file. Maybe one solution is to
 generate the file unzipped and determine that user should zip the file with
 password on his Windows or Linux operating system. But, I can't let that
 responsibility on user hands. So, because that I need to generate the file
 already protected.  PS: Sorry my bad english. I'm Brazilian and I'm not
 fluent english.  Thanks one more time, Petrus Bastos.  On Feb 18, 2008
 12:26 AM, Nick Stinemates [EMAIL PROTECTED] wrote:   Petrus Bastos
 wrote:   Chris, Thanks for your help, but I think that package
 can't make what I  want.   But , I appreciate your help anyway and if
 you have any other ideas,  please   let me know! :) Thanks,
   Petrus Bastos. On Feb 17, 2008 10:38 PM, Chris 
 [EMAIL PROTECTED] wrote:   Petrus Bastos wrote:   
  Unfortunately I don't have access to this family of methods because 
security policy. Lefting this way out, I didn't find
 anyway on how to do that.  If you have any idea
 or know any module can do that, I'll appreciate to know too! 
See if the pear package does what you want:
 http://pear.php.net/package/File_Archive --   Postgresql 
 php tutorials   http://www.designmagick.com/ 
 I'm sure you know what you're doing, but maybe you'd be better off 
 letting us know the task / process to better understand what you'd like 
 to accomplish. From there, since it's obvious that PHP does not have 
 built in password functions, and that exec() is out of the question; 
 maybe we can figure out how to move onward.   --  ==
  Nick Stinemates ([EMAIL PROTECTED])  http://nick.stinemates.org 
  AIM: Nick Stinemates  MSN: [EMAIL PROTECTED]  Yahoo:
 [EMAIL PROTECTED]  ==   
 _




Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Wolf

 Petrus Bastos [EMAIL PROTECTED] wrote: 
 Bastien,
 
 I thank your help, but I think that your idea doesn't resolve my problem
 because I need generate that file online when user clicks on a link.The file
 must be obtained at the time he clicks.
 
 Thanks anyway,
 Petrus Bastos.
 
!-- SNIP --

What methods do you have available?  When you run phpinfo script (?php 
phpinfo() ? what does it say the compile statement is?  

If it was compiled --with-zip then you should be good with the PECL usage
http://us3.php.net/zip

Otherwise, you are probably SOL...

Wolf

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



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Petrus Bastos
Wolf,

I thank your help! I have all zip methods available, but don't have any
method that generate password protected zip file.

Thanks anyway,
Petrus Bastos.

On Feb 18, 2008 1:10 PM, Wolf [EMAIL PROTECTED] wrote:


  Petrus Bastos [EMAIL PROTECTED] wrote:
  Bastien,
 
  I thank your help, but I think that your idea doesn't resolve my
 problem
  because I need generate that file online when user clicks on a link.Thefile
  must be obtained at the time he clicks.
 
  Thanks anyway,
  Petrus Bastos.
 
 !-- SNIP --

 What methods do you have available?  When you run phpinfo script (?php
 phpinfo() ? what does it say the compile statement is?

 If it was compiled --with-zip then you should be good with the PECL usage
 http://us3.php.net/zip

 Otherwise, you are probably SOL...

 Wolf



RE: [PHP] Converting tab delimited file to CSV

2008-02-18 Thread Jay Blanchard
[snip]
That's funny... MS defaults to tabs for a file whose extension is .csv
which is an acronym for (C)omma (S)eparated (V)alues.
[/snip]

Welcome to Microsoftwhere do we want you to go today?

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



Re: [PHP] Converting tab delimited file to CSV

2008-02-18 Thread Wolf

 Graham Cossey [EMAIL PROTECTED] wrote: 
 I was wondering if someone could offer some advice please.
 
 I'm being sent data in tab delimited files which I'm trying to split
 into smaller files and convert to comma delimited using PHP.
 
 Now, I can replace the tabs with commas and opening the resulting
 files in a basic text editor all looks fine. However when I open the
 files in M$ Excel they're still being treated as tab delimited and all
 values are being shoved into a single column.
 
 What can I do in the PHP code to specifically make the file CSV and be
 treated as such by M$ Excel?
 
 I'm currently just using fopen for old and new files and fwrite.
 
 -- 
 Graham

When using MicroShaft products to open generated files, you will need to open 
M$ software first, then use File - Open to correctly open the file.

M$ Excel uses TABS to split their CSV files (don't ask why, it's MicroShaft) so 
you'll have to play/tweak your files to get them to open correctly.  

Wolf

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



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Daniel Brown
On Feb 18, 2008 11:18 AM, Petrus Bastos [EMAIL PROTECTED] wrote:
 Wolf,

 I thank your help! I have all zip methods available, but don't have any
 method that generate password protected zip file.

In all honesty, Petrus, since none of the suggestions made to you
will work in your situation, I'm afraid the answer is you can't do
it.

The only way you'll be able to do it is to move to a host that
allows exec() or at least has (or will allow you to install) a
PEAR/PECL module to perform more advanced zip operations.

-- 
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?

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



Re: [PHP] Converting tab delimited file to CSV

2008-02-18 Thread Robert Cummings

On Mon, 2008-02-18 at 05:20 -0800, Hiep Nguyen wrote:
 On Mon, 18 Feb 2008, Graham Cossey wrote:
 
  I was wondering if someone could offer some advice please.
 
  I'm being sent data in tab delimited files which I'm trying to split
  into smaller files and convert to comma delimited using PHP.
 
  Now, I can replace the tabs with commas and opening the resulting
  files in a basic text editor all looks fine. However when I open the
  files in M$ Excel they're still being treated as tab delimited and all
  values are being shoved into a single column.
 
  What can I do in the PHP code to specifically make the file CSV and be
  treated as such by M$ Excel?
 
  I'm currently just using fopen for old and new files and fwrite.
 
 
 don't double-click on file_name.csv, instead open MS Excel, then click on 
 file open and locate your file, then you'll know what to do from there.

That's funny... MS defaults to tabs for a file whose extension is .csv
which is an acronym for (C)omma (S)eparated (V)alues.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] open a secondary window/tab in the browser from php

2008-02-18 Thread Richard Lynch
On Mon, February 18, 2008 6:59 am, julian wrote:
 I have an application that along  filling in some forms, it produces a
 pdf file, as confirmation of all entered data.

 I want to send this pdf file to a different window/tab of the browser,
 so it is displayed and can latter be printed.

 In the mean time, the original window contains a confirmation message,
 to continue with the work flow.

 I would like to do this without use of JavaScript

 Any combination of headers ??

No combination of headers will open a new tab/window.

target=_blank will do what you want, if it's in an A(nchor) tag or
FORM tag.



-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



RE: [PHP] Converting tab delimited file to CSV

2008-02-18 Thread Richard Lynch
On Mon, February 18, 2008 10:36 am, Jay Blanchard wrote:
 [snip]
 That's funny... MS defaults to tabs for a file whose extension is .csv
 which is an acronym for (C)omma (S)eparated (V)alues.
 [/snip]

 Welcome to Microsoftwhere do we want you to go today?

I think it defaults to whatever you last used, not to a specific choice.

I also *think* that MS actually invented CSV, as I recall...

Probably, since the mess of comma, quotes to escape commas, and
double-quotes to escape the quotes not escaping the commas, is typical
of the wooly-brained MS design (sic)

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Converting tab delimited file to CSV

2008-02-18 Thread Richard Lynch


On Mon, February 18, 2008 7:11 am, Graham Cossey wrote:
 I was wondering if someone could offer some advice please.

 I'm being sent data in tab delimited files which I'm trying to split
 into smaller files and convert to comma delimited using PHP.

 Now, I can replace the tabs with commas and opening the resulting
 files in a basic text editor all looks fine. However when I open the
 files in M$ Excel they're still being treated as tab delimited and all
 values are being shoved into a single column.

 What can I do in the PHP code to specifically make the file CSV and be
 treated as such by M$ Excel?

 I'm currently just using fopen for old and new files and fwrite.

First, note that MS Excel is quite happy to import tab-delimited if
you punch the right radio buttons on the import dialog...

Next, use fgetcsv and fputcsv with different args (\t and ,) to
read/write the files, and you should get valid CSV files.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



RE: [PHP] Converting tab delimited file to CSV

2008-02-18 Thread Edward Kay

 On Mon, February 18, 2008 10:36 am, Jay Blanchard wrote:
  [snip]
  That's funny... MS defaults to tabs for a file whose extension is .csv
  which is an acronym for (C)omma (S)eparated (V)alues.
  [/snip]
 
  Welcome to Microsoftwhere do we want you to go today?

 I think it defaults to whatever you last used, not to a specific choice.


That would seem to be a possibility. I can quite happliy double-click a .csv
file and have it open correctly in Excel.

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



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Richard Lynch
On Sun, February 17, 2008 1:57 pm, Nick Stinemates wrote:
 Petrus Bastos wrote:
 Hi Nick,

 Sorry, but I forgot to tell you that I can't use this exec
 neither
 system commands because they are disabled for security precautions.
 So, Do
 you have any other ideas on how can I do that?

Sometimes, you can write a cron job that does what you want from the
shell, and that has less restrictions, since the php.ini file can be
specified/modified on the command line on the fly...

Perhaps that would help you here...


And a potentially truly UGLY hack...

I'm betting that the password protection of the zip file is just a
few different bytes in the header portion of a zip...

So take an un-protected zip, and password-protect it, and then do a
diff and see what changed.

Then take that diff output, and just paste it in as the front of the
other zip files...

Might work.

Might make hash of the zip files.

Won't know til you try.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Richard Lynch
On Mon, February 18, 2008 5:59 am, Petrus Bastos wrote:
 Thanks again for your worry. So, let's go, here goes my situation.
 I'm
 exporting data to another system. That system have an option to be
 feed by a
 password protected zip file. The export activity will be occur in this
 way:
 the user will generate the file on my application and will put this
 file
 into that another system. So, I need generate that file. Maybe one
 solution
 is to generate the file unzipped and determine that user should zip
 the file
 with password on his Windows or Linux operating system. But, I can't
 let
 that responsibility on user hands. So, because that I need to generate
 the
 file already protected.

Perhaps you could use SCP (or SSH tunneling) to transfer the file from
system to system, so that it need not ever be visible to the outside
world, and thus not need the rather lame zip password.

Another option would be to take the whole file and 2-way encrypt it
with a public/private key pair, and install the private key on the
receiving server.

In other words, get out of the zip password rut, and protect the file
some other way.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Petrus Bastos
Daniel,

But I can install PEAR/PECL modules, but I didn't see any module that do
what I want. Do you know any module that create password protected zip
files?

Thanks again,
Petrus Bastos.

On Feb 18, 2008 1:29 PM, Daniel Brown [EMAIL PROTECTED] wrote:

 On Feb 18, 2008 11:18 AM, Petrus Bastos [EMAIL PROTECTED] wrote:
  Wolf,
 
  I thank your help! I have all zip methods available, but don't have
 any
  method that generate password protected zip file.

In all honesty, Petrus, since none of the suggestions made to you
 will work in your situation, I'm afraid the answer is you can't do
 it.

The only way you'll be able to do it is to move to a host that
 allows exec() or at least has (or will allow you to install) a
 PEAR/PECL module to perform more advanced zip operations.

 --
 /Dan

 Daniel P. Brown
 Senior Unix Geek
 ? while(1) { $me = $mind--; sleep(86400); } ?



Re: [PHP] regex usage

2008-02-18 Thread Richard Lynch


On Sun, February 17, 2008 9:34 am, Valedol wrote:
 Is there a mothod to check string`s length with regex or the only way
 is
 using strlen?

 I want string consisting of 4 digits
 and check string with this code:

 if (preg_match(/\d{4}/,$_POST[id]))
 { echo $_POST[id]; }

 but preg_match  returns true when string consists of 4 or more digits

Actually, it will return true for anthing with 4 consecutive digits
anywhere inside it, including:

abc1234def

You want:
/^\d{4}\$/
if you want EXACTLY 4 digits and nothing more.

^ anchors the string at the start
$ anchors the string at the end

The \ in front of $ is because $ is PHP for a variable, and while
there are not characters after it, so it's NOT a variable today, you
might add some on another day...

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] PHP/mySQL dropping zeros after inserting number into record

2008-02-18 Thread Richard Lynch
On Sat, February 16, 2008 5:22 pm, Rob Gould wrote:
 I've got a PHP script that inserts 00012345678 into a record in a
 mySQL database (it's a barcode).  Things work ok unless the number has
 preceding zeros, and then the zeros get cut off and all I get is
 12345678.

 I have the mySQL database fieldtype set to bigint(14).  If the maximum
 length a barcode can be is 14, is there a better fieldtype to use that
 will keep the zeros?

 (or some way for PHP to tell mySQL not to chop off the zeros?)

I personally would have used char(14) for a barcode, since it's really
a 14-character fixed-width thing.

You could use formatting on the output to get the leading zeros:
sprintf(%0,14d, $barcode); //or somesuch http://php.net/sprintf

And comparisons within MySQL should type-juggle to int, and make
things work out...

So, really, the bigint(14) should be okay, once you format the output
to look right

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] separating strings from extensions

2008-02-18 Thread Richard Lynch
On Sun, February 17, 2008 4:37 pm, nihilism machine wrote:
 i am using this code to get the extension of a filename:

 $extension = strtolower(strrchr($fileName,.));

 how can i get the text BEFORE the . (period)

http://php.net/basename

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Check time in between times

2008-02-18 Thread Richard Lynch
On Sat, February 16, 2008 11:53 pm, Johny Burns wrote:
 I am having fields in my table where I put times like 4:30pm in string
 format

This is your first mistake...

Use time fields for time, so you can do time operations on time fields.

Otherwise, you are just re-inventing the wheel and re-writing a
billion lines of code that the database geeks already wrote, tested,
and QA-ed.

Once you fix this, your question becomes a non-question...

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Session destruction problem

2008-02-18 Thread Richard Lynch
On Sat, February 16, 2008 2:31 pm, Adil Drissi wrote:
 I need help with sessions.
 I have a simple authentification relying only on
 sessions (i don't use cookies).

Do you mean that you are also using the no_cookie setting in PHP and
using the URL to pass around the session ID?

Or jut that you don't use extra cookies on top of the one PHP uses
by default?

 After the user submits
 his username and password, the script checks if that
 corresponds to a record in a mysql table. If this is
 the case $_SESSION['sessioname'] = $_POST['login'];.
 the $_SESSION['sessioname'] is checked in subsequent
 pages to see if the user is connected or not.
 The problem is after the user logs out, and after that
 uses the previous button of the browser he becomes
 connected. How can i prevent this please.

If the URL has the old session ID, and you aren't destroying it
completely somehow, then they'll be logged in once they go back to the
URL with the session ID.

?php
session_start();
unset($_SESSION[sessioname]);
session_destroy();
header(location: index.php);
?

If you want to destroy the session completely, use:
$_SESSION = array();
to wipe out ALL the session data.

Also, on *some* browsers, sending the cookies session_start (if you
are using cookies) and the Location: header with an INCOMPLETE URL
means the browser will screw up.

Use the COMPLETE URL in your header(Location)

And use a capital L in Location, as well, to be totally kosher, I
think.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] www. not working

2008-02-18 Thread Richard Lynch
On Fri, February 15, 2008 2:46 pm, nihilism machine wrote:
 this still does not work, if a domain has no preceeding www. it
 redirects to http://www.www.site.com, if it has a www. it goes to
 www.www.mydomain.com
 , any ideas?

Don't do that.

Some sites may or may not use www. for whatever reason...

Usually screwed-up A-name records by incompetent sysadmins, but there
it is...


 ?php

 class URL {

   // Public Variables
   public $ServerName;
   public $WWW;

   // Public Functions

   public function __construct() {
   $this-checkWWW();
   $this-ServerName = $_SERVER['SERVER_NAME'] .
 $_SERVER['REQUEST_URI'];
   }

   // Check if site is preceeded by 'WWW'
   public function checkWWW() {
   $myDomain = $_SERVER['SERVER_NAME'];
   $FindWWW = 'www.';
   $POS = strpos($myDomain, $FindWWW);

It won't be 1, since the http:// is in there, and even if it wasn't,
it would be 0, not 1, because PHP uses 0-based strings..

   if ($POS === 1) {
   $this-WWW = true;
   } else {
   $this-WWW = false;
   }
   }

   // Redirect to WWW
   public function WWWRedirect() {
   if ($this-WWW == false) {
   $redir = Location: http://www.; . $this-ServerName;
   header($redir);
   }
   }

 }

 $myURL = new URL();
 $myURL-WWWRedirect();

 ?

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




-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Semaphores without sysvmsg?

2008-02-18 Thread Richard Lynch
On Fri, February 15, 2008 6:42 pm, Michael McGlothlin wrote:
 Does anyone have a good method of supporting semaphores when PHP's
 System V IPC functions can't be enabled? I'm trying to implement
 locking
 for using shmop (actually modifying someone elses code) and it
 requires
 sysvmsg but my shared host doesn't have this enabled.

mkdir is atomic, so you should be able to use that to create a
semaphore/lock

Just in case something gets wedged, you might check the
http://php.net/filemtime of the dir, and ignore anything super stale.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Nick Stinemates
Richard Lynch wrote:
 On Sun, February 17, 2008 1:57 pm, Nick Stinemates wrote:
   
 Petrus Bastos wrote:
 
 Hi Nick,

 Sorry, but I forgot to tell you that I can't use this exec
 neither
 system commands because they are disabled for security precautions.
 So, Do
 you have any other ideas on how can I do that?
   

 Sometimes, you can write a cron job that does what you want from the
 shell, and that has less restrictions, since the php.ini file can be
 specified/modified on the command line on the fly...

 Perhaps that would help you here...


 And a potentially truly UGLY hack...

 I'm betting that the password protection of the zip file is just a
 few different bytes in the header portion of a zip...

 So take an un-protected zip, and password-protect it, and then do a
 diff and see what changed.

 Then take that diff output, and just paste it in as the front of the
 other zip files...

 Might work.

 Might make hash of the zip files.

 Won't know til you try.

   
Richard

Unfortunately,y our hypothesis is incorrect. ZIP files are 'encrypted'
using the password you provide. I was thinking along those lines as well.

-- 
==
Nick Stinemates ([EMAIL PROTECTED])
http://nick.stinemates.org

AIM: Nick Stinemates
MSN: [EMAIL PROTECTED]
Yahoo: [EMAIL PROTECTED]
==

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



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Nick Stinemates
Petrus Bastos wrote:
 Richard,

  Unfortunately, I can't get out of the zip password rut because the
 destination system read only this file format. I can't change the
 destination system.

 Thanks,
 Petrus.

 On Feb 18, 2008 2:11 PM, Richard Lynch [EMAIL PROTECTED] wrote:

   
 On Mon, February 18, 2008 5:59 am, Petrus Bastos wrote:
 
 Thanks again for your worry. So, let's go, here goes my situation.
 I'm
 exporting data to another system. That system have an option to be
 feed by a
 password protected zip file. The export activity will be occur in this
 way:
 the user will generate the file on my application and will put this
 file
 into that another system. So, I need generate that file. Maybe one
 solution
 is to generate the file unzipped and determine that user should zip
 the file
 with password on his Windows or Linux operating system. But, I can't
 let
 that responsibility on user hands. So, because that I need to generate
 the
 file already protected.
   
 Perhaps you could use SCP (or SSH tunneling) to transfer the file from
 system to system, so that it need not ever be visible to the outside
 world, and thus not need the rather lame zip password.

 Another option would be to take the whole file and 2-way encrypt it
 with a public/private key pair, and install the private key on the
 receiving server.

 In other words, get out of the zip password rut, and protect the file
 some other way.

 --
 Some people have a gift link here.
 Know what I want?
 I want you to buy a CD from some indie artist.
 http://cdbaby.com/from/lynch
 Yeah, I get a buck. So?


 

   
Sounds like a creative challenge... this is what makes programmers
problem solvers. You can write the code, you have the knowledge.. and
then you get requirements like this one. How annoying!

I found out some interesting information researching your issue. It
seems that encryption by password is actually not built in to ZIP
itself, but was an implementation detail apps like WinZip added to the
mix. Because of that, the original ZIP libs don't have any notions of
password protection.

It seems like this isn't a language specific issue, either.

I think it's time to get creative, Petros. You're in a bind, and I
assume you need to get this done, so you have the following options (in
the order I would do it in..)
 - Turn on exec()
 - You can use/modify an app I wrote (in python) which accepts UDP
packets and executed commands based off of it. You can strip out the
really insecure things and just accept 'zip' commands. The lib/app is
really small and lightweight. There are no dependencies outside of I
think 3 python modules. If I couldn't turn on exec(), this is the route
I would go.
 - Use some form of file/directory montoring + zip.
 - Pass the request on to an environment that has zip()

-- 
==
Nick Stinemates ([EMAIL PROTECTED])
http://nick.stinemates.org

AIM: Nick Stinemates
MSN: [EMAIL PROTECTED]
Yahoo: [EMAIL PROTECTED]
==

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



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Casey
On Feb 18, 2008 9:07 AM, Richard Lynch [EMAIL PROTECTED] wrote:
 On Sun, February 17, 2008 1:57 pm, Nick Stinemates wrote:
  Petrus Bastos wrote:
  Hi Nick,
 
  Sorry, but I forgot to tell you that I can't use this exec
  neither
  system commands because they are disabled for security precautions.
  So, Do
  you have any other ideas on how can I do that?

 Sometimes, you can write a cron job that does what you want from the
 shell, and that has less restrictions, since the php.ini file can be
 specified/modified on the command line on the fly...

 Perhaps that would help you here...


 And a potentially truly UGLY hack...

 I'm betting that the password protection of the zip file is just a
 few different bytes in the header portion of a zip...

 So take an un-protected zip, and password-protect it, and then do a
 diff and see what changed.

 Then take that diff output, and just paste it in as the front of the
 other zip files...

 Might work.

 Might make hash of the zip files.

 Won't know til you try.


The RFC makes it sound so confusing.

-- 
-Casey

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



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Petrus Bastos
Richard,

 Unfortunately, I can't get out of the zip password rut because the
destination system read only this file format. I can't change the
destination system.

Thanks,
Petrus.

On Feb 18, 2008 2:11 PM, Richard Lynch [EMAIL PROTECTED] wrote:

 On Mon, February 18, 2008 5:59 am, Petrus Bastos wrote:
  Thanks again for your worry. So, let's go, here goes my situation.
  I'm
  exporting data to another system. That system have an option to be
  feed by a
  password protected zip file. The export activity will be occur in this
  way:
  the user will generate the file on my application and will put this
  file
  into that another system. So, I need generate that file. Maybe one
  solution
  is to generate the file unzipped and determine that user should zip
  the file
  with password on his Windows or Linux operating system. But, I can't
  let
  that responsibility on user hands. So, because that I need to generate
  the
  file already protected.

 Perhaps you could use SCP (or SSH tunneling) to transfer the file from
 system to system, so that it need not ever be visible to the outside
 world, and thus not need the rather lame zip password.

 Another option would be to take the whole file and 2-way encrypt it
 with a public/private key pair, and install the private key on the
 receiving server.

 In other words, get out of the zip password rut, and protect the file
 some other way.

 --
 Some people have a gift link here.
 Know what I want?
 I want you to buy a CD from some indie artist.
 http://cdbaby.com/from/lynch
 Yeah, I get a buck. So?




Re: [PHP] XSLTProcessor without validation

2008-02-18 Thread Richard Lynch


On Fri, February 15, 2008 12:54 am, Siegfried Gipp wrote:
 Am Donnerstag, 14. Februar 2008 21:01:42 schrieb Richard Lynch:

 You could also consider filing a Feature Request in
 http://bugs.php.net/
 Well, the bug reporting page has a bug. A graphical captcha is needed,
 but
 there is no such captcha. Repetitive loading does not change this.

 From an accessibility point of view graphical captchas are a bad idea.
 Not
 existing, but required graphical captchas are an even worse idea. This
 way
 the bug report mechanism is essentially 100% inaccessible :)

Works for me.

It's a JPEG.

Does your browser support JPEGs?

Perhaps you are using IE and it's ignoring the proper headers and
trying to guess what kind of file that image is based on the URL,
which is what IE tends to do...


 Regards
 Siegfried

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




-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] question about database field-types and special characters

2008-02-18 Thread Richard Lynch
On Thu, February 14, 2008 8:47 pm, Rob Gould wrote:
 Should I have used utf-8 instead?

Yes.

And you need to convince not only the MySQL server to use UTF-8, but
also the MySQL client compiled into your PHP to use UTF-8.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] separating strings from extensions

2008-02-18 Thread Richard Lynch
Since you provide the suffice (extension) to basename, it's not
basename that's broken...

It's not knowing what extension you wanted to provide in the first
place...

On Mon, February 18, 2008 11:56 am, Nick Stinemates wrote:
 Richard Lynch wrote:
 On Sun, February 17, 2008 4:37 pm, nihilism machine wrote:

 i am using this code to get the extension of a filename:

 $extension = strtolower(strrchr($fileName,.));

 how can i get the text BEFORE the . (period)


 http://php.net/basename


 Funny enough, even in the comments someone states 'this breaks for
 complex file-ending like .tar.gz'

 Considering file names don't mean much, it would be OK (imo) to use
 basename for standard operations. If you're working/looking for the
 exact type, it's time to use MIME as it is more reliable than
 something
 like a filename.

 http://us2.php.net/manual/en/ref.mime-magic.php

 Good luck.

 ==
 Nick Stinemates ([EMAIL PROTECTED])
 http://nick.stinemates.org

 AIM: Nick Stinemates
 MSN: [EMAIL PROTECTED]
 Yahoo: [EMAIL PROTECTED]
 ==

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




-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Converting tab delimited file to CSV

2008-02-18 Thread Andrew Ballard
On Feb 18, 2008 12:02 PM, Edward Kay [EMAIL PROTECTED] wrote:


  On Mon, February 18, 2008 10:36 am, Jay Blanchard wrote:
   [snip]
   That's funny... MS defaults to tabs for a file whose extension is .csv
   which is an acronym for (C)omma (S)eparated (V)alues.
   [/snip]
  
   Welcome to Microsoftwhere do we want you to go today?
 
  I think it defaults to whatever you last used, not to a specific choice.
 

 That would seem to be a possibility. I can quite happliy double-click a
 .csv
 file and have it open correctly in Excel.


Yes. And Excel seems to prefer .txt for tab delimited. However, .txt is
usually opened by Notepad by default, so you have to right-click and tell it
to Open With... Excel. When I do this, it reads it as columnar data rather
than a single column.

Andrew


Re: [PHP] Check time in between times

2008-02-18 Thread Nick Stinemates
Richard Lynch wrote:
 On Sat, February 16, 2008 11:53 pm, Johny Burns wrote:
   
 I am having fields in my table where I put times like 4:30pm in string
 format
 

 This is your first mistake...

 Use time fields for time, so you can do time operations on time fields.

 Otherwise, you are just re-inventing the wheel and re-writing a
 billion lines of code that the database geeks already wrote, tested,
 and QA-ed.

 Once you fix this, your question becomes a non-question...

   
I am going to reinvent the wheel to a square, just in case they got it
wrong. [=

-- 
==
Nick Stinemates ([EMAIL PROTECTED])
http://nick.stinemates.org

AIM: Nick Stinemates
MSN: [EMAIL PROTECTED]
Yahoo: [EMAIL PROTECTED]
==

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



Re: [PHP] Gzipped output

2008-02-18 Thread Richard Lynch
On Fri, February 15, 2008 8:54 am, Eric Butera wrote:
 On Thu, Feb 14, 2008 at 3:52 PM, Richard Lynch [EMAIL PROTECTED] wrote:


  On Mon, February 11, 2008 9:59 am, Eric Butera wrote:
   On Feb 11, 2008 10:44 AM, Per Jessen [EMAIL PROTECTED] wrote:
   Eric Butera wrote:
  
I like it from a coding point of view  (it's neat and
 elegant),
   but I
don't think it achieves anything else than my initial
 suggestion
   of
using exec(gzip -c).
   
   
Except for that little thing where you shouldn't be using
 execs in
public facing code.
  
   Why not?
  

  You should never use exec  friends when there is another way
 around
   the problem.  It is a security concern.

  The only security concern I am aware of is if you pass in user
  supplied data to the exec() arg...

  And if you filter it properly, it is no more risky than anything
 else.

  If you don't filter properly, then you're in trouble no matter what
  external lib you are using...



  --
  Some people have a gift link here.
  Know what I want?
  I want you to buy a CD from some indie artist.
  http://cdbaby.com/from/lynch
  Yeah, I get a buck. So?



 Okay so let's just take a look at how many applications across the
 internet have SQL vulns.

 Look at secunia.

 http://secunia.com/search/?search=sql

 Found: 2625 Secunia Security Advisories, displaying 1-25

 Oh crap!  So let's just assume we're all idiots and we can't secure
 our applications.  Since we can't secure our applications we need to
 take the next step which is damage control.  At least against sql
 injection we can re-roll our backup and be online in a few minutes
 with the appropriate patch.

 Let us look at XSS now.  http://sla.ckers.org/forum/list.php?2  Looks
 like there are quite a few of those too.  If Google/Yahoo can't stop
 this stuff how are us mere mortals supposed to?

 With the ability to run raw executable commands, you're going to have
 a lot harder time fixing that situation.  So yes, it is possible to
 run stuff safely and secure like, but not it is not easy and is very
 error prone.  That is why I recommend to never even attempt it.

The existence of a few million morons who can type insecure stuff in
PHP does not invalidate my statement. :-)

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Fwrite Function

2008-02-18 Thread Richard Lynch


On Sat, February 16, 2008 6:03 am, Yuval Schwartz wrote:
 Hello,

 Can you please help me, I am writing code where I create a file and
 write to
 it from a form on a webpage and then read and display this file on the
 webpage.
 I want to change the color of the text that is written to the file.
 Do you know how I can do this?

 This is some of my code if you need clarification:
 * $boardFile = MessageBoard.txt;
 $boardFileHandle = fopen($boardFile,'a') or die(can't open file);
 fwrite($boardFileHandle, $name);
 fwrite($boardFileHandle, $talk);
 fclose($boardFileHandle);
 }
 $boardFile = MessageBoard.txt;
 $boardFileHandle = fopen($boardFile,r);
 $talkR = fread($boardFileHandle, filesize($boardFile));
 fclose($boardFileHandle);
 echo $talkR;*

I would recommend not trying to colorize the text in the file, but
rather to colorize it upon display...

echo div style=\color: red;\$talkR;/div\n;


-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Sending XML to MSIE7

2008-02-18 Thread Richard Lynch
If IE does anything other than a file download with
application/octet-stream, it's very broken indeed...

Does your URL end in .xml?

Often IE assumes the Content-type is not correct, and runs with the
idea that the end of the URL in 8.3 notation is what the file REALLY
is.

On Fri, February 15, 2008 9:26 am, Brian Dunning wrote:
 I just tried that, and unfortunately the MSIE7 toolkit behavior was
 the same. Darn, I had high hopes for your suggestion as soon as I read
 it. I fear this means there's little we can do server-side in PHP,
 except to choose something other than XML for the result.


 On Feb 14, 2008, at 11:56 PM, Per Jessen wrote:

 Brian Dunning wrote:

 Does anyone know if there's a way to send XML to MSIE7 and avoid
 having MSIE mangle the XML with CSS to display it pleasantly as
 HTML?


 Isn't it enough to send it with Content-Type: application/octet-
 stream ?

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




-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Converting tab delimited file to CSV

2008-02-18 Thread Graham Cossey
On Feb 18, 2008 5:23 PM, Andrew Ballard [EMAIL PROTECTED] wrote:

 On Feb 18, 2008 12:02 PM, Edward Kay [EMAIL PROTECTED] wrote:

 
   On Mon, February 18, 2008 10:36 am, Jay Blanchard wrote:
[snip]
That's funny... MS defaults to tabs for a file whose extension is .csv
which is an acronym for (C)omma (S)eparated (V)alues.
[/snip]
   
Welcome to Microsoftwhere do we want you to go today?
  
   I think it defaults to whatever you last used, not to a specific choice.
  
 
  That would seem to be a possibility. I can quite happliy double-click a
  .csv
  file and have it open correctly in Excel.
 
 
 Yes. And Excel seems to prefer .txt for tab delimited. However, .txt is
 usually opened by Notepad by default, so you have to right-click and tell it
 to Open With... Excel. When I do this, it reads it as columnar data rather
 than a single column.

 Andrew


I need to spend some time looking at *exactly* what is happening in
various scenarios from the sound of things.

My data source used to supply comma separated files which open just
fine in Excel (and still do) but they have recently changed to tab
delimited. These open fine in Excel but if you go to save the file it
auto-selects .txt !! I'm currently opening the tab delimited files in
Excel and doing a Save As to save as CSV. Excel then handles the file
OK and my app likes it when imported (using fgetcsv with , delimiter).
As I type I'm thinking I should make my import script a bit more
intelligent and check for ',' or '\t' in the incoming file and
proceed accordingly... My biggest gripe with tab delimited files is
that they are quite a bit bigger than comma delimited files so I may
have to split the large files I receive into smaller 'chunks' to allow
them to be uploaded.

One thing I have noticed is that the files I create in my PHP script
(The script breaks a large file into smaller files of 25,000
records/rows each.) when opened in Excel (by double-clicking the file
in Windows Explorer) came up with an unrecognised file format message
for all files except the first. If you ignore this message the tab
delimited files open OK but the comma separated ones do not. The
except the first made me think that there may be something hidden
at the beginning of the file to say what type of data follows.

I can probably code around the problem but I'd rather not have to but
from the sound of things I'd need to get M$ to change

-- 
Graham

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



Re: [PHP] Sending XML to MSIE7

2008-02-18 Thread Richard Lynch
On Fri, February 15, 2008 10:03 am, Shawn McKenzie wrote:
 Brian Dunning wrote:
 Isn't it enough to send it with Content-Type:
 application/octet-stream ?

 Do you want the user to download the file?  Try using:
 'Content-Disposition: attachment; filename=...'

Apologies in advance to our regular readers:
richardlynch.blogspot.com/2006/06/php-downloads-content-disposition.html

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Converting tab delimited file to CSV

2008-02-18 Thread Andrew Ballard
On Feb 18, 2008 1:08 PM, Graham Cossey [EMAIL PROTECTED] wrote:

 My biggest gripe with tab delimited files is
 that they are quite a bit bigger than comma delimited files so I may
 have to split the large files I receive into smaller 'chunks' to allow
 them to be uploaded.


Why would tab-delimited files be larger than CSV? A tab character takes up
just as much space as a comma as far as document size is concerned. Am I
missing something?

Andrew


Re: [PHP] separating strings from extensions

2008-02-18 Thread Nick Stinemates
Richard Lynch wrote:
 On Sun, February 17, 2008 4:37 pm, nihilism machine wrote:
   
 i am using this code to get the extension of a filename:

 $extension = strtolower(strrchr($fileName,.));

 how can i get the text BEFORE the . (period)
 

 http://php.net/basename

   
Funny enough, even in the comments someone states 'this breaks for
complex file-ending like .tar.gz'

Considering file names don't mean much, it would be OK (imo) to use
basename for standard operations. If you're working/looking for the
exact type, it's time to use MIME as it is more reliable than something
like a filename.

http://us2.php.net/manual/en/ref.mime-magic.php

Good luck.

==
Nick Stinemates ([EMAIL PROTECTED])
http://nick.stinemates.org

AIM: Nick Stinemates
MSN: [EMAIL PROTECTED]
Yahoo: [EMAIL PROTECTED]
==

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



Re: [PHP] Converting tab delimited file to CSV

2008-02-18 Thread Andrew Ballard
On Feb 18, 2008 1:39 PM, Robert Cummings [EMAIL PROTECTED] wrote:


 On Mon, 2008-02-18 at 13:24 -0500, Andrew Ballard wrote:
  On Feb 18, 2008 1:08 PM, Graham Cossey [EMAIL PROTECTED] wrote:
 
   My biggest gripe with tab delimited files is
   that they are quite a bit bigger than comma delimited files so I may
   have to split the large files I receive into smaller 'chunks' to allow
   them to be uploaded.
  
  
  Why would tab-delimited files be larger than CSV? A tab character takes
 up
  just as much space as a comma as far as document size is concerned. Am I
  missing something?

 He's probably confusing tab delimited with fixed width columns.

 Cheers,
 Rob.


Ah, yes. That would also explain why Excel would open it as a single column
by default if he didn't use the text import wizard.

FWIW - If you do open a text file like this, there is a menu item to convert
text to columnar data once the sheet is already open so you don't have to
close the document and reopen it.

Andrew


Re: [PHP] Converting tab delimited file to CSV

2008-02-18 Thread Robert Cummings

On Mon, 2008-02-18 at 13:24 -0500, Andrew Ballard wrote:
 On Feb 18, 2008 1:08 PM, Graham Cossey [EMAIL PROTECTED] wrote:
 
  My biggest gripe with tab delimited files is
  that they are quite a bit bigger than comma delimited files so I may
  have to split the large files I receive into smaller 'chunks' to allow
  them to be uploaded.
 
 
 Why would tab-delimited files be larger than CSV? A tab character takes up
 just as much space as a comma as far as document size is concerned. Am I
 missing something?

He's probably confusing tab delimited with fixed width columns.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



[PHP] Re: open a secondary window/tab in the browser from php

2008-02-18 Thread Shawn McKenzie
julian wrote:
 
 
 Hi,
 
 I have an application that along  filling in some forms, it produces a
 pdf file, as confirmation of all entered data.
 
 I want to send this pdf file to a different window/tab of the browser,
 so it is displayed and can latter be printed.
 
 In the mean time, the original window contains a confirmation message,
 to continue with the work flow.
 
 I would like to do this without use of JavaScript
 
 Any combination of headers ??
 
 Any hints appreciated.
 
 JCG

AFAIK you must use javascript.  The two scenarios I see are:

1. Your form uses target=_blank to open the PDF and there is some
onsubmit javascript that updates your form.
2. Your form updates itself when submitted and there is some onsubmit
javascript to open the PDF in a new window.

-Shawn

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



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Petrus Bastos
Hey folks,

   I got access to exec method for test! But, it's not working... :(  the
function returns 127 and don't create the zip file, I've tested on Linux
command tool and works! Do you have any idea why didn't work?

Thanks again and sorry for the inconvenience,
Petrus Bastos.

On Feb 18, 2008 2:37 PM, Nick Stinemates [EMAIL PROTECTED] wrote:

 Petrus Bastos wrote:
  Richard,
 
   Unfortunately, I can't get out of the zip password rut because the
  destination system read only this file format. I can't change the
  destination system.
 
  Thanks,
  Petrus.
 
  On Feb 18, 2008 2:11 PM, Richard Lynch [EMAIL PROTECTED] wrote:
 
 
  On Mon, February 18, 2008 5:59 am, Petrus Bastos wrote:
 
  Thanks again for your worry. So, let's go, here goes my situation.
  I'm
  exporting data to another system. That system have an option to be
  feed by a
  password protected zip file. The export activity will be occur in this
  way:
  the user will generate the file on my application and will put this
  file
  into that another system. So, I need generate that file. Maybe one
  solution
  is to generate the file unzipped and determine that user should zip
  the file
  with password on his Windows or Linux operating system. But, I can't
  let
  that responsibility on user hands. So, because that I need to generate
  the
  file already protected.
 
  Perhaps you could use SCP (or SSH tunneling) to transfer the file from
  system to system, so that it need not ever be visible to the outside
  world, and thus not need the rather lame zip password.
 
  Another option would be to take the whole file and 2-way encrypt it
  with a public/private key pair, and install the private key on the
  receiving server.
 
  In other words, get out of the zip password rut, and protect the file
  some other way.
 
  --
  Some people have a gift link here.
  Know what I want?
  I want you to buy a CD from some indie artist.
  http://cdbaby.com/from/lynch
  Yeah, I get a buck. So?
 
 
 
 
 
 Sounds like a creative challenge... this is what makes programmers
 problem solvers. You can write the code, you have the knowledge.. and
 then you get requirements like this one. How annoying!

 I found out some interesting information researching your issue. It
 seems that encryption by password is actually not built in to ZIP
 itself, but was an implementation detail apps like WinZip added to the
 mix. Because of that, the original ZIP libs don't have any notions of
 password protection.

 It seems like this isn't a language specific issue, either.

 I think it's time to get creative, Petros. You're in a bind, and I
 assume you need to get this done, so you have the following options (in
 the order I would do it in..)
  - Turn on exec()
  - You can use/modify an app I wrote (in python) which accepts UDP
 packets and executed commands based off of it. You can strip out the
 really insecure things and just accept 'zip' commands. The lib/app is
 really small and lightweight. There are no dependencies outside of I
 think 3 python modules. If I couldn't turn on exec(), this is the route
 I would go.
  - Use some form of file/directory montoring + zip.
  - Pass the request on to an environment that has zip()

 --
 ==
 Nick Stinemates ([EMAIL PROTECTED])
 http://nick.stinemates.org

 AIM: Nick Stinemates
 MSN: [EMAIL PROTECTED]
 Yahoo: [EMAIL PROTECTED]
 ==





Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Nick Stinemates
Petrus Bastos wrote:
 Hey folks,

I got access to exec method for test! But, it's not working... :( 
 the function returns 127 and don't create the zip file, I've tested on
 Linux command tool and works! Do you have any idea why didn't work?

 Thanks again and sorry for the inconvenience,
 Petrus Bastos.

 On Feb 18, 2008 2:37 PM, Nick Stinemates [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] wrote:

 Petrus Bastos wrote:
  Richard,
 
   Unfortunately, I can't get out of the zip password rut
 because the
  destination system read only this file format. I can't change the
  destination system.
 
  Thanks,
  Petrus.
 
  On Feb 18, 2008 2:11 PM, Richard Lynch [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] wrote:
 
 
  On Mon, February 18, 2008 5:59 am, Petrus Bastos wrote:
 
  Thanks again for your worry. So, let's go, here goes my
 situation.
  I'm
  exporting data to another system. That system have an option to be
  feed by a
  password protected zip file. The export activity will be occur
 in this
  way:
  the user will generate the file on my application and will put
 this
  file
  into that another system. So, I need generate that file. Maybe one
  solution
  is to generate the file unzipped and determine that user
 should zip
  the file
  with password on his Windows or Linux operating system. But, I
 can't
  let
  that responsibility on user hands. So, because that I need to
 generate
  the
  file already protected.
 
  Perhaps you could use SCP (or SSH tunneling) to transfer the
 file from
  system to system, so that it need not ever be visible to the
 outside
  world, and thus not need the rather lame zip password.
 
  Another option would be to take the whole file and 2-way encrypt it
  with a public/private key pair, and install the private key on the
  receiving server.
 
  In other words, get out of the zip password rut, and protect
 the file
  some other way.
 
  --
  Some people have a gift link here.
  Know what I want?
  I want you to buy a CD from some indie artist.
  http://cdbaby.com/from/lynch
  Yeah, I get a buck. So?
 
 
 
 
 
 Sounds like a creative challenge... this is what makes programmers
 problem solvers. You can write the code, you have the knowledge.. and
 then you get requirements like this one. How annoying!

 I found out some interesting information researching your issue. It
 seems that encryption by password is actually not built in to ZIP
 itself, but was an implementation detail apps like WinZip added to the
 mix. Because of that, the original ZIP libs don't have any notions of
 password protection.

 It seems like this isn't a language specific issue, either.

 I think it's time to get creative, Petros. You're in a bind, and I
 assume you need to get this done, so you have the following
 options (in
 the order I would do it in..)
  - Turn on exec()
  - You can use/modify an app I wrote (in python) which accepts UDP
 packets and executed commands based off of it. You can strip out the
 really insecure things and just accept 'zip' commands. The lib/app is
 really small and lightweight. There are no dependencies outside of I
 think 3 python modules. If I couldn't turn on exec(), this is the
 route
 I would go.
  - Use some form of file/directory montoring + zip.
  - Pass the request on to an environment that has zip()

 --
 ==
 Nick Stinemates ([EMAIL PROTECTED] mailto:[EMAIL PROTECTED])
 http://nick.stinemates.org

 AIM: Nick Stinemates
 MSN: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
 Yahoo: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
 ==



What platform are you testing on?

You got it to work under Linux but not on Windows? Am I understanding
that properly?

For windows, I read you should be using a tool called PkZIP.

-- 
==
Nick Stinemates ([EMAIL PROTECTED])
http://nick.stinemates.org

AIM: Nick Stinemates
MSN: [EMAIL PROTECTED]
Yahoo: [EMAIL PROTECTED]
==

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



Re: [PHP] open a secondary window/tab in the browser from php

2008-02-18 Thread tedd

At 1:59 PM +0100 2/18/08, julian wrote:

Hi,

I have an application that along  filling in some forms, it produces 
a pdf file, as confirmation of all entered data.


I want to send this pdf file to a different window/tab of the 
browser, so it is displayed and can latter be printed.


In the mean time, the original window contains a confirmation 
message, to continue with the work flow.


I would like to do this without use of JavaScript

Any combination of headers ??

Any hints appreciated.

JCG


Besides piss them off, what would you do to a user like me who never uses tabs?

My advice, leave what the user wants alone.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] separating strings from extensions

2008-02-18 Thread tedd

At 5:56 PM -0500 2/17/08, Daniel Brown wrote:

On Feb 17, 2008 5:37 PM, nihilism machine [EMAIL PROTECTED] wrote:

 i am using this code to get the extension of a filename:


  $extension = strtolower(strrchr($fileName,.));


 how can i get the text BEFORE the . (period)


You can STFW and RTFM.  This list should never be your first place
to ask simple questions.


Besides, it confuses us.

We think it's a trick question and have to think very hard about it. 
After realizing that it's a simple question, then we get all strange 
and stuff and start slobbering. Which in turn, shorts out our 
keyboards and we start typing all sorts of funny stuff. So, just 
don't do it.


It was bad enough that you used the variable named $extension and 
then asked what came before it, which is more a prefix type question 
-- see how confusing asking a simple question can become. So, just 
don't do it -- or did I already say that?


Cheers,

tedd (wiping off keyboard)

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



RE: [PHP] classes

2008-02-18 Thread Jay Blanchard
[snip]
if i declare an instance of a class in the top of my php file, then  
have html, then later on user $myClassInstance-myMethod(); --  
myMethod() does not execute, only when i have the instantiation of the  
class right before the call to the method does it work. any ideas?
[/snip]

You are no longer running the script once the output has been sent to
the screen. You need to flush output to the screen or re-order your
code.

http://www.php.net/flush

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



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Petrus Bastos
I'm testing on FreeBSD. I can use any command through system(), but the zip
command doesn't works! I don't know why.


On Feb 18, 2008 4:06 PM, Nick Stinemates [EMAIL PROTECTED] wrote:

 Petrus Bastos wrote:
  Hey folks,
 
 I got access to exec method for test! But, it's not working... :(
  the function returns 127 and don't create the zip file, I've tested on
  Linux command tool and works! Do you have any idea why didn't work?
 
  Thanks again and sorry for the inconvenience,
  Petrus Bastos.
 
  On Feb 18, 2008 2:37 PM, Nick Stinemates [EMAIL PROTECTED]
  mailto:[EMAIL PROTECTED] wrote:
 
  Petrus Bastos wrote:
   Richard,
  
Unfortunately, I can't get out of the zip password rut
  because the
   destination system read only this file format. I can't change the
   destination system.
  
   Thanks,
   Petrus.
  
   On Feb 18, 2008 2:11 PM, Richard Lynch [EMAIL PROTECTED]
  mailto:[EMAIL PROTECTED] wrote:
  
  
   On Mon, February 18, 2008 5:59 am, Petrus Bastos wrote:
  
   Thanks again for your worry. So, let's go, here goes my
  situation.
   I'm
   exporting data to another system. That system have an option to
 be
   feed by a
   password protected zip file. The export activity will be occur
  in this
   way:
   the user will generate the file on my application and will put
  this
   file
   into that another system. So, I need generate that file. Maybe
 one
   solution
   is to generate the file unzipped and determine that user
  should zip
   the file
   with password on his Windows or Linux operating system. But, I
  can't
   let
   that responsibility on user hands. So, because that I need to
  generate
   the
   file already protected.
  
   Perhaps you could use SCP (or SSH tunneling) to transfer the
  file from
   system to system, so that it need not ever be visible to the
  outside
   world, and thus not need the rather lame zip password.
  
   Another option would be to take the whole file and 2-way encrypt
 it
   with a public/private key pair, and install the private key on
 the
   receiving server.
  
   In other words, get out of the zip password rut, and protect
  the file
   some other way.
  
   --
   Some people have a gift link here.
   Know what I want?
   I want you to buy a CD from some indie artist.
   http://cdbaby.com/from/lynch
   Yeah, I get a buck. So?
  
  
  
  
  
  Sounds like a creative challenge... this is what makes programmers
  problem solvers. You can write the code, you have the knowledge..
 and
  then you get requirements like this one. How annoying!
 
  I found out some interesting information researching your issue. It
  seems that encryption by password is actually not built in to ZIP
  itself, but was an implementation detail apps like WinZip added to
 the
  mix. Because of that, the original ZIP libs don't have any notions
 of
  password protection.
 
  It seems like this isn't a language specific issue, either.
 
  I think it's time to get creative, Petros. You're in a bind, and I
  assume you need to get this done, so you have the following
  options (in
  the order I would do it in..)
   - Turn on exec()
   - You can use/modify an app I wrote (in python) which accepts UDP
  packets and executed commands based off of it. You can strip out the
  really insecure things and just accept 'zip' commands. The lib/app
 is
  really small and lightweight. There are no dependencies outside of I
  think 3 python modules. If I couldn't turn on exec(), this is the
  route
  I would go.
   - Use some form of file/directory montoring + zip.
   - Pass the request on to an environment that has zip()
 
  --
  ==
  Nick Stinemates ([EMAIL PROTECTED] mailto:[EMAIL PROTECTED])
  http://nick.stinemates.org
 
  AIM: Nick Stinemates
  MSN: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
  Yahoo: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
  ==
 
 
 
 What platform are you testing on?

 You got it to work under Linux but not on Windows? Am I understanding
 that properly?

 For windows, I read you should be using a tool called PkZIP.

 --
 ==
 Nick Stinemates ([EMAIL PROTECTED])
 http://nick.stinemates.org

 AIM: Nick Stinemates
 MSN: [EMAIL PROTECTED]
 Yahoo: [EMAIL PROTECTED]
 ==





[PHP] classes

2008-02-18 Thread nihilism machine
if i declare an instance of a class in the top of my php file, then  
have html, then later on user $myClassInstance-myMethod(); --  
myMethod() does not execute, only when i have the instantiation of the  
class right before the call to the method does it work. any ideas?


-e

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



Re: [PHP] separating strings from extensions

2008-02-18 Thread Shawn McKenzie
Børge Holen wrote:
 On Monday 18 February 2008 00:10:30 John Meyer wrote:
 Daniel Brown wrote:
 On Feb 17, 2008 5:37 PM, nihilism machine [EMAIL PROTECTED] 
 wrote:
 i am using this code to get the extension of a filename:

 $extension = strtolower(strrchr($fileName,.));

 how can i get the text BEFORE the . (period)
 You can STFW and RTFM.  This list should never be your first place
 to ask simple questions.

 In any case

 ?
 $split = explode('.',strtolower($fileName));
 $name = $split[0];
 $ext = $split[1];
 ?
 Flame job aside, that's going to fail on a compound extension such as
 .tar.gz by just returning .tar
 
 so.
 
 it.will.fail.this.one.to.txt 
 
 and a fix would also fail because you would have to hardcord everygoddamn 
 ending if thats what youre after. How many do you care to count for?
 I would say stick with the last dot, if its not particulary often you stumble 
 over those .tar.bz2 endings.
 
 what does he want to upload anyway?
 Oi you, whats yer task?
 
 
 
 
 
 
 

Regardless, a tar.gz file if it is gzipped is a gzip file.  You must
gunzip it to get the tar, just like manifesto.ps.tar is still a tar that
just happens to contain postscript files ;-)

-Shawn

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



RE: [PHP] Protected ZIP file with password

2008-02-18 Thread Jay Blanchard
[snip]
I'm testing on FreeBSD. I can use any command through system(), but the
zip
command doesn't works! I don't know why.
[/snip]

Have you tried the command from the command line without PHP to make
sure it works?

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



[PHP] problem with stream_select and signals

2008-02-18 Thread Marcos Lois Bermúdez
There is any form of detect signal interrupting the stream_select call, 
some times a signal is not a error and there is other change to get the 
result, so if *_select tell me if its interruptded by signal.


in socket_select i can determine if a signal interrupted the 
socket_select, but streams don't have this facility.


so there is any form of detecting this?

socket_last_error() is not aceptable that this module are no avaliable 
by default in 5.3.0 and abovem and of course only applicable to sockets.


Regards.

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



Re: [PHP] classes

2008-02-18 Thread Shawn McKenzie
Jay Blanchard wrote:
 [snip]
 if i declare an instance of a class in the top of my php file, then  
 have html, then later on user $myClassInstance-myMethod(); --  
 myMethod() does not execute, only when i have the instantiation of the  
 class right before the call to the method does it work. any ideas?
 [/snip]
 
 You are no longer running the script once the output has been sent to
 the screen. You need to flush output to the screen or re-order your
 code.
 
 http://www.php.net/flush

Huh, what?!?! to both of you:

?php
$myClassInstance = new myClass();
?
Hello
?php

$myClassInstance-myMethod();

class myClass
{
function myMethod()
{
echo  world!;
}
}
?

Outputs the expected.  Must be an error, maybe fatal or parse before the
method call or maybe your method does execute you just are expecting
something different?

-Shawn

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



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Petrus Bastos
Yes.

On Feb 18, 2008 5:50 PM, Jay Blanchard [EMAIL PROTECTED] wrote:

 [snip]
 I'm testing on FreeBSD. I can use any command through system(), but the
 zip
 command doesn't works! I don't know why.
 [/snip]

 Have you tried the command from the command line without PHP to make
 sure it works?


Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Petrus Bastos
zip program is installed. I'd type whereis and returned
/usr/ports/archivers/zip. I've change my zip command and put th whole path.
Now return error 126. :(

On Feb 18, 2008 5:51 PM, Stut [EMAIL PROTECTED] wrote:

 Petrus Bastos wrote:
  I'm testing on FreeBSD. I can use any command through system(), but the
 zip
  command doesn't works! I don't know why.

 Is zip installed? AFAIK it's not by default.

 Do a system('whereis zip'); to see.

 -Stut

 --
 http://stut.net/



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Shawn McKenzie
Shawn McKenzie wrote:
 Petrus Bastos wrote:
 zip program is installed. I'd type whereis and returned
 /usr/ports/archivers/zip. I've change my zip command and put th whole path.
 Now return error 126. :(

 On Feb 18, 2008 5:51 PM, Stut [EMAIL PROTECTED] wrote:

 Petrus Bastos wrote:
 I'm testing on FreeBSD. I can use any command through system(), but the
 zip
 command doesn't works! I don't know why.
 Is zip installed? AFAIK it's not by default.

 Do a system('whereis zip'); to see.

 -Stut

 --
 http://stut.net/

 
 Umm, it's been a while for me on BSD, but isn't
 '/usr/ports/archivers/zip' a directory holding sources to build zip?
 
 -Shawn

Maybe as root:

cd /usr/ports/archivers/zip
make install clean zip

-Shawn

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



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Daniel Brown
On Feb 18, 2008 4:05 PM, Shawn McKenzie [EMAIL PROTECTED] wrote:
 Umm, it's been a while for me on BSD, but isn't
 '/usr/ports/archivers/zip' a directory holding sources to build zip?

Yes, Shawn, you're correct.  Ports are (on BSD and MacOS) for
automated installations like DEBs and RPMs on other systems.

-- 
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?

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



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Petrus Bastos
Unfortunately, I don't have access to root user here. It was a miracle get
access to system command. I have to resolve this problem without root user.
:(

On Feb 18, 2008 6:08 PM, Shawn McKenzie [EMAIL PROTECTED] wrote:

 Shawn McKenzie wrote:
  Petrus Bastos wrote:
  zip program is installed. I'd type whereis and returned
  /usr/ports/archivers/zip. I've change my zip command and put th whole
 path.
  Now return error 126. :(
 
  On Feb 18, 2008 5:51 PM, Stut [EMAIL PROTECTED] wrote:
 
  Petrus Bastos wrote:
  I'm testing on FreeBSD. I can use any command through system(), but
 the
  zip
  command doesn't works! I don't know why.
  Is zip installed? AFAIK it's not by default.
 
  Do a system('whereis zip'); to see.
 
  -Stut
 
  --
  http://stut.net/
 
 
  Umm, it's been a while for me on BSD, but isn't
  '/usr/ports/archivers/zip' a directory holding sources to build zip?
 
  -Shawn

 Maybe as root:

 cd /usr/ports/archivers/zip
 make install clean zip

 -Shawn

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




Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Petrus Bastos
Ok. I've tried the command again and returned /usr/local/bin/zip... but
return the same error...

On Feb 18, 2008 6:13 PM, Shawn McKenzie [EMAIL PROTECTED] wrote:

 Petrus Bastos wrote:
  Unfortunately, I don't have access to root user here. It was a miracle
 get
  access to system command. I have to resolve this problem without root
 user.
  :(
 
  On Feb 18, 2008 6:08 PM, Shawn McKenzie [EMAIL PROTECTED] wrote:
 
  Shawn McKenzie wrote:
  Petrus Bastos wrote:
  zip program is installed. I'd type whereis and returned
  /usr/ports/archivers/zip. I've change my zip command and put th whole
  path.
  Now return error 126. :(
 
  On Feb 18, 2008 5:51 PM, Stut [EMAIL PROTECTED] wrote:
 
  Petrus Bastos wrote:
  I'm testing on FreeBSD. I can use any command through system(), but
  the
  zip
  command doesn't works! I don't know why.
  Is zip installed? AFAIK it's not by default.
 
  Do a system('whereis zip'); to see.
 
  -Stut
 
  --
  http://stut.net/
 
  Umm, it's been a while for me on BSD, but isn't
  '/usr/ports/archivers/zip' a directory holding sources to build zip?
 
  -Shawn
  Maybe as root:
 
  cd /usr/ports/archivers/zip
  make install clean zip
 
  -Shawn
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 Well, have someone install zip.  You won't have any luck trying to
 execute that directory.

 -Shawn

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




Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Greg Donald
On 2/18/08, Shawn McKenzie [EMAIL PROTECTED] wrote:
 cd /usr/ports/archivers/zip
 make install clean zip

pkg_add -r zip

done.


-- 
Greg Donald
http://destiney.com/

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



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Wolf

 Petrus Bastos [EMAIL PROTECTED] wrote: 
 I'm testing on FreeBSD. I can use any command through system(), but the zip
 command doesn't works! I don't know why.
 
 
! -- SNIP --
According to Google:
http://www.google.com/search?q=php%3A+exec+zip+error+127ie=utf-8oe=utf-8aq=trls=com.ubuntu:en-US:officialclient=firefox-a
 

Using terms php: exec zip error 127

Try passthru and see what you get.

Have you done any looking for the error codes in the documentation?

Wolf

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



Re: [PHP] Converting tab delimited file to CSV

2008-02-18 Thread Graham Cossey
On Feb 18, 2008 6:45 PM, Andrew Ballard [EMAIL PROTECTED] wrote:
 On Feb 18, 2008 1:39 PM, Robert Cummings [EMAIL PROTECTED] wrote:

 
  On Mon, 2008-02-18 at 13:24 -0500, Andrew Ballard wrote:
   On Feb 18, 2008 1:08 PM, Graham Cossey [EMAIL PROTECTED] wrote:
  
My biggest gripe with tab delimited files is
that they are quite a bit bigger than comma delimited files so I may
have to split the large files I receive into smaller 'chunks' to allow
them to be uploaded.
   
   
   Why would tab-delimited files be larger than CSV? A tab character takes
  up
   just as much space as a comma as far as document size is concerned. Am I
   missing something?
 
  He's probably confusing tab delimited with fixed width columns.
 
  Cheers,
  Rob.
 

 Ah, yes. That would also explain why Excel would open it as a single column
 by default if he didn't use the text import wizard.

 FWIW - If you do open a text file like this, there is a menu item to convert
 text to columnar data once the sheet is already open so you don't have to
 close the document and reopen it.

 Andrew


Nope not fixed width, definitely tab delimited (longer fields
'overlap' ones above and below when viewed in a text editor), as for
the size difference I don't know why but when I open into Excel and
save as CSV the files are smaller.

I just opened a 50.2KB tab delimited file into Excel saved it as CSV
and this new file is 25KB!!

Maybe I really am finally going mad.


-- 
Graham

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



Re: [PHP] classes

2008-02-18 Thread Nick Stinemates
Jay Blanchard wrote:
 [snip]
 if i declare an instance of a class in the top of my php file, then  
 have html, then later on user $myClassInstance-myMethod(); --  
 myMethod() does not execute, only when i have the instantiation of the  
 class right before the call to the method does it work. any ideas?
 [/snip]

 You are no longer running the script once the output has been sent to
 the screen. You need to flush output to the screen or re-order your
 code.

 http://www.php.net/flush

   
Can't be true

?php

class a {
public function test() {
echo hello;
}
}
$a = new a();
?
html
body
testing... br
?php

$a-test();

?
/body
/html


Definitely works.

-- 
==
Nick Stinemates ([EMAIL PROTECTED])
http://nick.stinemates.org

AIM: Nick Stinemates
MSN: [EMAIL PROTECTED]
Yahoo: [EMAIL PROTECTED]
==

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



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Stut

Petrus Bastos wrote:

I'm testing on FreeBSD. I can use any command through system(), but the zip
command doesn't works! I don't know why.


Is zip installed? AFAIK it's not by default.

Do a system('whereis zip'); to see.

-Stut

--
http://stut.net/

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



Re: [PHP] classes

2008-02-18 Thread Stut

nihilism machine wrote:
if i declare an instance of a class in the top of my php file, then have 
html, then later on user $myClassInstance-myMethod(); -- myMethod() 
does not execute, only when i have the instantiation of the class right 
before the call to the method does it work. any ideas?


Show us some code. Chances are that you're blatting over the 
$myClassInstance variable, or are running into scope issues.


-Stut

--
http://stut.net/

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



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Shawn McKenzie
Greg Donald wrote:
 On 2/18/08, Shawn McKenzie [EMAIL PROTECTED] wrote:
 cd /usr/ports/archivers/zip
 make install clean zip
 
 pkg_add -r zip
 
 done.
 
 

Sure, if you want to miss all the linker and compiler goodies :-)

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



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Shawn McKenzie
Petrus Bastos wrote:
 Unfortunately, I don't have access to root user here. It was a miracle get
 access to system command. I have to resolve this problem without root user.
 :(
 
 On Feb 18, 2008 6:08 PM, Shawn McKenzie [EMAIL PROTECTED] wrote:
 
 Shawn McKenzie wrote:
 Petrus Bastos wrote:
 zip program is installed. I'd type whereis and returned
 /usr/ports/archivers/zip. I've change my zip command and put th whole
 path.
 Now return error 126. :(

 On Feb 18, 2008 5:51 PM, Stut [EMAIL PROTECTED] wrote:

 Petrus Bastos wrote:
 I'm testing on FreeBSD. I can use any command through system(), but
 the
 zip
 command doesn't works! I don't know why.
 Is zip installed? AFAIK it's not by default.

 Do a system('whereis zip'); to see.

 -Stut

 --
 http://stut.net/

 Umm, it's been a while for me on BSD, but isn't
 '/usr/ports/archivers/zip' a directory holding sources to build zip?

 -Shawn
 Maybe as root:

 cd /usr/ports/archivers/zip
 make install clean zip

 -Shawn

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


 
Well, have someone install zip.  You won't have any luck trying to
execute that directory.

-Shawn

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



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Petrus Bastos
I'd look at parameters and my command is ok.

On Feb 18, 2008 5:51 PM, Nick Stinemates [EMAIL PROTECTED] wrote:

 Petrus Bastos wrote:
  I'm testing on FreeBSD. I can use any command through system(), but the
 zip
  command doesn't works! I don't know why.
 
 
  On Feb 18, 2008 4:06 PM, Nick Stinemates [EMAIL PROTECTED] wrote:
 
 
  Petrus Bastos wrote:
 
  Hey folks,
 
 I got access to exec method for test! But, it's not working... :(
  the function returns 127 and don't create the zip file, I've tested on
  Linux command tool and works! Do you have any idea why didn't work?
 
  Thanks again and sorry for the inconvenience,
  Petrus Bastos.
 
  On Feb 18, 2008 2:37 PM, Nick Stinemates [EMAIL PROTECTED]
  mailto:[EMAIL PROTECTED] wrote:
 
  Petrus Bastos wrote:
   Richard,
  
Unfortunately, I can't get out of the zip password rut
  because the
   destination system read only this file format. I can't change
 the
   destination system.
  
   Thanks,
   Petrus.
  
   On Feb 18, 2008 2:11 PM, Richard Lynch [EMAIL PROTECTED]
  mailto:[EMAIL PROTECTED] wrote:
  
  
   On Mon, February 18, 2008 5:59 am, Petrus Bastos wrote:
  
   Thanks again for your worry. So, let's go, here goes my
  situation.
   I'm
   exporting data to another system. That system have an option
 to
 
  be
 
   feed by a
   password protected zip file. The export activity will be occur
  in this
   way:
   the user will generate the file on my application and will put
  this
   file
   into that another system. So, I need generate that file. Maybe
 
  one
 
   solution
   is to generate the file unzipped and determine that user
  should zip
   the file
   with password on his Windows or Linux operating system. But, I
  can't
   let
   that responsibility on user hands. So, because that I need to
  generate
   the
   file already protected.
  
   Perhaps you could use SCP (or SSH tunneling) to transfer the
  file from
   system to system, so that it need not ever be visible to the
  outside
   world, and thus not need the rather lame zip password.
  
   Another option would be to take the whole file and 2-way
 encrypt
 
  it
 
   with a public/private key pair, and install the private key on
 
  the
 
   receiving server.
  
   In other words, get out of the zip password rut, and protect
  the file
   some other way.
  
   --
   Some people have a gift link here.
   Know what I want?
   I want you to buy a CD from some indie artist.
   http://cdbaby.com/from/lynch
   Yeah, I get a buck. So?
  
  
  
  
  
  Sounds like a creative challenge... this is what makes programmers
  problem solvers. You can write the code, you have the knowledge..
 
  and
 
  then you get requirements like this one. How annoying!
 
  I found out some interesting information researching your issue.
 It
  seems that encryption by password is actually not built in to ZIP
  itself, but was an implementation detail apps like WinZip added to
 
  the
 
  mix. Because of that, the original ZIP libs don't have any notions
 
  of
 
  password protection.
 
  It seems like this isn't a language specific issue, either.
 
  I think it's time to get creative, Petros. You're in a bind, and I
  assume you need to get this done, so you have the following
  options (in
  the order I would do it in..)
   - Turn on exec()
   - You can use/modify an app I wrote (in python) which accepts
 UDP
  packets and executed commands based off of it. You can strip out
 the
  really insecure things and just accept 'zip' commands. The lib/app
 
  is
 
  really small and lightweight. There are no dependencies outside of
 I
  think 3 python modules. If I couldn't turn on exec(), this is the
  route
  I would go.
   - Use some form of file/directory montoring + zip.
   - Pass the request on to an environment that has zip()
 
  --
  ==
  Nick Stinemates ([EMAIL PROTECTED] mailto:[EMAIL PROTECTED])
  http://nick.stinemates.org
 
  AIM: Nick Stinemates
  MSN: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
 
  Yahoo: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
  ==
 
 
 
 
  What platform are you testing on?
 
  You got it to work under Linux but not on Windows? Am I understanding
  that properly?
 
  For windows, I read you should be using a tool called PkZIP.
 
  --
  ==
  Nick Stinemates ([EMAIL PROTECTED])
  http://nick.stinemates.org
 
  AIM: Nick Stinemates
  MSN: [EMAIL PROTECTED]
  Yahoo: [EMAIL PROTECTED]
  ==
 
 
 
 
 
 
 Do you have SSH access to the system?

 If so, 'man zip' and look at the params.

 --
 ==
 Nick 

Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Shawn McKenzie
Petrus Bastos wrote:
 zip program is installed. I'd type whereis and returned
 /usr/ports/archivers/zip. I've change my zip command and put th whole path.
 Now return error 126. :(
 
 On Feb 18, 2008 5:51 PM, Stut [EMAIL PROTECTED] wrote:
 
 Petrus Bastos wrote:
 I'm testing on FreeBSD. I can use any command through system(), but the
 zip
 command doesn't works! I don't know why.
 Is zip installed? AFAIK it's not by default.

 Do a system('whereis zip'); to see.

 -Stut

 --
 http://stut.net/

 

Umm, it's been a while for me on BSD, but isn't
'/usr/ports/archivers/zip' a directory holding sources to build zip?

-Shawn

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



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Nick Stinemates
Petrus Bastos wrote:
 I'm testing on FreeBSD. I can use any command through system(), but the zip
 command doesn't works! I don't know why.


 On Feb 18, 2008 4:06 PM, Nick Stinemates [EMAIL PROTECTED] wrote:

   
 Petrus Bastos wrote:
 
 Hey folks,

I got access to exec method for test! But, it's not working... :(
 the function returns 127 and don't create the zip file, I've tested on
 Linux command tool and works! Do you have any idea why didn't work?

 Thanks again and sorry for the inconvenience,
 Petrus Bastos.

 On Feb 18, 2008 2:37 PM, Nick Stinemates [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] wrote:

 Petrus Bastos wrote:
  Richard,
 
   Unfortunately, I can't get out of the zip password rut
 because the
  destination system read only this file format. I can't change the
  destination system.
 
  Thanks,
  Petrus.
 
  On Feb 18, 2008 2:11 PM, Richard Lynch [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] wrote:
 
 
  On Mon, February 18, 2008 5:59 am, Petrus Bastos wrote:
 
  Thanks again for your worry. So, let's go, here goes my
 situation.
  I'm
  exporting data to another system. That system have an option to
   
 be
 
  feed by a
  password protected zip file. The export activity will be occur
 in this
  way:
  the user will generate the file on my application and will put
 this
  file
  into that another system. So, I need generate that file. Maybe
   
 one
 
  solution
  is to generate the file unzipped and determine that user
 should zip
  the file
  with password on his Windows or Linux operating system. But, I
 can't
  let
  that responsibility on user hands. So, because that I need to
 generate
  the
  file already protected.
 
  Perhaps you could use SCP (or SSH tunneling) to transfer the
 file from
  system to system, so that it need not ever be visible to the
 outside
  world, and thus not need the rather lame zip password.
 
  Another option would be to take the whole file and 2-way encrypt
   
 it
 
  with a public/private key pair, and install the private key on
   
 the
 
  receiving server.
 
  In other words, get out of the zip password rut, and protect
 the file
  some other way.
 
  --
  Some people have a gift link here.
  Know what I want?
  I want you to buy a CD from some indie artist.
  http://cdbaby.com/from/lynch
  Yeah, I get a buck. So?
 
 
 
 
 
 Sounds like a creative challenge... this is what makes programmers
 problem solvers. You can write the code, you have the knowledge..
   
 and
 
 then you get requirements like this one. How annoying!

 I found out some interesting information researching your issue. It
 seems that encryption by password is actually not built in to ZIP
 itself, but was an implementation detail apps like WinZip added to
   
 the
 
 mix. Because of that, the original ZIP libs don't have any notions
   
 of
 
 password protection.

 It seems like this isn't a language specific issue, either.

 I think it's time to get creative, Petros. You're in a bind, and I
 assume you need to get this done, so you have the following
 options (in
 the order I would do it in..)
  - Turn on exec()
  - You can use/modify an app I wrote (in python) which accepts UDP
 packets and executed commands based off of it. You can strip out the
 really insecure things and just accept 'zip' commands. The lib/app
   
 is
 
 really small and lightweight. There are no dependencies outside of I
 think 3 python modules. If I couldn't turn on exec(), this is the
 route
 I would go.
  - Use some form of file/directory montoring + zip.
  - Pass the request on to an environment that has zip()

 --
 ==
 Nick Stinemates ([EMAIL PROTECTED] mailto:[EMAIL PROTECTED])
 http://nick.stinemates.org

 AIM: Nick Stinemates
 MSN: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
 Yahoo: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
 ==



   
 What platform are you testing on?

 You got it to work under Linux but not on Windows? Am I understanding
 that properly?

 For windows, I read you should be using a tool called PkZIP.

 --
 ==
 Nick Stinemates ([EMAIL PROTECTED])
 http://nick.stinemates.org

 AIM: Nick Stinemates
 MSN: [EMAIL PROTECTED]
 Yahoo: [EMAIL PROTECTED]
 ==



 

   
Do you have SSH access to the system?

If so, 'man zip' and look at the params.

-- 
==
Nick Stinemates ([EMAIL PROTECTED])
http://nick.stinemates.org

AIM: Nick Stinemates
MSN: [EMAIL PROTECTED]
Yahoo: [EMAIL PROTECTED]
==

-- 
PHP General Mailing List 

Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Petrus Bastos
Actually, I don't know anything about FreeBSD. I never used this system.
But, here my zip command works fine at command line, why doesn't works with
PHP?


On Feb 18, 2008 6:28 PM, Shawn McKenzie [EMAIL PROTECTED] wrote:

 Greg Donald wrote:
  On 2/18/08, Shawn McKenzie [EMAIL PROTECTED] wrote:
  Sure, if you want to miss all the linker and compiler goodies :-)
 
  I'm guessing that'd be non-issue for an obviously inexperienced FreeBSD
 user.
 
 
 But I'm guessing he'd think it was cool.  Also, he's not root so I
 assume that pkg_add won't work either.  The ftp error may be misleading,
 dunno.

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




Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Wolf

 Petrus Bastos [EMAIL PROTECTED] wrote: 
 Actually, I don't know anything about FreeBSD. I never used this system.
 But, here my zip command works fine at command line, why doesn't works with
 PHP?
 
 
! -- SNIP --

Have you talked with your server admins about the use of zip?  Sounds like you 
have an environment set up by a blind monkey.

Are you sure the command is actually working from the command line?
What is the command and output?

Wolf

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



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Wolf

 Petrus Bastos [EMAIL PROTECTED] wrote: 
 Wolf,
 
 I'm sure actually working from the command line.
 
  /usr/local/bin/zip -P  t.zip biblioteca.php
   adding: biblioteca.php (deflated 73%)
 
 
 
 On Feb 18, 2008 6:37 PM, Wolf [EMAIL PROTECTED] wrote:
 
 
   Petrus Bastos [EMAIL PROTECTED] wrote:
   Actually, I don't know anything about FreeBSD. I never used this
  system.
   But, here my zip command works fine at command line, why doesn't works
  with
   PHP?
  
  
  ! -- SNIP --
 
  Have you talked with your server admins about the use of zip?  Sounds like
  you have an environment set up by a blind monkey.
 
  Are you sure the command is actually working from the command line?
  What is the command and output?
 
  Wolf
 

What does your script command look like?

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



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Shawn McKenzie
Greg Donald wrote:
 On 2/18/08, Shawn McKenzie [EMAIL PROTECTED] wrote:
 Sure, if you want to miss all the linker and compiler goodies :-)
 
 I'm guessing that'd be non-issue for an obviously inexperienced FreeBSD user.
 
 
But I'm guessing he'd think it was cool.  Also, he's not root so I
assume that pkg_add won't work either.  The ftp error may be misleading,
dunno.

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



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Greg Donald
On 2/18/08, Petrus Bastos [EMAIL PROTECTED] wrote:
 Error: FTP Unable to get
 ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-6.1-release/Latest/zip.tbz:
 File unavailable (e.g., file not found, no access)
  pkg_add: unable to fetch
 'ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-6.1-release/Latest/zip.tbz'
 by URL


Works fine for me on 6.3-RELEASE.


-- 
Greg Donald
http://destiney.com/

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



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Petrus Bastos
Wolf,

I'm sure actually working from the command line.

 /usr/local/bin/zip -P  t.zip biblioteca.php
  adding: biblioteca.php (deflated 73%)



On Feb 18, 2008 6:37 PM, Wolf [EMAIL PROTECTED] wrote:


  Petrus Bastos [EMAIL PROTECTED] wrote:
  Actually, I don't know anything about FreeBSD. I never used this
 system.
  But, here my zip command works fine at command line, why doesn't works
 with
  PHP?
 
 
 ! -- SNIP --

 Have you talked with your server admins about the use of zip?  Sounds like
 you have an environment set up by a blind monkey.

 Are you sure the command is actually working from the command line?
 What is the command and output?

 Wolf



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Petrus Bastos
Error: FTP Unable to get
ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-6.1-release/Latest/zip.tbz:
File unavailable (e.g., file not found, no access)
pkg_add: unable to fetch '
ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-6.1-release/Latest/zip.tbz'
by URL

:(

On Feb 18, 2008 6:17 PM, Greg Donald [EMAIL PROTECTED] wrote:

 On 2/18/08, Shawn McKenzie [EMAIL PROTECTED] wrote:
  cd /usr/ports/archivers/zip
  make install clean zip

 pkg_add -r zip

 done.


 --
 Greg Donald
 http://destiney.com/

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




Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Stut

Petrus Bastos wrote:

Actually, I don't know anything about FreeBSD. I never used this system.
But, here my zip command works fine at command line, why doesn't works with
PHP?


Is here the server or your local machine? If zip works fine on the 
command line on the server then it's installed and should work fine from 
PHP assuming the web user has permission to do it.


You need to use the full path to the zip exe (usually /usr/local/bin/zip 
on FreeBSD), and full paths to any other file references just to be sure.


Make sure you're using a function that's gives you the full output and 
not just the last line. I tend to use backticks for this. It would also 
help to add 21 to the end of the command so you get output to stderr 
as well as stdout.


Finally, if it's still not working might I suggest you share your code. 
The problem may be more obvious if we have that.


-Stut

--
http://stut.net/

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



Re: [PHP] Converting tab delimited file to CSV

2008-02-18 Thread Andrew Ballard
On Feb 18, 2008 4:01 PM, Graham Cossey [EMAIL PROTECTED] wrote:

 On Feb 18, 2008 6:45 PM, Andrew Ballard [EMAIL PROTECTED] wrote:
  On Feb 18, 2008 1:39 PM, Robert Cummings [EMAIL PROTECTED] wrote:
 
  
   On Mon, 2008-02-18 at 13:24 -0500, Andrew Ballard wrote:
On Feb 18, 2008 1:08 PM, Graham Cossey [EMAIL PROTECTED]
 wrote:
   
 My biggest gripe with tab delimited files is
 that they are quite a bit bigger than comma delimited files so I
 may
 have to split the large files I receive into smaller 'chunks' to
 allow
 them to be uploaded.


Why would tab-delimited files be larger than CSV? A tab character
 takes
   up
just as much space as a comma as far as document size is concerned.
 Am I
missing something?
  
   He's probably confusing tab delimited with fixed width columns.
  
   Cheers,
   Rob.
  
 
  Ah, yes. That would also explain why Excel would open it as a single
 column
  by default if he didn't use the text import wizard.
 
  FWIW - If you do open a text file like this, there is a menu item to
 convert
  text to columnar data once the sheet is already open so you don't have
 to
  close the document and reopen it.
 
  Andrew
 

 Nope not fixed width, definitely tab delimited (longer fields
 'overlap' ones above and below when viewed in a text editor), as for
 the size difference I don't know why but when I open into Excel and
 save as CSV the files are smaller.

 I just opened a 50.2KB tab delimited file into Excel saved it as CSV
 and this new file is 25KB!!

 Maybe I really am finally going mad.


 --
 Graham


I can only think of two things that might cause that sort of bloat in a
file. Either the original had a lot of values quoted as strings that Excel
felt did not need to be (Excel usually only quotes strings if they have
commas in them whereas I've seen CSV files from an Oracle DB where every
field was quoted) or else the original was in a multi-byte character
encoding like UTF-16 and Excel trimmed it down to Windows-1252 or something
when you save it. Beyond that, I can't see any reason why the files would
vary that much. I can see a small difference with differing line endings (CR
LF versus just LF) in a file with several short lines, but Excel would even
tend toward the longer line endings.

Andrew


Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Greg Donald
On 2/18/08, Shawn McKenzie [EMAIL PROTECTED] wrote:
 Sure, if you want to miss all the linker and compiler goodies :-)

I'm guessing that'd be non-issue for an obviously inexperienced FreeBSD user.


-- 
Greg Donald
http://destiney.com/

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



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Petrus Bastos
I've tried. returned

Array
(
)

127



On Feb 18, 2008 6:58 PM, Daniel Brown [EMAIL PROTECTED] wrote:

 On Feb 18, 2008 4:55 PM, Petrus Bastos [EMAIL PROTECTED] wrote:
  system(/usr/local/bin/zip -P  t.zip biblioteca.php,$ret_val);
 
  that's my code and even zip with full path, return $ret_val = 127;

Try this instead:

 ?
 exec('/usr/local/bin/zip -P  t.zip biblioteca.php',$ret,$err);

 echo pre /\n;
 print_r($ret);
 echo /pre\n;

 echo pre /\n;
 print_r($err);
 echo /pre\n;
 ?

 --
 /Dan

 Daniel P. Brown
 Senior Unix Geek
 ? while(1) { $me = $mind--; sleep(86400); } ?



Re: [PHP] classes

2008-02-18 Thread Nick Stinemates
Shawn McKenzie wrote:
 Jay Blanchard wrote:
   
 [snip]
 if i declare an instance of a class in the top of my php file, then  
 have html, then later on user $myClassInstance-myMethod(); --  
 myMethod() does not execute, only when i have the instantiation of the  
 class right before the call to the method does it work. any ideas?
 [/snip]

 You are no longer running the script once the output has been sent to
 the screen. You need to flush output to the screen or re-order your
 code.

 http://www.php.net/flush
 

 Huh, what?!?! to both of you:

 ?php
 $myClassInstance = new myClass();
 ?
 Hello
 ?php

 $myClassInstance-myMethod();

 class myClass
 {
 function myMethod()
 {
 echo  world!;
 }
 }
 ?

 Outputs the expected.  Must be an error, maybe fatal or parse before the
 method call or maybe your method does execute you just are expecting
 something different?

 -Shawn

   
What part of my example was unclear?

-- 
==
Nick Stinemates ([EMAIL PROTECTED])
http://nick.stinemates.org

AIM: Nick Stinemates
MSN: [EMAIL PROTECTED]
Yahoo: [EMAIL PROTECTED]
==

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



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Wolf

 Petrus Bastos [EMAIL PROTECTED] wrote: 
 system(/usr/local/bin/zip -P  t.zip biblioteca.php,$ret_val);
 
 that's my code and even zip with full path, return $ret_val = 127;
 
 On Feb 18, 2008 6:43 PM, Wolf [EMAIL PROTECTED] wrote:
 
 
   Petrus Bastos [EMAIL PROTECTED] wrote:
   Wolf,
  
   I'm sure actually working from the command line.
  
/usr/local/bin/zip -P  t.zip biblioteca.php
 adding: biblioteca.php (deflated 73%)
   
  
  
   On Feb 18, 2008 6:37 PM, Wolf [EMAIL PROTECTED] wrote:
  
   
 Petrus Bastos [EMAIL PROTECTED] wrote:
 Actually, I don't know anything about FreeBSD. I never used this
system.
 But, here my zip command works fine at command line, why doesn't
  works
with
 PHP?


! -- SNIP --
   
Have you talked with your server admins about the use of zip?  Sounds
  like
you have an environment set up by a blind monkey.
   
Are you sure the command is actually working from the command line?
What is the command and output?
   
Wolf
   
 
  What does your script command look like?
 
http://www.google.com/search?q=php%3A+exec+zip+error+127ie=utf-8oe=utf-8aq=trls=com.ubuntu:en-US:officialclient=firefox-a

Try using Passthru

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



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Petrus Bastos
Results the same thing.

On Feb 18, 2008 6:59 PM, Wolf [EMAIL PROTECTED] wrote:


  Petrus Bastos [EMAIL PROTECTED] wrote:
  system(/usr/local/bin/zip -P  t.zip biblioteca.php,$ret_val);
 
  that's my code and even zip with full path, return $ret_val = 127;
 
  On Feb 18, 2008 6:43 PM, Wolf [EMAIL PROTECTED] wrote:
 
  
    Petrus Bastos [EMAIL PROTECTED] wrote:
Wolf,
   
I'm sure actually working from the command line.
   
 /usr/local/bin/zip -P  t.zip biblioteca.php
  adding: biblioteca.php (deflated 73%)

   
   
On Feb 18, 2008 6:37 PM, Wolf [EMAIL PROTECTED] wrote:
   

  Petrus Bastos [EMAIL PROTECTED] wrote:
  Actually, I don't know anything about FreeBSD. I never used
 this
 system.
  But, here my zip command works fine at command line, why doesn't
   works
 with
  PHP?
 
 
 ! -- SNIP --

 Have you talked with your server admins about the use of zip?
  Sounds
   like
 you have an environment set up by a blind monkey.

 Are you sure the command is actually working from the command
 line?
 What is the command and output?

 Wolf

  
   What does your script command look like?
  

 http://www.google.com/search?q=php%3A+exec+zip+error+127ie=utf-8oe=utf-8aq=trls=com.ubuntu:en-US:officialclient=firefox-a

 Try using Passthru



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Petrus Bastos
system(/usr/local/bin/zip -P  t.zip biblioteca.php,$ret_val);

that's my code and even zip with full path, return $ret_val = 127;

On Feb 18, 2008 6:43 PM, Wolf [EMAIL PROTECTED] wrote:


  Petrus Bastos [EMAIL PROTECTED] wrote:
  Wolf,
 
  I'm sure actually working from the command line.
 
   /usr/local/bin/zip -P  t.zip biblioteca.php
adding: biblioteca.php (deflated 73%)
  
 
 
  On Feb 18, 2008 6:37 PM, Wolf [EMAIL PROTECTED] wrote:
 
  
    Petrus Bastos [EMAIL PROTECTED] wrote:
Actually, I don't know anything about FreeBSD. I never used this
   system.
But, here my zip command works fine at command line, why doesn't
 works
   with
PHP?
   
   
   ! -- SNIP --
  
   Have you talked with your server admins about the use of zip?  Sounds
 like
   you have an environment set up by a blind monkey.
  
   Are you sure the command is actually working from the command line?
   What is the command and output?
  
   Wolf
  

 What does your script command look like?



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Daniel Brown
On Feb 18, 2008 4:55 PM, Petrus Bastos [EMAIL PROTECTED] wrote:
 system(/usr/local/bin/zip -P  t.zip biblioteca.php,$ret_val);

 that's my code and even zip with full path, return $ret_val = 127;

Try this instead:

?
exec('/usr/local/bin/zip -P  t.zip biblioteca.php',$ret,$err);

echo pre /\n;
print_r($ret);
echo /pre\n;

echo pre /\n;
print_r($err);
echo /pre\n;
?

-- 
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?

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



Re: [PHP] Protected ZIP file with password

2008-02-18 Thread Petrus Bastos
I've tried without success...

system(/usr/local/bin/zip -P 
/.automount/ipojuca/export/homeg03/golapa/public_html/mapdenguepe128/site/php/biblioteca/t.zip
/.automount/ipojuca/export/homeg03/golapa/public_html/mapdenguepe128/site/php/biblioteca/biblioteca.php,$ret_val);


On Feb 18, 2008 7:16 PM, Shawn McKenzie [EMAIL PROTECTED] wrote:

 In your php code you'll need the full path to biblioteca.php and to
 t.zip and the web user will need write permissions to the dir where you
 create t.zip.

 -Shawn

 Petrus Bastos wrote:
  Wolf,
 
  I'm sure actually working from the command line.
 
   /usr/local/bin/zip -P  t.zip biblioteca.php
adding: biblioteca.php (deflated 73%)
  
 
 
  On Feb 18, 2008 6:37 PM, Wolf [EMAIL PROTECTED]
  mailto:[EMAIL PROTECTED] wrote:
 
 
   Petrus Bastos [EMAIL PROTECTED]
  mailto:[EMAIL PROTECTED] wrote:
   Actually, I don't know anything about FreeBSD. I never used
  this system.
   But, here my zip command works fine at command line, why doesn't
  works with
   PHP?
  
  
  ! -- SNIP --
 
  Have you talked with your server admins about the use of zip?
   Sounds like you have an environment set up by a blind monkey.
 
  Are you sure the command is actually working from the command line?
  What is the command and output?
 
  Wolf
 
 



  1   2   >