php-general Digest 23 Feb 2012 09:15:52 -0000 Issue 7699

2012-02-23 Thread php-general-digest-help

php-general Digest 23 Feb 2012 09:15:52 - Issue 7699

Topics (messages 316760 through 316763):

Re: SimpleXML and the Single String (SOLVED)
316760 by: Jay Blanchard
316761 by: Marco Behnke
316762 by: Jay Blanchard

PHP-FPM  security.limit_extensions
316763 by: Paspao

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---

On 2/22/2012 8:32 AM, ma...@behnke.biz wrote:

  There is another nice way.
You can pass a second value to the simple xml constructor which is a class
name to be used instead of SimpleXMLElement.
You can write your own class that extends SimpleXMLElement and override the
magic methods to skip the casting

I don't really see a need to add an extra layer or class extension when 
casting works fine. Am I wrong? Why add several lines of code in an 
extension class?
---End Message---
---BeginMessage---
Am 22.02.12 16:04, schrieb Jay Blanchard:
 On 2/22/2012 8:32 AM, ma...@behnke.biz wrote:
   There is another nice way.
 You can pass a second value to the simple xml constructor which is a
 class
 name to be used instead of SimpleXMLElement.
 You can write your own class that extends SimpleXMLElement and
 override the
 magic methods to skip the casting

 I don't really see a need to add an extra layer or class extension
 when casting works fine. Am I wrong? Why add several lines of code in
 an extension class?

To keep the code readable?

$value = $xml-node;

vs.

$value = (String)$xml-node;

I like the first one. Plus you handle it to dynamically to the right type

function __get($value)
{
if is float return float casted value
if is boolean ...
and so on
}

-- 
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz




signature.asc
Description: OpenPGP digital signature
---End Message---
---BeginMessage---
 I don't really see a need to add an extra layer or class extension
 when casting works fine. Am I wrong? Why add several lines of code in
 an extension class?
 
 To keep the code readable?
 
 $value = $xml-node;
 
 vs.
 
 $value = (String)$xml-node;
 
 I like the first one. Plus you handle it to dynamically to the right type
 
 function __get($value)
 {
if is float return float casted value
if is boolean ...
and so on
 }

The code is no less readable my way, YMMV
---End Message---
---BeginMessage---
Hello ,

I need to parse PHP files with no extension , I was getting access denied error 
than I discovered that it was cause by security.limit_extensions option in 
PHP-FPM config file.

I tried to add the script name (testscript) to the configuration file and now 
it works:

security.limit_extensions = .php .php3 .php4 .php5 testscript

I do not want to add all filenames and then restart php-fpm each time, is there 
a way to parse all file without extension or a wildcard to put in configuration?


Thank you
P.---End Message---


php-general Digest 24 Feb 2012 02:02:31 -0000 Issue 7700

2012-02-23 Thread php-general-digest-help

php-general Digest 24 Feb 2012 02:02:31 - Issue 7700

Topics (messages 316764 through 316774):

Re: PHP-FPM security.limit_extensions
316764 by: Nilesh Govindrajan

Selecting checkboxes based on SQL query
316765 by: Rick Dwyer
316766 by: Matijn Woudt
316767 by: Matijn Woudt
316768 by: Fatih P.
316769 by: Rick Dwyer
316770 by: Fatih P.
316771 by: Jim Lucas

Where did my comment go related to lower/upper bounds for any number and offset?
316772 by: Daevid Vincent
316773 by: Daniel Brown

Apache 2.4.1 and php?
316774 by: Daniel Fenn

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---
On Feb 23, 2012 2:46 PM, Paspao pas...@gmail.com wrote:

 Hello ,

 I need to parse PHP files with no extension , I was getting access denied
error than I discovered that it was cause by security.limit_extensions
option in PHP-FPM config file.

 I tried to add the script name (testscript) to the configuration file and
now it works:

 security.limit_extensions = .php .php3 .php4 .php5 testscript

 I do not want to add all filenames and then restart php-fpm each time, is
there a way to parse all file without extension or a wildcard to put in
configuration?


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


I'm not sure why would you want to do that. Why dont you use rewrite rules
instead?

--
Nilesh Govindrajan
http://nileshgr.com
---End Message---
---BeginMessage---

Hello all.

I perform a SQL query like the following:

$sql = 'select * from my_table where id=10

It returns the the following array for 3 records:


Array ( [0] = Array ( [cb] = 2 ) [1] = Array ( [cb] = 6 ) [2] =  
Array ( [cb] = 1 ) )


The values of CB in the above array are the values of html checkboxes  
on a page.


input type=checkbox name=cb[ ] value=1...
input type=checkbox name=cb[ ] value=2...
input type=checkbox name=cb[ ] value=3...
input type=checkbox name=cb[ ] value=4... etc

If the above array's cb value matches the value of a checkbox on the  
page, I need the default state of the checkbox to be checked so I  
know I'm going to have some ternary logic in each html checkbox.  But  
I don't know how to create a custom function from the above array to  
provide that logic.  I've tried some tutorials, but with no success as  
the array I am receiving is not like those in the tutorials.


Any help would be greatly appreciated.

Thank you.


 --Rick


---End Message---
---BeginMessage---
On Thu, Feb 23, 2012 at 7:49 PM, Rick Dwyer rpdw...@earthlink.net wrote:
 Hello all.

 I perform a SQL query like the following:

 $sql = 'select * from my_table where id=10

 It returns the the following array for 3 records:


 Array ( [0] = Array ( [cb] = 2 ) [1] = Array ( [cb] = 6 ) [2] = Array (
 [cb] = 1 ) )

 The values of CB in the above array are the values of html checkboxes on a
 page.

 input type=checkbox name=cb[ ] value=1...
 input type=checkbox name=cb[ ] value=2...
 input type=checkbox name=cb[ ] value=3...
 input type=checkbox name=cb[ ] value=4... etc

 If the above array's cb value matches the value of a checkbox on the page, I
 need the default state of the checkbox to be checked so I know I'm going
 to have some ternary logic in each html checkbox.  But I don't know how to
 create a custom function from the above array to provide that logic.  I've
 tried some tutorials, but with no success as the array I am receiving is not
 like those in the tutorials.

 Any help would be greatly appreciated.

 Thank you.


  --Rick


How about this:

input type=checkbox name=cb[ ] value=1 ?php
if(in_array(array('cb' = 1))) echo checked; ?...
input type=checkbox name=cb[ ] value=2 ?php
if(in_array(array('cb' = 2))) echo checked; ?...
input type=checkbox name=cb[ ] value=3 ?php
if(in_array(array('cb' = 3))) echo checked; ?...
input type=checkbox name=cb[ ] value=4 ?php
if(in_array(array('cb' = 4))) echo checked; ?... etc

- Matijn
---End Message---
---BeginMessage---
On Thu, Feb 23, 2012 at 8:07 PM, Matijn Woudt tijn...@gmail.com wrote:
 On Thu, Feb 23, 2012 at 7:49 PM, Rick Dwyer rpdw...@earthlink.net wrote:
 Hello all.

 I perform a SQL query like the following:

 $sql = 'select * from my_table where id=10

 It returns the the following array for 3 records:


 Array ( [0] = Array ( [cb] = 2 ) [1] = Array ( [cb] = 6 ) [2] = Array (
 [cb] = 1 ) )

 The values of CB in the above array are the values of html checkboxes on a
 page.

 input type=checkbox name=cb[ ] value=1...
 input type=checkbox name=cb[ ] value=2...
 input type=checkbox name=cb[ ] value=3...
 input type=checkbox name=cb[ ] value=4...