php-general Digest 11 Oct 2011 09:21:56 -0000 Issue 7514

2011-10-11 Thread php-general-digest-help

php-general Digest 11 Oct 2011 09:21:56 - Issue 7514

Topics (messages 315212 through 315226):

Decoding Barcode Images
315212 by: Floyd Resler
315213 by: Jason Pruim
315214 by: Matthew Pounsett
315215 by: Shaun J. Farrell
315216 by: Floyd Resler

Re: Oi , Portas/ Hello, Ports
315217 by: Tim Streater
315218 by: Ashley Sheridan

Re: Need help Wth PHP
315219 by: Rod Lindgren
315220 by: Paul M Foster
315222 by: Rod Lindgren
315224 by: Govinda

Re: Multiple SQLite statements
315221 by: Paul M Foster
315226 by: Tim Streater

Re: Please unsubscribe
315223 by: Sharl.Jimh.Tsin

OpenSSL PKCS12 Exporting
315225 by: Justin Kaufman

Administrivia:

To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
php-gene...@lists.php.net


--
---BeginMessage---
I've been trying to find a solution for decoding barcode images in PHP but 
haven't had much luck so far.  Does anyone have any suggestions?

Thanks!
Floyd

---End Message---
---BeginMessage---

Jason Pruim
li...@pruimphotography.com



On Oct 10, 2011, at 2:42 PM, Floyd Resler wrote:

 I've been trying to find a solution for decoding barcode images in PHP but 
 haven't had much luck so far.  Does anyone have any suggestions?
 
 Thanks!
 Floyd


Hi Floyd,

What kind of barcodes are you wanting to work with? 2D? Postnet? IMB? QRCodes?


---End Message---
---BeginMessage---

On 2011-10-10, at 14:42, Floyd Resler wrote:

 I've been trying to find a solution for decoding barcode images in PHP but 
 haven't had much luck so far.  Does anyone have any suggestions?

I'm not familiar with a way to do it directly in PHP, but you could shell out 
to something like zbar to do it.



---End Message---
---BeginMessage---
zxing has a java commandline app that you can run.. simple to use great results.

http://code.google.com/p/zxing/

Shaun
www.brewerydb.com

On Oct 10, 2011, at 2:47 PM, Matthew Pounsett wrote:

 
 On 2011-10-10, at 14:42, Floyd Resler wrote:
 
 I've been trying to find a solution for decoding barcode images in PHP but 
 haven't had much luck so far.  Does anyone have any suggestions?
 
 I'm not familiar with a way to do it directly in PHP, but you could shell out 
 to something like zbar to do it.
 
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

---End Message---
---BeginMessage---

On Oct 10, 2011, at 3:54 PM, Shaun J. Farrell wrote:

 zxing has a java commandline app that you can run.. simple to use great 
 results.
 
 http://code.google.com/p/zxing/
 
 Shaun
 www.brewerydb.com
 
 On Oct 10, 2011, at 2:47 PM, Matthew Pounsett wrote:
 
 
 On 2011-10-10, at 14:42, Floyd Resler wrote:
 
 I've been trying to find a solution for decoding barcode images in PHP but 
 haven't had much luck so far.  Does anyone have any suggestions?
 
 I'm not familiar with a way to do it directly in PHP, but you could shell 
 out to something like zbar to do it.
 
 
 
 

Thanks for pointing out zxing!  It seems to work great except it doesn't like 
my PDF-417 barcode.  A little tweaking on my end should get it to work.

Thanks!
Floyd


---End Message---
---BeginMessage---
On 10 Oct 2011 at 19:30, Ashley Sheridan a...@ashleysheridan.co.uk wrote: 

 Jim Giner jim.gi...@albanyhandball.com wrote:


 QI.VOLMAR QI qi.vol...@gmail.com wrote in message
 news:cab7l6ey9rkfwtmprpe0fk3doo5s1c5jyhpnbt5rjj0f_eb5...@mail.gmail.com...
 Alguem sabe se, e como eu posso trabalhar com as portas do computador
 com
 php no windows?

 Do someone know if, and how, I could work with Computer logical ports
 with
 PHP on Windows?

 ex: shell_exec('cat /dev/usbmon0 | hexdump'); - Linux


 If you mean use php to interrogate a port I would think the answer is
 No.
 Computer port=client; PHP=server.

 You can if the port is a server port, i.e. you're creating a daemon.. But, if
 it is the client machine you wish to inspect, then as Jim mentioned, PHP is
 not for you and something like java may be better suited, although I'm not
 sure how much power an applet has in this area.

Nothing wrong with using PHP client-side, I run plenty of PHP scripts that way.

