php-general Digest 1 Sep 2008 13:56:08 -0000 Issue 5657

Topics (messages 279185 through 279216):

[HS] Howto answer Was: [PHP] casting static property
        279185 by: Lupus Michaelis

Re: ASCII Captcha
        279186 by: Ross McKay
        279204 by: Nisse Engström
        279206 by: Nisse Engström

Re: switch case - to require the break statements seems strange to me
        279187 by: Diogo Neves
        279190 by: Jochem Maas
        279192 by: Lupus Michaelis

Re: casting static property
        279188 by: Micah Gersten

Re: [PHP-DEV] T_PAAMAYIM_NEKUDOTAYIM
        279189 by: Jochem Maas
        279191 by: Diogo Neves
        279195 by: Maciek Sokolewicz

Creating single row for multiple items.
        279193 by: Tom Shaw
        279194 by: Diogo Neves

Re: skinning a cat (was: Individual bulk e-mails - performance question)
        279196 by: Per Jessen

Re: skinning a cat
        279197 by: Jochem Maas
        279198 by: Colin Guthrie
        279200 by: Jochem Maas
        279202 by: Per Jessen
        279203 by: Per Jessen
        279214 by: Jochem Maas
        279215 by: Per Jessen

newbie - how to receive/iterate posted arrays
        279199 by: Govinda
        279201 by: Diogo Neves
        279207 by: David Robley
        279208 by: Carlos Medina

uploading file outside WEB Root
        279205 by: Angelo Zanetti
        279210 by: Carlos Medina

Shared memory, mutex functionality and spawning threads. Is it possible using 
PHP?
        279209 by: Kent Larsson

Re: What's with the Rx symbol?
        279211 by: Robin Vickery

Job opening in Leiden, Netherlands: PHP/MySQL developer
        279212 by: Ivo F.A.C. Fokkema

Re: Individual bulk e-mails - performance question (was "skinning a cat") :-)
        279213 by: Merlin Morgenstern

Re: how to write good code
        279216 by: Shiplu

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 ---
Govinda a écrit :

does "top post" mean to puts one's reply text at the top of the email? People prefer it to be at the bottom?

  Yes, because the regular way is to read top to bottom.

Personally I like the new text to be at the top so I don't have to scroll down to see the new part

  You don't have to scroll if everybody clean as it must.

expect/prefer so I can maximize my chance to get help when I need it  ;-)

Yeah, because morron like me autoscroll ;) If I see nothing, I don't answer and stroke <n> key to reach the next message :)

--
Mickaël Wolff aka Lupus Michaelis
http://lupusmic.org

--- End Message ---
--- Begin Message ---
Jochem Maas wrote:

>figures, no blooming good to us then :-)

No, I wouldn't bother! (It actually p!sses me off when I have to type my
email address into a form because they've decided to pick some unique
name for the field!)

>makes me think of another trick to block spam/cruft/etc from
>form submissions (including double POSTs) ... set a hidden field
>to a random value that session bound and usable only once ... if
>the value is not present in the POST or it's not set in the session
>as being valid and usable then don't accept the POST ... if the
>POST is accepted then remove the value from the session.

Yes, your Honey Pots idea intrigues me, and I'll be stealing it, thanks!

>cake is a metaphor. let's imagine it means 'girls' for instance ... 
>you with me now? ;-)

Um... nope, no idea what you mean (nodding!).

