php-general Digest 11 Nov 2011 18:15:38 -0000 Issue 7562

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

php-general Digest 11 Nov 2011 18:15:38 - Issue 7562

Topics (messages 315636 through 315641):

Re: Headers already sent
315636 by: Larry Garfield
315637 by: Kranthi Krishna
315639 by: Marc Guay

Re: json_encode confusion
315638 by: Richard Quadling

Frivolous Friday Fun!
315640 by: Jason Pruim
315641 by: Marc Guay

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---
Perhaps your server is configured to have output buffering enabled by 
default?  Check php.ini / phpinfo().


--Larry Garfield

On 11/11/2011 12:12 AM, Kranthi Krishna wrote:

Hi all,

I am missing something pretty obvious here. The PHP Manual says
Remember that header() must be called before any actual output is
sent, either by normal HTML tags, blank lines in a file, or from
PHP.. A simple test case shows otherwise

I have the following code

test
?php
setcookie(TestCookie, 'test');

nothing more nothing less.. only this code in a file

I get the output in the browser (test) AND the cookie is set
(verified by live HTTP headers). Any ides on why this is happening ?

Linux localhost 2.6.40-4.fc15.i686 #1 SMP Fri Jul 29 18:54:39 UTC 2011 i686
Apache 2.0 Handler
Zend Engine v2.3.0,  Xdebug v2.1.2
PHP 5.3.6

Kranthi.
http://goo.gl/e6t3

---End Message---
---BeginMessage---
Hi,

 Perhaps your server is configured to have output buffering enabled by default
Thanks. That was the problem. I spent a day trying to debug this.

Kranthi.
http://goo.gl/e6t3
---End Message---
---BeginMessage---
 Thanks. That was the problem. I spent a day trying to debug this.

Smash head against wall first, ask questions later.  That's my
methodology as well.  :)

Marc
---End Message---
---BeginMessage---
On 10 November 2011 14:45, Bastien Koert phps...@gmail.com wrote:
 Morning all,

 I've been having some fun with converting a text data file import into
 a json object for storage.

 I have a text file that is pipe delimited coming in via an upload. The
 first row is the headers and the second row is the data.

 Using this code:

 $data = file(inline_Nov_8_2011.txt);

 if(count($data)==2){

        $keys   = explode(|, $data[0]);
        $fields = explode(|, $data[1]);

        $combine = array_combine($keys, $fields);

        $json = json_encode($combine);
 }

 After the combine, I get an array that looks like this

 Array
 (
    ['Legal Last Name '] = Andros
    ['Legal Middle Initial '] =
    ['Legal First Name '] = Marisa
    ['Maiden/Other Name '] =
    ['Social Insurance No. '] = 123456789
    ['Date of Birth '] = 2/1/1988
    ['Gender '] = Female
 )

 But the json encoded value looks like this (there are way more
 elements but this should be enough to represent what I need to do).

 {null:Andros,null:,null:Marisa,null:,null:123456789,null:2\/1\/1988,null:Female}

 I have been googling for info about allowed values for the json keys,
 but can't seem to find a clear doc on what is allowed and what isn't.
 I have tried unquoted keys, replaced the spaced with underscores but
 nothing I do seems to help.

 When I echo out the json encoded data, the keys are all nulls.

 Can someone point me in the correct direction? It may be that I need
 to manually create the key names as an array first, which I was hoping
 to avoid since the file format coming from the client is still in some
 flux.

?php
$data = array(
   'Legal Last Name ' = 'Andros',
   'Legal Middle Initial ' = '',
   'Legal First Name ' = 'Marisa',
   'Maiden/Other Name ' = '',
   'Social Insurance No. ' = 123456789,
   'Date of Birth ' = '2/1/1988',
   'Gender ' = 'Female'
);

echo json_encode($data, JSON_FORCE_OBJECT);
?

outputs ...

{Legal Last Name :Andros,Legal Middle Initial :,Legal First
Name :Marisa,Maiden\/Other Name :,Social Insurance No.
:123456789,Date of Birth :2\/1\/1988,Gender :Female}