--
Cheers  --  Tim
---End Message---
---BeginMessage---
On Mon, 2011-10-10 at 22:15 +0100, Tim Streater wrote:

 On 10 Oct 2011 at 19:30, Ashley Sheridan a...@ashleysheridan.co.uk wrote: 
 
  Jim Giner jim.gi...@albanyhandball.com wrote:
 
 
  QI.VOLMAR QI qi.vol...@gmail.com wrote in message
  news:cab7l6ey9rkfwtmprpe0fk3doo5s1c5jyhpnbt5rjj0f_eb5...@mail.gmail.com...
  Alguem sabe se, e como eu posso trabalhar com as portas do computador
  com
  php no windows?
 
  Do someone know if, and how, I could work with Computer logical ports
  with
  PHP on 

php-general Digest 12 Oct 2011 04:20:38 -0000 Issue 7515

2011-10-11 Thread php-general-digest-help

php-general Digest 12 Oct 2011 04:20:38 - Issue 7515

Topics (messages 315227 through 315245):

Re: Multiple SQLite statements
315227 by: David Robley
315228 by: Tim Streater
315229 by: David Robley
315230 by: Tim Streater

newline and return issues in string
315231 by: admin.buskirkgraphics.com
315232 by: Bastien Koert
315233 by: admin.buskirkgraphics.com
315234 by: Richard Quadling
315235 by: Fatih P.
315236 by: Al
315237 by: admin.buskirkgraphics.com
315238 by: admin.buskirkgraphics.com
315239 by: Al

Re: files outside of documentRoot
315240 by: Ricardo Martinez
315241 by: Bastien Koert

Problem with base64_encode and openssl_verify
315242 by: QI.VOLMAR QI

How to know the path of `php.ini` used when call php.exe from CLI/command-line 
in Windows 7
315243 by: Nam Gi VU
315244 by: Daniel Brown

Re: Server Side Include translator as PHP functions
315245 by: tamouse mailing lists

Administrivia:

To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
php-gene...@lists.php.net


--
---BeginMessage---
Tim Streater wrote:

 On 11 Oct 2011 at 03:03, Paul M Foster pa...@quillandmouse.com wrote:
 
 On Mon, Oct 10, 2011 at 04:14:00PM +0100, Tim Streater wrote:

 I would like to use the SQLite3 (not PDO) interface to SQLite, and I
 would like to be able to supply a string containing several SQL
 statements and have them all executed, thus saving the overhead of
 several calls. It *appears* that this may be how it actually works,
 but I wondered if anyone could confirm that.

 --
 Cheers  --  Tim


 The docs appear to agree that this is allowed. See:

 http://us.php.net/manual/en/function.sqlite-exec.php
 
 That's the SQLite interface, though, rather than the SQLite3 one. The
 latter just says: Executes an SQL query 
 
 --
 Cheers  --  Tim

Not to be a smartass or anything, but what about TIAS ?


Cheers
-- 
David Robley

I don't eat snails... I prefer FAST food!
Today is Prickle-Prickle, the 65th day of Bureaucracy in the YOLD 3177. 

---End Message---
---BeginMessage---
On 11 Oct 2011 at 10:47, David Robley robl...@aapt.net.au wrote: 

 Tim Streater wrote:

 On 11 Oct 2011 at 03:03, Paul M Foster pa...@quillandmouse.com wrote:

 On Mon, Oct 10, 2011 at 04:14:00PM +0100, Tim Streater wrote:

 I would like to use the SQLite3 (not PDO) interface to SQLite, and I
 would like to be able to supply a string containing several SQL
 statements and have them all executed, thus saving the overhead of
 several calls. It *appears* that this may be how it actually works,
 but I wondered if anyone could confirm that.

 The docs appear to agree that this is allowed. See:

 http://us.php.net/manual/en/function.sqlite-exec.php

 That's the SQLite interface, though, rather than the SQLite3 one. The
 latter just says: Executes an SQL query 

 Not to be a smartass or anything, but what about TIAS ?

What that?

--
Cheers  --  Tim
---End Message---
---BeginMessage---
Tim Streater wrote:

 On 11 Oct 2011 at 10:47, David Robley robl...@aapt.net.au wrote:
 
 Tim Streater wrote:

 On 11 Oct 2011 at 03:03, Paul M Foster pa...@quillandmouse.com wrote:

 On Mon, Oct 10, 2011 at 04:14:00PM +0100, Tim Streater wrote:

 I would like to use the SQLite3 (not PDO) interface to SQLite, and I
 would like to be able to supply a string containing several SQL
 statements and have them all executed, thus saving the overhead of
 several calls. It *appears* that this may be how it actually works,
 but I wondered if anyone could confirm that.
 
 The docs appear to agree that this is allowed. See:

 http://us.php.net/manual/en/function.sqlite-exec.php

 That's the SQLite interface, though, rather than the SQLite3 one. The
 latter just says: Executes an SQL query 
 
 Not to be a smartass or anything, but what about TIAS ?
 
 What that?
 
 --
 Cheers  --  Tim