[She's about to come over and demand her coffee, must fetch ;) ]
-- 
Ross McKay, Toronto, NSW Australia
"Such a pretty girl, happy in an ugly place,
 watching all the pretty people
 doing lots of ugly things" - Everclear

--- End Message ---
--- Begin Message ---
On Fri, 29 Aug 2008 16:11:01 -0400, tedd wrote:
> 
> http://webbytedd.com/aa/assorted-captcha/

Some of these are really cool. Assuming they are
actually working, that is...

Graphic CAPTCHA:
----------------

      Error!
  Reload the page!

Audio CAPTCHA:
--------------

  There is nothing to click and no indication that I
  should enable Flash.

  And when I enter the number, I get "Sorry, you didn't make it...".

Performance CAPTCHA:
--------------------
  This one actually works. Well, sort of...

  Notice: Undefined index: x in
/var/www/vhosts/webbytedd.com/httpdocs/aa/assorted-captcha/index.php on
line 153

  Notice: Undefined index: y in
/var/www/vhosts/webbytedd.com/httpdocs/aa/assorted-captcha/index.php on
line 154

  Congratulations, you made it via Performance CAPTCHA !

Question CAPTCHA:
-----------------

  Sorry, you didn't make it...

Arrow CAPTCHA:
--------------
  I like this one! Except...

  Notice: Undefined index: 0 in
/var/www/vhosts/webbytedd.com/httpdocs/aa/assorted-captcha/index.php on
line 190

  Sorry, you didn't make it...


I also get a 404 for "/aa/assorted-captcha/a.js".

I managed 1 out of 5. What do I win?


/Nisse

--- End Message ---
--- Begin Message ---
On Mon, 1 Sep 2008 11:14:39 +0200, Nisse Engström wrote:

> On Fri, 29 Aug 2008 16:11:01 -0400, tedd wrote:
>> 
>> http://webbytedd.com/aa/assorted-captcha/
> 
> Performance CAPTCHA:
> --------------------
>   This one actually works. Well, sort of...

And maybe your code should check for a circle rather
than a square, or am I picking nits?


/Nisse

--- End Message ---
--- Begin Message ---
Hi,

Well, I see a good reason anyway...
U can have a lot of entry points and only one to exit...
Like:

switch ($i) {
case 0:
   echo "\$i < 1";
case 1:
   echo "\$i < 2";
case 2:
   echo "\$i < 3";
default:
   echo "\$i > 2";
}

Or

switch ($i) {
case 0:
case 1:
case 2:
   echo "\$i < 3";
   break;
default:
   echo "\$i > 2";
}

Nothing says that you can only use it as an option one statement...

On Mon, Sep 1, 2008 at 2:04 AM, Lupus Michaelis
<[EMAIL PROTECTED]<[EMAIL PROTECTED]>
> wrote:

> Govinda a écrit :
>
>> Or is there a better reason?
>>
>
>  What is exactly in $i ? A scalar integer, a string containing an integer ?
> A boolean ? What version of PHP ?
>
> --
> Mickaël Wolff aka Lupus Michaelis
> http://lupusmic.org
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
-- 
Thanks for your attention,

Diogo Neves
Web Developer @ SAPO.pt by PrimeIT.pt

--- End Message ---
--- Begin Message ---
Govinda schreef:
Not that it is an issue, but just to understand the logic-
Why do we have to use 'break' statements in each case?

switch ($i) {
case 0:
    echo "i equals 0";
    break;
case 1:
    echo "i equals 1";
    break;
case 2:
    echo "i equals 2";
    break;
}

all 3 cases fire, even though $i only equals ONE of those case values (if I said that right). I mean if $i==1, then in other languages I don't expect the first or last case to fire! (?) Is the purpose just so one has the OPTION of letting them all fire, and turning that off with 'break'?

pretty much, all code will be run inside the switch after the first case
found to equate (match) until a break is hit. try it:

foreach (range(0,2) as $i) {
        echo "\$i = $i -- running switch ... \n";
        switch ($i) {
                case 0:
                        echo "first case\n";
                case 1:
                        echo "second case\n";
                case 2:
                        echo "third case\n";
        }
}

Or is there a better reason?

-G



--- End Message ---
--- Begin Message ---
Diogo Neves a écrit :
Hi,

Well, I see a good reason anyway...
U can have a lot of entry points and only one to exit...
Like:

I misunderstood the question :-/ I read Govinda had a strange behavior that ignore the break :-D

--
Mickaël Wolff aka Lupus Michaelis
http://lupusmic.org

--- End Message ---
--- Begin Message ---
Old timers like it at the bottom, but I agree with the newcomers.  Top
posting as long as it's not mixed with bottom posting can be easier for
people who follow the threads. (I know I mixed it here)

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Diogo Neves wrote:
> On Mon, Sep 1, 2008 at 12:43 AM, Govinda <[EMAIL PROTECTED]>
> wrote:
>   
>> On Aug 31, 2008, at 2:17 PM, Jochem Maas wrote:
>>     
>>> another tip: don't top post :-)
>>>       
>> does "top post" mean to puts one's reply text at the top of the email?
>>  People prefer it to be at the bottom?
>> Personally I like the new text to be at the top so I don't have to scroll
>> down to see the new part, but please do clarify what old timers
>> expect/prefer so I can maximize my chance to get help when I need it  ;-)
>>
>> (oops. Didn't mean to send you a copy too Jochem.)
>>
>> -G
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>>     
>
> Hi,
>
> I was confused too, then I seached wikipedia and found this:
> http://en.wikipedia.org/wiki/Posting_style
>
> But I, like you, prefer too see te new text on top...
> Maybe as you say he can clarify, but possible they like more like this?
>
>
>   

--- End Message ---
--- Begin Message ---
redirecting to generals mailing list ...

Diogo Neves schreef:
php -r 'class B { private static function a() {} public function
__callStatic($method, $parms) { echo $method, "\n"; } } $a = new B;
$a::a();'

Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in Command line
code on line 1

