php-general Digest 2 Apr 2013 10:46:23 -0000 Issue 8181

2013-04-02 Thread php-general-digest-help

php-general Digest 2 Apr 2013 10:46:23 - Issue 8181

Topics (messages 320724 through 320737):

mysqli  nested queries - maybe I'm rusty...
320724 by: Jay Blanchard
320737 by: Jay Blanchard

A relative date puzzle
320725 by: Jim Giner
320726 by: Mattias Thorslund
320727 by: Mattias Thorslund
320728 by: Jim Giner
320729 by: Steven Staples

Is there a PHP based authentication library?
320730 by: Mark
320731 by: David OBrien
320732 by: Sorin Badea
320733 by: Mark
320734 by: Mark
320735 by: Andy McKenzie

php-fpm (5.4.13) takes up all cpu resources
320736 by: Free Proxy

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---
I am putting together an application where we are almost exclusively 
using stored procedures in MySQL because most of the heavy lifting (as 
it should be) is done in the database.


I have exactly one situation where I need to execute a stored procedure 
and while returning the results if I run a across a particular value in 
those results I need to execute another SP to handle. Because I have 
forgotten which combination or store_result, use_result, fetch_row (not 
to mention that fetch row doesn't have the column names in the array, 
just the index) to use I am banging my head against the wall while 
getting the dastardly 2014 Commands out of sync; error. Can someone 
provide some insight please?


Assume that $mysqli is the connection -

$sql = CALL sp_ONE( . $product . , . $level . );
if(!$result = $mysqli-multi_query($sql)) {
echo Error: ( . $mysqli-errno . )  . $mysqli-error .  on 
Query  . $sql;

} else {
do {
if($side = $mysqli-store_result()) {

/* output the list */
echo 'ul';
while($row = $side-fetch_row()) {
/* careful, column names aren't carried over */
echo 'li data-page=' . $row[2] . '' . $row[1] . 
'/li';

/* do we need to do a another stored procedure? */
if(isset($row[3])) {
/* get the info */
$sql = CALL sp_TWO( . $product . , . $row[0] . );
if(!$subResult = $mysqli-multi_query($sql)) {
echo Error: ( . $mysqli-errno . )  . 
$mysqli-error .  on Query  . $sql;

}
/* output the extra info */
echo 'ul';
while($sub = mysqli_fetch_array($subResult)) {
echo 'li data-page=' . $sub[1] . '' . 
$sub[0] . '/li';

}
echo '/ul';
}
}
echo '/ul';
$side-close();
}
} while($mysqli-next_result());
}



---End Message---
---BeginMessage---

Anyone? I have not been able to find a solution online.

On 4/1/2013 11:33 AM, Jay Blanchard wrote:
I am putting together an application where we are almost exclusively 
using stored procedures in MySQL because most of the heavy lifting (as 
it should be) is done in the database.


I have exactly one situation where I need to execute a stored 
procedure and while returning the results if I run a across a 
particular value in those results I need to execute another SP to 
handle. Because I have forgotten which combination or store_result, 
use_result, fetch_row (not to mention that fetch row doesn't have the 
column names in the array, just the index) to use I am banging my head 
against the wall while getting the dastardly 2014 Commands out of 
sync; error. Can someone provide some insight please?


Assume that $mysqli is the connection -