Er, Try It And See

A couple of minutes experimentation might have saved you the time of email,
wait for an answer ...


Cheers
-- 
David Robley

Mothers are the necessity of invention -- Calvin
Today is Prickle-Prickle, the 65th day of Bureaucracy in the YOLD 3177. 

---End Message---
---BeginMessage---
On 11 Oct 2011 at 11:25, David Robley robl...@aapt.net.au wrote: 

 Tim Streater wrote:

 On 11 Oct 2011 at 10:47, David Robley robl...@aapt.net.au wrote:

 Tim Streater wrote:

 On 11 Oct 2011 at 03:03, Paul M Foster pa...@quillandmouse.com wrote:

 On Mon, Oct 10, 2011 at 04:14:00PM +0100, Tim Streater wrote:

 I would like to use the SQLite3 (not PDO) interface to SQLite, and I
 would like to be able to supply a string containing several SQL
 statements and have them all executed, thus saving the overhead 

Re: Re: [PHP] Multiple SQLite statements

2011-10-11 Thread Tim Streater
On 11 Oct 2011 at 03:03, Paul M Foster pa...@quillandmouse.com wrote: 

 On Mon, Oct 10, 2011 at 04:14:00PM +0100, Tim Streater wrote:

 I would like to use the SQLite3 (not PDO) interface to SQLite, and I
 would like to be able to supply a string containing several SQL
 statements and have them all executed, thus saving the overhead of
 several calls. It *appears* that this may be how it actually works,
 but I wondered if anyone could confirm that.

 --
 Cheers  --  Tim


 The docs appear to agree that this is allowed. See:

 http://us.php.net/manual/en/function.sqlite-exec.php

That's the SQLite interface, though, rather than the SQLite3 one. The latter 
just says: Executes an SQL query 

--
Cheers  --  Tim

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

Re: Re: [PHP] Multiple SQLite statements

2011-10-11 Thread David Robley
Tim Streater wrote:

 On 11 Oct 2011 at 03:03, Paul M Foster pa...@quillandmouse.com wrote:
 
 On Mon, Oct 10, 2011 at 04:14:00PM +0100, Tim Streater wrote:

 I would like to use the SQLite3 (not PDO) interface to SQLite, and I
 would like to be able to supply a string containing several SQL
 statements and have them all executed, thus saving the overhead of
 several calls. It *appears* that this may be how it actually works,
 but I wondered if anyone could confirm that.

 --
 Cheers  --  Tim


 The docs appear to agree that this is allowed. See:

 http://us.php.net/manual/en/function.sqlite-exec.php
 
 That's the SQLite interface, though, rather than the SQLite3 one. The
 latter just says: Executes an SQL query 
 
 --
 Cheers  --  Tim

Not to be a smartass or anything, but what about TIAS ?


Cheers
-- 
David Robley

I don't eat snails... I prefer FAST food!
Today is Prickle-Prickle, the 65th day of Bureaucracy in the YOLD 3177. 


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



Re: Re: Re: [PHP] Multiple SQLite statements

2011-10-11 Thread Tim Streater
On 11 Oct 2011 at 10:47, David Robley robl...@aapt.net.au wrote: 

 Tim Streater wrote:

 On 11 Oct 2011 at 03:03, Paul M Foster pa...@quillandmouse.com wrote:

 On Mon, Oct 10, 2011 at 04:14:00PM +0100, Tim Streater wrote:

 I would like to use the SQLite3 (not PDO) interface to SQLite, and I
 would like to be able to supply a string containing several SQL
 statements and have them all executed, thus saving the overhead of
 several calls. It *appears* that this may be how it actually works,
 but I wondered if anyone could confirm that.

 The docs appear to agree that this is allowed. See:

 http://us.php.net/manual/en/function.sqlite-exec.php

 That's the SQLite interface, though, rather than the SQLite3 one. The
 latter just says: Executes an SQL query 

 Not to be a smartass or anything, but what about TIAS ?

What that?

--
Cheers  --  Tim

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

Re: Re: Re: [PHP] Multiple SQLite statements

2011-10-11 Thread David Robley
Tim Streater wrote:

 On 11 Oct 2011 at 10:47, David Robley robl...@aapt.net.au wrote:
 
 Tim Streater wrote:

 On 11 Oct 2011 at 03:03, Paul M Foster pa...@quillandmouse.com wrote:

 On Mon, Oct 10, 2011 at 04:14:00PM +0100, Tim Streater wrote:

 I would like to use the SQLite3 (not PDO) interface to SQLite, and I
 would like to be able to supply a string containing several SQL
 statements and have them all executed, thus saving the overhead of
 several calls. It *appears* that this may be how it actually works,
 but I wondered if anyone could confirm that.
 
 The docs appear to agree that this is allowed. See:

 http://us.php.net/manual/en/function.sqlite-exec.php

 That's the SQLite interface, though, rather than the SQLite3 one. The
 latter just says: Executes an SQL query 
 
 Not to be a smartass or anything, but what about TIAS ?
 
 What that?
 
 --
 Cheers  --  Tim