-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc : Fantasy Shopper
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea :
fan.sh/6/370
---End Message---
---BeginMessage---
The wife of a programmer to his husband:
Quote:
Darling, 
I'm starting to get a little worried about your work; you work too much... 
you spend more time with your CPU than with me... You program too much...
Her husband answers, to calm her:
Code:
!Honey; 
if(you.IsThinking(this)) !Worry;
CLove* myself = new CLove;   //I love you darling
while(world.DoExist()) 
{
 myself-m_bLoveForYou++;
 if(!myself-IsTrue())
 {
  delete myself;
  _exit(-1);
 }
}


And on a serious note... To any Past, Present, Or Future service man (Or woman) 
Thank you for your sacrifice in defending our ability to send out these 
Frivolous Friday emails! :)


Jason Pruim

Re: [PHP] json_encode confusion

2011-11-11 Thread Richard Quadling
On 10 November 2011 14:45, Bastien Koert phps...@gmail.com wrote:
 Morning all,

 I've been having some fun with converting a text data file import into
 a json object for storage.

 I have a text file that is pipe delimited coming in via an upload. The
 first row is the headers and the second row is the data.

 Using this code:

 $data = file(inline_Nov_8_2011.txt);

 if(count($data)==2){

        $keys   = explode(|, $data[0]);
        $fields = explode(|, $data[1]);

        $combine = array_combine($keys, $fields);

        $json = json_encode($combine);
 }

 After the combine, I get an array that looks like this

 Array
 (
    ['Legal Last Name '] = Andros
    ['Legal Middle Initial '] =
    ['Legal First Name '] = Marisa
    ['Maiden/Other Name '] =
    ['Social Insurance No. '] = 123456789
    ['Date of Birth '] = 2/1/1988
    ['Gender '] = Female
 )

 But the json encoded value looks like this (there are way more
 elements but this should be enough to represent what I need to do).

 {null:Andros,null:,null:Marisa,null:,null:123456789,null:2\/1\/1988,null:Female}

 I have been googling for info about allowed values for the json keys,
 but can't seem to find a clear doc on what is allowed and what isn't.
 I have tried unquoted keys, replaced the spaced with underscores but
 nothing I do seems to help.

 When I echo out the json encoded data, the keys are all nulls.

 Can someone point me in the correct direction? It may be that I need
 to manually create the key names as an array first, which I was hoping
 to avoid since the file format coming from the client is still in some
 flux.

?php
$data = array(
   'Legal Last Name ' = 'Andros',
   'Legal Middle Initial ' = '',
   'Legal First Name ' = 'Marisa',
   'Maiden/Other Name ' = '',
   'Social Insurance No. ' = 123456789,
   'Date of Birth ' = '2/1/1988',
   'Gender ' = 'Female'
);

echo json_encode($data, JSON_FORCE_OBJECT);
?

outputs ...

{Legal Last Name :Andros,Legal Middle Initial :,Legal First
Name :Marisa,Maiden\/Other Name :,Social Insurance No.
:123456789,Date of Birth :2\/1\/1988,Gender :Female}


-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc : Fantasy Shopper
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea :
fan.sh/6/370

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



Re: [PHP] Headers already sent

2011-11-11 Thread Marc Guay
 Thanks. That was the problem. I spent a day trying to debug this.

Smash head against wall first, ask questions later.  That's my
methodology as well.  :)

Marc

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



[PHP] Frivolous Friday Fun!

2011-11-11 Thread Jason Pruim
The wife of a programmer to his husband:
Quote:
Darling, 
I'm starting to get a little worried about your work; you work too much... 
you spend more time with your CPU than with me... You program too much...
Her husband answers, to calm her:
Code:
!Honey; 
if(you.IsThinking(this)) !Worry;
CLove* myself = new CLove;   //I love you darling
while(world.DoExist()) 
{
 myself-m_bLoveForYou++;
 if(!myself-IsTrue())
 {
  delete myself;
  _exit(-1);
 }
}


And on a serious note... To any Past, Present, Or Future service man (Or woman) 
Thank you for your sacrifice in defending our ability to send out these 
Frivolous Friday emails! :)


Jason Pruim
li...@pruimphotography.com





Re: [PHP] Frivolous Friday Fun!

2011-11-11 Thread Marc Guay
     if(!myself-IsTrue())
     {
          delete myself;
          _exit(-1);
     }

I like this part...


 And on a serious note... To any Past, Present, Or Future service man (Or 
 woman) Thank you for your sacrifice in defending our ability to send out 
 these Frivolous Friday emails! :)

