Re: [PHP] Re: filter_input and $_POST deep array

2011-09-23 Thread Thijs Lensselink
On 09/23/2011 06:16 PM, jean-baptiste verrey wrote:
> foreach cannot work in this situation has filter_input does not work
> recursively and work only on the first level of $_POST (or $_GET) 
> so the best solution seems to be to use filter_var($_POST['var']['var2']);
I was sure filter_input would work on nested levels. But it doesn't as
you point out.

You could do something like this if you want to filter the same types

array_walk_recursive($_POST, function(&$value) {
$value = filter_var($value, FILTER_SANITIZE_STRING);
});

>
> Thanks anyway
>
> On 23 September 2011 17:13, Thijs Lensselink  > wrote:
>
> On 09/23/2011 03:17 PM, jean-baptiste verrey wrote:
> > seems that the only solution is to still use $_POST and use
> filter_var
> > instead, it could have been better!
> You can foreach the $_Post['login'] array and use filter_input on each
> iteration to do the filtering.
> Or maybe the filter_input_array is a better place to look at. The
> manual
> is your friend.
>
> http://php.net/manual/en/function.filter-input.php
>
> Besides that. Calling filter_var two times won't kill you!
> > On 23 September 2011 14:11, jean-baptiste verrey <
> > jeanbaptiste.ver...@gmail.com
> > wrote:
> >
> >> What do you mean? I don't see how I could use foreach there
> >>
> >> On 23 September 2011 13:31, Al  > wrote:
> >>
> >>>
> >>> On 9/23/2011 5:51 AM, jean-baptiste verrey wrote:
> >>>
>  Hi,
> 
>  I have using a form that gives me something like
>   $_POST=array(
>  'login'=>array(
>  'email'=>'he...@myphp.net ',
>  'password'=>'123456'
>  )
>  )
> 
>  is there a way to use filter_input function to filter the
> values? I tried
>  filter_input(INPUT_POST,'**login[email]') but it does not work!
> 
>  Regards,
> 
>  Jean-Baptiste Verrey
> 
> 
> >>> foreach() in the manual
> >>>
> >>> --
> >>> PHP General Mailing List (http://www.php.net/)
> >>> To unsubscribe, visit: http://www.php.net/unsub.php
> >>>
> >>>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



Re: [PHP] 'Mobile' PHP

2011-09-23 Thread Tommy Pham
On Fri, Sep 23, 2011 at 11:37 AM, Lester Caine  wrote:

> Tommy Pham wrote:
>
>> Have you looked at Quercus to see if it could run on Android?  If it
>> could, you
>> can then run your PHP code then.
>>
> http://techblog.aasisvinayak.**com/deploy-php-applications-**
> in-google-app-engine/popped
>  up while I was searching. The bit I'm still wasting time on at the
> moment is how to deploy it as a stand alone application on the tablet I
> have, but I'm not sure that I can pull stuff yet as the 'android
> marketplace' sites complain that my 'phone is not recognised' :)
>
>
> --
> Lester Caine - G8HFL
> -
> Contact - 
> http://lsces.co.uk/wiki/?page=**contact
> L.S.Caine Electronic Services - http://lsces.co.uk
> EnquirySolve - http://enquirysolve.com/
> Model Engineers Digital Workshop - http://medw.co.uk//
> Firebird - http://www.firebirdsql.org/index.php
>

>From the link you gave, looks like it uses Quercus after all.  So you might
want to see if you could just Quercus running 1st.


Re: [PHP] 'Mobile' PHP

2011-09-23 Thread Lester Caine

Tommy Pham wrote:

Have you looked at Quercus to see if it could run on Android?  If it could, you
can then run your PHP code then.
http://techblog.aasisvinayak.com/deploy-php-applications-in-google-app-engine/ 
popped up while I was searching. The bit I'm still wasting time on at the moment 
is how to deploy it as a stand alone application on the tablet I have, but I'm 
not sure that I can pull stuff yet as the 'android marketplace' sites complain 
that my 'phone is not recognised' :)


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

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



Re: [PHP] 'Mobile' PHP

2011-09-23 Thread Tommy Pham
Have you looked at Quercus to see if it could run on Android?  If it could,
you can then run your PHP code then.


Re: Re: [PHP] Search for string followed by whitespace

2011-09-23 Thread Daniel Brown
On Fri, Sep 23, 2011 at 13:21, Tim Streater  wrote:
>
> Dan,
>
> Thanks for the suggestion but I need to know where the string occurs as I 
> want to then do some excision/incision.