Er, Try It And See

A couple of minutes experimentation might have saved you the time of email,
wait for an answer ...


Cheers
-- 
David Robley

Mothers are the necessity of invention -- Calvin
Today is Prickle-Prickle, the 65th day of Bureaucracy in the YOLD 3177. 


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



Re: Re: Re: Re: [PHP] Multiple SQLite statements

2011-10-11 Thread Tim Streater
On 11 Oct 2011 at 11:25, David Robley robl...@aapt.net.au wrote: 

 Tim Streater wrote:

 On 11 Oct 2011 at 10:47, David Robley robl...@aapt.net.au wrote:

 Tim Streater wrote:

 On 11 Oct 2011 at 03:03, Paul M Foster pa...@quillandmouse.com wrote:

 On Mon, Oct 10, 2011 at 04:14:00PM +0100, Tim Streater wrote:

 I would like to use the SQLite3 (not PDO) interface to SQLite, and I
 would like to be able to supply a string containing several SQL
 statements and have them all executed, thus saving the overhead of
 several calls. It *appears* that this may be how it actually works,
 but I wondered if anyone could confirm that.

 The docs appear to agree that this is allowed. See:

 http://us.php.net/manual/en/function.sqlite-exec.php

 That's the SQLite interface, though, rather than the SQLite3 one. The
 latter just says: Executes an SQL query 

 Not to be a smartass or anything, but what about TIAS ?

 What that?

 Er, Try It And See

 A couple of minutes experimentation might have saved you the time of email,
 wait for an answer ...

Well, there is an sqlite3 executable that one can run to do CLI things to a 
database. OS X comes with that and I was also able to download the source of 
that program, and the SQLite C amalgamation, and rebuild it myself. It is 
certainly possible, with that program, to execute a sequence of semi-colon 
separated statements. It *doesn't* work with PHP's PDO interface to sqlite, as 
I found in a test program I put together; I haven't properly tested that with 
the sqlite3 interface. I've tried asking on the sqlite general mailing list and 
(to me at least), the answers are at best unclear. There is a function, part of 
the C interface to sqlite, that talks about a sequence of statements, but I 
guess ultimately it depends on how the writer of the PHP sqlite3 interface 
implemented it.

--
Cheers  --  Tim

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

[PHP] newline and return issues in string

2011-10-11 Thread admin
I have come across an issue with my string that I would like to find a
faster way to resolve.

It seems there are new lines and returns at different positions of the
string. 

 

First I exploded on the new line explode(“\n”, $ string)

This gave me a nice array but when I try to implode I get the new lines
again.

There is not a consistent position and there seems to be some hidden returns
in the array as well.

 

Is there a way, or has someone written a filter that would allow me to
remove all the newlines and returns from the array or string.

Understand I have resolved this issue but I think I have to be going about
this the hard way because it is just too complex .

 

FYI

$filter = array(\r\n, \n, \r);

str_replace($filter,’’,$string) ß this is useless in this situation I have
tried and it does not change the string at all.

Understand the newlines and returns do not display in the string as
literals. Meaning you do not see /n or /r it is hidden.

 

 



Re: [PHP] newline and return issues in string

2011-10-11 Thread Bastien Koert
On Tue, Oct 11, 2011 at 7:58 AM,  ad...@buskirkgraphics.com wrote:
 I have come across an issue with my string that I would like to find a
 faster way to resolve.

 It seems there are new lines and returns at different positions of the
 string.



 First I exploded on the new line explode(“\n”, $ string)

 This gave me a nice array but when I try to implode I get the new lines
 again.

 There is not a consistent position and there seems to be some hidden returns
 in the array as well.



 Is there a way, or has someone written a filter that would allow me to
 remove all the newlines and returns from the array or string.

 Understand I have resolved this issue but I think I have to be going about
 this the hard way because it is just too complex .



 FYI

 $filter = array(\r\n, \n, \r);

 str_replace($filter,’’,$string) ß this is useless in this situation I have
 tried and it does not change the string at all.

 Understand the newlines and returns do not display in the string as
 literals. Meaning you do not see /n or /r it is hidden.







What about using nl2br() and then stripping out all the BR tags?

-- 

Bastien

Cat, the other other white meat

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



RE: [PHP] newline and return issues in string

