Forms Proccessing

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Honky Tonk Hero

    Forms Proccessing

    Hello,

    I have a premade for that is having probelms dealing with aposterphies
    and forward slahes. Is there a way to edit the code so it does not alter
    aposterphies and forward slahes?
    Example:
    If I enter ' the form displays it as /'
    If I enter / the for displays it as //

    I'm a very very new comer to PHP, so please be gental.

    Thanks in advance for your help,

    HTH Brand
  • Geoff Berrow

    #2
    Re: Forms Proccessing

    I noticed that Message-ID:
    <0l7Od.3164$ZZ. 1106@newssvr23. news.prodigy.ne t> from Honky Tonk Hero
    contained the following:
    [color=blue]
    >If I enter ' the form displays it as /'
    >If I enter / the for displays it as //
    >
    >I'm a very very new comer to PHP, so please be gental.[/color]

    Instead of

    echo $_POST['name_of_field'];

    do

    echo stripslashes($_ POST['name_of_field']);

    --
    Geoff Berrow (put thecat out to email)
    It's only Usenet, no one dies.
    My opinions, not the committee's, mine.
    Simple RFDs http://www.ckdog.co.uk/rfdmaker/

    Comment

    • Alvaro G. Vicario

      #3
      Re: Forms Proccessing

      *** Honky Tonk Hero escribió/wrote (Tue, 08 Feb 2005 18:15:24 GMT):[color=blue]
      > I have a premade for that is having probelms dealing with aposterphies
      > and forward slahes. Is there a way to edit the code so it does not alter
      > aposterphies and forward slahes?
      > Example:
      > If I enter ' the form displays it as /'
      > If I enter / the for displays it as //[/color]

      It's a pretty stupid "feature" that PHP has. It can either be enabled or
      disabled, in your server it seems to be enabled. Check this:



      You can either disable it (if it's possible) or use code to detect it and
      act accordingly.


      --
      -+ Álvaro G. Vicario - Burgos, Spain
      +- http://www.demogracia.com (la web de humor barnizada para la intemperie)
      ++ Manda tus dudas al grupo, no a mi buzón
      -+ Send your questions to the group, not to my mailbox
      --

      Comment

      • Kevin

        #4
        Re: Forms Proccessing

        On Tue, 8 Feb 2005 20:29:47 +0100
        "Alvaro G. Vicario" <kAlvaroNOSPAMT HANKS@terra.es> wrote:
        [color=blue]
        > *** Honky Tonk Hero escribió/wrote (Tue, 08 Feb 2005 18:15:24
        > GMT):[color=green]
        > > I have a premade for that is having probelms dealing with
        > > aposterphies and forward slahes. Is there a way to edit the
        > > code so it does not alter aposterphies and forward slahes?
        > > Example:
        > > If I enter ' the form displays it as /'
        > > If I enter / the for displays it as //[/color]
        >
        > It's a pretty stupid "feature" that PHP has. It can either be
        > enabled or disabled, in your server it seems to be enabled.
        > Check this:[/color]

        Yeah, totally useless.

        [...]
        [color=blue]
        > You can either disable it (if it's possible) or use code to
        > detect it and act accordingly.[/color]

        Yes, and it's better not to depend on the server. Here's a way:

        $r = get_magic_quote s_gpc();

        function strip_r($v) {
        $v = is_array($v) ?
        array_map('stri p_r',$v) : stripslashes($v );
        return $v;
        }

        if ($r) {
        $_POST = array_map('stri p_r', $_POST);
        $_GET = array_map('stri p_r', $_GET);
        $_COOKIE = array_map('stri p_r', $_COOKIE);
        }

        And for runtime magic quotes,

        $i = get_magic_quote s_runtime();
        $r = set_magic_quote s_runtime(0);

        if($i)
        if (!$r)
        print "Can't set. Can't help.\n";

        Comment

        • Honky Tonk Hero

          #5
          Re: Forms Proccessing

          Hey thanks for the great support fellas!

          Now for a very newb question... (I mean very newb. New as in "This is
          the first time I've messed with PHP".)
          Based on the code below, how and were would I set up the code to fix the
          Magic Quotes?

          -- BEGINE CODE --
          $blanks = 0;
          foreach($_POST as $key => $value) {
          if ($value)
          {
          $url .= "&" . $key . "=" . urlencode($valu e);
          }
          else
          {
          if (!(($key == "Address2") || ($key == "OtherNetEquip" ) || ($key ==
          "PVR") || ($key == "PremChanne l") || ($key == "OtherAV") || ($key ==
          "Mailinglis t") || ($key == "Comments") ))
          $blanks++;
          }
          }

          // echo "url:$url<br>\n ";

          // $url = urlencode(urlen code($url));

          // echo "urlencoded:$ur l<br>\n";

          if ($blanks)
          echo '<meta http-equiv="refresh" content="'.$del ay.';url='.$url .'">';
          else
          {
          -- END CODE --

          Thank you very much for your help.

          Warren
          HTH Brand

          Comment

          • Geoff Berrow

            #6
            Re: Forms Proccessing

            I noticed that Message-ID:
            <%sDOd.3718$ZZ. 2210@newssvr23. news.prodigy.ne t> from Honky Tonk Hero
            contained the following:
            [color=blue]
            >Hey thanks for the great support fellas!
            >
            >Now for a very newb question... (I mean very newb. New as in "This is
            >the first time I've messed with PHP".)
            >Based on the code below, how and were would I set up the code to fix the
            >Magic Quotes?[/color]

            <snip>[color=blue]
            > $url .= "&" . $key . "=" . urlencode($valu e);[/color]
            $url .= "&" . $key . "=" . stripslashes(ur lencode($value) );

            --
            Geoff Berrow (put thecat out to email)
            It's only Usenet, no one dies.
            My opinions, not the committee's, mine.
            Simple RFDs http://www.ckdog.co.uk/rfdmaker/

            Comment

            • Honky Tonk Hero

              #7
              Re: Forms Proccessing

              Thanks for the help Geoff!

              I appreciate it.

              James


              Geoff Berrow wrote:[color=blue]
              > I noticed that Message-ID:
              > <%sDOd.3718$ZZ. 2210@newssvr23. news.prodigy.ne t> from Honky Tonk Hero
              > contained the following:
              >
              >[color=green]
              >>Hey thanks for the great support fellas!
              >>
              >>Now for a very newb question... (I mean very newb. New as in "This is
              >>the first time I've messed with PHP".)
              >>Based on the code below, how and were would I set up the code to fix the
              >>Magic Quotes?[/color]
              >
              >
              > <snip>
              >[color=green]
              >> $url .= "&" . $key . "=" . urlencode($valu e);[/color]
              >
              > $url .= "&" . $key . "=" . stripslashes(ur lencode($value) );
              >[/color]

              Comment

              Working...