Ok, i found the error, but anyway... a what?

it's hebrew for 'double colon' (::), google could have told you this.

please note, the internals mailing is for php engine development/developers,
I don't think they look forward to this kind of question (t)here.

...we're lucky enough that they tolerate lurkers (*cough*) :-)




--- End Message ---
--- Begin Message ---
On Mon, Sep 1, 2008 at 3:09 AM, Jochem Maas <[EMAIL PROTECTED]> wrote:

> redirecting to generals mailing list ...
>
> Diogo Neves schreef:
>
>> php -r 'class B { private static function a() {} public function
>> __callStatic($method, $parms) { echo $method, "\n"; } } $a = new B;
>> $a::a();'
>>
>> Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in Command
>> line
>> code on line 1
>>
>> Ok, i found the error, but anyway... a what?
>>
>
> it's hebrew for 'double colon' (::), google could have told you this.
>
> please note, the internals mailing is for php engine
> development/developers,
> I don't think they look forward to this kind of question (t)here.
>
> ...we're lucky enough that they tolerate lurkers (*cough*) :-)
>
>
>>
> Ok, and I really love the guys... but hebrew?


-- 
Thanks for your attention,

Diogo Neves
Web Developer @ SAPO.pt by PrimeIT.pt

--- End Message ---
--- Begin Message ---
Jochem Maas wrote:
redirecting to generals mailing list ...

Diogo Neves schreef:
php -r 'class B { private static function a() {} public function
__callStatic($method, $parms) { echo $method, "\n"; } } $a = new B;
$a::a();'

Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in Command line
code on line 1

Ok, i found the error, but anyway... a what?

it's hebrew for 'double colon' (::), google could have told you this.

please note, the internals mailing is for php engine development/developers,
I don't think they look forward to this kind of question (t)here.

...we're lucky enough that they tolerate lurkers (*cough*) :-)



It's even in the manual [1]:
"Paamayim Nekudotayim would, at first, seem like a strange choice for naming a double-colon. However, while writing the Zend Engine 0.5 (which powers PHP 3), that's what the Zend team decided to call it. It actually does mean double-colon - in Hebrew! "

- Tul

[1] http://www.php.net/manual/en/language.oop5.paamayim-nekudotayim.php


--- End Message ---
--- Begin Message ---
My array looks very similar to this. I need to create a single row for the
items that have the same order number for CSV export.  I'd prefer to do this
PHP wise instead of SQL. But would appreciate any help I can get.

 

 