2011-10-11 Thread admin
 -Original Message-
 From: Bastien Koert [mailto:phps...@gmail.com]
 Sent: Tuesday, October 11, 2011 8:53 AM
 To: ad...@buskirkgraphics.com
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] newline and return issues in string
 
 On Tue, Oct 11, 2011 at 7:58 AM,  ad...@buskirkgraphics.com wrote:
  I have come across an issue with my string that I would like to find
 a
  faster way to resolve.
 
  It seems there are new lines and returns at different positions of
 the
  string.
 
 
 
  First I exploded on the new line explode(“\n”, $ string)
 
  This gave me a nice array but when I try to implode I get the new
 lines
  again.
 
  There is not a consistent position and there seems to be some hidden
 returns
  in the array as well.
 
 
 
  Is there a way, or has someone written a filter that would allow me
 to
  remove all the newlines and returns from the array or string.
 
  Understand I have resolved this issue but I think I have to be going
 about
  this the hard way because it is just too complex .
 
 
 
  FYI
 
  $filter = array(\r\n, \n, \r);
 
  str_replace($filter,’’,$string) ß this is useless in this situation I
 have
  tried and it does not change the string at all.
 
  Understand the newlines and returns do not display in the string as
  literals. Meaning you do not see /n or /r it is hidden.
 
 
 
 
 
 
 
 What about using nl2br() and then stripping out all the BR tags?
 
 --
 
 Bastien
 
 Cat, the other other white meat

I tried that but same issue



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



Re: [PHP] newline and return issues in string

2011-10-11 Thread Richard Quadling
On 11 October 2011 12:58,  ad...@buskirkgraphics.com wrote:
 I have come across an issue with my string that I would like to find a
 faster way to resolve.

 It seems there are new lines and returns at different positions of the
 string.



 First I exploded on the new line explode(“\n”, $ string)

 This gave me a nice array but when I try to implode I get the new lines
 again.

 There is not a consistent position and there seems to be some hidden returns
 in the array as well.



 Is there a way, or has someone written a filter that would allow me to
 remove all the newlines and returns from the array or string.

 Understand I have resolved this issue but I think I have to be going about
 this the hard way because it is just too complex .



 FYI

 $filter = array(\r\n, \n, \r);

 str_replace($filter,’’,$string) ß this is useless in this situation I have
 tried and it does not change the string at all.

You don't want to remove them. You want to replace them with a constant.

$lines = explode(PHP_EOL, str_replace($filter, PHP_EOL, $string));

for example.





-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

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



Re: [PHP] newline and return issues in string

2011-10-11 Thread Fatih P.

On 10/11/2011 04:44 PM, Richard Quadling wrote:

On 11 October 2011 12:58,ad...@buskirkgraphics.com  wrote:

I have come across an issue with my string that I would like to find a
faster way to resolve.

It seems there are new lines and returns at different positions of the
string.



First I exploded on the new line explode(“\n”, $ string)

This gave me a nice array but when I try to implode I get the new lines
again.

There is not a consistent position and there seems to be some hidden returns
in the array as well.



Is there a way, or has someone written a filter that would allow me to
remove all the newlines and returns from the array or string.

Understand I have resolved this issue but I think I have to be going about
this the hard way because it is just too complex .



FYI

$filter = array(\r\n, \n, \r);

str_replace($filter,’’,$string) ß this is useless in this situation I have
tried and it does not change the string at all.

You don't want to remove them. You want to replace them with a constant.

$lines = explode(PHP_EOL, str_replace($filter, PHP_EOL, $string));

for example.







try to implement a string builder using array or arrayobject and on 
insert; filter / replace your text / characters using regex,



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



[PHP] Re: newline and return issues in string

2011-10-11 Thread Al



On 10/11/2011 7:58 AM, ad...@buskirkgraphics.com wrote:

I have come across an issue with my string that I would like to find a
faster way to resolve.

It seems there are new lines and returns at different positions of the
string.



First I exploded on the new line explode(“\n”, $ string)

This gave me a nice array but when I try to implode I get the new lines
again.

There is not a consistent position and there seems to be some hidden returns
in the array as well.



Is there a way, or has someone written a filter that would allow me to
remove all the newlines and returns from the array or string.

Understand I have resolved this issue but I think I have to be going about
this the hard way because it is just too complex .



FYI

$filter = array(\r\n, \n, \r);

str_replace($filter,’’,$string) ß this is useless in this situation I have
tried and it does not change the string at all.

Understand the newlines and returns do not display in the string as
literals. Meaning you do not see /n or /r it is hidden.








Try this:

$strippedStr= preg_replace(%(\n|\r)%, #, $string);

The # will let your see what's happening. Change it to simply . for the 
final version.






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



RE: [PHP] newline and return issues in string

2011-10-11 Thread admin
 -Original Message-
 From: Richard Quadling [mailto:rquadl...@gmail.com]
 Sent: Tuesday, October 11, 2011 9:44 AM
 To: ad...@buskirkgraphics.com
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] newline and return issues in string
 
 On 11 October 2011 12:58,  ad...@buskirkgraphics.com wrote:
  I have come across an issue with my string that I would like to find
 a
  faster way to resolve.
 
  It seems there are new lines and returns at different positions of
 the
  string.
 
 
 
  First I exploded on the new line explode(“\n”, $ string)
 
  This gave me a nice array but when I try to implode I get the new
 lines
  again.
 
  There is not a consistent position and there seems to be some hidden
 returns
  in the array as well.
 
 
 
  Is there a way, or has someone written a filter that would allow me
 to
  remove all the newlines and returns from the array or string.
 
  Understand I have resolved this issue but I think I have to be going
 about
  this the hard way because it is just too complex .
 
 
 
  FYI
 
  $filter = array(\r\n, \n, \r);
 
  str_replace($filter,’’,$string) ß this is useless in this situation I
 have
  tried and it does not change the string at all.
 
 You don't want to remove them. You want to replace them with a
 constant.
 
 $lines = explode(PHP_EOL, str_replace($filter, PHP_EOL, $string));
 
 for example.
 
 
 
 
 
 --
 Richard Quadling
 Twitter : EE : Zend : PHPDoc
 @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea



Richard I am not sure I understand what that is doing it made things 300% worse.



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



RE: [PHP] Re: newline and return issues in string

2011-10-11 Thread admin


Richard L. Buskirk
Senior Software Engineer/Systems Administrator

