OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general Digest 31 May 2005 10:52:13 -0000 Issue 3485

php-general-digest-helplists.php.net
Date: Tue May 31 2005 - 05:52:13 CDT


php-general Digest 31 May 2005 10:52:13 -0000 Issue 3485

Topics (messages 216010 through 216034):

Re: Replacing 2 strings
        216010 by: Brian V Bonini
        216017 by: Murray . PlanetThoughtful

Re: Free penetration test
        216011 by: Ryan A

How to make a script sleep for 5 seconds?
        216012 by: Robert Cummings
        216016 by: Ryan A
        216018 by: Rory Browne
        216019 by: Peter Brodersen
        216020 by: disguised.jedi.gmail.com
        216021 by: Richard Lynch
        216023 by: Rory Browne
        216024 by: Robert Cummings

Re: Dummy question about knowing marked checkboxes
        216013 by: Mikey

Re: Retrieving client SSL info
        216014 by: Peter Brodersen

Re: Code Check
        216015 by: Mikey
        216022 by: Richard Lynch

Re: unable to exec shell commands
        216025 by: Richard Lynch

Re: Questionary Development
        216026 by: Richard Lynch
        216029 by: Rory Browne

Re: Copy sent mail in a mailbox folder
        216027 by: Richard Lynch

Re: Code Check fixed
        216028 by: janbro

php + cvs
        216030 by: Vlad Golodov
        216031 by: Burhan Khalid
        216033 by: Jochem Maas

Dynamically loading function arguments
        216032 by: RaTT
        216034 by: Jochem Maas

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


On Mon, 2005-05-30 at 16:24, W Luke wrote:
> On 30/05/05, Brian V Bonini <b-boninicox.net> wrote:
>
> [...]
>
> > > Again, an example that is as close to your real-world needs as possible
> > > would be very helpful.
> >
> > The original request was: "the text-to-replace is just in a var named
> > $text1".
> >
> > I read that to mean you'd already extracted "<^JIM_JONES>" into $text1
>
> Sorry - my mistake/fault. $text1 always begins with <^JIM_JONES> by
> is followed by various other stuff:
>
> <^JIM_JONES> Leicester, 1720. Oxford, 1800 CONFIRMED: meeting at 19.10
>
> And I'd like it to read, simply, JIM JONES: (I think having the name
> in Caps would be best for now) and leave the rest of the text
> unaltered:

<?php // this will produce Jim-Jones as in previous post

function replace($string, $search)
{
        $string = strstr($string, $search)
        $string = preg_replace("/(<|\^|>)/", "",$string);
        $string = str_replace("_", " ", $string);
        $string = ucwords(strtolower($string));
        $string = str_replace(" ", "-", $string);
        return $string;
                                                                                }

$text = 'My name is <^JIM_JONES> and I like ice cream';
$search_string = '<^JIM_JONES>';
echo replace($text, $search_string);

?>

<?php // this will produce JIM JONES

function replace($string, $search)
{
        $string = strstr($string, $search)
        $string = preg_replace("/(<|\^|>)/", "",$string);
        $string = str_replace("_", " ", $string);
        return $string;
                                                                                }

$text = 'My name is <^JIM_JONES> and I like ice cream';
$search_string = '<^JIM_JONES>';
echo replace($text, $search_string);

?>

--

s/:-[(/]/:-)/g

Brian GnuPG -> KeyID: 0x04A4F0DC | Key Server: pgp.mit.edu
======================================================================
gpg --keyserver pgp.mit.edu --recv-keys 04A4F0DC
Key Info: http://gfx-design.com/keys
Linux Registered User #339825 at http://counter.li.org

attached mail follows:


> <?php // this will produce JIM JONES
>
> function replace($string, $search)
> {
> $string = strstr($string, $search)
> $string = preg_replace("/(<|\^|>)/", "",$string);
> $string = str_replace("_", " ", $string);
> return $string;
>
> }
>
> $text = 'My name is <^JIM_JONES> and I like ice cream';
> $search_string = '<^JIM_JONES>';
> echo replace($text, $search_string);
>
> ?>

This is a pretty good solution, however for the sake of paranoia about
potentially removing characters that Will may not want targeted by the
function (i.e., what if "<", ">", "^" or "_" legitimately appear later in
the string and are accidentally removed?), I'd do something like the
following:

<?

function replace($string){
        preg_match("/^<\^([a-zA-Z]+?)_([a-zA-Z]+?)>/", $string, $matcharr);
        $string = str_replace($matcharr[0], $matcharr[1] . " " .$matcharr[2]
. ":", $string);
        return $string;

}
        
$string = "<^JIM_JONES> Leicester, 1720. Oxford, 1800 CONFIRMED: meeting at
19.10";
echo replace($string);

?>

One of the small benefits of this solution is that Will doesn't need to know
what is contained in the target substring beforehand.

Regards,

Murray

attached mail follows:


Hehe, well put...a few things you forgot to write:

Ryan A and Rory Browne got so irritated because its like talking to a
tree.....in english when the tree
only understands some other language :-D
that they tried to throw in the towel

I was so fed up I was going to drop the whole thing because certain well
wishers wrote
to me too telling me it was hopeless to try to reason or use logic with
him...and I pretty much
dropped it till he got the hairs at the back of my neck up by saying i like
saying things and running..
so am taking it offlist.

Consider this link:

http://www.somesite.com/section=servers&something=somethingelse&a=b&b=a&blah=jack&bill=gates&gates=evil&affilate=1145&more=gibberish&claudia=too_good_for_that_magician_guy

imagine someone gave you that kind of a link when you asked for
help.....pretty good but unless you really searched for it you would miss
the affiliate=1145 part...yes, its there..check it out...the affiliate could
be smaller too..something like aff=1045 but its lost in the other gibberish
of the url...