... but not so much this part.  *I* can send Frivolous Friday emails
in spite of war, not because of it; please watch your ours.

Marc

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



Re: [PHP] Frivolous Friday Fun!

2011-11-11 Thread Daniel Brown
On Fri, Nov 11, 2011 at 13:15, Marc Guay marc.g...@gmail.com wrote:

 ... but not so much this part.  *I* can send Frivolous Friday emails
 in spite of war, not because of it; please watch your ours.

Our does not automatically become all-inclusive, but rather
suggests that the individual is part of a larger group.  Please watch
your presumptions of being force-included into said group, as the
statement is valid regardless of anyone's personal opinion.  ;-P

-- 
/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] Frivolous Friday Fun!

2011-11-11 Thread Marc Guay
    Our does not automatically become all-inclusive, but rather
 suggests that the individual is part of a larger group.  Please watch
 your presumptions of being force-included into said group, as the
 statement is valid regardless of anyone's personal opinion.  ;-P

Crap, you're right.

My apologies to myself for including myself in a group I didn't want
to be a part of.

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



Re: [PHP] Frivolous Friday Fun!

2011-11-11 Thread muad shibani
I love it

On Fri, Nov 11, 2011 at 9:22 PM, Marc Guay marc.g...@gmail.com wrote:

 Our does not automatically become all-inclusive, but rather
  suggests that the individual is part of a larger group.  Please watch
  your presumptions of being force-included into said group, as the
  statement is valid regardless of anyone's personal opinion.  ;-P

 Crap, you're right.

 My apologies to myself for including myself in a group I didn't want
 to be a part of.

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




-- 
*___*
*
*
السجل .. كل الأخبار من كل مكان

www.alsjl.com

صفحة السجل على فيسبوك
http://www.facebook.com/alsjl

*Muad Shibani*
*
*
Aden Yemen
Mobile: 00967 733045678

www.muadshibani.com


[PHP] Up to date book on PHP security?

2011-11-11 Thread Keith Purtell
As a PHP newbie, I was advised to get a book by Chris Shiflett titled 
Essential PHP Security. I looked at Amazon.com but the book appears to 
be more than five years old. Should I get something more up to date?


- Keith


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



Re: [PHP] Up to date book on PHP security?

2011-11-11 Thread Alain Williams
On Fri, Nov 11, 2011 at 05:01:19PM -0600, Keith Purtell wrote:
 As a PHP newbie, I was advised to get a book by Chris Shiflett titled 
 Essential PHP Security. I looked at Amazon.com but the book appears to 
 be more than five years old. Should I get something more up to date?

It is a good book -- easy to read, 1/2 day, and gives you a big picture.

-- 
Alain Williams
Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT 
Lecturer.
+44 (0) 787 668 0256  http://www.phcomp.co.uk/
Parliament Hill Computers Ltd. Registration Information: 
http://www.phcomp.co.uk/contact.php
#include std_disclaimer.h

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



Re: [PHP] Frivolous Friday Fun!

2011-11-11 Thread George Langley

On 2011-11-11, at 11:08 AM, Jason Pruim wrote:
 
 
 And on a serious note... To any Past, Present, Or Future service man (Or 
 woman) Thank you for your sacrifice in defending our ability to send out 
 these Frivolous Friday emails! :)

You're welcome!

CPO2 George Langley
HMCS TECUMSEH Naval Reserve
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Pipe To A Program

2011-11-11 Thread Ron Piggott

I am looking at CPanel’s “E-Mail filtering” option “Pipe To A Program”
http://docs.cpanel.net/twiki/bin/view/AllDocumentation/CpanelDocs/FilterOptions

The goal I am working towards is saving the contents of an incoming e-mail 
address into a mySQL table.  I am thinking of trying to program a customer 
contact center application.

Does anyone know what variable the e-mail message is assigned within the 
context of “Pipe To A Program”?  Is there a way to find out?  I can’t figure 
this out.  

What I have tried so far is below:

===
#!/usr/local/bin/php -q
?php


foreach($_REQUEST as $key = $val) {
 $$key = $val;
 
$email_body .= KEY:  . $key . \r\n;
$email_body .= VAL:  . $val . \r\n;
$email_body .= \r\n;

}

mail( user@domain , Test Pipe To Program , $email_body );
===

The mail command works, but the e-mail message body is empty.   I am at a loss 
of how to proceed.

Ron