You can’t grow your business with systems that are on life support...


 -Original Message-
 From: Al [mailto:n...@ridersite.org]
 Sent: Tuesday, October 11, 2011 10:17 AM
 To: php-general@lists.php.net
 Subject: [PHP] Re: newline and return issues in string
 
 
 
 On 10/11/2011 7:58 AM, ad...@buskirkgraphics.com wrote:
  I have come across an issue with my string that I would like to find
 a
  faster way to resolve.
 
  It seems there are new lines and returns at different positions of
 the
  string.
 
 
 
  First I exploded on the new line explode(“\n”, $ string)
 
  This gave me a nice array but when I try to implode I get the new
 lines
  again.
 
  There is not a consistent position and there seems to be some hidden
 returns
  in the array as well.
 
 
 
  Is there a way, or has someone written a filter that would allow me
 to
  remove all the newlines and returns from the array or string.
 
  Understand I have resolved this issue but I think I have to be going
 about
  this the hard way because it is just too complex .
 
 
 
  FYI
 
  $filter = array(\r\n, \n, \r);
 
  str_replace($filter,’’,$string) ß this is useless in this situation I
 have
  tried and it does not change the string at all.
 
  Understand the newlines and returns do not display in the string as
  literals. Meaning you do not see /n or /r it is hidden.
 
 
 
 
 
 
 
 Try this:
 
 $strippedStr= preg_replace(%(\n|\r)%, #, $string);
 
 The # will let your see what's happening. Change it to simply . for
 the
 final version.
 
 
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




PERFECT  Thank you so much for that


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



Re: [PHP] Re: newline and return issues in string

2011-10-11 Thread Al



On 10/11/2011 10:44 AM, ad...@buskirkgraphics.com wrote:



Richard L. Buskirk
Senior Software Engineer/Systems Administrator

You can’t grow your business with systems that are on life support...



-Original Message-
From: Al [mailto:n...@ridersite.org]
Sent: Tuesday, October 11, 2011 10:17 AM
To: php-general@lists.php.net
Subject: [PHP] Re: newline and return issues in string



On 10/11/2011 7:58 AM, ad...@buskirkgraphics.com wrote:

I have come across an issue with my string that I would like to find

a

faster way to resolve.

It seems there are new lines and returns at different positions of

the

string.



First I exploded on the new line explode(“\n”, $ string)

This gave me a nice array but when I try to implode I get the new

lines

again.

There is not a consistent position and there seems to be some hidden

returns

in the array as well.



Is there a way, or has someone written a filter that would allow me

to

remove all the newlines and returns from the array or string.

Understand I have resolved this issue but I think I have to be going

about

this the hard way because it is just too complex .



FYI

$filter = array(\r\n, \n, \r);

str_replace($filter,’’,$string) ß this is useless in this situation I

have

tried and it does not change the string at all.

Understand the newlines and returns do not display in the string as
literals. Meaning you do not see /n or /r it is hidden.








Try this:

$strippedStr= preg_replace(%(\n|\r)%, #, $string);

The # will let your see what's happening. Change it to simply . for
the
final version.





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





PERFECT  Thank you so much for that



I don't know why so many go to awful extremes to avoid using the preg functions. 
Rarely, does their overhead have a measurable affect on overall execution times.



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



Re: [PHP] Re: files outside of documentRoot

2011-10-11 Thread Ricardo Martinez
Hi!

i'm was checking, readfile(); and fpassthru();

With easy examples, i can use it for show a pic in the screen and download a
file, from outside of documentRoot. It works fine.

The problem that i have now, is, i need can work with it, inside of other
documents, but i'm getting all time error by the headers. ( already sendt
... )

Anyone knows how to use it for can call the files and work together with
other page ¿?

Thanks

On Sun, Oct 9, 2011 at 6:57 PM, Sean Greenslade zootboys...@gmail.comwrote:


 On Sun, Oct 9, 2011 at 9:52 AM, Ricardo Martinez harisel...@gmail.comwrote:

 The files are, png, pdf and flv.

 Only users login can see or download it.

 thx ;

 On Sat, Oct 8, 2011 at 11:16 PM, Shawn McKenzie nos...@mckenzies.net
 wrote:

  On 10/08/2011 03:40 PM, Ricardo Martinez wrote:
   Hi List!
  
   I need to access files outside the DocumentRoot.
  
   I've been looking for info and documentation, and I've read that it
 can
  be
   done using symbolic links and another way is by using headers.
  
   I want to know, what do you think, what is the best way, and if anyone
  knows
   a good doc about of it.
  
   Thanks!!!
  
 
  It depends on what you mean by files.  Are they PHP files that need to
  be run, or images, or files that need to be downloaded by the user?
 
  For PHP, you would add the external dir to your include path.
 
  For images you can use a php file as the img src and that file sets the
  appropriate headers and uses readfile() to get and echo the image data:
  getimage.php?image=someimage.gif
 
  For download files you would do it in the same manner as for images:
  download.php?file=somefile.zip
 
 
  --
  Thanks!
  -Shawn
  http://www.spidean.com
 

 --
 Ricardo
 ___
 IT Architect
 website: http://www.pulsarinara.com



 Sounds like the downloader php script would be perfect (what Shawn
 suggested). Have the script check the login status, then (if valid) send the
 proper headers for the file and read out the data with the script.

 --
 --Zootboy

 Sent from my PC.




-- 
Ricardo
___
IT Architect
website: http://www.pulsarinara.com


Re: [PHP] Re: files outside of documentRoot

2011-10-11 Thread Bastien Koert
On Tue, Oct 11, 2011 at 11:00 AM, Ricardo Martinez harisel...@gmail.com wrote:
 Hi!

 i'm was checking, readfile(); and fpassthru();

 With easy examples, i can use it for show a pic in the screen and download a
 file, from outside of documentRoot. It works fine.

 The problem that i have now, is, i need can work with it, inside of other
 documents, but i'm getting all time error by the headers. ( already sendt
 ... )

 Anyone knows how to use it for can call the files and work together with
 other page ¿?

 Thanks

 On Sun, Oct 9, 2011 at 6:57 PM, Sean Greenslade zootboys...@gmail.comwrote:


 On Sun, Oct 9, 2011 at 9:52 AM, Ricardo Martinez harisel...@gmail.comwrote:

 The files are, png, pdf and flv.

 Only users login can see or download it.

 thx ;

 On Sat, Oct 8, 2011 at 11:16 PM, Shawn McKenzie nos...@mckenzies.net
 wrote:

  On 10/08/2011 03:40 PM, Ricardo Martinez wrote:
   Hi List!
  
   I need to access files outside the DocumentRoot.
  
   I've been looking for info and documentation, and I've read that it
 can
  be
   done using symbolic links and another way is by using headers.
  
   I want to know, what do you think, what is the best way, and if anyone
  knows
   a good doc about of it.
  
   Thanks!!!
  
 
  It depends on what you mean by files.  Are they PHP files that need to
  be run, or images, or files that need to be downloaded by the user?
 
  For PHP, you would add the external dir to your include path.
 
  For images you can use a php file as the img src and that file sets the
  appropriate headers and uses readfile() to get and echo the image data:
  getimage.php?image=someimage.gif
 
  For download files you would do it in the same manner as for images:
  download.php?file=somefile.zip
 
 
  --
  Thanks!
  -Shawn
  http://www.spidean.com
 

 --
 Ricardo
 ___
 IT Architect
 website: http://www.pulsarinara.com



 Sounds like the downloader php script would be perfect (what Shawn
 suggested). Have the script check the login status, then (if valid) send the
 proper headers for the file and read out the data with the script.

 --
 --Zootboy

 Sent from my PC.




 --
 Ricardo
 ___
 IT Architect
 website: http://www.pulsarinara.com


For images and the like, I have a separate page that is called that
handles the image and the headers needed

In the page I have some thing like

echo img src='get_image.php?id=$id';