$ar = array(

   array(

     "order_id" => "34",

     "order_number" => "35Y345Y356YU3",

     "order_name" => "Steinway Grand Piano #11",

     "order_ordered_size" => "Grand",

     "order_sales_price" => "78671.90",

     "order_shipping_price" => "7.85",

     "order_shipping_extra" => "0.06",

   ),

   array(

     "order_id" => "35",

     "order_number" => "35Y345Y356YU3",

     "order_name" => "Bechstein",

     "order_ordered_size" => "Grand",

     "order_sales_price" => "11671.90",

     "order_shipping_price" => "51.00",

     "order_shipping_extra" => "450.00",

   ),

   array(

     "order_id" => "36",

     "order_number" => "35Y345Y356YU3",

     "order_name" => "Bosendorfer",

     "order_ordered_size" => "Grand",

     "order_sales_price" => "11671.90",

     "order_shipping_price" => "500.00",

     "order_shipping_extra" => "450.00",

   ),

   array(

     "order_id" => "37",

     "order_number" => "78973467Y3Y36",

     "order_name" => "Steinway Grand Piano #11",

     "order_ordered_size" => "Grand",

     "order_sales_price" => "78671.90",

     "order_shipping_price" => "7.85",

     "order_shipping_extra" => "0.06",

   ),

   array(

     "order_id" => "38",

     "order_number" => "78973467Y3Y36",

     "order_name" => "Baldwin L Grand Piano #39",

     "order_ordered_size" => "Grand",

     "order_sales_price" => "11671.90",

     "order_shipping_price" => "1.00",

     "order_shipping_extra" => "450.00",

   )

);


--- End Message ---
--- Begin Message ---
Hi,
Check if I understood you...
You have this array and want create a csv?

On Mon, Sep 1, 2008 at 5:04 AM, Tom Shaw <[EMAIL PROTECTED]> wrote:

> My array looks very similar to this. I need to create a single row for the
> items that have the same order number for CSV export.  I'd prefer to do
> this
> PHP wise instead of SQL. But would appreciate any help I can get.
>
>
>
>
>
> $ar = array(
>
>   array(
>
>     "order_id" => "34",
>
>     "order_number" => "35Y345Y356YU3",
>
>     "order_name" => "Steinway Grand Piano #11",
>
>     "order_ordered_size" => "Grand",
>
>     "order_sales_price" => "78671.90",
>
>     "order_shipping_price" => "7.85",
>
>     "order_shipping_extra" => "0.06",
>
>   ),
>
>   array(
>
>     "order_id" => "35",
>
>     "order_number" => "35Y345Y356YU3",
>
>     "order_name" => "Bechstein",
>
>     "order_ordered_size" => "Grand",
>
>     "order_sales_price" => "11671.90",
>
>     "order_shipping_price" => "51.00",
>
>     "order_shipping_extra" => "450.00",
>
>   ),
>
>   array(
>
>     "order_id" => "36",
>
>     "order_number" => "35Y345Y356YU3",
>
>     "order_name" => "Bosendorfer",
>
>     "order_ordered_size" => "Grand",
>
>     "order_sales_price" => "11671.90",
>
>     "order_shipping_price" => "500.00",
>
>     "order_shipping_extra" => "450.00",
>
>   ),
>
>   array(
>
>     "order_id" => "37",
>
>     "order_number" => "78973467Y3Y36",
>
>     "order_name" => "Steinway Grand Piano #11",
>
>     "order_ordered_size" => "Grand",
>
>     "order_sales_price" => "78671.90",
>
>     "order_shipping_price" => "7.85",
>
>     "order_shipping_extra" => "0.06",
>
>   ),
>
>   array(
>
>     "order_id" => "38",
>
>     "order_number" => "78973467Y3Y36",
>
>     "order_name" => "Baldwin L Grand Piano #39",
>
>     "order_ordered_size" => "Grand",
>
>     "order_sales_price" => "11671.90",
>
>     "order_shipping_price" => "1.00",
>
>     "order_shipping_extra" => "450.00",
>
>   )
>
> );
>

-- 
Thanks for your attention,

Diogo Neves
Web Developer @ SAPO.pt by PrimeIT.pt

