php-general Digest 29 Mar 2009 21:12:59 -0000 Issue 6038

Topics (messages 290794 through 290798):

Re: Sort a multi-dimensional array on a certain key followed by another key
        290794 by: Virgilio Quilario

Re: Calling function on the same line?
        290795 by: Andrea Giammarchi
        290796 by: Andrea Giammarchi

Re: foreach and form submission.
        290797 by: Angus Mann

Security Support
        290798 by: Grant Peel

Administrivia:

To subscribe to the digest, e-mail:
        [email protected]

To unsubscribe from the digest, e-mail:
        [email protected]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
> Ok so, I have an array
>
> [0(index)][1st key][2nd key]
>
> Basically I don't care about the index. As a matter of fact I'd prefer it
> reset to still be in order afterwards.
>
> However, I need to sort the 1st key and keep correlation w the second key.
> Then sort on the second key.
>
> I have video volumes and scenes like
>
> [0][110][1]
> [1][110][3]
> [2][110][2]
> [3][110][4]
>
> Any help would be much appreciated.
>

looks like a job for array_multisort() function
http://php.net/array_multisort

virgil
http://www.jampmark.com

--- End Message ---
--- Begin Message ---
I don't , I mean if the function is not str_replace you do not necesary need 
the echo (array_push, as example)
This notation:
<?=
is deprecated since dunno how long ago ... strongly not suggested

> Date: Sun, 29 Mar 2009 01:06:16 +0800
> Subject: Re: [PHP] Calling function on the same line?
> From: [email protected]
> To: [email protected]
> CC: [email protected]
> 
> >
> > I miss the utility to do stuff like that ... seriously ... but in any case:
> >
> > <?php
> > echo ($f = 'str_replace') ? $f("a", "b", "aaa") : null;
> > ?>
> >
> > where echo is optional.
> >
> > Regards
> 
> you mean this
> <?= ($f = 'str_replace') ? $f("a","b","aaa") : null; ?>
> 
> virgil
> http://www.jampmark.com

_________________________________________________________________
Drag n’ drop—Get easy photo sharing with Windows Live™ Photos.

http://www.microsoft.com/windows/windowslive/products/photos.aspx

--- End Message ---
--- Begin Message ---
How do you pass that string?
If you replace via other file, you do not need to use strings, just call the 
function.
If you are parsing a variable, you do not need the inline ...
$_GET['function']("a", "b", "aaa");
if the query string is &function=str_replace

I do not get the problem at all specially now that you do not need variables 
... and if you will end up with eval, you are doing something wrong.

Regards



Date: Sat, 28 Mar 2009 17:09:15 +0300
Subject: Re: [PHP] Calling function on the same line?
From: [email protected]
To: [email protected]

Thank you for trying to help, But I am trying to do it without variables.... =[

On Sat, Mar 28, 2009 at 3:51 PM, Andrea Giammarchi <[email protected]> wrote:




I miss the utility to do stuff like that ... seriously ... but in any case:



<?php

echo ($f = 'str_replace') ? $f("a", "b", "aaa") : null;

?>



where echo is optional.



Regards





> Date: Sat, 28 Mar 2009 15:26:18 +0300

> From: [email protected]

> To: [email protected]

> Subject: [PHP] Calling function on the same line?

>

> Is there any way to do something like:

>

> <?php

> ("str_replace")("a", "b", "aaa");

> ?>

>

> ?

>

> One of the problems that I must keep "str_replace" on the same line...The

> only solution I see is call_user_func, but I would like to know if you guys

> might have a clue =]

> Tried looking on the manual, sadly didn't found anything

>

> Thanks, Daniel



_________________________________________________________________

More than messages–check out the rest of the Windows Live™.

http://www.microsoft.com/windows/windowslive/

_________________________________________________________________
News, entertainment and everything you care about at Live.com. Get it now!
http://www.live.com/getstarted.aspx

--- End Message ---
--- Begin Message ---
Thanks Ashley...that did the trick.
After reading about the limitations of strip_tags I decided to just replace the bad bits as below... It still uses your "foreach" suggestion but replaces "<" and ">" with "(" and ")" instead of stripping tags.

I think I will extend the good and bad arrays to deal with magic quotes also !

$bad = array('<','&lt;','&#60;', '>', '&gt;', '&#62');
$good = array('(', '(', '(', ')', ')', ')');
foreach ($_POST as $key => $value) {
$_POST[$key] = str_ireplace($bad, $good, $value);
}





I'd do something like this, so as to preserve the original post data
array:

$data = Array();
foreach($_POST as $key => $value)
{
   $data[$key] = strip_tags($value);
}

Note that strip_tags() will not be able to decently clean up messy code
(i.e. code where the opening or closing tags themselves aren't formed
properly)


Ash
www.ashleysheridan.co.uk




--- End Message ---
--- Begin Message ---
Good Morning / Afternoon,

We run several of our own servers:

- Dell Power Edge 1U, Pentium,
- FreeBSD (6.x soon to be 7.x)
- along with all the standard Web Application installation (PHP Apache Exim, Pop3, Proftp, MySQL etc etc).

What I am asking here, is if any one in this community has the knowledge to act as a security consultant in an occasional, as required basis. Anyone interested should have expience with Apache, PHP, Perl on the FreeBSD platform.

We are more than willing to compensate for services rendered, and are more than willing to discuss terms.

In the end, we would be more than willing to share any non-fudiciary information with anyone who could find it useful (via this or other mailing lists).

We are asking any interested parties to contact us off-list such that we don't need to make any private matters public.

This is a bonified request, as we can setup servers ourselves, but simply do not have the time to research various run time, and security related items.

TIA,

-Grant
--- End Message ---

Reply via email to