Decency would dictate that the person sending you the link tells you theres
an affiliate code there somewhere...
thats all I am saying....but I cant seem to get that message accross to
someone...so am pretty much throwing in the towel
after I have a few words offlist ;-)

But all in all, its been a pretty good few weeks on the list with no one
asking "which php editor is best" or
"how do you make a script sleep for x seconds" or "how do i do **** on the
clients machine?"

Peace all.

Cheers,
Ryan

On 5/31/2005 12:53:26 AM, Rory Browne (rory.brownegmail.com) wrote:
> Okay
>
> Let me summerise what has happened here.
>
> 1: The OP asked for a free penetration test.
>
> 2: Chris points out that his firm, which provides the suggested
> service, albeit not free, generally recommends a code audit instead.
>
> 3: Manuel Lemos, points out a site that provides a free sample test.
> The url includes a referer id, which Manuel
> doesn't see a need to
> mention.
>
> 4: Ryan A, points out that Manuel Lemos is "connected" to the site,
> and that his link contains a referer id. He suggests that such facts
> be explicitly disclosed.
>
> 5: Manuel Lemos, responds saying that it is irrelevent, that he gains
> income from his link to the site. He states that Chris Shifett is
> connected to the site that he mentions, and that the php group earn
> money from listing books on their website.
>
> 6: Ryan A, and Rory Browne(ie me) explain, that users generally like
> to know how to treat information they receive. They like to decide for
> themselves if the information may be biased. They also discredit
> Manuels statments regarding the php groups listing of amazon books.
>
> 7: Manuel repeats step 5, which results in Rory and Ryan repeating
> step 6. This happens numerous times. It becomes clear, that Manuel
will not listen to reason, and will instead repeat the same
discredited arguments. During this time, others point out that they
too would like to be informed of any potential bias, so that they can
decide for themselves if the information is actually biased.

8: Anonymous third parties, suggest via private email, that Manuel
cannot be reasoned with. I decide that I'd perfer to make such
assertions myself, without relying the judgement of others, and give
Manuel the benifit of the doubt. Manuel begins making wild
accusations, leading Ryan ane Rory to take the discussion off-list,
until such stage that a resolution is found.

Let me now summerise the above into an even shorter, and clearer message:

Grow up, and get a grip. We don't know you well enough to have some
wild conspiracy against you.

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.322 / Virus Database: 267.3.0 - Release Date: 5/30/2005

attached mail follows:


Sorry to hijack this thread but I was wondering how to make a script
sleep for 5 seconds?

Thanks most gratefully in advance from the bottom of my heart,
Rob.

--
Disclaimer: This has been a weak attempt at jest. Only 2 cute and fluffy
bunny rabbits were harmed during this endeavour.

On Mon, 2005-05-30 at 19:49, Ryan A wrote:
> Hehe, well put...a few things you forgot to write:
>
> Ryan A and Rory Browne got so irritated because its like talking to a
> tree.....in english when the tree
> only understands some other language :-D
> that they tried to throw in the towel
>
> I was so fed up I was going to drop the whole thing because certain well
> wishers wrote
> to me too telling me it was hopeless to try to reason or use logic with
> him...and I pretty much
> dropped it till he got the hairs at the back of my neck up by saying i like
> saying things and running..
> so am taking it offlist.
>
> Consider this link:
>
> http://www.somesite.com/section=servers&something=somethingelse&a=b&b=a&blah=jack&bill=gates&gates=evil&affilate=1145&more=gibberish&claudia=too_good_for_that_magician_guy
>
> imagine someone gave you that kind of a link when you asked for
> help.....pretty good but unless you really searched for it you would miss
> the affiliate=1145 part...yes, its there..check it out...the affiliate could
> be smaller too..something like aff=1045 but its lost in the other gibberish
> of the url...
>
> Decency would dictate that the person sending you the link tells you theres
> an affiliate code there somewhere...
> thats all I am saying....but I cant seem to get that message accross to
> someone...so am pretty much throwing in the towel
> after I have a few words offlist ;-)
>
> But all in all, its been a pretty good few weeks on the list with no one
> asking "which php editor is best" or
> "how do you make a script sleep for x seconds" or "how do i do **** on the
> clients machine?"
>
> Peace all.
>
> Cheers,
> Ryan
>
> On 5/31/2005 12:53:26 AM, Rory Browne (rory.brownegmail.com) wrote:
> > Okay
> >
> > Let me summerise what has happened here.
> >
> > 1: The OP asked for a free penetration test.
> >
> > 2: Chris points out that his firm, which provides the suggested
> > service, albeit not free, generally recommends a code audit instead.
> >
> > 3: Manuel Lemos, points out a site that provides a free sample test.
> > The url includes a referer id, which Manuel
> > doesn't see a need to
> > mention.
> >
> > 4: Ryan A, points out that Manuel Lemos is "connected" to the site,
> > and that his link contains a referer id. He suggests that such facts
> > be explicitly disclosed.
> >
> > 5: Manuel Lemos, responds saying that it is irrelevent, that he gains
> > income from his link to the site. He states that Chris Shifett is
> > connected to the site that he mentions, and that the php group earn
> > money from listing books on their website.
> >
> > 6: Ryan A, and Rory Browne(ie me) explain, that users generally like
> > to know how to treat information they receive. They like to decide for
> > themselves if the information may be biased. They also discredit
> > Manuels statments regarding the php groups listing of amazon books.
> >
> > 7: Manuel repeats step 5, which results in Rory and Ryan repeating
> > step 6. This happens numerous times. It becomes clear, that Manuel
> will not listen to reason, and will instead repeat the same
> discredited arguments. During this time, others point out that they
> too would like to be informed of any potential bias, so that they can
> decide for themselves if the information is actually biased.
>
> 8: Anonymous third parties, suggest via private email, that Manuel
> cannot be reasoned with. I decide that I'd perfer to make such
> assertions myself, without relying the judgement of others, and give
> Manuel the benifit of the doubt. Manuel begins making wild
> accusations, leading Ryan ane Rory to take the discussion off-list,
> until such stage that a resolution is found.
>
> Let me now summerise the above into an even shorter, and clearer message:
>
> Grow up, and get a grip. We don't know you well enough to have some
> wild conspiracy against you.
>
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.322 / Virus Database: 267.3.0 - Release Date: 5/30/2005
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