--- End Message ---
--- Begin Message ---
Robert Cummings wrote:

>> >> #!/bin/sh
>> >> while true
>> >> do
>> >>     <yourscript>
>> >>     sleep 300
>> >> done
>> > 
>> > I accomplish the same with cron scripts by using locks with expiry.
>> 
>> got an example? my cat skinning skills need to be improved, the cat
>> won't like it but screw the cat, right?
> 
[snip code]
> I implemented my own lock class which uses directory creation and the
> return value to determine if the lock was successful. Unlike file
> creation (or so I read several years ago) directory creation is atomic
> and works across NFS. As an added benefit, I'm able to store lock
> related data into the lock directory as files.

I'm probably old fashioned, but to me all that stuff is way overkill.  I
also tend to think that synchronizing scripts is a job for the shell,
not PHP. 

lockfile=/var/lock/<xxxx>/file
# clear out a lock older than 60mins
find $lockfile -cmin +60 | xargs rm
test ! -f $lockfile && (
touch $lockfile
<run some php>
rm -f $lockfile
)


/Per Jessen, Zürich


--- End Message ---
--- Begin Message ---
Per Jessen schreef:
Robert Cummings wrote:

#!/bin/sh
while true
do
    <yourscript>
    sleep 300
done
I accomplish the same with cron scripts by using locks with expiry.
got an example? my cat skinning skills need to be improved, the cat
won't like it but screw the cat, right?
[snip code]
I implemented my own lock class which uses directory creation and the
return value to determine if the lock was successful. Unlike file
creation (or so I read several years ago) directory creation is atomic
and works across NFS. As an added benefit, I'm able to store lock
related data into the lock directory as files.

I'm probably old fashioned, but to me all that stuff is way overkill.  I
also tend to think that synchronizing scripts is a job for the shell,
not PHP.

either way, I've just learn't something new as far as shellscripting goes :-)
apart from the xargs command ... that still does my head in (don't worry
I'll look it up ... for the umpteenth time).

lockfile=/var/lock/<xxxx>/file
# clear out a lock older than 60mins
find $lockfile -cmin +60 | xargs rm
test ! -f $lockfile && (
touch $lockfile
<run some php>
rm -f $lockfile
)

wouldn't creating a dir be better here? (with regard to atomicity)




/Per Jessen, Zürich




--- End Message ---
--- Begin Message ---
Jochem Maas wrote:
either way, I've just learn't something new as far as shellscripting goes :-)
apart from the xargs command ... that still does my head in (don't worry
I'll look it up ... for the umpteenth time).

find $lockfile -cmin +60 | xargs rm

FWIW, it's nicer to do:
$ find $lockfine -cmin +60 -exec rm {} \;


This method handles files with spaces in them, where are the xargs method does not (not that it matters in this case).

HTHs

Col

--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]


