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 27 Feb 2007 04:23:18 -0000 Issue 4648

php-general-digest-helplists.php.net
Date: Mon Feb 26 2007 - 22:23:18 CST


php-general Digest 27 Feb 2007 04:23:18 -0000 Issue 4648

Topics (messages 249450 through 249475):

Re: $_SERVER['PHP_SELF'] in a included file
        249450 by: Stut
        249451 by: Jochem Maas

Re: PHP4 and PHP5
        249452 by: Jochem Maas

audio CAPTCHA - was Combining sound files
        249453 by: tedd
        249455 by: benifactor
        249457 by: Németh Zoltán
        249458 by: benifactor
        249460 by: benifactor
        249462 by: Németh Zoltán
        249463 by: Colin Guthrie

Re: GET doesn't work as POST
        249454 by: Jim Lucas

Re: array issues
        249456 by: Matt Carlson

Multiple Submit
        249459 by: Dan Shirah
        249461 by: Németh Zoltán
        249466 by: Jim Lucas
        249467 by: tedd
        249468 by: Dan Shirah
        249469 by: David Giragosian
        249470 by: Jim Lucas
        249472 by: Dan Shirah
        249474 by: Jim Lucas

Re: getting authentication information from apache
        249464 by: Ryan

Re: Uploading into website directory for Php files
        249465 by: Edward Vermillion
        249471 by: Edward Vermillion

Re: read file local not remote
        249473 by: Joker7

Array question
        249475 by: Gerry D

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:


clive wrote:
> Thanks Vincent,Stut and Olaf. Thats __file___ is exactly what I needed :)
>
> now for another brain teaser for your collective brains, How does a
> function know what file it was called from.
>
> a.php includes functions.php
>
> in a.php we call function test(); which is declared in functions.php
>
> Is there anyway for test(); to echo "called from a.php" with out
> passing 'a.php' or ___FILE___ as a parameter to the function?
>
> Im busy googling now for a answer.

Note that the following function has not been extensively tested, and
should be treated as such. I wrote this function a long time ago to get
the calling function from a common error routine. You should be able to
modify this to get what you want...

function GetCaller($offset = 0)
{
   $trace = debug_backtrace();
   $retval = '';
   if (is_array($trace))
   {
     foreach ($trace as $call)
     {
       if ($offset > 0)
       {
         $offset--;
       }
       else
       {
         if (strlen($retval) == 0)
         {
           $retval = str_replace($GLOBALS['rootdir'], '',
                                 $call['file']).':'.$call['line'].' ';
         }
         elseif (isset($call['function']))
         {
           return $retval.(isset($call['class'])
                           ?
                          $call['class'].'::'
                           :
                          '').$call['function'];
         }
       }
     }
   }

   if (strlen($retval) == 0)
     return 'unknown';

   return $retval.'unknown function';
}

Hope it helps.

-Stut

attached mail follows:


Vincent DUPONT wrote:
> hi
>
> I'm afraid this is not available by default.
> You can try to parse the debug_backtrace() (see http://be2.php.net/manual/en/function.debug-backtrace.php)
> but this is probably too complex for online processing.

unless you are doing something *very* exotic (which almost by definition
means your skills are beyond the point whereby this list could probably help you)
there should be *no* reason for a function to ever need to know who/what/where it was
called from/by ... of course in the process of developing something like debug_backtrace()
can be very handy for helping to figure out what is going on!

that said if a function seems to need to know who called it (or anything like that)
then you probably have a bad smell in your design .. consider that a function does
something according to it's input, and that the output of a function should be predictable [given
a particular set of input parameters) then the caller, it's environment/start and/or the
execution path should have no baring on the function's result - if they did then the function's
result could no longer be considered predictable (unless your going to memorize every execution-path/state
in your application now and in the future!).

having said all that there are probably some exceptions to the rule - although I can't think
of any right now.

>
> if there are some native functions, please tell me !!

there are none - although I did read a thread on the internals mailing list that
mentioned something along these lines in the form of a request ... unlikely that it
will be included.

>
>
> Vincent Dupont
> Principal Consultant OpenSource Competence Center
> Ausy Belgium
> http://www.ausy.be
>
>
>
> -----Original Message-----
> From: clive [mailto:cliverttc.co.za]
> Sent: Mon 2/26/2007 15:15
> To: clive
> Cc: PHP General List
> Subject: Re: [PHP] $_SERVER['PHP_SELF'] in a included file
>
> Thanks Vincent,Stut and Olaf. Thats __file___ is exactly what I needed :)
>
> now for another brain teaser for your collective brains, How does a
> function know what file it was called from.
>
> a.php includes functions.php
>
> in a.php we call function test(); which is declared in functions.php
>
> Is there anyway for test(); to echo "called from a.php" with out
> passing 'a.php' or ___FILE___ as a parameter to the function?
>
> Im busy googling now for a answer.
>

attached mail follows:


Steven Macintyre wrote:
> "This tutorial shows how to install and configure Apache2 with PHP5 and PHP4
> enabled at the same time. Because it is not possible to run both PHP5 and
> PHP4 as Apache modules, we must run one of them as CGI, the other one as
> Apache module."