> Disclaimer: This has been a weak attempt at jest. Only 2 cute and fluffy
> bunny rabbits were harmed during this endeavour.

I sure hope one of them was Bugs....the SOB gets away with murder!
J/k

Cheers,
Ryan

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.322 / Virus Database: 267.3.0 - Release Date: 5/30/2005

attached mail follows:


for($i = time(); time() < $i + 5; ){
echo "you could use sleep(), but hey";
}

On 5/31/05, Robert Cummings <robertinterjinn.com> wrote:
> Sorry to hijack this thread but I was wondering how to make a script
> sleep for 5 seconds?
>
> Thanks most gratefully in advance from the bottom of my heart,
> Rob.
>
> --
> Disclaimer: This has been a weak attempt at jest. Only 2 cute and fluffy
> bunny rabbits were harmed during this endeavour.
>
>
> On Mon, 2005-05-30 at 19:49, Ryan A wrote:
> > Hehe, well put...a few things you forgot to write:
> >
> > Ryan A and Rory Browne got so irritated because its like talking to a
> > tree.....in english when the tree
> > only understands some other language :-D
> > that they tried to throw in the towel
> >
> > I was so fed up I was going to drop the whole thing because certain well
> > wishers wrote
> > to me too telling me it was hopeless to try to reason or use logic with
> > him...and I pretty much
> > dropped it till he got the hairs at the back of my neck up by saying i like
> > saying things and running..
> > so am taking it offlist.
> >
> > Consider this link:
> >
> > http://www.somesite.com/section=servers&something=somethingelse&a=b&b=a&blah=jack&bill=gates&gates=evil&affilate=1145&more=gibberish&claudia=too_good_for_that_magician_guy
> >
> > imagine someone gave you that kind of a link when you asked for
> > help.....pretty good but unless you really searched for it you would miss
> > the affiliate=1145 part...yes, its there..check it out...the affiliate could
> > be smaller too..something like aff=1045 but its lost in the other gibberish
> > of the url...
> >
> > Decency would dictate that the person sending you the link tells you theres
> > an affiliate code there somewhere...
> > thats all I am saying....but I cant seem to get that message accross to
> > someone...so am pretty much throwing in the towel
> > after I have a few words offlist ;-)
> >
> > But all in all, its been a pretty good few weeks on the list with no one
> > asking "which php editor is best" or
> > "how do you make a script sleep for x seconds" or "how do i do **** on the
> > clients machine?"
> >
> > Peace all.
> >
> > Cheers,
> > Ryan
> >
> > On 5/31/2005 12:53:26 AM, Rory Browne (rory.brownegmail.com) wrote:
> > > Okay
> > >
> > > Let me summerise what has happened here.
> > >
> > > 1: The OP asked for a free penetration test.
> > >
> > > 2: Chris points out that his firm, which provides the suggested
> > > service, albeit not free, generally recommends a code audit instead.
> > >
> > > 3: Manuel Lemos, points out a site that provides a free sample test.
> > > The url includes a referer id, which Manuel
> > > doesn't see a need to
> > > mention.
> > >
> > > 4: Ryan A, points out that Manuel Lemos is "connected" to the site,
> > > and that his link contains a referer id. He suggests that such facts
> > > be explicitly disclosed.
> > >
> > > 5: Manuel Lemos, responds saying that it is irrelevent, that he gains
> > > income from his link to the site. He states that Chris Shifett is
> > > connected to the site that he mentions, and that the php group earn
> > > money from listing books on their website.
> > >
> > > 6: Ryan A, and Rory Browne(ie me) explain, that users generally like
> > > to know how to treat information they receive. They like to decide for
> > > themselves if the information may be biased. They also discredit
> > > Manuels statments regarding the php groups listing of amazon books.
> > >
> > > 7: Manuel repeats step 5, which results in Rory and Ryan repeating
> > > step 6. This happens numerous times. It becomes clear, that Manuel
> > will not listen to reason, and will instead repeat the same
> > discredited arguments. During this time, others point out that they
> > too would like to be informed of any potential bias, so that they can
> > decide for themselves if the information is actually biased.
> >
> > 8: Anonymous third parties, suggest via private email, that Manuel
> > cannot be reasoned with. I decide that I'd perfer to make such
> > assertions myself, without relying the judgement of others, and give
> > Manuel the benifit of the doubt. Manuel begins making wild
> > accusations, leading Ryan ane Rory to take the discussion off-list,
> > until such stage that a resolution is found.
> >
> > Let me now summerise the above into an even shorter, and clearer message:
> >
> > Grow up, and get a grip. We don't know you well enough to have some
> > wild conspiracy against you.
> >
> >
> >
> > --
> > No virus found in this outgoing message.
> > Checked by AVG Anti-Virus.
> > Version: 7.0.322 / Virus Database: 267.3.0 - Release Date: 5/30/2005
> --
> .------------------------------------------------------------.
> | InterJinn Application Framework - http://www.interjinn.com |
> :------------------------------------------------------------:
> | An application and templating framework for PHP. Boasting |
> | a powerful, scalable system for accessing system services |
> | such as forms, properties, sessions, and caches. InterJinn |
> | also provides an extremely flexible architecture for |
> | creating re-usable components quickly and easily. |
> `------------------------------------------------------------'
>
>

attached mail follows:


On Mon, 30 May 2005 21:08:29 -0400, in php.general
robertinterjinn.com (Robert Cummings) wrote:

>Sorry to hijack this thread but I was wondering how to make a script
>sleep for 5 seconds?

Easy:
<?php
for($i=0;$i<5;$i++) sleep(1);
?>

Or better:
<?php
$endtime = time()+5;
while (time() != $endtime);
?>

Or even better:
<?php
$endtime = time()+5;
while (`date +%s` != $endtime);
?>

We have busy wait, we have risk of indefinite loops. The next step
should be (more) imprecision. Maybe read /proc/cpuinfo and perform n
steps of simple loop where n is calculated from the cpu type, mhz and
current load. Maybe a PEAR project?

--
- Peter Brodersen

attached mail follows:


On 5/30/05, Robert Cummings <robertinterjinn.com> wrote:
> Sorry to hijack this thread but I was wondering how to make a script
> sleep for 5 seconds?
>
> Thanks most gratefully in advance from the bottom of my heart,
> Rob.
>
> --
> Disclaimer: This has been a weak attempt at jest. Only 2 cute and fluffy
> bunny rabbits were harmed during this endeavour.
RTFM - http://www.php.net/sleep

Try this: sleep(5);

It's amazing how useful the manual can be . . .

--
PHP rocks!
"Knowledge is Power. Power Corrupts. Go to school, become evil"

Disclaimer: Any disclaimer attached to this message may be ignored.
However, I must say that the ENTIRE contents of this message are
subject to other's criticism, corrections, and speculations.

This message is Certified Virus Free

--
PHP rocks!
"Knowledge is Power. Power Corrupts. Go to school, become evil"

Disclaimer: Any disclaimer attached to this message may be ignored.
However, I must say that the ENTIRE contents of this message are
subject to other's criticism, corrections, and speculations.

This message is Certified Virus Free

attached mail follows:


On Mon, May 30, 2005 7:17 pm, Peter Brodersen said:
> On Mon, 30 May 2005 21:08:29 -0400, in php.general
> robertinterjinn.com (Robert Cummings) wrote:
>
>>Sorry to hijack this thread but I was wondering how to make a script
>>sleep for 5 seconds?

sleep(5);

> Easy:
> <?php
> for($i=0;$i<5;$i++) sleep(1);
> ?>
>
> Or better:
> <?php
> $endtime = time()+5;
> while (time() != $endtime);
> ?>

This runs the risk of somebody adding some code in there that takes longer
than a second to run, and then suddenly it's in an infinite loop because
the $endtime is never EQUAL to time()

Safe to say while (time() <= $endtime)

> Or even better:
> <?php
> $endtime = time()+5;
> while (`date +%s` != $endtime);

Gak!

Why would you shell out to do this?

> ?>
>
> We have busy wait, we have risk of indefinite loops. The next step
> should be (more) imprecision. Maybe read /proc/cpuinfo and perform n
> steps of simple loop where n is calculated from the cpu type, mhz and
> current load. Maybe a PEAR project?
>
> --
> - Peter Brodersen
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


On 5/31/05, Richard Lynch <ceol-i-e.com> wrote:
> On Mon, May 30, 2005 7:17 pm, Peter Brodersen said:
> > On Mon, 30 May 2005 21:08:29 -0400, in php.general
> > robertinterjinn.com (Robert Cummings) wrote:
> >
> >>Sorry to hijack this thread but I was wondering how to make a script
> >>sleep for 5 seconds?
>
> sleep(5);
>
> > Easy:
> > <?php
> > for($i=0;$i<5;$i++) sleep(1);
> > ?>
> >
> > Or better:
> > <?php
> > $endtime = time()+5;
> > while (time() != $endtime);
> > ?>
>
> This runs the risk of somebody adding some code in there that takes longer
> than a second to run, and then suddenly it's in an infinite loop because
> the $endtime is never EQUAL to time()
>
> Safe to say while (time() <= $endtime)
>
> > Or even better:
> > <?php
> > $endtime = time()+5;
> > while (`date +%s` != $endtime);
>
> Gak!
>
> Why would you shell out to do this?

Because you can :)

>
> > ?>
> >
> > We have busy wait, we have risk of indefinite loops. The next step
> > should be (more) imprecision. Maybe read /proc/cpuinfo and perform n
> > steps of simple loop where n is calculated from the cpu type, mhz and
> > current load. Maybe a PEAR project?
> >
> > --
> > - Peter Brodersen
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> --
> Like Music?
> http://l-i-e.com/artists.htm
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


On Mon, 2005-05-30 at 23:17, Richard Lynch wrote:
> On Mon, May 30, 2005 7:17 pm, Peter Brodersen said:
> > On Mon, 30 May 2005 21:08:29 -0400, in php.general
> > robertinterjinn.com (Robert Cummings) wrote:
> >
> >>Sorry to hijack this thread but I was wondering how to make a script
> >>sleep for 5 seconds?
>
> sleep(5);
>
> > Easy:
> > <?php
> > for($i=0;$i<5;$i++) sleep(1);
> > ?>
> >
> > Or better:
> > <?php
> > $endtime = time()+5;
> > while (time() != $endtime);
> > ?>
>
> This runs the risk of somebody adding some code in there that takes longer
> than a second to run, and then suddenly it's in an infinite loop because
> the $endtime is never EQUAL to time()
>
> Safe to say while (time() <= $endtime)
>
> > Or even better:
> > <?php
> > $endtime = time()+5;
> > while (`date +%s` != $endtime);
>
> Gak!
>
> Why would you shell out to do this?

Mr. Lynch, either intentionally or inadvertently, you have succeeded in
making me spray water out my nose as I happened to be drinking a glass
of it when I read your reply :B

> > We have busy wait, we have risk of indefinite loops. The next step
> > should be (more) imprecision. Maybe read /proc/cpuinfo and perform n
> > steps of simple loop where n is calculated from the cpu type, mhz and
> > current load. Maybe a PEAR project?

Definitely a PEAR candidate, but we should ensure it requires the
compatibility suite.

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


infoglobalissa.com wrote:

>The name property currrently set as the value of name='interesses' ... should be different for each different checkbox. Then you test for the value of 'on' or 'off'. If the checkbox is checked then the default value will be 'on'.
>
>In your code you have set values but those are not strictly necessary because if no value is declared then 'on' or 'off' are used. Perhaps you may consider using the values Alojamento, Artesanato and Eventos for the names instead like this?
>
>Example:
>Alojamento <input name='alojamento' type='checkbox'>
>Artesanato <input name='artesanato' type='checkbox'>
>Eventos <input name='eventos' type='checkbox'>
>
>Here's a basic checkbox article which may help:
>
>http://www.globalissa.com/articles/articleCheckbox.php
>
>Rob
>http://www.globalissa.com
>
>===
>with reference to:
>snip
>My dummy question, for which i apologise once more is: after submitting the form, how can i know which chekboxes were checked ?
>
>Thanking you in advance.
>
>Warm Regards,
>Mário Gamito
>
>
>
<input name="foo" value="bar" type="checkbox"> Bar

Would result in $_REQUEST['foo'] being a) set and b) hold the value of
"bar".

regards,

Mikey

attached mail follows:


On Thu, 26 May 2005 21:32:27 +0200, in php.general phpter.dk (Peter
Brodersen) wrote:

>A phpinfo() only shows that $_SERVER['HTTPS'] has been set to "on".
>The mod_ssl-refrence shows though that a lot of other environment
>variables should be present:
>http://www.modssl.org/docs/2.1/ssl_reference.html#ToC23
>.. but I can't seem to retrieve this information anywhere.

I reached the following solution:

I never got access to any SSL_*-variables under $_SERVER (not even the
server variables or using another language - or server, php version
and OS), but a workaround for Apache and mod_ssl is to add
        SSLOptions +ExportCertData
to httpd.conf (or .htaccess)

The certificate presented by the client would then be stored in
$_SERVER['SSL_CLIENT_CERT'] (the only SSL_*-variable available,
besides SSL_SERVER_CERT). The data could then be retrieved using
openssl_x509_parse(), e.g.:

<?php
$cert = openssl_x509_parse($_SERVER['SSL_CLIENT_CERT']);
print $cert['subject']['CN'];
?>

I would still like to know why the SSL-variables aren't available, but
I don't think this is a PHP issue.

Just wanted to post my solution for the sake of mail archives :-)

--
- Peter Brodersen

attached mail follows:


janbro wrote:

>Hi List, I don't know where else to look. I've got PHP 5.0.0 and MySQL
>4.1.3. (on Windwows XP with Apache 2.0.50)
>
>Here is my Code: the Query with the delete is not executed and I don't
>know why. If I copy it into the MySQL Command line like it is here,
>everything works fine. I have another example with a more simple delete
>which works (same syntax)
>
>If I replace the delete with the insert statement it works.
>
>What 'am I doing wrong here?
>
>
>
>
>
>>public function DeleteOldFails (){
>> $conClas=$this->con();
>> $con=$conClas->mysqlConnect ();
>>
>> $query = "DELETE FROM LoginTracker WHERE (UNIX_TIMESTAMP(CURRENT_TIMESTAMP) - UNIX_TIMESTAMP(DateAttack)) > 3600;";
>>// $query ="INSERT INTO LoginTracker (IPAttack, User) VALUES ('127.0.0.1','user')";
>> echo "$con<br>Diesen Auf ERFOLG TESTEN! LÖSCHT ER WAS ER SOLL? <br>$query<br>";
>> print $con->query($query);
>> $con->query("OPTIMIZE TABLE LoginTracker ");
>>
>> $this->discon ($conClas, $con);
>> }
>>
>>
>
>thx
>janbro
>
>
>
Have you checked that the two previous function calls are returning as
expected?

HTH,

Mikey

attached mail follows:


What you are doing wrong is ignoring the error messages MySQL is storing
for you...

On Mon, May 30, 2005 12:37 pm, janbro said:
> Hi List, I don't know where else to look. I've got PHP 5.0.0 and MySQL
> 4.1.3. (on Windwows XP with Apache 2.0.50)
>
> Here is my Code: the Query with the delete is not executed and I don't
> know why. If I copy it into the MySQL Command line like it is here,
> everything works fine. I have another example with a more simple delete
> which works (same syntax)
>
> If I replace the delete with the insert statement it works.
>
> What 'am I doing wrong here?
>
>
>
>> public function DeleteOldFails (){
>> $conClas=$this->con();
>> $con=$conClas->mysqlConnect ();
>>
>> $query = "DELETE FROM LoginTracker WHERE
>> (UNIX_TIMESTAMP(CURRENT_TIMESTAMP) - UNIX_TIMESTAMP(DateAttack)) >
>> 3600;";
>> // $query ="INSERT INTO LoginTracker (IPAttack, User) VALUES
>> ('127.0.0.1','user')";
>> echo "$con<br>Diesen Auf ERFOLG TESTEN! LÖSCHT ER WAS ER SOLL?
>> <br>$query<br>";
>> print $con->query($query);

echo mysql_error();

>> $con->query("OPTIMIZE TABLE LoginTracker ");
>>
>> $this->discon ($conClas, $con);
>> }
>
> thx
> janbro
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


You should always use a full path to commands and file names in exec,
because you never know what $PATH shell value will be...

You may also be working under some kind of secure enviroment such as a
chroot shell thingie (about which I know almost nothing) or SE Linux (in
which case there should be some kinda file in /etc/ that has a name kinda
like 'selinux' that tells you what's going on) or...

Honestly, though, I'd suggest you make a concerted effort (sooner or
later) to change your scripts to use full paths, even if you get it to
work without them this time around.

On Sat, May 28, 2005 12:42 pm, Andy Pieters said:
> Hi all
>
> I have several scripts that stoped working. All those scripts have in
> common
> that they call shell commands.
>
> To find out what was going on, I did a little test
> cat << "?>" | php
> <?php
> echo "exec test\n";
> exec("dir",$output,$errs);
> ?>
> exec test
> sh: /usr/local/php/bin/dir: No such file or directory
>
> As you can see it is trying to call sh with a weird path. It should
> use /usr/bin/dir instead
>
> Also when I try it with 'type' (which is an internal command) it has the
> same
> result.
>
> I recently switched from FC3 to FC4 for my development. The PHP binary
> I'm
> using was compiled from sources with the following charasteristics:
>
>
> PHP Version => 4.3.10
>
> Configure Command => './configure' '--prefix=/usr/local/bin'
> '--bindir=/usr/bin' '--with-mysql' '--with-config-file-path=/etc'
> '--enable-mbstring' '--enable-mbregex' '--with-gd'
> '--enable-gd-native-ttf'
> '--with-ttf-dir=/usr/bin' '--with-freetype-dir=/usr/lib'
> '--with-png-dir=/usr/lib' '--with-xpm-dir=/usr/X11R6' '--enable-ftp'
> '--enable-memory-limit' '--enable-safe-mode' '--enable-bcmath'
> '--enable-calendar' '--enable-ctype' '--enable-inline-optimization'
> '--with-bz2' '--with-iconv' '--with-zlib-dir=/usr/lib' '--disable-cgi'
> '--with-cli'
> Server API => Command Line Interface
>
> Any ideas?
>
>
> With kind regards
>
>
> Andy
>
> --
> Registered Linux User Number 379093
> -- --BEGIN GEEK CODE BLOCK-----
> Version: 3.1
> GAT/O/>E$ d-(---)>+ s:(+)>: a--(-)>? C++++$(+++) UL++++>++++$ P-(+)>++
> L+++>++++$ E---(-) W+++>+++$ !N o? !K? W--(---) !O !M- V-- PS++(+++)
> PE--(-) Y+ PGP++(+++) t+(++) 5-- X++ R*(+) !tv b-() DI(+) D+(+++) G(+)
> e>++++$ h++(*) r-->++ y--()>++++
> -- ---END GEEK CODE BLOCK------
> --
> Check out these few php utilities that I released
> under the GPL2 and that are meant for use with a
> php cli binary:
>
> http://www.vlaamse-kern.com/sas/
> --
>
> --
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


On Sat, May 28, 2005 10:08 am, ...helmut said:
> I have a form that contains 100 questions. To make it easier on the user,
> I
> will divide it into 5 sections (20 questions per section), then all the
> information will be written to a db. What is the best way to carry along
> through the pages the information that has already been submitted?
> Cookies?
> Writing to a DB after each section? Session Variables?

I would recommend using the DB first.

If you can't/won't do that, use sessions.

I would NOT recommend carrying all the variables along as INPUT
TYPE="HIDDEN" -- While that would "work" it makes it much harder to allow,
say, a user who got disconnected to complete the form later, or a user
whose session timed out because their boss walked in, or...

If you've stored their info in sessions, you will still lose it if their
session times out.

If it's in the DB, then they can complete the form whenever they have time.

100 questions is a lot of questions...

You might even allow them to answer different sections in different
orders, if there is a nice way to present them with some kind of grouping
that's less arbitrary than 1-20, 21-40, ...

'Course, if this is a timed test/exam or something, some of the above is
moot... But a student trying to take an exam that gets disconnected?
Better to log their session start/end in the DB and only "count" time
against them if it is contiguous, if you can.

> I read that writing to a database as i go along could be too much of a
> hazzle for the db, specially if I have multiple people filling out the
> form
> at the same time.

You're not gonna slam the database unless you have *LOTS* of people
filling out the form at the same time.

How many is *LOTS* depends on hardware, and you should test this with YOUR
hardware/network, but I suspect you are worrying over a non-issue on this.

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


On 5/31/05, Richard Lynch <ceol-i-e.com> wrote:
> On Sat, May 28, 2005 10:08 am, ...helmut said:
> > I have a form that contains 100 questions. To make it easier on the user,
> > I
> > will divide it into 5 sections (20 questions per section), then all the
> > information will be written to a db. What is the best way to carry along
> > through the pages the information that has already been submitted?
> > Cookies?
> > Writing to a DB after each section? Session Variables?
>
> I would recommend using the DB first.
>
> If you can't/won't do that, use sessions.
>
> I would NOT recommend carrying all the variables along as INPUT
> TYPE="HIDDEN" -- While that would "work" it makes it much harder to allow,
> say, a user who got disconnected to complete the form later, or a user
> whose session timed out because their boss walked in, or...
When I suggested hidden input fields, I was working on the assumption,
that the person wouldn't be filling out half of the form, and then
coming back later to fill in the rest of the form.

Assuming it would be nice to cross-reference answers with other
answers from the same answerer, putting them in the DB initially will
not solve your problem. Unless you use sessions, then you know that
somebody answered questions 1 - 20, and you know that someone answered
21 - 40. You don't know that the answerers to the two sections are
from the same person, unless you use sessions as well, which negates
your next point.

>
> If you've stored their info in sessions, you will still lose it if their
> session times out.
>
> If it's in the DB, then they can complete the form whenever they have time.
>
> 100 questions is a lot of questions...
>
> You might even allow them to answer different sections in different
> orders, if there is a nice way to present them with some kind of grouping
> that's less arbitrary than 1-20, 21-40, ...
>
> 'Course, if this is a timed test/exam or something, some of the above is
> moot... But a student trying to take an exam that gets disconnected?
> Better to log their session start/end in the DB and only "count" time
> against them if it is contiguous, if you can.
>
> > I read that writing to a database as i go along could be too much of a
> > hazzle for the db, specially if I have multiple people filling out the
> > form
> > at the same time.
>
> You're not gonna slam the database unless you have *LOTS* of people
> filling out the form at the same time.
>
> How many is *LOTS* depends on hardware, and you should test this with YOUR
> hardware/network, but I suspect you are worrying over a non-issue on this.
>
> --
> Like Music?
> http://l-i-e.com/artists.htm
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


On Sat, May 28, 2005 2:58 am, Reto said:
> Hi list,
>
> I'm sending mails with PEAR::Mail / PEAR::Mail_Mime or with PHPMailer
> (http://phpmailer.sf.net). The final solution will implemented depending
> on which implementation better fits my needs.
>
> Anyway, and that is the problem, after sending the mail I want to save a
> copy of the mail in an IMAP folder called "Sent".
>
> I would be pleased if someone could send me a hint or a link how to
> achive this. Either with PEAR or with PHPMailer generated mails.
>
> My first thought was to walk through the mail object and extracting all
> necessary attributes and generating a new message and save this to the
> mailfolder...

If all else fails, you could send it to your From: address with an extra
header like:
X-File-In-Sent: File-In-Sent-Folder

and then put a filter in your email client to filter all the stuff on that
header into "Sent"

Crude, but effective :-)

--

Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


Ok, thx, I've got it done. Dumb mistake, the user didn't have rights to
delete, it's as simple as that. My trials thru the command line where as
root....
thx guys
janbro

Richard Lynch schrieb:
> What you are doing wrong is ignoring the error messages MySQL is storing
> for you...
>
>
> On Mon, May 30, 2005 12:37 pm, janbro said:
>
>>Hi List, I don't know where else to look. I've got PHP 5.0.0 and MySQL
>>4.1.3. (on Windwows XP with Apache 2.0.50)
>>
>>Here is my Code: the Query with the delete is not executed and I don't
>>know why. If I copy it into the MySQL Command line like it is here,
>>everything works fine. I have another example with a more simple delete
>>which works (same syntax)
>>
>>If I replace the delete with the insert statement it works.
>>
>>What 'am I doing wrong here?
>>
>>
>>
>>
>>>public function DeleteOldFails (){
>>> $conClas=$this->con();
>>> $con=$conClas->mysqlConnect ();
>>>
>>> $query = "DELETE FROM LoginTracker WHERE
>>>(UNIX_TIMESTAMP(CURRENT_TIMESTAMP) - UNIX_TIMESTAMP(DateAttack)) >
>>>3600;";
>>>// $query ="INSERT INTO LoginTracker (IPAttack, User) VALUES
>>>('127.0.0.1','user')";
>>> echo "$con<br>Diesen Auf ERFOLG TESTEN! LÖSCHT ER WAS ER SOLL?
>>><br>$query<br>";
>>> print $con->query($query);
>
>
> echo mysql_error();
>
>
>>> $con->query("OPTIMIZE TABLE LoginTracker ");
>>>
>>> $this->discon ($conClas, $con);
>>> }
>>
>>thx
>>janbro
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
>

attached mail follows:


Hi All!

are here any people who have tried to develop php application using CVS?
What programms have you used for it? CVS should be located on the internet.

Thanks in advance,

Vlad

attached mail follows:


Vlad Golodov wrote:
> Hi All!
>
> are here any people who have tried to develop php application using CVS?
> What programms have you used for it? CVS should be located on the internet.

I have used CVS before (since its available in Zend Studio) and have had
to do a bit of reconfiguring of Zend (because I refuse to connect using
pserver, and the CVS-over-SSH instructions at Zend didn't work for me).

You can get other CVS clients installed and use them for
checkin/checkout and then edit the files in your favorite editor (if it
is not cvs-enabled).

Some of the good ones are TortoiseCVS and WinCVS.

attached mail follows:


Vlad Golodov wrote:
> Hi All!
>
> are here any people who have tried to develop php application using CVS?

yes, everyday :-)
bare in mind that CVS actually creates a bit more work for you (especially in the
beginning when you are still on the fairly steep CVS learning curve) but that
you gain in oversight and ability to step back etc etc.

Also I hear lots of good things about subversion (SVN), which is a
newer alternative for version control - some even say its better.

> What programms have you used for it? CVS should be located on the internet.

when on Windows I use TortoiseCVS as my CVS client. your CVS server should be
setup somewhere you are reach it (I have mine setup so that I can SSH or VPN
to the network the CVS box is on) - alternatively if you are developing on your
own its quite feasable to run the CVS server/repository on your local box
(and move it later if you want to share).

the biggest problem is being able to check out a _working_ copy of your site.
that requires some preparation - often you have 2 or 3 places you need to run
a copy of a site (local/test, staging, live). each copy of the site may have
slightly different include paths, different DB connections, etc.
in order to accomodate the differences I usually keep 'box' specific configuration
stuff in barebones 1 file that does not exist in CVS (usually called global.php)
and/or make use of a .htaccess file that also does not exist inside CVS.

if you are deploying your sites/apps to remote servers (think linux/*nix) then you
had better get familiar with a few of the basic cmdlines for working with CVS, once
you have a checkout setup (for instance for staging or demoing) with the correct
CVSROOT (etc) its quite simple to update the 'demo' server with the following cmd
(typed while you are in the appropriate dir):

> cvs up

Don't forget that if you are developing in a different place to where the live site
will run then you will probably have to keep DB schemas in sync as well - you will
have to think about keeping a DB updater script in CVS to allow you to update the
demo/live copies of the DB. Personally I'm a FirebirdDB fan - and I use IBExpert to
sync the different copies of a DB that may exist for a given project.

well there you have a little insight into my world, hope you succeed with version
control too!

rgds,
Jochem

>
> Thanks in advance,
>
> Vlad
>

attached mail follows:


Hi

Currently we are building a basic content management system where we
would like to be able to write as libral customized tags as possible,

for example [[select:array_name,title]] or [[form:name]] in the
format of [[<function>:<arguments>]]

The problem that we are experiencing are that the arguments are being
parsed as a single string, does anybody know of what function / method
i can use to get around this? My default option is to write the
functions to split the single supplied argument into their respective
arguments, but i am sure there is a easier way around?

I have tried splitting them up, and rejoining them with a "," but i
think i am just redoing what php does internally.

Here is my current code,
<?php

// function = select, array = _title_, name= select_title

$str = "{{select:_title_,select_title}}";

parse($str);

function parse($str){
            $reg_ex = '/\{\{([a-zA-Z0-9\-_]+):(.*)\}\}/'; //
{{function_name:paramaters,seperate,by,comma}}
            preg_match_all($reg_ex,$str,$matches,PREG_SET_ORDER);
            // $matches[0] = whole function
            // $matches[1] = function
            // $matches[2] = content / params
            
           echo $match_count = count($matches);
                for ($i=0;$i<$match_count;$i++){
                    $output = null;
                    if(function_exists($matches[$i][1])){
                        //function has been declared
                        // TO-DO: add safe mode function array to specify allowed functions
                                                #echo " DEBUG: {$matches[$i][1]} ( {$matches[$i][2]} ) <br
/>\n";
                                $args = explode(",",$matches[$i][2]);
                                $cnt = count($args);
                                $params = null;
                                for($j=0; $j < $cnt; $j++){
                                        #$params .= "\$args[$j]";
                                        $params .= $args[$j];
                                        $params .= ($j != ($cnt-1))? ",": "";
                                }// end for
                                //eval("echo $params;");
                                //$output =
$matches[$i][1](implode(",",$args));//single str
                                $output = $matches[$i][1]($params);
                               $str = eregi_replace($matches[$i][0],$output,$str);
                         } //end if
                   else {
                                // function not found or allowed remove tags
                                //echo "DEBUG: function not found<br />\n";
                                  $str = eregi_replace($matches[$i][0],'',$str);
                   }// end else
                }//end for
          return $str;
  }
  
  function select($array='',$name='',$extra=''){
                  echo '<pre>';
                  print_r(func_get_args());
                echo '</pre>';
  }
?>

Kind regards
Jarratt

attached mail follows:


RaTT wrote:
> Hi
>
> Currently we are building a basic content management system where we
> would like to be able to write as libral customized tags as possible,
>
> for example [[select:array_name,title]] or [[form:name]] in the
> format of [[<function>:<arguments>]]
>
> The problem that we are experiencing are that the arguments are being
> parsed as a single string, does anybody know of what function / method
> i can use to get around this? My default option is to write the
> functions to split the single supplied argument into their respective
> arguments, but i am sure there is a easier way around?
>
> I have tried splitting them up, and rejoining them with a "," but i
> think i am just redoing what php does internally.

some funcs that might help you:

compact()
extract()
call_user_func()
call_user_func_array()

also I recommend doing everything you can not to have to use
an eval() statement anywhere with this code as that would be comparatively
slow and you have to start worrying about possible security issues...

lastly my personal preference is towards the preg_*() funcs
rather than the eregi_*() funcs. regardless you should minimize the use
of regular expressions if you can... use explode(), strstr() and the like
where ever possible.

if you find a neat way of making use of call_user_func_array() then I think
you can cut the step where you rebuild the params string with commas.

also you might want to check out the way the Smarty guys implemented their
plugin/tag functionality - you may not like their style or implementation
but no doubt there is some overlap in what you are trying to do and what
they have done - so it may give you some ideas.

good luck.

>
> Here is my current code,
> <?php
>
> // function = select, array = _title_, name= select_title
>
> $str = "{{select:_title_,select_title}}";
>
> parse($str);
>
> function parse($str){
> $reg_ex = '/\{\{([a-zA-Z0-9\-_]+):(.*)\}\}/'; //
> {{function_name:paramaters,seperate,by,comma}}
> preg_match_all($reg_ex,$str,$matches,PREG_SET_ORDER);
> // $matches[0] = whole function
> // $matches[1] = function
> // $matches[2] = content / params
>
> echo $match_count = count($matches);
> for ($i=0;$i<$match_count;$i++){
> $output = null;
> if(function_exists($matches[$i][1])){
> //function has been declared
> // TO-DO: add safe mode function array to specify allowed functions
> #echo " DEBUG: {$matches[$i][1]} ( {$matches[$i][2]} ) <br
> />\n";
> $args = explode(",",$matches[$i][2]);
> $cnt = count($args);
> $params = null;
> for($j=0; $j < $cnt; $j++){
> #$params .= "\$args[$j]";
> $params .= $args[$j];
> $params .= ($j != ($cnt-1))? ",": "";
> }// end for
> //eval("echo $params;");
> //$output =
> $matches[$i][1](implode(",",$args));//single str
> $output = $matches[$i][1]($params);
> $str = eregi_replace($matches[$i][0],$output,$str);
> } //end if
> else {
> // function not found or allowed remove tags
> //echo "DEBUG: function not found<br />\n";
> $str = eregi_replace($matches[$i][0],'',$str);
> }// end else
> }//end for
> return $str;
> }
>
> function select($array='',$name='',$extra=''){
> echo '<pre>';
> print_r(func_get_args());
> echo '</pre>';
> }
> ?>
>
> Kind regards
> Jarratt
>