Consider preg_replace() with that same pattern.  Or, at the most
involved, preg_replace_callback().

-- 

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] 'Mobile' PHP

2011-09-23 Thread Lester Caine

Daniel Brown wrote:

>  As the op noted, there is php for android, which I run on my phone. It 
doesn't have the full capabilities but the base stuff seems to be there. It runs 
quite well in fact.

 I've been running it for about a year now (shortly after the
initial release), and - though it requires an abstraction layer known
as SL4A (Scripting Language for Android) - it works quite well for an
immature project.  Plus, the project maintainers have created a basic
framework that interfaces with the phone's own capabilities, such as
vibrations, LED control, et cetera.  It's fun to play around with once
in a while, but I've yet to dive into it enough to do anything more
than novelty scripts for personal usage.


I think that is the major part of the 'problem'. I just want to run the SAME 
code that runs on the laptops on the tablets ... I don't need any of the parts 
that are specific to a mobile phone :(


The PHP for Android needs a lot more extensions added to do that.

--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

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



Re: [PHP] Re: filter_input and $_POST deep array

2011-09-23 Thread jean-baptiste verrey
foreach cannot work in this situation has filter_input does not work
recursively and work only on the first level of $_POST (or $_GET)
so the best solution seems to be to use filter_var($_POST['var']['var2']);

Thanks anyway

On 23 September 2011 17:13, Thijs Lensselink  wrote:

> On 09/23/2011 03:17 PM, jean-baptiste verrey wrote:
> > seems that the only solution is to still use $_POST and use filter_var
> > instead, it could have been better!
> You can foreach the $_Post['login'] array and use filter_input on each
> iteration to do the filtering.
> Or maybe the filter_input_array is a better place to look at. The manual
> is your friend.
>
> http://php.net/manual/en/function.filter-input.php
>
> Besides that. Calling filter_var two times won't kill you!
> > On 23 September 2011 14:11, jean-baptiste verrey <
> > jeanbaptiste.ver...@gmail.com> wrote:
> >
> >> What do you mean? I don't see how I could use foreach there
> >>
> >> On 23 September 2011 13:31, Al  wrote:
> >>
> >>>
> >>> On 9/23/2011 5:51 AM, jean-baptiste verrey wrote:
> >>>
>  Hi,
> 
>  I have using a form that gives me something like
>   $_POST=array(
>  'login'=>array(
>  'email'=>'he...@myphp.net',
>  'password'=>'123456'
>  )
>  )
> 
>  is there a way to use filter_input function to filter the values? I
> tried
>  filter_input(INPUT_POST,'**login[email]') but it does not work!
> 
>  Regards,
> 
>  Jean-Baptiste Verrey
> 
> 
> >>> foreach() in the manual
> >>>
> >>> --
> >>> PHP General Mailing List (http://www.php.net/)
> >>> To unsubscribe, visit: http://www.php.net/unsub.php
> >>>
> >>>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] Re: filter_input and $_POST deep array

2011-09-23 Thread Thijs Lensselink
On 09/23/2011 03:17 PM, jean-baptiste verrey wrote:
> seems that the only solution is to still use $_POST and use filter_var
> instead, it could have been better!
You can foreach the $_Post['login'] array and use filter_input on each
iteration to do the filtering.
Or maybe the filter_input_array is a better place to look at. The manual
is your friend.

http://php.net/manual/en/function.filter-input.php

Besides that. Calling filter_var two times won't kill you!
> On 23 September 2011 14:11, jean-baptiste verrey <
> jeanbaptiste.ver...@gmail.com> wrote:
>
>> What do you mean? I don't see how I could use foreach there
>>
>> On 23 September 2011 13:31, Al  wrote:
>>
>>>
>>> On 9/23/2011 5:51 AM, jean-baptiste verrey wrote:
>>>
 Hi,

 I have using a form that gives me something like
  $_POST=array(
 'login'=>array(
 'email'=>'he...@myphp.net',
 'password'=>'123456'
 )
 )

 is there a way to use filter_input function to filter the values? I tried
 filter_input(INPUT_POST,'**login[email]') but it does not work!

 Regards,

 Jean-Baptiste Verrey


>>> foreach() in the manual
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>


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



Re: [PHP] 'Mobile' PHP

2011-09-23 Thread Daniel Brown
On Fri, Sep 23, 2011 at 10:19, Ashley Sheridan  
wrote:
>
> As the op noted, there is php for android, which I run on my phone. It 
> doesn't have the full capabilities but the base stuff seems to be there. It 
> runs quite well in fact.

I've been running it for about a year now (shortly after the
initial release), and - though it requires an abstraction layer known
as SL4A (Scripting Language for Android) - it works quite well for an
immature project.  Plus, the project maintainers have created a basic
framework that interfaces with the phone's own capabilities, such as
vibrations, LED control, et cetera.  It's fun to play around with once
in a while, but I've yet to dive into it enough to do anything more
than novelty scripts for personal usage.

