Loading ...
Sorry, an error occurred while loading the content.
 

Does This Class Work with Register_Globals = Off?

Expand Messages
  • fchang
    Hi Manuel, I had originally posted this question on freshmeat.net but I thought that it would be better served if I move the thread to this forum since others
    Message 1 of 4 , Oct 12 11:30 PM
      Hi Manuel,

      I had originally posted this question on freshmeat.net but I thought
      that it would be better served if I move the thread to this forum
      since others may benefit from your advice as well.

      My original question was:

      "I'm running Php 5.0 with Register_Globals = Off. I seem to have a
      problem when calling the $form->WasSubmitted function. The function
      keeps returning a null string even though the form was submitted
      previously. It seems that the IsSetValue method makes uses of
      globals.

      Is this class certified for Php 5.0 with register_globals off? If
      not, any suggestions on how we might be able to make it work?

      Thanks in advance for your input."

      Your reply on freshmeat.net was:

      "No, the IsSetValue function also checks the $_POST and $_GET
      variables, so there is no reason for it not work as intended.

      I suspect that you are not specifying a specific input name for the
      WasSubmitted function to check and that makes it traverse all the
      form fields to determine which submit button was used.

      In this case, it only works if the submit inputs in your form set
      the NAME attribute. Otherwise the class does not have a reliable way
      to determine whether the form was submitted.

      If this is your problem, just define the NAME attribute of your form
      submit inputs."

      Going back to my sample project, I was supplying a specific input
      name when calling the WasSubmitted function. The NAME attribute was
      also supplied when adding the submit input to the form.

      I further checked the class file which had the following header:

      $Header: /home/mlemos/cvsroot/forms/forms.php,v 1.165 2004/07/14
      08:39:47 mlemos Exp $

      and the IsSetValue function is defined as the following:

      Function IsSetValue($variable,$file)
      {
      global $HTTP_POST_FILES,$HTTP_POST_VARS,$HTTP_GET_VARS;

      return(($file ? IsSet($HTTP_POST_FILES[$variable]) : (IsSet
      ($HTTP_GET_VARS[$variable]) || IsSet($HTTP_POST_VARS[$variable])))
      || IsSet($GLOBALS[$variable]));
      }

      which does not check for the $_POST and $_GET super globals.

      I may be missing something simple here since I am still fairly new
      to the PHP world. I would appreciate any additional insight you may
      provide into this issue.

      Thanks again for all your help.

      Francis
    • Manuel Lemos
      Hello, ... Now that you mentioned it, I realized that I have changed that last month but did not upload the updated version. I just did it now. Please check it
      Message 2 of 4 , Oct 13 1:17 PM
        Hello,

        On 10/13/2004 03:30 AM, fchang wrote:
        > Going back to my sample project, I was supplying a specific input
        > name when calling the WasSubmitted function. The NAME attribute was
        > also supplied when adding the submit input to the form.
        >
        > I further checked the class file which had the following header:
        >
        > $Header: /home/mlemos/cvsroot/forms/forms.php,v 1.165 2004/07/14
        > 08:39:47 mlemos Exp $
        >
        > and the IsSetValue function is defined as the following:
        >
        > Function IsSetValue($variable,$file)
        > {
        > global $HTTP_POST_FILES,$HTTP_POST_VARS,$HTTP_GET_VARS;
        >
        > return(($file ? IsSet($HTTP_POST_FILES[$variable]) : (IsSet
        > ($HTTP_GET_VARS[$variable]) || IsSet($HTTP_POST_VARS[$variable])))
        > || IsSet($GLOBALS[$variable]));
        > }
        >
        > which does not check for the $_POST and $_GET super globals.
        >
        > I may be missing something simple here since I am still fairly new
        > to the PHP world. I would appreciate any additional insight you may
        > provide into this issue.

        Now that you mentioned it, I realized that I have changed that last
        month but did not upload the updated version. I just did it now. Please
        check it in the PHP Classes site. Thank you for reporting.


        --

        Regards,
        Manuel Lemos

        PHP Classes - Free ready to use OOP components written in PHP
        http://www.phpclasses.org/

        PHP Reviews - Reviews of PHP books and other products
        http://www.phpclasses.org/reviews/

        Metastorage - Data object relational mapping layer generator
        http://www.meta-language.net/metastorage.html
      • fchang
        Hi Manuel, Thanks. The new version now works! I have noticed a documentation error as well. The documentation states that the AddInput function takes
        Message 3 of 4 , Oct 15 11:10 PM
          Hi Manuel,

          Thanks. The new version now works!

          I have noticed a documentation error as well. The documentation
          states that the AddInput function takes
          parameter "ReplaceExpressions" to perform input value
          transformations; however, the actual code is looking
          for "ReplacePatterns" instead. Thus, if you pass
          in "ReplaceExpressions" as the input arry to the AddInput function,
          the transformation does not work.

          Also, is it possible to turn off client side transformation even if
          the browser has Javascript enabled?

          Thanks.


          --- In forms-dev@yahoogroups.com, Manuel Lemos <mlemos@a...> wrote:
          > Hello,
          >
          > On 10/13/2004 03:30 AM, fchang wrote:
          > > Going back to my sample project, I was supplying a specific
          input
          > > name when calling the WasSubmitted function. The NAME attribute
          was
          > > also supplied when adding the submit input to the form.
          > >
          > > I further checked the class file which had the following header:
          > >
          > > $Header: /home/mlemos/cvsroot/forms/forms.php,v 1.165 2004/07/14
          > > 08:39:47 mlemos Exp $
          > >
          > > and the IsSetValue function is defined as the following:
          > >
          > > Function IsSetValue($variable,$file)
          > > {
          > > global $HTTP_POST_FILES,$HTTP_POST_VARS,$HTTP_GET_VARS;
          > >
          > > return(($file ? IsSet($HTTP_POST_FILES[$variable]) : (IsSet
          > > ($HTTP_GET_VARS[$variable]) || IsSet($HTTP_POST_VARS
          [$variable])))
          > > || IsSet($GLOBALS[$variable]));
          > > }
          > >
          > > which does not check for the $_POST and $_GET super globals.
          > >
          > > I may be missing something simple here since I am still fairly
          new
          > > to the PHP world. I would appreciate any additional insight you
          may
          > > provide into this issue.
          >
          > Now that you mentioned it, I realized that I have changed that
          last
          > month but did not upload the updated version. I just did it now.
          Please
          > check it in the PHP Classes site. Thank you for reporting.
          >
          >
          > --
          >
          > Regards,
          > Manuel Lemos
          >
          > PHP Classes - Free ready to use OOP components written in PHP
          > http://www.phpclasses.org/
          >
          > PHP Reviews - Reviews of PHP books and other products
          > http://www.phpclasses.org/reviews/
          >
          > Metastorage - Data object relational mapping layer generator
          > http://www.meta-language.net/metastorage.html
        • Manuel Lemos
          Hello, ... Ah, right. I have just fixed that now. Thanks for the notice. ... Not yet. I will add an option for the next release. -- Regards, Manuel Lemos PHP
          Message 4 of 4 , Oct 21 11:38 AM
            Hello,

            On 10/16/2004 03:10 AM, fchang wrote:
            > I have noticed a documentation error as well. The documentation
            > states that the AddInput function takes
            > parameter "ReplaceExpressions" to perform input value
            > transformations; however, the actual code is looking
            > for "ReplacePatterns" instead. Thus, if you pass
            > in "ReplaceExpressions" as the input arry to the AddInput function,
            > the transformation does not work.

            Ah, right. I have just fixed that now. Thanks for the notice.


            > Also, is it possible to turn off client side transformation even if
            > the browser has Javascript enabled?

            Not yet. I will add an option for the next release.


            --

            Regards,
            Manuel Lemos

            PHP Classes - Free ready to use OOP components written in PHP
            http://www.phpclasses.org/

            PHP Reviews - Reviews of PHP books and other products
            http://www.phpclasses.org/reviews/

            Metastorage - Data object relational mapping layer generator
            http://www.meta-language.net/metastorage.html
          Your message has been successfully submitted and would be delivered to recipients shortly.