$sql = CALL sp_ONE( . $product . , . $level . );
if(!$result = $mysqli-multi_query($sql)) {
echo Error: ( . $mysqli-errno . )  . $mysqli-error .  on 
Query  . $sql;

} else {
do {
if($side = $mysqli-store_result()) {

/* output the list */
echo 'ul';
while($row = $side-fetch_row()) {
/* careful, column names aren't carried over */
echo 'li data-page=' . $row[2] . '' . $row[1] . 
'/li';

/* do we need to do a another stored procedure? */
if(isset($row[3])) {
/* get the info */
$sql = CALL sp_TWO( . $product . , . $row[0] . 
);

if(!$subResult = $mysqli-multi_query($sql)) {
echo Error: ( . $mysqli-errno . )  . 
$mysqli-error .  on Query  . $sql;

}
/* output the extra info */
echo 'ul';
while($sub = mysqli_fetch_array($subResult)) {
 

php-general Digest 3 Apr 2013 04:32:47 -0000 Issue 8182

2013-04-02 Thread php-general-digest-help

php-general Digest 3 Apr 2013 04:32:47 - Issue 8182

Topics (messages 320738 through 320754):

Set process custom identifier
320738 by: Sorin Badea
320739 by: Matijn Woudt
320740 by: Sorin Badea
320742 by: Stuart Dallas
320744 by: Sorin Badea
320745 by: Stuart Dallas
320747 by: Sorin Badea

Re: {SOLVED] mysqli  nested queries - maybe I'm rusty...
320741 by: Jay Blanchard
320746 by: Lester Caine

Re: A relative date puzzle
320743 by: Jim Giner

webform spam prevention
320748 by: Jen Rasmussen
320749 by: Sorin Badea
320750 by: Jen Rasmussen

Re: Is there a PHP based authentication library?
320751 by: Mark
320752 by: Bastien
320753 by: Mark
320754 by: Nathan Nobbe

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---
Hi guys,
I'm trying to find a solution to identify a php process that is spawned
with pnctl_fork. I've tried to set a custom gid but this isn't viable
because I have to run the parent proc with administrative permissions. I
need to do this native without any pecl extensions.
Is there a way to do this ?

Regards,
-- 
Badea Sorin (unu.sorin)
sorin.bade...@gmail.com
unu_so...@yahoo.com
---End Message---
---BeginMessage---
Hi,

pcntl_fork will return the pid of the fork, what is wrong with using that
pid to identify the process?

- Matijn


On Tue, Apr 2, 2013 at 3:38 PM, Sorin Badea sorin.bade...@gmail.com wrote:

 Hi guys,
 I'm trying to find a solution to identify a php process that is spawned
 with pnctl_fork. I've tried to set a custom gid but this isn't viable
 because I have to run the parent proc with administrative permissions. I
 need to do this native without any pecl extensions.
 Is there a way to do this ?

 Regards,
 --
 Badea Sorin (unu.sorin)
 sorin.bade...@gmail.com
 unu_so...@yahoo.com

---End Message---
---BeginMessage---
I don't want to wait for it and surely I don't want to safe that pid in
same place. I just want to use `ps` with a pattern to return my forked
process.


On Tue, Apr 2, 2013 at 4:48 PM, Matijn Woudt tijn...@gmail.com wrote:

 Hi,

 pcntl_fork will return the pid of the fork, what is wrong with using that
 pid to identify the process?

 - Matijn


 On Tue, Apr 2, 2013 at 3:38 PM, Sorin Badea sorin.bade...@gmail.comwrote:

 Hi guys,
 I'm trying to find a solution to identify a php process that is spawned
 with pnctl_fork. I've tried to set a custom gid but this isn't viable
 because I have to run the parent proc with administrative permissions. I
 need to do this native without any pecl extensions.
 Is there a way to do this ?

 Regards,
 --
 Badea Sorin (unu.sorin)
 sorin.bade...@gmail.com
 unu_so...@yahoo.com





-- 
Badea Sorin (unu.sorin)
sorin.bade...@gmail.com
unu_so...@yahoo.com
Pagina personala:
http://badeasorin.com
---End Message---
---BeginMessage---
On 2 Apr 2013, at 14:50, Sorin Badea sorin.bade...@gmail.com wrote:

 I don't want to wait for it and surely I don't want to safe that pid in
 same place. I just want to use `ps` with a pattern to return my forked
 process.

Storing the PID of a process you need to monitor is the established method, and 
is certainly the most reliable. Why can't you use the PID as the pattern to 
look for? If there's a reason then please explain it as that will help us 
assist you. If there's no reason then I don't understand why you're trying to 
over-complicate it.

If you're just wanting to monitor it from the process that forked it then you 
don't need to store the PID anywhere other than a variable, and you don't need 
to wait for it.

If you absolutely must do this then the only way is via an extension such as 
proctitle: http://php.net/setproctitle

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/

 On Tue, Apr 2, 2013 at 4:48 PM, Matijn Woudt tijn...@gmail.com wrote:
 
 Hi,
 
 pcntl_fork will return the pid of the fork, what is wrong with using that
 pid to identify the process?
 
 - Matijn
 
 
 On Tue, Apr 2, 2013 at 3:38 PM, Sorin Badea sorin.bade...@gmail.comwrote:
 
 Hi guys,
 I'm trying to find a solution to identify a php process that is spawned
 with pnctl_fork. I've tried to set a custom gid but this isn't viable
 because I have to run the parent proc with administrative permissions. I
 need to do this native without any pecl extensions.
 Is there a way to do this ?
 
 Regards,
 --
 Badea Sorin (unu.sorin)
 sorin.bade...@gmail.com
 unu_so...@yahoo.com
 
 
 
 
 
 -- 
 Badea Sorin (unu.sorin)
 sorin.bade...@gmail.com
 unu_so...@yahoo.com
 Pagina personala:
 http://badeasorin.com

---End Message---
---BeginMessage---
I'm trying to implement a standalone threading component, 

Re: [PHP] mysqli nested queries - maybe I'm rusty...

2013-04-02 Thread Jay Blanchard

Anyone? I have not been able to find a solution online.

On 4/1/2013 11:33 AM, Jay Blanchard wrote:
I am putting together an application where we are almost exclusively 
using stored procedures in MySQL because most of the heavy lifting (as 
it should be) is done in the database.


I have exactly one situation where I need to execute a stored 
procedure and while returning the results if I run a across a 
particular value in those results I need to execute another SP to 
handle. Because I have forgotten which combination or store_result, 
use_result, fetch_row (not to mention that fetch row doesn't have the 
column names in the array, just the index) to use I am banging my head 
against the wall while getting the dastardly 2014 Commands out of 
sync; error. Can someone provide some insight please?


Assume that $mysqli is the connection -

$sql = CALL sp_ONE( . $product . , . $level . );
if(!$result = $mysqli-multi_query($sql)) {
echo Error: ( . $mysqli-errno . )  . $mysqli-error .  on 
Query  . $sql;

} else {
do {
if($side = $mysqli-store_result()) {

/* output the list */
echo 'ul';
while($row = $side-fetch_row()) {
/* careful, column names aren't carried over */
echo 'li data-page=' . $row[2] . '' . $row[1] . 
'/li';

/* do we need to do a another stored procedure? */
if(isset($row[3])) {
/* get the info */
$sql = CALL sp_TWO( . $product . , . $row[0] . 
);

if(!$subResult = $mysqli-multi_query($sql)) {
echo Error: ( . $mysqli-errno . )  . 
$mysqli-error .  on Query  . $sql;

}
/* output the extra info */
echo 'ul';
while($sub = mysqli_fetch_array($subResult)) {
echo 'li data-page=' . $sub[1] . '' . 
$sub[0] . '/li';

}
echo '/ul';
}
}
echo '/ul';
$side-close();
}
} while($mysqli-next_result());
}







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



[PHP] Set process custom identifier

2013-04-02 Thread Sorin Badea
Hi guys,
I'm trying to find a solution to identify a php process that is spawned
with pnctl_fork. I've tried to set a custom gid but this isn't viable
because I have to run the parent proc with administrative permissions. I
need to do this native without any pecl extensions.
Is there a way to do this ?

Regards,
-- 
Badea Sorin (unu.sorin)
sorin.bade...@gmail.com
unu_so...@yahoo.com


Re: [PHP] Set process custom identifier

2013-04-02 Thread Matijn Woudt
Hi,

pcntl_fork will return the pid of the fork, what is wrong with using that
pid to identify the process?

- Matijn


On Tue, Apr 2, 2013 at 3:38 PM, Sorin Badea sorin.bade...@gmail.com wrote:

 Hi guys,
 I'm trying to find a solution to identify a php process that is spawned
 with pnctl_fork. I've tried to set a custom gid but this isn't viable
 because I have to run the parent proc with administrative permissions. I
 need to do this native without any pecl extensions.
 Is there a way to do this ?

 Regards,
 --
 Badea Sorin (unu.sorin)
 sorin.bade...@gmail.com
 unu_so...@yahoo.com



Re: [PHP] Set process custom identifier

2013-04-02 Thread Sorin Badea
I don't want to wait for it and surely I don't want to safe that pid in
same place. I just want to use `ps` with a pattern to return my forked
process.


On Tue, Apr 2, 2013 at 4:48 PM, Matijn Woudt tijn...@gmail.com wrote:

 Hi,

 pcntl_fork will return the pid of the fork, what is wrong with using that
 pid to identify the process?

 - Matijn


 On Tue, Apr 2, 2013 at 3:38 PM, Sorin Badea sorin.bade...@gmail.comwrote:

 Hi guys,
 I'm trying to find a solution to identify a php process that is spawned
 with pnctl_fork. I've tried to set a custom gid but this isn't viable
 because I have to run the parent proc with administrative permissions. I
 need to do this native without any pecl extensions.
 Is there a way to do this ?

 Regards,
 --
 Badea Sorin (unu.sorin)
 sorin.bade...@gmail.com
 unu_so...@yahoo.com





-- 
Badea Sorin (unu.sorin)
sorin.bade...@gmail.com
unu_so...@yahoo.com
Pagina personala:
http://badeasorin.com


Re: [PHP] {SOLVED] mysqli nested queries - maybe I'm rusty...

2013-04-02 Thread Jay Blanchard

[snip]
...stuff...
[/snip]

I rewrote everything so that I could get the data in a single query and 
then performed some manipulation with PHP to get the proper output. No 
need to call multiple queries in this case, just had to sleep on it.


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



Re: [PHP] Set process custom identifier

2013-04-02 Thread Stuart Dallas
On 2 Apr 2013, at 14:50, Sorin Badea sorin.bade...@gmail.com wrote:

 I don't want to wait for it and surely I don't want to safe that pid in
 same place. I just want to use `ps` with a pattern to return my forked
 process.

Storing the PID of a process you need to monitor is the established method, and 
is certainly the most reliable. Why can't you use the PID as the pattern to 
look for? If there's a reason then please explain it as that will help us 
assist you. If there's no reason then I don't understand why you're trying to 
over-complicate it.

If you're just wanting to monitor it from the process that forked it then you 
don't need to store the PID anywhere other than a variable, and you don't need 
to wait for it.

If you absolutely must do this then the only way is via an extension such as 
proctitle: http://php.net/setproctitle

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/

 On Tue, Apr 2, 2013 at 4:48 PM, Matijn Woudt tijn...@gmail.com wrote:
 
 Hi,
 
 pcntl_fork will return the pid of the fork, what is wrong with using that
 pid to identify the process?
 
 - Matijn
 
 
 On Tue, Apr 2, 2013 at 3:38 PM, Sorin Badea sorin.bade...@gmail.comwrote:
 
 Hi guys,
 I'm trying to find a solution to identify a php process that is spawned
 with pnctl_fork. I've tried to set a custom gid but this isn't viable
 because I have to run the parent proc with administrative permissions. I
 need to do this native without any pecl extensions.
 Is there a way to do this ?
 
 Regards,
 --
 Badea Sorin (unu.sorin)
 sorin.bade...@gmail.com
 unu_so...@yahoo.com
 
 
 
 
 
 -- 
 Badea Sorin (unu.sorin)
 sorin.bade...@gmail.com
 unu_so...@yahoo.com
 Pagina personala:
 http://badeasorin.com



[PHP] Re: A relative date puzzle

2013-04-02 Thread Jim Giner

On 4/1/2013 2:05 PM, Jim Giner wrote:

I'm looking for some ideas on how to handle the following get a datetime
value that is relative to a specific future date when presented with a
partial day time value.

Specifically, I have an appl that requires some lengthy input involving
days and times.  I have streamlined the d/e effort so that it can be
done entirely using the number keypad (if available), or else just with
numeric entries.  Works great, very quick (JS) and accurate.  Basically
the users type some numbers and end up with something like:

Sat 08:00am  or Fri 07:00pm etc.

Does anyone have an idea on how I can convert this value to a true
datetime value for my database updates, where the above value is
relative to a specific date in the future?  IE, the d/e takes place a
few days before a certain upcoming date and I want my entry of Sat to
translate to the Saturday following that certain date.  This could take
place one to two weeks prior to the start date, so just adding next to
the value above won't work.  I really need to incorporate a specific
date in the solution.

Thoughts anyone?

For those interested - the proposed answer is indeed the answer.

To convert a relative time string such as Sat 01:00pm to an absolute 
date relative to a given date this does the trick:


$dt = strtotime(sat 01:00pm,strtotime(2012-11-16)

which would return 11/17/12 01:00 pm

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



Re: [PHP] Set process custom identifier

2013-04-02 Thread Sorin Badea
I'm trying to implement a standalone threading component, and in current
implementation I'm using `popen` to run a separate process with some
arguments that I'm using to identify them (for example `php
some_dummy_file.php -thread_id=some_hash`). This way when I'm trying to
see which are my threads I don't have to check every stored pid and see if
they are still up.


On Tue, Apr 2, 2013 at 5:02 PM, Stuart Dallas stu...@3ft9.com wrote:

 On 2 Apr 2013, at 14:50, Sorin Badea sorin.bade...@gmail.com wrote:

 I don't want to wait for it and surely I don't want to safe that pid in
 same place. I just want to use `ps` with a pattern to return my forked
 process.


 Storing the PID of a process you need to monitor is the established
 method, and is certainly the most reliable. Why can't you use the PID as
 the pattern to look for? If there's a reason then please explain it as that
 will help us assist you. If there's no reason then I don't understand why
 you're trying to over-complicate it.

 If you're just wanting to monitor it from the process that forked it then
 you don't need to store the PID anywhere other than a variable, and you
 don't need to wait for it.

 If you absolutely must do this then the only way is via an extension such
 as proctitle: http://php.net/setproctitle

 -Stuart

 --
 Stuart Dallas
 3ft9 Ltd
 http://3ft9.com/

 On Tue, Apr 2, 2013 at 4:48 PM, Matijn Woudt tijn...@gmail.com wrote:

 Hi,

 pcntl_fork will return the pid of the fork, what is wrong with using that
 pid to identify the process?

 - Matijn


 On Tue, Apr 2, 2013 at 3:38 PM, Sorin Badea sorin.bade...@gmail.com
 wrote:

 Hi guys,
 I'm trying to find a solution to identify a php process that is spawned
 with pnctl_fork. I've tried to set a custom gid but this isn't viable
 because I have to run the parent proc with administrative permissions. I
 need to do this native without any pecl extensions.
 Is there a way to do this ?

 Regards,
 --
 Badea Sorin (unu.sorin)
 sorin.bade...@gmail.com
 unu_so...@yahoo.com





 --
 Badea Sorin (unu.sorin)
 sorin.bade...@gmail.com
 unu_so...@yahoo.com
 Pagina personala:
 http://badeasorin.com





-- 
Badea Sorin (unu.sorin)
sorin.bade...@gmail.com
unu_so...@yahoo.com
Pagina personala:
http://badeasorin.com


Re: [PHP] Set process custom identifier

2013-04-02 Thread Stuart Dallas
On 2 Apr 2013, at 15:11, Sorin Badea sorin.bade...@gmail.com wrote:

 I'm trying to implement a standalone threading component, and in current 
 implementation I'm using `popen` to run a separate process with some 
 arguments that I'm using to identify them (for example `php 
 some_dummy_file.php -thread_id=some_hash`). This way when I'm trying to see 
 which are my threads I don't have to check every stored pid and see if they 
 are still up. 

Personally I would be storing the PIDs somewhere, but that's just me.

The other way you could probably do it is by having the main script (the one 
executed on the command line) named something unique, the use dirname(__FILE__) 
to get that name from within that script. Then parse the PS output for that 
script name. You may need to exclude lines containing bash or similar depending 
on how the script was executed.

Seriously, PIDs are the way to go! Based on what you've put above you already 
have some sort of storage that's tracking threads (they have a hash), so why 
not add the PID to that? Or, even better, use the PID as that hash?

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/


 On Tue, Apr 2, 2013 at 5:02 PM, Stuart Dallas stu...@3ft9.com wrote:
 On 2 Apr 2013, at 14:50, Sorin Badea sorin.bade...@gmail.com wrote:
 
 I don't want to wait for it and surely I don't want to safe that pid in
 same place. I just want to use `ps` with a pattern to return my forked
 process.
 
 Storing the PID of a process you need to monitor is the established method, 
 and is certainly the most reliable. Why can't you use the PID as the pattern 
 to look for? If there's a reason then please explain it as that will help us 
 assist you. If there's no reason then I don't understand why you're trying to 
 over-complicate it.
 
 If you're just wanting to monitor it from the process that forked it then you 
 don't need to store the PID anywhere other than a variable, and you don't 
 need to wait for it.
 
 If you absolutely must do this then the only way is via an extension such as 
 proctitle: http://php.net/setproctitle
 
 -Stuart
 
 -- 
 Stuart Dallas
 3ft9 Ltd
 http://3ft9.com/
 
 On Tue, Apr 2, 2013 at 4:48 PM, Matijn Woudt tijn...@gmail.com wrote:
 
 Hi,
 
 pcntl_fork will return the pid of the fork, what is wrong with using that
 pid to identify the process?
 
 - Matijn
 
 
 On Tue, Apr 2, 2013 at 3:38 PM, Sorin Badea sorin.bade...@gmail.comwrote:
 
 Hi guys,
 I'm trying to find a solution to identify a php process that is spawned
 with pnctl_fork. I've tried to set a custom gid but this isn't viable
 because I have to run the parent proc with administrative permissions. I
 need to do this native without any pecl extensions.
 Is there a way to do this ?
 
 Regards,
 --
 Badea Sorin (unu.sorin)
 sorin.bade...@gmail.com
 unu_so...@yahoo.com
 
 
 
 
 
 -- 
 Badea Sorin (unu.sorin)
 sorin.bade...@gmail.com
 unu_so...@yahoo.com
 Pagina personala:
 http://badeasorin.com
 
 
 
 
 -- 
 Badea Sorin (unu.sorin)
 sorin.bade...@gmail.com
 unu_so...@yahoo.com
 Pagina personala:
 http://badeasorin.com



Re: [PHP] {SOLVED] mysqli nested queries - maybe I'm rusty...

2013-04-02 Thread Lester Caine

Jay Blanchard wrote:

[snip]
...stuff...
[/snip]

I rewrote everything so that I could get the data in a single query and then
performed some manipulation with PHP to get the proper output. No need to call
multiple queries in this case, just had to sleep on it.


In Firebird, CTE queries are great for this type of problem. Just having a 
single result set and formatting the results based on a 'level' field makes 
things very flexible and you just stream the one set of results.


--
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
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

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



Re: [PHP] Set process custom identifier

2013-04-02 Thread Sorin Badea
I'm not storing the hashes, just generate them when starting the thread. I
think that storing the thread pid in a local file (pids/threadx.pid) is the
only way but I don't think is the best.
Thanks anyway Stuard!


On Tue, Apr 2, 2013 at 5:18 PM, Stuart Dallas stu...@3ft9.com wrote:

 On 2 Apr 2013, at 15:11, Sorin Badea sorin.bade...@gmail.com wrote:

 I'm trying to implement a standalone threading component, and in current
 implementation I'm using `popen` to run a separate process with some
 arguments that I'm using to identify them (for example `php
 some_dummy_file.php -thread_id=some_hash`). This way when I'm trying to
 see which are my threads I don't have to check every stored pid and see if
 they are still up.


 Personally I would be storing the PIDs somewhere, but that's just me.

 The other way you could probably do it is by having the main script (the
 one executed on the command line) named something unique, the use
 dirname(__FILE__) to get that name from within that script. Then parse the
 PS output for that script name. You may need to exclude lines containing
 bash or similar depending on how the script was executed.

 Seriously, PIDs are the way to go! Based on what you've put above you
 already have some sort of storage that's tracking threads (they have a
 hash), so why not add the PID to that? Or, even better, use the PID as that
 hash?

 -Stuart

 --
 Stuart Dallas
 3ft9 Ltd
 http://3ft9.com/


 On Tue, Apr 2, 2013 at 5:02 PM, Stuart Dallas stu...@3ft9.com wrote:

 On 2 Apr 2013, at 14:50, Sorin Badea sorin.bade...@gmail.com wrote:

 I don't want to wait for it and surely I don't want to safe that pid in
 same place. I just want to use `ps` with a pattern to return my forked
 process.


 Storing the PID of a process you need to monitor is the established
 method, and is certainly the most reliable. Why can't you use the PID as
 the pattern to look for? If there's a reason then please explain it as that
 will help us assist you. If there's no reason then I don't understand why
 you're trying to over-complicate it.

 If you're just wanting to monitor it from the process that forked it then
 you don't need to store the PID anywhere other than a variable, and you
 don't need to wait for it.

 If you absolutely must do this then the only way is via an extension such
 as proctitle: http://php.net/setproctitle

 -Stuart

 --
 Stuart Dallas
 3ft9 Ltd
 http://3ft9.com/

 On Tue, Apr 2, 2013 at 4:48 PM, Matijn Woudt tijn...@gmail.com wrote:

 Hi,

 pcntl_fork will return the pid of the fork, what is wrong with using that
 pid to identify the process?

 - Matijn


 On Tue, Apr 2, 2013 at 3:38 PM, Sorin Badea sorin.bade...@gmail.com
 wrote:

 Hi guys,
 I'm trying to find a solution to identify a php process that is spawned
 with pnctl_fork. I've tried to set a custom gid but this isn't viable
 because I have to run the parent proc with administrative permissions. I
 need to do this native without any pecl extensions.
 Is there a way to do this ?

 Regards,
 --
 Badea Sorin (unu.sorin)
 sorin.bade...@gmail.com
 unu_so...@yahoo.com





 --
 Badea Sorin (unu.sorin)
 sorin.bade...@gmail.com
 unu_so...@yahoo.com
 Pagina personala:
 http://badeasorin.com





 --
 Badea Sorin (unu.sorin)
 sorin.bade...@gmail.com
 unu_so...@yahoo.com
 Pagina personala:
 http://badeasorin.com





-- 
Badea Sorin (unu.sorin)
sorin.bade...@gmail.com
unu_so...@yahoo.com
Pagina personala:
http://badeasorin.com


[PHP] webform spam prevention

2013-04-02 Thread Jen Rasmussen
Can someone recommend a best practice for blocking spam on web forms (aside
from captcha) ? 

 

I've been for the most part utilizing a honeypot method and then
individually blocking IPs and am looking for a more efficient method that
won't require daily maintenance. 

 

I've come across this module: http://spam-ip.com/phpnuke-spam-module.php

 

Has anyone used this method or have any other better suggestions?

 

Thanks in advance! 

 

Jen Rasmussen 

Web Development Manager | Cetacea Sound Corp.

763-225-8465 | www.cetaceasound.com


P Before printing this message, make sure that it's necessary. The
environment is in your hands

 



FW: [PHP] webform spam prevention

2013-04-02 Thread Jen Rasmussen
Unfortunately, my research shows a lot of users have issues with captcha's,
specifically recaptcha can be very difficult to read in most instances, and
am looking for an alternative method. I do like the slider method on
theymakeapps.com, I may take a look at that, thanks. 

Jen


-Original Message-
From: Sorin Badea [mailto:sorin.bade...@gmail.com] 
Sent: Tuesday, April 02, 2013 2:20 PM
To: j...@cetaceasound.com
Cc: php-general@lists.php.net
Subject: Re: [PHP] webform spam prevention

You can take a look at this article
http://coding.smashingmagazine.com/2011/03/04/in-search-of-the-perfect-captc
ha/


On Tue, Apr 2, 2013 at 10:13 PM, Jen Rasmussen j...@cetaceasound.com wrote:

 Can someone recommend a best practice for blocking spam on web forms 
 (aside from captcha) ?



 I've been for the most part utilizing a honeypot method and then 
 individually blocking IPs and am looking for a more efficient method 
 that won't require daily maintenance.



 I've come across this module: 
 http://spam-ip.com/phpnuke-spam-module.php



 Has anyone used this method or have any other better suggestions?



 Thanks in advance!



 Jen Rasmussen

 Web Development Manager | Cetacea Sound Corp.

 763-225-8465 | www.cetaceasound.com


 P Before printing this message, make sure that it's necessary. The 
 environment is in your hands






--
Badea Sorin (unu.sorin)
sorin.bade...@gmail.com
unu_so...@yahoo.com
Pagina personala:
http://badeasorin.com


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



Re: [PHP] webform spam prevention

2013-04-02 Thread Sorin Badea
You can take a look at this article
http://coding.smashingmagazine.com/2011/03/04/in-search-of-the-perfect-captcha/


On Tue, Apr 2, 2013 at 10:13 PM, Jen Rasmussen j...@cetaceasound.com wrote:

 Can someone recommend a best practice for blocking spam on web forms (aside
 from captcha) ?



 I've been for the most part utilizing a honeypot method and then
 individually blocking IPs and am looking for a more efficient method that
 won't require daily maintenance.



 I've come across this module: http://spam-ip.com/phpnuke-spam-module.php



 Has anyone used this method or have any other better suggestions?



 Thanks in advance!



 Jen Rasmussen

 Web Development Manager | Cetacea Sound Corp.

 763-225-8465 | www.cetaceasound.com


 P Before printing this message, make sure that it's necessary. The
 environment is in your hands






-- 
Badea Sorin (unu.sorin)
sorin.bade...@gmail.com
unu_so...@yahoo.com
Pagina personala:
http://badeasorin.com


Re: [PHP] Is there a PHP based authentication library?

2013-04-02 Thread Mark
Hi Andy,

To be honest, that's also not what i'm looking for, but might be a
good starting point to extend on. Depends on how you made it :) I cant
promise that i'ill be working on it. I might be for some future
project in my company but it might very well not happen as well.

On Tue, Apr 2, 2013 at 2:08 AM, Andy McKenzie amckenz...@gmail.com wrote:
 I started building one at my last job, though it was part of a framework I
 was developing.  I knew I was going to need to authenticate against both
 LDAP and old-fashioned database username/md5-password columns.  (Ah, legacy
 user databases.)

 If it would be useful, I could dig out what I had and try to make it into a
 stand-alone set of functions, but I never got further than those two
 options.  Basically there was a script that took in a username and password
 from a web form, then looked at a config file to decide which set of the
 sub-functions to use.  For a DB, it checked to see if the username and
 hashed password matched a row in the database;  for LDAP, it did some
 re-encoding to handle the weird encrypt that our OpenLDAP server used, then
 ran through the process of checking to see if the user actually had that as
 their password.

 Like I said, let me know if anyone wants to see it... I'm unemployed right
 now, and a project to work on this week (or next... this week is kind of
 busy) might be a good thing.

 -Andy McKenzie


 On Mon, Apr 1, 2013 at 6:49 PM, Mark mark...@gmail.com wrote:

 On Tue, Apr 2, 2013 at 12:27 AM, Sorin Badea sorin.bade...@gmail.com
 wrote:
  Hi Mark,
  I think a simple Google search would be faster. Anyway, an unified way
 for
  3rd party authentication doesn't exist from my knowledge, but for Persona
  you could use the sample from mozilla github account
  https://github.com/mozilla/browserid-cookbook .
 
  Good luck,
  Sorin!
 
 
  On Tue, Apr 2, 2013 at 12:26 AM, Mark mark...@gmail.com wrote:
 
  Hi,
 
  I stumbled upon this payment library: http://ci-merchant.org/ which
  abstracts the different payment backends away and exposes a new easy
  to use interface for the app developer to use. Thus making it very
  easy to use different payment providers.
 
  I was wondering if something like that is also existing for
  authentication? For example, in authentication you have quite a few
  different ones:
  - Mozilla Persona
  - openid
  - facebook connect
  - google (openid?)
  - use/pass based authentication (a.k.a. the self made version that
  every dev begins with)
  - oauth
  - twitter connect
  - etc...
 
  Is there such a library in existence? I'm especially looking for one
  with mozilla persona implemented.
 
  Kind regards,
  Mark
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
  --
  Badea Sorin (unu.sorin)
  sorin.bade...@gmail.com
  unu_so...@yahoo.com
  Pagina personala:
  http://badeasorin.com

 I couldn't find it on google thus i asked in the one place where - if
 it exists - people would probably know. I find it quite surprising
 that a library like this isn't in existence yet. I can imagine tons of
 sites would certainly benefit from having one generic interface to
 use.

 Anyway, thank you for your pointer and reply. If you (or anyone else)
 finds a lib for this, please don't hesitate to post it in here. :)

 --
 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] Is there a PHP based authentication library?

2013-04-02 Thread Bastien
Check out 
http://philsturgeon.co.uk/blog/2011/09/ninjauth-social-integration-php from 
Phil sturgeon. 

Bastien Koert

On 2013-04-02, at 3:41 PM, Mark mark...@gmail.com wrote:

 Hi Andy,
 
 To be honest, that's also not what i'm looking for, but might be a
 good starting point to extend on. Depends on how you made it :) I cant
 promise that i'ill be working on it. I might be for some future
 project in my company but it might very well not happen as well.
 
 On Tue, Apr 2, 2013 at 2:08 AM, Andy McKenzie amckenz...@gmail.com wrote:
 I started building one at my last job, though it was part of a framework I
 was developing.  I knew I was going to need to authenticate against both
 LDAP and old-fashioned database username/md5-password columns.  (Ah, legacy
 user databases.)
 
 If it would be useful, I could dig out what I had and try to make it into a
 stand-alone set of functions, but I never got further than those two
 options.  Basically there was a script that took in a username and password
 from a web form, then looked at a config file to decide which set of the
 sub-functions to use.  For a DB, it checked to see if the username and
 hashed password matched a row in the database;  for LDAP, it did some
 re-encoding to handle the weird encrypt that our OpenLDAP server used, then
 ran through the process of checking to see if the user actually had that as
 their password.
 
 Like I said, let me know if anyone wants to see it... I'm unemployed right
 now, and a project to work on this week (or next... this week is kind of
 busy) might be a good thing.
 
 -Andy McKenzie
 
 
 On Mon, Apr 1, 2013 at 6:49 PM, Mark mark...@gmail.com wrote:
 
 On Tue, Apr 2, 2013 at 12:27 AM, Sorin Badea sorin.bade...@gmail.com
 wrote:
 Hi Mark,
 I think a simple Google search would be faster. Anyway, an unified way
 for
 3rd party authentication doesn't exist from my knowledge, but for Persona
 you could use the sample from mozilla github account
 https://github.com/mozilla/browserid-cookbook .
 
 Good luck,
 Sorin!
 
 
 On Tue, Apr 2, 2013 at 12:26 AM, Mark mark...@gmail.com wrote:
 
 Hi,
 
 I stumbled upon this payment library: http://ci-merchant.org/ which
 abstracts the different payment backends away and exposes a new easy
 to use interface for the app developer to use. Thus making it very
 easy to use different payment providers.
 
 I was wondering if something like that is also existing for
 authentication? For example, in authentication you have quite a few
 different ones:
 - Mozilla Persona
 - openid
 - facebook connect
 - google (openid?)
 - use/pass based authentication (a.k.a. the self made version that
 every dev begins with)
 - oauth
 - twitter connect
 - etc...
 
 Is there such a library in existence? I'm especially looking for one
 with mozilla persona implemented.
 
 Kind regards,
 Mark
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 --
 Badea Sorin (unu.sorin)
 sorin.bade...@gmail.com
 unu_so...@yahoo.com
 Pagina personala:
 http://badeasorin.com
 
 I couldn't find it on google thus i asked in the one place where - if
 it exists - people would probably know. I find it quite surprising
 that a library like this isn't in existence yet. I can imagine tons of
 sites would certainly benefit from having one generic interface to
 use.
 
 Anyway, thank you for your pointer and reply. If you (or anyone else)
 finds a lib for this, please don't hesitate to post it in here. :)
 
 --
 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] Is there a PHP based authentication library?

2013-04-02 Thread Mark
Hi Bastien,

That is indeed getting very close to what i was looking for. Thanks a lot!

On Tue, Apr 2, 2013 at 9:46 PM, Bastien phps...@gmail.com wrote:
 Check out
 http://philsturgeon.co.uk/blog/2011/09/ninjauth-social-integration-php from
 Phil sturgeon.

 Bastien Koert

 On 2013-04-02, at 3:41 PM, Mark mark...@gmail.com wrote:

 Hi Andy,

 To be honest, that's also not what i'm looking for, but might be a
 good starting point to extend on. Depends on how you made it :) I cant
 promise that i'ill be working on it. I might be for some future
 project in my company but it might very well not happen as well.

 On Tue, Apr 2, 2013 at 2:08 AM, Andy McKenzie amckenz...@gmail.com wrote:

 I started building one at my last job, though it was part of a framework I

 was developing.  I knew I was going to need to authenticate against both

 LDAP and old-fashioned database username/md5-password columns.  (Ah, legacy

 user databases.)


 If it would be useful, I could dig out what I had and try to make it into a

 stand-alone set of functions, but I never got further than those two

 options.  Basically there was a script that took in a username and password

 from a web form, then looked at a config file to decide which set of the

 sub-functions to use.  For a DB, it checked to see if the username and

 hashed password matched a row in the database;  for LDAP, it did some

 re-encoding to handle the weird encrypt that our OpenLDAP server used, then

 ran through the process of checking to see if the user actually had that as

 their password.


 Like I said, let me know if anyone wants to see it... I'm unemployed right

 now, and a project to work on this week (or next... this week is kind of

 busy) might be a good thing.


 -Andy McKenzie



 On Mon, Apr 1, 2013 at 6:49 PM, Mark mark...@gmail.com wrote:


 On Tue, Apr 2, 2013 at 12:27 AM, Sorin Badea sorin.bade...@gmail.com

 wrote:

 Hi Mark,

 I think a simple Google search would be faster. Anyway, an unified way

 for

 3rd party authentication doesn't exist from my knowledge, but for Persona

 you could use the sample from mozilla github account

 https://github.com/mozilla/browserid-cookbook .


 Good luck,

 Sorin!



 On Tue, Apr 2, 2013 at 12:26 AM, Mark mark...@gmail.com wrote:


 Hi,


 I stumbled upon this payment library: http://ci-merchant.org/ which

 abstracts the different payment backends away and exposes a new easy

 to use interface for the app developer to use. Thus making it very

 easy to use different payment providers.


 I was wondering if something like that is also existing for

 authentication? For example, in authentication you have quite a few

 different ones:

 - Mozilla Persona

 - openid

 - facebook connect

 - google (openid?)

 - use/pass based authentication (a.k.a. the self made version that

 every dev begins with)

 - oauth

 - twitter connect

 - etc...


 Is there such a library in existence? I'm especially looking for one

 with mozilla persona implemented.


 Kind regards,

 Mark


 --

 PHP General Mailing List (http://www.php.net/)

 To unsubscribe, visit: http://www.php.net/unsub.php





 --

 Badea Sorin (unu.sorin)

 sorin.bade...@gmail.com

 unu_so...@yahoo.com

 Pagina personala:

 http://badeasorin.com


 I couldn't find it on google thus i asked in the one place where - if

 it exists - people would probably know. I find it quite surprising

 that a library like this isn't in existence yet. I can imagine tons of

 sites would certainly benefit from having one generic interface to

 use.


 Anyway, thank you for your pointer and reply. If you (or anyone else)

 finds a lib for this, please don't hesitate to post it in here. :)


 --

 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


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



Re: [PHP] Is there a PHP based authentication library?

2013-04-02 Thread Nathan Nobbe
On Tue, Apr 2, 2013 at 3:35 PM, Mark mark...@gmail.com wrote:

 Hi Bastien,

 That is indeed getting very close to what i was looking for. Thanks a lot!


I've just finished up a project using simpleSamlPhp.

http://simplesamlphp.org/

There's quite a few modules, but I've only used the SAML one, so YMMV.

-nathan

bash-3.2$ ls -1 modules/
InfoCard
adfs
aggregator
aggregator2
aselect
authX509
authYubiKey
authcrypt
authfacebook
authlinkedin
authmyspace
authorize
authtwitter
authwindowslive
autotest
cas
casserver
cdc
consent
consentAdmin
consentSimpleAdmin
core
cron
discopower
exampleattributeserver
exampleauth
expirycheck
ldap
logpeek
memcacheMonitor
metaedit
metarefresh
modinfo
multiauth
negotiate
oauth
openid
openidProvider
papi
portal
preprodwarning
radius
riak
saml
saml2debug
sanitycheck
smartnameattribute
sqlauth
statistics
themefeidernd