-- 

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] 'Mobile' PHP

2011-09-23 Thread Ashley Sheridan


Lester Caine  wrote:

>Bastien wrote:
>> Depending in what has to be done, could you use HTML5 with local
>storage and sync back up later?
>The whole database is small enough to fit in 100Mb but needs Firebird
>to access
>it via PHP.
>
>> AFAIK android runs java programs using a custom JVM.  So any app on
>those devices will need to run in java. Not sure that you couldn't port
>the php engine to that, and it would be an interesting task.
>That is the bit I'm wanting to do I think, I have no plans to rewrite 5
>years
>worth of PHP into Java ;)
>It all runs quite happily on a laptop and syncs back when internet is
>available
>again, so I may simply have to put a decent Linux distribution on the
>tablet ...
>and then there isn't a problem ...
>
>--
>Lester Caine - G8HFL
>-
>Contact - http://lsces.co.uk/wiki/?page=contact
>L.S.Caine Electronic Services - http://lsces.co.uk
>EnquirySolve - http://enquirysolve.com/
>Model Engineers Digital Workshop - http://medw.co.uk//
>Firebird - http://www.firebirdsql.org/index.php
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

As the op noted, there is php for android, which I run on my phone. It doesn't 
have the full capabilities but the base stuff seems to be there. It runs quite 
well in fact.

Thanks,
Ash
http://www.ashleysheridan.co.uk
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

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



Re: [PHP] 'Mobile' PHP

2011-09-23 Thread Lester Caine

Bastien wrote:

Depending in what has to be done, could you use HTML5 with local storage and 
sync back up later?
The whole database is small enough to fit in 100Mb but needs Firebird to access 
it via PHP.



AFAIK android runs java programs using a custom JVM.  So any app on those 
devices will need to run in java. Not sure that you couldn't port the php 
engine to that, and it would be an interesting task.
That is the bit I'm wanting to do I think, I have no plans to rewrite 5 years 
worth of PHP into Java ;)
It all runs quite happily on a laptop and syncs back when internet is available 
again, so I may simply have to put a decent Linux distribution on the tablet ... 
and then there isn't a problem ...


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

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



Re: [PHP] Re: filter_input and $_POST deep array

2011-09-23 Thread jean-baptiste verrey
seems that the only solution is to still use $_POST and use filter_var
instead, it could have been better!

On 23 September 2011 14:11, jean-baptiste verrey <
jeanbaptiste.ver...@gmail.com> wrote:

> What do you mean? I don't see how I could use foreach there
>
> On 23 September 2011 13:31, Al  wrote:
>
>>
>>
>> On 9/23/2011 5:51 AM, jean-baptiste verrey wrote:
>>
>>> Hi,
>>>
>>> I have using a form that gives me something like
>>>  $_POST=array(
>>> 'login'=>array(
>>> 'email'=>'he...@myphp.net',
>>> 'password'=>'123456'
>>> )
>>> )
>>>
>>> is there a way to use filter_input function to filter the values? I tried
>>> filter_input(INPUT_POST,'**login[email]') but it does not work!
>>>
>>> Regards,
>>>
>>> Jean-Baptiste Verrey
>>>
>>>
>>
>> foreach() in the manual
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>


Re: [PHP] Re: filter_input and $_POST deep array

2011-09-23 Thread jean-baptiste verrey
What do you mean? I don't see how I could use foreach there

On 23 September 2011 13:31, Al  wrote:

>
>
> On 9/23/2011 5:51 AM, jean-baptiste verrey wrote:
>
>> Hi,
>>
>> I have using a form that gives me something like
>>  $_POST=array(
>> 'login'=>array(
>> 'email'=>'he...@myphp.net',
>> 'password'=>'123456'
>> )
>> )
>>
>> is there a way to use filter_input function to filter the values? I tried
>> filter_input(INPUT_POST,'**login[email]') but it does not work!
>>
>> Regards,
>>
>> Jean-Baptiste Verrey
>>
>>
>
> foreach() in the manual
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


[PHP] Re: filter_input and $_POST deep array

2011-09-23 Thread Al



On 9/23/2011 5:51 AM, jean-baptiste verrey wrote:

Hi,

I have using a form that gives me something like
  $_POST=array(
 'login'=>array(
 'email'=>'he...@myphp.net',
 'password'=>'123456'
 )
)

is there a way to use filter_input function to filter the values? I tried
filter_input(INPUT_POST,'login[email]') but it does not work!

Regards,

Jean-Baptiste Verrey




foreach() in the manual

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



Re: [PHP] 'Mobile' PHP

2011-09-23 Thread Bastien


On 2011-09-23, at 4:27 AM, Lester Caine  wrote:

> OK, I can see 'PHP for Android' which seems to have stalled, and I've been 
> playing with other options, but I'm not currently happy with any of this 
> 'mobile' stuff.
> 
> The 'problem' is quite simple ... While mobile broadband might work in some 
> quite limited areas of the UK - like in bigger towns - it's reliability even 
> in smaller towns is simply getting worse! So a number of my customers have 
> been asking me to provide a backup system which is working fine on laptops, 
> but these are a little cumbersome when the guys have to work away from the 
> vehicles. Tablets via broadband work ... while one can get a signal ... and 
> in many areas around here even getting a PHONE signal depends on where you 
> stand ... so I need a working local PHP setup which can take over and 
> provided things like access codes and the like while out of range, and update 
> the main database when back in range.
> 
> Android, mobile windows and the like currently seem very restrictive when it 
> comes to this type of development, so has anybody got any ideas on how to 
> proceed? I though that Android was essentially a strangled version of Linux, 
> so it should be able to run any Linux application?
> 
> -- 
> Lester Caine - G8HFL
> -
> Contact - http://lsces.co.uk/wiki/?page=contact
> L.S.Caine Electronic Services - http://lsces.co.uk
> EnquirySolve - http://enquirysolve.com/
> Model Engineers Digital Workshop - http://medw.co.uk//
> Firebird - http://www.firebirdsql.org/index.php
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

Depending in what has to be done, could you use HTML5 with local storage and 
sync back up later? 

AFAIK android runs java programs using a custom JVM.  So any app on those 
devices will need to run in java. Not sure that you couldn't port the php 
engine to that, and it would be an interesting task.

Bastien Koert
905-904-0334
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] filter_input and $_POST deep array

2011-09-23 Thread jean-baptiste verrey
Hi,

I have using a form that gives me something like
 $_POST=array(
'login'=>array(
'email'=>'he...@myphp.net',
'password'=>'123456'
)
)

is there a way to use filter_input function to filter the values? I tried
filter_input(INPUT_POST,'login[email]') but it does not work!

Regards,

Jean-Baptiste Verrey


Re: [PHP] Any free online tests to test my PHP knowledge?

2011-09-23 Thread Richard Quadling
On 22 September 2011 18:53, Mike Hansen  wrote:
> Does anyone know of a site that has an online test of PHP skills? I'd like
> to review my PHP knowledge.
>
> I've already run across this site:
> http://vladalexa.com/scripts/php/test/test_php_skill.html
>
> Thanks,
>
> Mike

I took the ZCE exam and I used "The Zend PHP Certification Practice
Test Book" and the "Zend PHP Certification Study Guide". Both of these
are for PHP4 (though I never actually used PHP4) - so no good now -
unless you use PHP4 of course.

There is a PHP 5 Study Guide
(http://www.phparch.com/books/phparchitects-zend-php-5-certification-study-guide-2nd-edition/)

I have the first edition, so a little out of date now but I do get a
free PDF of the 2nd edition.

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



[PHP] 'Mobile' PHP

2011-09-23 Thread Lester Caine
OK, I can see 'PHP for Android' which seems to have stalled, and I've been 
playing with other options, but I'm not currently happy with any of this 
'mobile' stuff.


The 'problem' is quite simple ... While mobile broadband might work in some 
quite limited areas of the UK - like in bigger towns - it's reliability even in 
smaller towns is simply getting worse! So a number of my customers have been 
asking me to provide a backup system which is working fine on laptops, but these 
are a little cumbersome when the guys have to work away from the vehicles. 
Tablets via broadband work ... while one can get a signal ... and in many areas 
around here even getting a PHONE signal depends on where you stand ... so I need 
a working local PHP setup which can take over and provided things like access 
codes and the like while out of range, and update the main database when back in 
range.


Android, mobile windows and the like currently seem very restrictive when it 
comes to this type of development, so has anybody got any ideas on how to 
proceed? I though that Android was essentially a strangled version of Linux, so 
it should be able to run any Linux application?


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

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