alternatively run 2 apaches and use the ProxyPass directive to make the second
apache 'available' via the first (meaning you don't have to mess around with
alternative ports when it comes to actually visiting/using the sites that run
on the second apache.

search the list archives for 'Rasmus' and 'ProxyPass' and you should find
the info needed to setup a 'php4-php5-proxypass'** configuration.

**that's an arbitrary name I just made up - seemed as good as anything else :-)

>
> http://www.howtoforge.com/apache2_with_php5_and_php4
>
> That’s via a google search ... never done it myself!
>
> S
>
>> -----Original Message-----
>> From: Martin Marques [mailto:martinbugs.unl.edu.ar]
>> Sent: 26 February 2007 03:50 PM
>> To: php-generallists.php.net
>> Subject: [PHP] PHP4 and PHP5
>>
>> Is it posible to run apache with PHP4 and PHP5 on different virtual
>> domains?
>>
>> --
>> 21:50:04 up 2 days, 9:07, 0 users, load average: 0.92, 0.37,
>> 0.18
>> ---------------------------------------------------------
>> Lic. Martín Marqués | SELECT 'mmarques' ||
>> Centro de Telemática | '' || 'unl.edu.ar';
>> Universidad Nacional | DBA, Programador,
>> del Litoral | Administrador
>> ---------------------------------------------------------
>

attached mail follows:


Hi gang:

Thanks for all the advice regarding combining sound files. I shall
look into all of it.

In the meantime, I am trying a different solution and would
appreciate your review of the technique:

http://www.sperling.com/a/c/

The point of this experiment is to "speak" the numbers required for a
CAPTCHA protection scheme.

I've had a few blind users report that this works for them, but
considering all the different platforms and talents on this list, I
thought that I would ask "Does this work (i.e., speak the numbers)
for you?" The numbers to be spoken are printed on the top of this
page for your notice.

If you would be so kind, please review, provide me your platform type
and success.

Thanks.

tedd

PS: What does this have to do with php? Well... a good deal of the
code is php and a mix of a bunch of other stuff (we don't live in a
vacuum) -- so please permit me this indulgence.

--
-------
http://sperling.com http://ancientstones.com http://earthstones.com

attached mail follows:


tried, and failed. got this error:

Notice: Undefined variable: captcha in
/home/httpd/vhosts/sperling.com/httpdocs/a/c/index.php on line 29

and no captcha was displayed.
----- Original Message -----
From: "tedd" <teddsperling.com>
To: <php-generallists.php.net>
Sent: Monday, February 26, 2007 8:04 AM
Subject: [PHP] audio CAPTCHA - was Combining sound files

> Hi gang:
>
> Thanks for all the advice regarding combining sound files. I shall look
> into all of it.
>
> In the meantime, I am trying a different solution and would appreciate
> your review of the technique:
>
> http://www.sperling.com/a/c/
>
> The point of this experiment is to "speak" the numbers required for a
> CAPTCHA protection scheme.
>
> I've had a few blind users report that this works for them, but
> considering all the different platforms and talents on this list, I
> thought that I would ask "Does this work (i.e., speak the numbers) for
> you?" The numbers to be spoken are printed on the top of this page for
> your notice.
>
> If you would be so kind, please review, provide me your platform type and
> success.
>
> Thanks.
>
> tedd
>
> PS: What does this have to do with php? Well... a good deal of the code is
> php and a mix of a bunch of other stuff (we don't live in a vacuum) -- so
> please permit me this indulgence.
>
> --
> -------
> http://sperling.com http://ancientstones.com http://earthstones.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


I got the same notice on the top of the page.
besides that, when clicking the "speak captcha" button nothing happens

greets
Zoltán Németh

2007. 02. 26, hétfő keltezéssel 08.12-kor benifactor ezt írta:
> tried, and failed. got this error:
>
> Notice: Undefined variable: captcha in
> /home/httpd/vhosts/sperling.com/httpdocs/a/c/index.php on line 29
>
> and no captcha was displayed.
> ----- Original Message -----
> From: "tedd" <teddsperling.com>
> To: <php-generallists.php.net>
> Sent: Monday, February 26, 2007 8:04 AM
> Subject: [PHP] audio CAPTCHA - was Combining sound files
>
>
> > Hi gang:
> >
> > Thanks for all the advice regarding combining sound files. I shall look
> > into all of it.
> >
> > In the meantime, I am trying a different solution and would appreciate
> > your review of the technique:
> >
> > http://www.sperling.com/a/c/
> >
> > The point of this experiment is to "speak" the numbers required for a
> > CAPTCHA protection scheme.
> >
> > I've had a few blind users report that this works for them, but
> > considering all the different platforms and talents on this list, I
> > thought that I would ask "Does this work (i.e., speak the numbers) for
> > you?" The numbers to be spoken are printed on the top of this page for
> > your notice.
> >
> > If you would be so kind, please review, provide me your platform type and
> > success.
> >
> > Thanks.
> >
> > tedd
> >
> > PS: What does this have to do with php? Well... a good deal of the code is
> > php and a mix of a bunch of other stuff (we don't live in a vacuum) -- so
> > please permit me this indulgence.
> >
> > --
> > -------
> > http://sperling.com http://ancientstones.com http://earthstones.com
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>

attached mail follows:


yea, same for me... but maybe the variable needs to be defined for anything
to happen, as we are probably supposed to press that before we speak tha
captcha..

----- Original Message -----
From: "Németh Zoltán" <znemethalterationx.hu>
To: "benifactor" <snorris17cox.net>
Cc: <php-generallists.php.net>
Sent: Monday, February 26, 2007 8:18 AM
Subject: Re: [PHP] audio CAPTCHA - was Combining sound files

I got the same notice on the top of the page.
besides that, when clicking the "speak captcha" button nothing happens

greets
Zoltán Németh

2007. 02. 26, hétfő keltezéssel 08.12-kor benifactor ezt írta:
> tried, and failed. got this error:
>
> Notice: Undefined variable: captcha in
> /home/httpd/vhosts/sperling.com/httpdocs/a/c/index.php on line 29
>
> and no captcha was displayed.
> ----- Original Message -----
> From: "tedd" <teddsperling.com>
> To: <php-generallists.php.net>
> Sent: Monday, February 26, 2007 8:04 AM
> Subject: [PHP] audio CAPTCHA - was Combining sound files
>
>
> > Hi gang:
> >
> > Thanks for all the advice regarding combining sound files. I shall look
> > into all of it.
> >
> > In the meantime, I am trying a different solution and would appreciate
> > your review of the technique:
> >
> > http://www.sperling.com/a/c/
> >
> > The point of this experiment is to "speak" the numbers required for a
> > CAPTCHA protection scheme.
> >
> > I've had a few blind users report that this works for them, but
> > considering all the different platforms and talents on this list, I
> > thought that I would ask "Does this work (i.e., speak the numbers) for
> > you?" The numbers to be spoken are printed on the top of this page for
> > your notice.
> >
> > If you would be so kind, please review, provide me your platform type
> > and
> > success.
> >
> > Thanks.
> >
> > tedd
> >
> > PS: What does this have to do with php? Well... a good deal of the code
> > is
> > php and a mix of a bunch of other stuff (we don't live in a vacuum) --
> > so
> > please permit me this indulgence.
> >
> > --
> > -------
> > http://sperling.com http://ancientstones.com http://earthstones.com
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>

attached mail follows:


    i was just trying again, and entered 406 via keyboard and pressed
submit, and it said i was successful, then i pressed back on my browser and
no longer had the error. it displayed the captcha at the top of the page
where the error was.

attached mail follows:


2007. 02. 26, hétfő keltezéssel 08.26-kor benifactor ezt írta:
> i was just trying again, and entered 406 via keyboard and pressed
> submit, and it said i was successful, then i pressed back on my browser and
> no longer had the error. it displayed the captcha at the top of the page
> where the error was.
>

yeah, if you enter anything (even incorrect), the captcha gets displayed
instead of the error message.

but the "speak captcha" button still does nothing

greets
Zoltán Németh

attached mail follows:


tedd wrote:
> PS: What does this have to do with php? Well... a good deal of the code
> is php and a mix of a bunch of other stuff (we don't live in a vacuum)
> -- so please permit me this indulgence.

Personally, I think this would be quite easy to do in flash... tho' I
don't really know flash, it just seems like the kind of thing it would
be good at :)

Also look at some of the mods for e.g. phpBB, as I'm sure they've got
audible captchas and the like.

Col.

attached mail follows:


Otto Wyss wrote:
> On the page
>
> http://www.orpatec.ch/turniere/5erfussball/index.php?page=bvallist.php&kind=regions
>
>
> I have a form with method="post" and action="<?PHP $_SERVER['PHP_SELF'];
> ?>". While it works fine this way, as soon as I change the form to
> method="get" it looses the parameter "kind" when I change e.g. the
> second parameter from "-Alle-" to "Gültig". Has anybody an idea why it
> works with POST but not with GET?
>
> <form action="<?PHP $_SERVER['PHP_SELF']; ?>" method="get">
try actually using echo or print to output the variable contents to the
browser. If you look at your source. you will notice there is no value
set for action....

> ...
> <select name="state" onchange="this.form.submit()">
>
> O. Wyss
>

--
Enjoy,

Jim Lucas

Different eyes see different things. Different hearts beat on different
strings. But there are times for you and me when all such things agree.

- Rush

attached mail follows:


If i'm understanding you correctly, you have something like a flat file, and hopefully it is artist[tab]artist[tab] with the title being something like artist1title[tab]artist2title[tab], etc. If so, use explode. $artists = explode("\t", $stringofartists); $songs = explode("\t", $stringoftitles); $i = 0; foreach($artists as $key) { $information[$key] = $songs[$i]; $i++; } I hope this is kind of what you were looking for. [snip] Artist[tab]artist[tab]artist[tab] etc as a entry for "artists" [/snip]

attached mail follows:


Hello all,

I have a page that has multiple submits on it. One submit is within my
javascriptfor form checking, the other submit is a button used to populate
all customer information if an order ID is entered.

Problem: I cannot get the two to coincide at the same time. They both use
the submit function to send the data to the same page instead of their
unique individual pages.

Code: Below are the code snipets.

<?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<script language="JavaScript">
<!--

function closeThis() {
 if (window.confirm("Are you sure you want to cancel the payment request?"))

  this.window.close();
}

*function checkForm() {*

 // ** START **
  if (inputForm.cc_phone_number.value == "") {
    alert( "Please enter a phone number." );
    inputForm.cc_phone_number.focus();
    return;
  }

   if (inputForm.receipt.value == "") {
    alert( "Please select whether or not a receipt was requested." );
    inputForm.phone_number.focus();
    return;
  }

  if (inputForm.cc_first_name.value == "") {
    alert( "Please enter a first name." );
    inputForm.cc_first_name.focus();
    return;
  }

  if (inputForm.cc_last_name.value == "") {
    alert( "Please enter a last name." );
    inputForm.cc_last_name.focus();
    return;
  }

  if (!(document.inputForm.cc_comments.value =="")) {
  if (document.inputForm.cc_comments.value.length > 250)
  {
    alert("The Comments must be less than 250 characters.\nIt is currently "
+ document.inputForm.window_name.value.length + " characters.");
   document.inputForm.window_name.focus();
   return;
  }
 }
* document.inputForm.submit();*
}

//-->
</script>
<LINK rel="stylesheet" type="text/css" href="../../CSS/background.css">
</head>
<body>
*<form name="inputForm" action="save.php" method="post"
enctype="multipart/form-data">*
<table align="center" border="0" cellpadding="0" cellspacing="0"
width="680">
 <tr>
    <td height="13" align="center" class="tblhead"><strong>Credit Card
Information</strong></td>
 </tr>

*// LOTS OF FORM DATA REMOVED FOR EMAIL LENGTH*

<table align="center" border="0" cellpadding="0" cellspacing="0"
width="680">
<tr>
*This is the other submit that I need to go a page other than the one
specified in the <form>*
*<td width="62"><a href="DeferredPayment3.php"><input type="submit"
name="retrieve" value="Retrieve"></a></td>*
      <td width="8"></td>
</tr>
</table>
<br />
<br />
<table align="center" border="0" cellpadding="0" cellspacing="0"
width="680">
 <tr>
*Call to the javascript checkForm function*
 *<td width="64" align="left"><a href="javascript:checkForm()"
title="Save">Save</a></td>
* <td width="616" align="left"><a href="javascript:closeThis()"
title="Close">Close</a></td>
 </tr>
</table>
</form>
</body>
</html>

attached mail follows:


2007. 02. 26, hétfő keltezéssel 11.23-kor Dan Shirah ezt írta:
> Hello all,
>
> I have a page that has multiple submits on it. One submit is within my
> javascriptfor form checking, the other submit is a button used to populate
> all customer information if an order ID is entered.
>
> Problem: I cannot get the two to coincide at the same time. They both use
> the submit function to send the data to the same page instead of their
> unique individual pages.
>
> Code: Below are the code snipets.
>
>
> <?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; ?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
> http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> <HEAD>
> <script language="JavaScript">
> <!--
>
> function closeThis() {
> if (window.confirm("Are you sure you want to cancel the payment request?"))
>
> this.window.close();
> }
>
> *function checkForm() {*
>
> // ** START **
> if (inputForm.cc_phone_number.value == "") {
> alert( "Please enter a phone number." );
> inputForm.cc_phone_number.focus();
> return;
> }
>
> if (inputForm.receipt.value == "") {
> alert( "Please select whether or not a receipt was requested." );
> inputForm.phone_number.focus();
> return;
> }
>
> if (inputForm.cc_first_name.value == "") {
> alert( "Please enter a first name." );
> inputForm.cc_first_name.focus();
> return;
> }
>
> if (inputForm.cc_last_name.value == "") {
> alert( "Please enter a last name." );
> inputForm.cc_last_name.focus();
> return;
> }
>
> if (!(document.inputForm.cc_comments.value =="")) {
> if (document.inputForm.cc_comments.value.length > 250)
> {
> alert("The Comments must be less than 250 characters.\nIt is currently "
> + document.inputForm.window_name.value.length + " characters.");
> document.inputForm.window_name.focus();
> return;
> }
> }
> * document.inputForm.submit();*
> }
>
> //-->
> </script>
> <LINK rel="stylesheet" type="text/css" href="../../CSS/background.css">
> </head>
> <body>
> *<form name="inputForm" action="save.php" method="post"
> enctype="multipart/form-data">*
> <table align="center" border="0" cellpadding="0" cellspacing="0"
> width="680">
> <tr>
> <td height="13" align="center" class="tblhead"><strong>Credit Card
> Information</strong></td>
> </tr>
>
> *// LOTS OF FORM DATA REMOVED FOR EMAIL LENGTH*
>
> <table align="center" border="0" cellpadding="0" cellspacing="0"
> width="680">
> <tr>
> *This is the other submit that I need to go a page other than the one
> specified in the <form>*
> *<td width="62"><a href="DeferredPayment3.php"><input type="submit"
> name="retrieve" value="Retrieve"></a></td>*
> <td width="8"></td>

AFAIK an <input> within an <a> tag will not work ever
why don't you do it the way you do the other submit button? (with
javascript submit();)

greets
Zoltán Németh

> </tr>
> </table>
> <br />
> <br />
> <table align="center" border="0" cellpadding="0" cellspacing="0"
> width="680">
> <tr>
> *Call to the javascript checkForm function*
> *<td width="64" align="left"><a href="javascript:checkForm()"
> title="Save">Save</a></td>
> * <td width="616" align="left"><a href="javascript:closeThis()"
> title="Close">Close</a></td>
> </tr>
> </table>
> </form>
> </body>
> </html>

attached mail follows:


Dan Shirah wrote:
> Hello all,
>
> I have a page that has multiple submits on it. One submit is within my
> javascriptfor form checking, the other submit is a button used to populate
> all customer information if an order ID is entered.
>
> Problem: I cannot get the two to coincide at the same time. They both use
> the submit function to send the data to the same page instead of their
> unique individual pages.
>
> Code: Below are the code snipets.
>
>
> <?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; ?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
> http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> <HEAD>
> <script language="JavaScript">
> <!--
>
> function closeThis() {
> if (window.confirm("Are you sure you want to cancel the payment request?"))
>
> this.window.close();
> }
>
> *function checkForm() {*
>
> // ** START **
> if (inputForm.cc_phone_number.value == "") {
> alert( "Please enter a phone number." );
> inputForm.cc_phone_number.focus();
> return;
> }
>
> if (inputForm.receipt.value == "") {
> alert( "Please select whether or not a receipt was requested." );
> inputForm.phone_number.focus();
> return;
> }
>
> if (inputForm.cc_first_name.value == "") {
> alert( "Please enter a first name." );
> inputForm.cc_first_name.focus();
> return;
> }
>
> if (inputForm.cc_last_name.value == "") {
> alert( "Please enter a last name." );
> inputForm.cc_last_name.focus();
> return;
> }
>
> if (!(document.inputForm.cc_comments.value =="")) {
> if (document.inputForm.cc_comments.value.length > 250)
> {
> alert("The Comments must be less than 250 characters.\nIt is currently "
> + document.inputForm.window_name.value.length + " characters.");
> document.inputForm.window_name.focus();
> return;
> }
> }
> * document.inputForm.submit();*
> }
>
> //-->
> </script>
> <LINK rel="stylesheet" type="text/css" href="../../CSS/background.css">
> </head>
> <body>
> *<form name="inputForm" action="save.php" method="post"
> enctype="multipart/form-data">*
> <table align="center" border="0" cellpadding="0" cellspacing="0"
> width="680">
> <tr>
> <td height="13" align="center" class="tblhead"><strong>Credit Card
> Information</strong></td>
> </tr>
>
> *// LOTS OF FORM DATA REMOVED FOR EMAIL LENGTH*
>
> <table align="center" border="0" cellpadding="0" cellspacing="0"
> width="680">
> <tr>
> *This is the other submit that I need to go a page other than the one
> specified in the <form>*
> *<td width="62"><a href="DeferredPayment3.php"><input type="submit"
> name="retrieve" value="Retrieve"></a></td>*
What exactly are you wanting the click to do?

Change to the page given in the <a> or submit the form?

> <td width="8"></td>
> </tr>
> </table>
> <br />
> <br />
> <table align="center" border="0" cellpadding="0" cellspacing="0"
> width="680">
> <tr>
> *Call to the javascript checkForm function*
> *<td width="64" align="left"><a href="javascript:checkForm()"
> title="Save">Save</a></td>
> * <td width="616" align="left"><a href="javascript:closeThis()"
> title="Close">Close</a></td>
> </tr>
> </table>
> </form>
> </body>
> </html>
>

--
Enjoy,

Jim Lucas

Different eyes see different things. Different hearts beat on different
strings. But there are times for you and me when all such things agree.

- Rush

attached mail follows:


At 11:23 AM -0500 2/26/07, Dan Shirah wrote:
>Hello all,
>
>I have a page that has multiple submits on it. One submit is within my
>javascriptfor form checking, the other submit is a button used to populate
>all customer information if an order ID is entered.
>
>Problem: I cannot get the two to coincide at the same time. They both use
>the submit function to send the data to the same page instead of their
>unique individual pages.

Nothing wrong with putting two forms on the same page and each with
their own action and submit button.

You can always add an attribute value (value=1) with each submit
button so that you can determine later which page to redirect your
attention.

tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com

attached mail follows:


When I click on "save" at the bottom, I want it to check my form and submit
all the values. When I click on the "Retrieve" button I want it to submit
my order number to another page, and also carry over the $_POST value of any
field that may have had info entered into it.

However, since I have a form within a form, it is giving me problems.

On 2/26/07, tedd <teddsperling.com> wrote:
>
> At 11:23 AM -0500 2/26/07, Dan Shirah wrote:
> >Hello all,
> >
> >I have a page that has multiple submits on it. One submit is within my
> >javascriptfor form checking, the other submit is a button used to
> populate
> >all customer information if an order ID is entered.
> >
> >Problem: I cannot get the two to coincide at the same time. They both
> use
> >the submit function to send the data to the same page instead of their
> >unique individual pages.
>
> Nothing wrong with putting two forms on the same page and each with
> their own action and submit button.
>
> You can always add an attribute value (value=1) with each submit
> button so that you can determine later which page to redirect your
> attention.
>
> tedd
> --
> -------
> http://sperling.com http://ancientstones.com http://earthstones.com
>

attached mail follows:


I always use :

onClick=\"this.form.action='SomeOtherPage.php'; \"

inside the button tag.

Seems to work just fine.

David

On 2/26/07, Dan Shirah <mrsquash2gmail.com> wrote:
>
> When I click on "save" at the bottom, I want it to check my form and
> submit
> all the values. When I click on the "Retrieve" button I want it to submit
> my order number to another page, and also carry over the $_POST value of
> any
> field that may have had info entered into it.
>
> However, since I have a form within a form, it is giving me problems.
>
>
> On 2/26/07, tedd <teddsperling.com> wrote:
> >
> > At 11:23 AM -0500 2/26/07, Dan Shirah wrote:
> > >Hello all,
> > >
> > >I have a page that has multiple submits on it. One submit is within my
> > >javascriptfor form checking, the other submit is a button used to
> > populate
> > >all customer information if an order ID is entered.
> > >
> > >Problem: I cannot get the two to coincide at the same time. They both
> > use
> > >the submit function to send the data to the same page instead of their
> > >unique individual pages.
> >
> > Nothing wrong with putting two forms on the same page and each with
> > their own action and submit button.
> >
> > You can always add an attribute value (value=1) with each submit
> > button so that you can determine later which page to redirect your
> > attention.
> >
> > tedd
> > --
> > -------
> > http://sperling.com http://ancientstones.com http://earthstones.com
> >
>

attached mail follows:


Dan Shirah wrote:
> Hello all,
>
> I have a page that has multiple submits on it. One submit is within my
> javascriptfor form checking, the other submit is a button used to populate
> all customer information if an order ID is entered.
>
> Problem: I cannot get the two to coincide at the same time. They both use
> the submit function to send the data to the same page instead of their
> unique individual pages.
>
> Code: Below are the code snipets.
>
>
> <?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; ?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
> http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> <HEAD>
> <script language="JavaScript">
> <!--
>
> function closeThis() {
> if (window.confirm("Are you sure you want to cancel the payment request?"))
>
> this.window.close();
> }
>
> *function checkForm() {*
>
> // ** START **
> if (inputForm.cc_phone_number.value == "") {
> alert( "Please enter a phone number." );
> inputForm.cc_phone_number.focus();
> return;
> }
>
> if (inputForm.receipt.value == "") {
> alert( "Please select whether or not a receipt was requested." );
> inputForm.phone_number.focus();
> return;
> }
>
> if (inputForm.cc_first_name.value == "") {
> alert( "Please enter a first name." );
> inputForm.cc_first_name.focus();
> return;
> }
>
> if (inputForm.cc_last_name.value == "") {
> alert( "Please enter a last name." );
> inputForm.cc_last_name.focus();
> return;
> }
>
> if (!(document.inputForm.cc_comments.value =="")) {
> if (document.inputForm.cc_comments.value.length > 250)
> {
> alert("The Comments must be less than 250 characters.\nIt is currently "
> + document.inputForm.window_name.value.length + " characters.");
> document.inputForm.window_name.focus();
> return;
> }
> }
> * document.inputForm.submit();*
> }
>
> //-->
> </script>
> <LINK rel="stylesheet" type="text/css" href="../../CSS/background.css">
> </head>
> <body>
> *<form name="inputForm" action="save.php" method="post"
> enctype="multipart/form-data">*
> <table align="center" border="0" cellpadding="0" cellspacing="0"
> width="680">
> <tr>
> <td height="13" align="center" class="tblhead"><strong>Credit Card
> Information</strong></td>
> </tr>
>
> *// LOTS OF FORM DATA REMOVED FOR EMAIL LENGTH*
>
> <table align="center" border="0" cellpadding="0" cellspacing="0"
> width="680">
> <tr>
> *This is the other submit that I need to go a page other than the one
> specified in the <form>*
> *<td width="62"><a href="DeferredPayment3.php"><input type="submit"
> name="retrieve" value="Retrieve"></a></td>*
> <td width="8"></td>
> </tr>
> </table>
> <br />
> <br />
> <table align="center" border="0" cellpadding="0" cellspacing="0"
> width="680">
> <tr>
> *Call to the javascript checkForm function*
> *<td width="64" align="left"><a href="javascript:checkForm()"
> title="Save">Save</a></td>
> * <td width="616" align="left"><a href="javascript:closeThis()"
> title="Close">Close</a></td>
> </tr>
> </table>
> </form>
> </body>
> </html>
>
I see a few things now that are wrong with this. I thought they were
comments but now that you have explained that it was a nested for, it
make a little more sense. You cannot nest forms.

if you want to have the for submitted to a different location, then you
have to use one form, with function that modify the action value and
change it to the correct url and then submit the form.

Try this:

<form action="original.php" method="get" onsubmit="return false;" >
<input type="submit"
        onclick=" alert("Original:"+this.form.action);
                        this.form.action = 'new.php';
                        alert("New:"+this.form.action); " />
</form>

--
Enjoy,

Jim Lucas

Different eyes see different things. Different hearts beat on different
strings. But there are times for you and me when all such things agree.

- Rush

attached mail follows:


Okay, I partially figured it out! YAY!

I only needed to have one form object.

*<form name="inputForm" action="" method="post"
enctype="multipart/form-data">*

Instead of putting an action in the form, leave it blank....and then specify
the forms action based on which button is clicked.

*<input type="submit" name="retrieve" value="Retrieve" onclick="
this.form.action='CSPayment3.php';" />*

And this will $_POST all your entered values as it should.

Now all I have to figure out is how to have:

*<a href="javascript:checkForm()" title="Save">Save</a>*

Run through all my form checks and then $_POST to my save.php page.

On 2/26/07, Jim Lucas <listscmsws.com> wrote:
>
> Dan Shirah wrote:
> > Hello all,
> >
> > I have a page that has multiple submits on it. One submit is within my
> > javascriptfor form checking, the other submit is a button used to
> populate
> > all customer information if an order ID is entered.
> >
> > Problem: I cannot get the two to coincide at the same time. They both
> use
> > the submit function to send the data to the same page instead of their
> > unique individual pages.
> >
> > Code: Below are the code snipets.
> >
> >
> > <?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; ?>
> > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
> > http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> > <html xmlns="http://www.w3.org/1999/xhtml">
> > <HEAD>
> > <script language="JavaScript">
> > <!--
> >
> > function closeThis() {
> > if (window.confirm("Are you sure you want to cancel the payment
> request?"))
> >
> > this.window.close();
> > }
> >
> > *function checkForm() {*
> >
> > // ** START **
> > if (inputForm.cc_phone_number.value == "") {
> > alert( "Please enter a phone number." );
> > inputForm.cc_phone_number.focus();
> > return;
> > }
> >
> > if (inputForm.receipt.value == "") {
> > alert( "Please select whether or not a receipt was requested." );
> > inputForm.phone_number.focus();
> > return;
> > }
> >
> > if (inputForm.cc_first_name.value == "") {
> > alert( "Please enter a first name." );
> > inputForm.cc_first_name.focus();
> > return;
> > }
> >
> > if (inputForm.cc_last_name.value == "") {
> > alert( "Please enter a last name." );
> > inputForm.cc_last_name.focus();
> > return;
> > }
> >
> > if (!(document.inputForm.cc_comments.value =="")) {
> > if (document.inputForm.cc_comments.value.length > 250)
> > {
> > alert("The Comments must be less than 250 characters.\nIt is
> currently "
> > + document.inputForm.window_name.value.length + " characters.");
> > document.inputForm.window_name.focus();
> > return;
> > }
> > }
> > * document.inputForm.submit();*
> > }
> >
> > //-->
> > </script>
> > <LINK rel="stylesheet" type="text/css" href="../../CSS/background.css">
> > </head>
> > <body>
> > *<form name="inputForm" action="save.php" method="post"
> > enctype="multipart/form-data">*
> > <table align="center" border="0" cellpadding="0" cellspacing="0"
> > width="680">
> > <tr>
> > <td height="13" align="center" class="tblhead"><strong>Credit Card
> > Information</strong></td>
> > </tr>
> >
> > *// LOTS OF FORM DATA REMOVED FOR EMAIL LENGTH*
> >
> > <table align="center" border="0" cellpadding="0" cellspacing="0"
> > width="680">
> > <tr>
> > *This is the other submit that I need to go a page other than the one
> > specified in the <form>*
> > *<td width="62"><a href="DeferredPayment3.php"><input type="submit"
> > name="retrieve" value="Retrieve"></a></td>*
> > <td width="8"></td>
> > </tr>
> > </table>
> > <br />
> > <br />
> > <table align="center" border="0" cellpadding="0" cellspacing="0"
> > width="680">
> > <tr>
> > *Call to the javascript checkForm function*
> > *<td width="64" align="left"><a href="javascript:checkForm()"
> > title="Save">Save</a></td>
> > * <td width="616" align="left"><a href="javascript:closeThis()"
> > title="Close">Close</a></td>
> > </tr>
> > </table>
> > </form>
> > </body>
> > </html>
> >
> I see a few things now that are wrong with this. I thought they were
> comments but now that you have explained that it was a nested for, it
> make a little more sense. You cannot nest forms.
>
> if you want to have the for submitted to a different location, then you
> have to use one form, with function that modify the action value and
> change it to the correct url and then submit the form.
>
> Try this:
>
> <form action="original.php" method="get" onsubmit="return false;" >
> <input type="submit"
> onclick=" alert("Original:"+this.form.action);
> this.form.action = 'new.php';
> alert("New:"+this.form.action); " />
> </form>
>
>
>
> --
> Enjoy,
>
> Jim Lucas
>
> Different eyes see different things. Different hearts beat on different
> strings. But there are times for you and me when all such things agree.
>
> - Rush
>
>
>
>

attached mail follows:


Dan Shirah wrote:
> Okay, I partially figured it out! YAY!
>
> I only needed to have one form object.
>
> *<form name="inputForm" action="" method="post"
> enctype="multipart/form-data">*
>
> Instead of putting an action in the form, leave it blank....and then
> specify
> the forms action based on which button is clicked.
>
> *<input type="submit" name="retrieve" value="Retrieve" onclick="
> this.form.action='CSPayment3.php';" />*
>
> And this will $_POST all your entered values as it should.
>
> Now all I have to figure out is how to have:
>
> *<a href="javascript:checkForm()" title="Save">Save</a>*
>
> Run through all my form checks and then $_POST to my save.php page.
>
>
>
> On 2/26/07, Jim Lucas <listscmsws.com> wrote:
>>
>> Dan Shirah wrote:
>> > Hello all,
>> >
>> > I have a page that has multiple submits on it. One submit is within my
>> > javascriptfor form checking, the other submit is a button used to
>> populate
>> > all customer information if an order ID is entered.
>> >
>> > Problem: I cannot get the two to coincide at the same time. They both
>> use
>> > the submit function to send the data to the same page instead of their
>> > unique individual pages.
>> >
>> > Code: Below are the code snipets.
>> >
>> >
>> > <?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; ?>
>> > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
>> > http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>> > <html xmlns="http://www.w3.org/1999/xhtml">
>> > <HEAD>
>> > <script language="JavaScript">
>> > <!--
>> >
>> > function closeThis() {
>> > if (window.confirm("Are you sure you want to cancel the payment
>> request?"))
>> >
>> > this.window.close();
>> > }
>> >
>> > *function checkForm() {*
>> >
>> > // ** START **
>> > if (inputForm.cc_phone_number.value == "") {
>> > alert( "Please enter a phone number." );
>> > inputForm.cc_phone_number.focus();
>> > return;
>> > }
>> >
>> > if (inputForm.receipt.value == "") {
>> > alert( "Please select whether or not a receipt was requested." );
>> > inputForm.phone_number.focus();
>> > return;
>> > }
>> >
>> > if (inputForm.cc_first_name.value == "") {
>> > alert( "Please enter a first name." );
>> > inputForm.cc_first_name.focus();
>> > return;
>> > }
>> >
>> > if (inputForm.cc_last_name.value == "") {
>> > alert( "Please enter a last name." );
>> > inputForm.cc_last_name.focus();
>> > return;
>> > }
>> >
>> > if (!(document.inputForm.cc_comments.value =="")) {
>> > if (document.inputForm.cc_comments.value.length > 250)
>> > {
>> > alert("The Comments must be less than 250 characters.\nIt is
>> currently "
>> > + document.inputForm.window_name.value.length + " characters.");
>> > document.inputForm.window_name.focus();
>> > return;
>> > }
>> > }
>> > * document.inputForm.submit();*
>> > }
>> >
>> > //-->
>> > </script>
>> > <LINK rel="stylesheet" type="text/css" href="../../CSS/background.css">
>> > </head>
>> > <body>
>> > *<form name="inputForm" action="save.php" method="post"
>> > enctype="multipart/form-data">*
>> > <table align="center" border="0" cellpadding="0" cellspacing="0"
>> > width="680">
>> > <tr>
>> > <td height="13" align="center" class="tblhead"><strong>Credit Card
>> > Information</strong></td>
>> > </tr>
>> >
>> > *// LOTS OF FORM DATA REMOVED FOR EMAIL LENGTH*
>> >
>> > <table align="center" border="0" cellpadding="0" cellspacing="0"
>> > width="680">
>> > <tr>
>> > *This is the other submit that I need to go a page other than the one
>> > specified in the <form>*
>> > *<td width="62"><a href="DeferredPayment3.php"><input type="submit"
>> > name="retrieve" value="Retrieve"></a></td>*
>> > <td width="8"></td>
>> > </tr>
>> > </table>
>> > <br />
>> > <br />
>> > <table align="center" border="0" cellpadding="0" cellspacing="0"
>> > width="680">
>> > <tr>
>> > *Call to the javascript checkForm function*
>> > *<td width="64" align="left"><a href="javascript:checkForm()"
>> > title="Save">Save</a></td>
>> > * <td width="616" align="left"><a href="javascript:closeThis()"
>> > title="Close">Close</a></td>
>> > </tr>
>> > </table>
>> > </form>
>> > </body>
>> > </html>
>> >
>> I see a few things now that are wrong with this. I thought they were
>> comments but now that you have explained that it was a nested for, it
>> make a little more sense. You cannot nest forms.
>>
>> if you want to have the for submitted to a different location, then you
>> have to use one form, with function that modify the action value and
>> change it to the correct url and then submit the form.
>>
>> Try this:
>>
>> <form action="original.php" method="get" onsubmit="return false;" >
>> <input type="submit"
>> onclick=" alert("Original:"+this.form.action);
>> this.form.action = 'new.php';
>> alert("New:"+this.form.action); " />
>> </form>
>>
>>
>>
>> --
>> Enjoy,
>>
>> Jim Lucas
>>
>> Different eyes see different things. Different hearts beat on different
>> strings. But there are times for you and me when all such things agree.
>>
>> - Rush
>>
>>
>>
>>
>

Change this line:
<a href="javascript:checkForm()" title="Save">Save</a>*
to this
<input type="button" value="Save" />

and then in the <form ...> tag add: onsubmit="checkForm();"

I would also run through your checkForm() function and make sure that it
is returning true or false always.

--
Enjoy,

Jim Lucas

Different eyes see different things. Different hearts beat on different
strings. But there are times for you and me when all such things agree.

- Rush

attached mail follows:


Tried that ($PHP_AUTH_USER) and it is also empty.

On 2/24/07, dave <daveproxy.ro> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> try echo $PHP_AUTH_USER;
>
> Ryan wrote:
> > Richard,
> >
> > I looked at phpinfo() as you said, same thing...
> >
> > _SERVER["REMOTE_USER"] no value
> >
> > You may be right, this may not be available, but I don't want to keep
> > throwing a login screen in front of users for no apparent reason.
> >
> > Thanks,
> > Ryan
> >
> >
> >
> >
> > On 2/23/07, Richard Lynch <ceol-i-e.com> wrote:
> >> On Wed, February 21, 2007 1:01 pm, Ryan wrote:
> >> > I'm new to php and I have am running php on apache. I already have
> >> > ldap
> >> > authentication set up in apache would rather not create a separate
> >> > system
> >> > for php. What would be ideal would be to get the current authenticated
> >> > user
> >> > from the apache environment. At this point I'm grabbing at straws, but
> >> > so
> >> > far I've tried....
> >> >
> >> > $ret = apache_getenv("LDAP_USER");
> >> > echo $ret;
> >> > echo $_SERVER['REMOTE_USER'];
> >> > echo $_SERVER['PHP_AUTH_DIGEST'];
> >> > $ret = apache_getenv('PHP_AUTH_DIGEST');
> >> >
> >> > None of these work. Has anyone done this??
> >>
> >> If the answer you are seeking isn't available in:
> >> <?php phpinfo();?>
> >> run on the page where you are trying to do this, then you probably
> >> can't get the answer you want.
> >>
> >> Running http://php.net/ldap to re-connect and re-authenticate will
> >> probably be fairly cheap, since LDAP is supposed to be pretty dang
> >> fast in the first place, and whatever caching is going on for the LDAP
> >> or OS calls behind LDAP virtually guarantees that the data you want is
> >> in RAM.
> >>
> >> --
> >> Some people have a "gift" link here.
> >> Know what I want?
> >> I want you to buy a CD from some starving artist.
> >> http://cdbaby.com/browse/from/lynch
> >> Yeah, I get a buck. So?
> >>
> >>
> >
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.1 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFF4AgsGPhC6XW20oARAmruAJ9zpCz5q6mN6rwlRHkyXgtox9ZvWACgnrXa
> TFy3y3YOWfFPaFctYAFbDFo=
> =6tjM
> -----END PGP SIGNATURE-----
>

attached mail follows:


On Feb 26, 2007, at 11:22 AM, StainOnRugaol.com wrote:

> Thanks alot for your response.. your information really was a help.
> but now knowing that I an use a folder in my root DIR.. how do I
> let PHP know where to look? For example the location lets say of
> my include fold is www.example.com/files/include how do I
> tell PHP to search that DIR? Thank you soo much! honestly!

I believe there is a way to either add paths or change the
include_path directive in your php script, you'll have to look in the
manual:

http://us3.php.net/manual/en/ini.php

I'm not too sure about it because I don't rely on the include_path
directive to locate my included files. I always give an absolute path
when I call them, just so I know for sure what I'm getting. To use
your example:

<?php
include '/files/include/foo.php';

// Do something with foo...
?>

instead of:

<?php
include 'foo.php';

// Do something with foo...
?>

there *could* be another 'foo.php' in the path that gets grabbed
before the one you want.

Or you can set a constant to the includes directory:

<?php

define('INCLUDE_DIR', '/files/include');

include INCLUDE_DIR.'foo.php';

// Do something with foo...
?>

By setting a constant to the directory, if you change the location of
the directory, then you only need to change the script in one spot
instead of hunting for all the include calls. Of course if you're
working with someone else's code and *they* are relying on
include_path being set correctly then you're pretty much stuck with
that, unless you want to rewrite their code.

Ed

attached mail follows:


On Feb 26, 2007, at 12:06 PM, Edward Vermillion wrote:

>
> Or you can set a constant to the includes directory:
>
> <?php
>
> define('INCLUDE_DIR', '/files/include');
>
> include INCLUDE_DIR.'foo.php';
>

Ooopps... should be define('INCLUDE_DIR', '/files/include/');

forgot the last '/'...

attached mail follows:


In news: 45E21F28.7030103gmail.com,
"Martin Zvarík" said:
>> Difference: You don't call file as http://www.myweb.com/ but instead
>> you use the path like c:\some.txt or ../some.txt etc.
>>
>> PHP 5
>> =====
>> echo file_get_contents("some.txt");

Works a treat

Cheers
Chris

--
Cheap As Chips Broadband http://yeah.kick-butt.co.uk
Superb hosting & domain name deals http://host.kick-butt.co.uk

attached mail follows:


I have a question on how to retrieve the value that corresponds to a
key in an array.

$fruit = array('a' => 'apple', 'b' => 'banana', 'c' => 'cranberry');

                $key = array_search($c, $fruit);
                if ( $key === FALSE )
                        $n = $c;
                else
                {
                        $n = $fruit[$key]; // how to get the value???
                }

the array_search works ok, but how do I get the value?

all I get back is 'a' or 'b', not 'apple' or 'banana'...

TIA

Gerry