--- End Message ---
--- Begin Message ---
Colin Guthrie schreef:
Jochem Maas wrote:
either way, I've just learn't something new as far as shellscripting goes :-)
apart from the xargs command ... that still does my head in (don't worry
I'll look it up ... for the umpteenth time).

find $lockfile -cmin +60 | xargs rm

FWIW, it's nicer to do:
$ find $lockfine -cmin +60 -exec rm {} \;


This method handles files with spaces in them, where are the xargs method does not (not that it matters in this case).

righto, good to know. -exec option of a find is one I still have to
look up every time I use it (although I think I guess the syntax correctly ... 
once)

HTHs

Col



--- End Message ---
--- Begin Message ---
Colin Guthrie wrote:

> Jochem Maas wrote:
>> either way, I've just learn't something new as far as shellscripting
>> goes :-)
>> apart from the xargs command ... that still does my head in (don't
>> worry I'll look it up ... for the umpteenth time).
>>>
>>> find $lockfile -cmin +60 | xargs rm
> 
> FWIW, it's nicer to do:
> $ find $lockfine -cmin +60 -exec rm {} \;
> 
> 
> This method handles files with spaces in them, where are the xargs
> method does not (not that it matters in this case).

That could also be taken care of by:

find $lockfile -cmin +60 -print0 | xargs -0 rm

IMO, the syntax of the -exec argument is too cumbersome. 


/Per Jessen, Zürich


--- End Message ---
--- Begin Message ---
Jochem Maas wrote:

>> lockfile=/var/lock/<xxxx>/file
>> # clear out a lock older than 60mins
>> find $lockfile -cmin +60 | xargs rm
>> test ! -f $lockfile && (
>> touch $lockfile
>> <run some php>
>> rm -f $lockfile
>> )
> 
> wouldn't creating a dir be better here? (with regard to atomicity)
> 

I haven't thought it through, but I don't think it would change
anything. 


/Per Jessen, Zürich


--- End Message ---
--- Begin Message ---
Per Jessen schreef:
Jochem Maas wrote:

lockfile=/var/lock/<xxxx>/file
# clear out a lock older than 60mins
find $lockfile -cmin +60 | xargs rm
test ! -f $lockfile && (
touch $lockfile
<run some php>
rm -f $lockfile
)
wouldn't creating a dir be better here? (with regard to atomicity)


I haven't thought it through, but I don't think it would change
anything.

directory creation is garanteed to be atomic, even across NFS, or
so Rob said. additionally his idea of being able to dump lock-process
related data in said directory is quite nifty.



/Per Jessen, Zürich




--- End Message ---
--- Begin Message ---
Jochem Maas wrote:

> Per Jessen schreef:
>> Jochem Maas wrote:
>> 
>>>> lockfile=/var/lock/<xxxx>/file
>>>> # clear out a lock older than 60mins
>>>> find $lockfile -cmin +60 | xargs rm
>>>> test ! -f $lockfile && (
>>>> touch $lockfile
>>>> <run some php>
>>>> rm -f $lockfile
>>>> )
>>> wouldn't creating a dir be better here? (with regard to atomicity)
>>>
>> 
>> I haven't thought it through, but I don't think it would change
>> anything.
> 
> directory creation is garanteed to be atomic, even across NFS, or
> so Rob said. 

Maybe so, but to avoid a race-condition, you need the test+touch
sequence to be atomic. 



/Per Jessen, Zürich


--- End Message ---
--- Begin Message ---
Hello early birds,

I am going round and round the docs and list posts I saved on this topic... but I am still stumped. Kindly show me what I am missing. I want to simply send an array of vars via a post form to my receiving script.

I've got simple inputs like this:

<input name="tmbsToiterate[muir_beach_tmb]" type="hidden" value="muir_beach_tmb" /> <input name="tmbsToiterate[ruby_mountain_tmb]" type="hidden" value="ruby_mountain_tmb" />

they post to the script with this: (and this is the line giving the error)-

foreach($_POST['$tmbsToiterate'] as $value) {

The error is "Warning: Invalid argument supplied for foreach()"

Seems so simple, but I can't get it... What am I doing wrong?
-Govinda


--- End Message ---
--- Begin Message ---
Hi,

On Mon, Sep 1, 2008 at 9:25 AM, Govinda <[EMAIL PROTECTED]> wrote:

> Hello early birds,
>
> I am going round and round the docs and list posts I saved on this topic...
> but I am still stumped.
> Kindly show me what I am missing.  I want to simply send an array of vars
> via a post form to my receiving script.
>
> I've got simple inputs like this:
>
> <input name="tmbsToiterate[muir_beach_tmb]" type="hidden"
> value="muir_beach_tmb" />
> <input name="tmbsToiterate[ruby_mountain_tmb]" type="hidden"
> value="ruby_mountain_tmb" />
>
> they post to the script with this: (and this is the line giving the error)-
>
> foreach($_POST['$tmbsToiterate'] as $value) {


// Maybe like this, but i'm not sure, try to do a var_dump( $_POST ) and see
what is inside ;)
foreach($_POST['tmbsToiterate'] as $value) {

>
>
> The error is "Warning: Invalid argument supplied for foreach()"
>
> Seems so simple, but I can't get it... What am I doing wrong?
> -Govinda
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 
Thanks for your attention,

Diogo Neves
Web Developer @ SAPO.pt by PrimeIT.pt

--- End Message ---
--- Begin Message ---
Govinda wrote:

> Hello early birds,
> 
> I am going round and round the docs and list posts I saved on this
> topic... but I am still stumped.
> Kindly show me what I am missing.  I want to simply send an array of
> vars via a post form to my receiving script.
> 
> I've got simple inputs like this:
> 
> <input name="tmbsToiterate[muir_beach_tmb]" type="hidden"
> value="muir_beach_tmb" />
> <input name="tmbsToiterate[ruby_mountain_tmb]" type="hidden"
> value="ruby_mountain_tmb" />
> 
> they post to the script with this: (and this is the line giving the
> error)-
> 
> foreach($_POST['$tmbsToiterate'] as $value) {
> 
> The error is "Warning: Invalid argument supplied for foreach()"
> 
> Seems so simple, but I can't get it... What am I doing wrong?
> -Govinda

foreach($_POST['tmbsToiterate'] as $value) {

Remove the $

Cheers
-- 
David Robley

"Our field is arthritis research," Tom and his room mate said jointly.
Today is Prickle-Prickle, the 25th day of Bureaucracy in the YOLD 3174. 


--- End Message ---
--- Begin Message ---
Govinda schrieb:
Hello early birds,

I am going round and round the docs and list posts I saved on this topic... but I am still stumped. Kindly show me what I am missing. I want to simply send an array of vars via a post form to my receiving script.

I've got simple inputs like this:

<input name="tmbsToiterate[muir_beach_tmb]" type="hidden" value="muir_beach_tmb" /> <input name="tmbsToiterate[ruby_mountain_tmb]" type="hidden" value="ruby_mountain_tmb" />

they post to the script with this: (and this is the line giving the error)-

foreach($_POST['$tmbsToiterate'] as $value) {

The error is "Warning: Invalid argument supplied for foreach()"

Seems so simple, but I can't get it... What am I doing wrong?
-Govinda

Hi Govinda,
delte the $ from the foreach '$tmbsToiterate'!

Regards

Carlos


--- End Message ---
--- Begin Message ---
Hi All, 

For security purposes I would like to upload a file outside the webroot.

I have got this to work on my local dev machine but it doesn't seem to work
on the live server.

I have tried both the relative path and also the full path (from the
$_SERVER[DOCUMENT_ROOT] variable).

Now I can't get the upload to work and have no idea what the problem could
be. I have also set the permissions of the folder, so that can't be a
problem.

Could it be a problem with server hosting restrictions? Or maybe the server
is setup for virtual hosting?

Thanks
Angelo




--- End Message ---
--- Begin Message ---
Angelo Zanetti schrieb:
Hi All,
For security purposes I would like to upload a file outside the webroot.

I have got this to work on my local dev machine but it doesn't seem to work
on the live server.

I have tried both the relative path and also the full path (from the
$_SERVER[DOCUMENT_ROOT] variable).

Now I can't get the upload to work and have no idea what the problem could
be. I have also set the permissions of the folder, so that can't be a
problem.

Could it be a problem with server hosting restrictions? Or maybe the server
is setup for virtual hosting?

Thanks
Angelo




Hi Angelo,
dev and live are the same Server/Machine type?
Restrictions on the Folder? ( Group restrictions, User Restrictions, etc)
Exists the Folder on the Live System?


Regards

Carlos

--- End Message ---
--- Begin Message ---
Hi,

Is it possible to have shared memory in the form of shared global variables
in PHP? Or any other form of shared memory? And if that is the case, is
there any form of mutex functionality which may be used to assure
syncronized access to this memory?

My next question is related to the first one.

Is it possible to have a thread running for processing of information. This
thread should be accessed from all the session instances, and it would also
need to be syncronized. I would like to have something like:
jobProcessorThread.addJob(aJobClassInstance)

The job processor thread should work with the jobs in its queue until the
queue is empty. Then it should idle until more requests are received.

And my last question.

Is it possible to let any code run and perform its work after PHP has sent
the page to the user? This could be an alternative to having a worker thread
in if it's also possible to have mutexes and shared memory. Then the worker
thread jobs could be processed after a page has been sent inside a critical
block protected by mutex functionality.

Best regards,
Kent

--- End Message ---
--- Begin Message ---
2008/8/30 Per Jessen <[EMAIL PROTECTED]>:
> tedd wrote:
>
>> What some browser developers did was to NOT make the conversion from
>> PUNYCODE to the correct code-points but rather show the PUNYCODE
>> "as-is", which was never the intent of the IDNS WG. This act defeated
>> the entire process of allowing non-English people to have non-English
>> domain names. This like throwing the baby out with the bath water.
>
> But that's not what FF does though - it has no problem with other domain
> names with international characters.  For instance, the normal Danish,
> German, French, Spanish and Icelandic characters work just fine. I have
> a testing domain which contains an 'ë' - also no problem. It seems to
> be just somewhat limited to those (and others I'm sure).

True...

Firefox holds a whitelist of toplevel domains that are allowed to
display unicode (to see the list go to about:config and enter
IDN.whitelist into the filter box).

It does not allow .com domains to contain unicode for obvious phishing
reasons, but if I temporarily add it to the whitelist, I can see tedds
yin-yang domain in all its glory. Although not, for some reason which
I can't be bothered investigating, the rx-2 domain.

-robin

--- End Message ---
--- Begin Message ---
Dear all,

We have an immediate job opening available to work in our team of
bio-informaticians on extending the LOVD software (www.LOVD.nl). Even if
you're still a beginner with PHP you're welcome to respond. Affinity to
biology is a big plus.

LOVD (Leiden Open Variation Database) is webbased software used by
hospitals and clinics worldwide to store patient and DNA mutation
information.

For more information, see our website or these two PDF files:
http://www.lovd.nl/Vac08_G2P_LSDBs.pdf
http://www.lovd.nl/LUMC_E.08.GJ.16HG.pdf

If you're interested, please let me know as soon as possible since we've
already started selecting candidates.

Ivo Fokkema

--- End Message ---
--- Begin Message ---
Per Jessen schrieb:
Jochem Maas wrote:

lockfile=/var/lock/<xxxx>/file
# clear out a lock older than 60mins
find $lockfile -cmin +60 | xargs rm
test ! -f $lockfile && (
touch $lockfile
<run some php>
rm -f $lockfile
)
wouldn't creating a dir be better here? (with regard to atomicity)


I haven't thought it through, but I don't think it would change
anything.

/Per Jessen, Zürich


Hello everybody,

thank you for the huge amount of replies on my question. I believe I quite lost a bit track on how to solve the problem hands on. To summerize, there are aparently two ways of skinning the cat :-)

1. Run a deamon
I admit I have never wrote one, and that seems therefore to be the harder option for me. Well... perhaps not. I assume it is simply creating a shell script like Jochem wrote, however I guess it would just take longer for me to get it running as I have never done that before.

2. Create a PHP file that holds some lock code which is triggered by CRON every 5 minutes. Taking the example from Robert.

3. Following idea which I am now actually implementing :-)

 - Add all emails into a mysql db with one insert command.
 - Run a php script by cron every 5 min that does the following:
        - update table, set session_id = x on all entries without session id
        - get all entries with that session ID
        - send email to those with that session ID
        - remove all entries with that session ID

Looks like easies sollution on how to skimm the cat. DB might not be the most performing sollution, but sufficient considering the hard ware power.

Thanks for your help!

Regards,

Merlin

--- End Message ---
--- Begin Message ---
Thanks Eric, Diogo, Ross and specially Christopher for this long article.
I have started reading those articles.
And I hope to collect those books too.


-- 
Blog: http://talk.cmyweb.net/
Follow me: http://twitter.com/shiplu

--- End Message ---

Reply via email to