Then in the get-image.php page i have the code that gets the image
from the db, outputs the appropriate headers and then outputs the
image

-- 

Bastien

Cat, the other other white meat

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



[PHP] Problem with base64_encode and openssl_verify

2011-10-11 Thread QI.VOLMAR QI
openssl_sign($dados, $signature, $pkeyid)); // return 1

$signatureValue = base64_encode($signature);

$funcionam = base64_decode($dados_que_nao);
$pubKey = file_get_contents('protected/models/nfe/certs/cert.pem');

openssl_verify($funcionam,$signature, $pubKey)); // return 0;

if I remove the de base64 encrypt and decrypt. It works fine. Can someone
helpme with this?


[PHP] How to know the path of `php.ini` used when call php.exe from CLI/command-line in Windows 7

2011-10-11 Thread Nam Gi VU
Hi every one,
Currently when I call php --ini from CLI, I just see C:\Windows but search
for this location, I cannot find any php.ini files.
I'm stuck there - where is the php.ini file used by php.exe called from CLI
as below

*C: php --ini*

Hope to hear from you!
Regards,
Nam


Re: [PHP] How to know the path of `php.ini` used when call php.exe from CLI/command-line in Windows 7

2011-10-11 Thread Daniel Brown
On Tue, Oct 11, 2011 at 14:40, Nam Gi VU nam.gi...@gmail.com wrote:
 Hi every one,
 Currently when I call php --ini from CLI, I just see C:\Windows but search
 for this location, I cannot find any php.ini files.
 I'm stuck there - where is the php.ini file used by php.exe called from CLI
 as below

 *C: php --ini*

If there's no php.ini file in the path it's checking, it'll just
use the internal defaults.  You may not have a php.ini file anywhere
on your system, which is okay if you don't need to do any tuning.

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/

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



Re: [PHP] Server Side Include translator as PHP functions

2011-10-11 Thread tamouse mailing lists
On Sat, Oct 8, 2011 at 10:36 AM, Complex complex.confus...@gmail.com wrote:
 Can you please tell me if there's already a set of PHP functions for
 translating SSI commands to PHP?
 I'm looking to do two things -- one difficult, one easy -- using PHP
 on a hosted server.

I can't believe that this hasn't already been done -- there are
probably lots of sites that used SSI in legacy systems that eventually
went to PHP that something like this only makes sense as an interim
step. Yet I can't find anything (or it's buried too deep in google
that my -fu isn't working).

Basically what you want to do is translate SSI directives on the fly
in PHP, yes? includes, execs, other SSI functions. I can't see an easy
way to this without actually reading the file and making substitutions
in it as you spit it out to the client. It doesn't seem like
especially difficult code to write, it's just surprising I can't find
something that already does it.

I did this a long time ago in Perl, but that code is lost to time.

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



Re: [PHP] Server Side Include translator as PHP functions

2011-10-11 Thread tamouse mailing lists
On Sun, Oct 9, 2011 at 12:36 PM, Tedd Sperling tedd.sperl...@gmail.com wrote:
 On Oct 9, 2011, at 11:41 AM, Complex wrote:

 Tedd,

 The crucial detail you're lookign for is my lack of choice or control
 in the matter, for all sorts of reasons that are actually quite stupid
 but not possible for *me* to change, and not possible for anyone else
 to change quickly. Thus I am looking for a solution to the problem at
 hand, instead of a suggestion for what the entire org should be doing
 instead. I know what they should be doing instead, but that's not my
 decision. It's not like I'm building a new website this way; I'm
 trying to move forwards with an existing and large website. The more
 different code-bases we have for different parts of the site, the
 harder it will be to actually change to something else (PHP-based, I
 pray).

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


 Without debating the question of choice, if I was confronted with a large web 
 site that used SSI, I would inform the client of such and put together a bid 
 as to my time to bring the site up to date. If not, then I think I would pass 
 on working the site. In my experience, it's not worth my additional time to 
 try to work around out of date technologies.

 It is also been my experience that when I am confronted with something large 
 scale, and when approved by the client, I simply do a site-wide find and 
 replace (namely change !--#include to ?php include) and then evaluate 
 all occurrences prior to changing. That usually gives me a good idea of the 
 breath of the problem.

 In addition, considering the !--#include has basically the same purpose as 
 ?php include, while it may be a wide-spread problem, I do not see it as a 
 serious problem to address. Certainly, when including files that have a 
 different suffix .shtml as compared to .php you will find that the Server 
 will treat them differently but that's pretty easy to fix -- just change the 
 files suffix or possibility write code in a .httacess file that would cause 
 the interpreter to consider shtml files the same a php.

 Of course, I may not fully understand the problem.

Of course, if it was just mapping includes, that would be too simple
to require much of a general solution. However SSI is more than just
includes. That's where it gets interesting.

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