I'm crazy, why php doesn't transfer variable submitted by web form?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • tigerwang1974@gmail.com

    I'm crazy, why php doesn't transfer variable submitted by web form?

    I had previously installed php-4.3.9 and apache-2.0.49 on my solaris9
    server and written a php script for user login, it ran well until
    today...:-(
    today for some reasons I upgraded php to php-5.1.2, complied as
    apache's DSO module, and I found the script couldn't work when being
    accessed by IE. I didn't know why...It seemed php script hadn't
    transfered variables submmitted by web form to itself...now the
    following is my script:


    <?php
    if ($queryflag == 1) {
    $ybn="admin";
    $ybp="111";
    $ybusername=$_P OST["username"];
    $ybuserpwd=$_PO ST["password"];
    if ($ybusername==$ ybn AND $ybuserpwd==$yb p){
    session_start() ;
    $_SESSION["admin"]=true;
    header("locatio n: testtest.php");
    } else {
    echo <<<EOM
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" >
    <title>login</title>
    <style type="text/css">
    <!--
    ..style5 {font-size: 24px}
    ..style6 {
    font-family: "Times New Roman", Times, serif;
    color: #FF0000;
    }
    ..style7 {
    font-size: 14px;
    color: #FF0000;
    }
    -->
    </style>
    </head>

    <body>
    <table width="200" border="0" align="center">
    <tr>
    <td height="68" colspan="2">
    <form name="form1" method="post" action="login.p hp">
    <table width="474" height="89" border="0"
    background="ima ge/log.gif">
    <tr>
    <td width="77" height="29">&nb sp;</td>
    <input type=hidden name=queryflag value=0>
    <td width="114" valign="bottom" ><input name="username"
    type="text" id="username" size="15"></td>
    <td width="42">&nbs p;</td>
    <td width="125" valign="bottom" ><input name="password"
    type="password" id="password" size="15"></td>
    <td width="82" valign="bottom" ><input name="imageFiel d"
    type="image" src="image/bt-login.gif" width="46" height="19" border="0"
    onclick="this.f orm.queryflag.v alue=1"></td>
    </tr>
    <tr>
    <td colspan="5"></td>
    </tr>
    <tr>
    <td height="26" colspan="5"><sp an class="style7"> username or
    password error!</span></td>
    </tr>
    </table>
    </form> </td>
    </tr>
    </table>
    </body>
    </html>
    EOM;
    }
    } else if (!isset($queryf lag)){
    echo <<<EOM
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" >
    <title>login</title>
    <style type="text/css">
    <!--
    ..style5 {font-size: 24px}
    ..style6 {
    font-family: "Times New Roman", Times, serif;
    color: #FF0000;
    }
    ..style7 {
    font-size: 16px;
    color: #FF0000;
    }
    -->
    </style>
    </head>

    <body>
    <table width="200" border="0" align="center">
    <tr>
    <td height="68" colspan="2">
    <form name="form1" method="post" action="login.p hp">
    <table width="474" height="89" border="0"
    background="ima ge/log.gif">
    <tr>
    <td width="77" height="29">&nb sp;</td>
    <td width="114" valign="bottom" ><input name="username"
    type="text" id="username" size="15"></td>
    <td width="42">&nbs p;</td>
    <input type=hidden name=queryflag value=0>
    <td width="125" valign="bottom" ><input name="password"
    type="password" id="password" size="15"></td>
    <td width="82" valign="bottom" ><input name="imageFiel d"
    type="image" src="image/bt-login.gif" width="46" height="19" border="0"
    onclick="this.f orm.queryflag.v alue=1"></td>
    </tr>
    <tr>
    <td colspan="5"></td>
    </tr>
    <tr>
    <td height="26" colspan="5">&nb sp;</td>
    </tr>
    </table>
    </form> </td>
    </tr>
    </table>
    </body>
    </html>
    EOM;
    }
    ?>

  • Juan José Gutiérrez de QuevedoPérez

    #2
    Re: I'm crazy, why php doesn't transfer variable submitted by webform?

    El 6 Apr 2006 03:21:54 -0700
    tigerwang1974@g mail.com escribió:
    [color=blue]
    > I had previously installed php-4.3.9 and apache-2.0.49 on my solaris9
    > server and written a php script for user login, it ran well until
    > today...:-(
    > today for some reasons I upgraded php to php-5.1.2, complied as[/color]

    well, you probably had register_global s On before, and php-5.1.2
    changed it to off.



    just substitute $queryflag for $_POST['queryflag'] and everything
    should work again




    --
    Juan José Gutiérrez de Quevedo
    Director Técnico (juanjo@iteisa. com)
    ITEISA (http://www.iteisa.com)
    942544036 - 637447953

    Comment

    • Erwin Moller

      #3
      Re: I'm crazy, why php doesn't transfer variable submitted by web form?

      Juan José Gutiérrez de Quevedo Pérez wrote:
      [color=blue]
      > El 6 Apr 2006 03:21:54 -0700
      > tigerwang1974@g mail.com escribió:
      >[color=green]
      >> I had previously installed php-4.3.9 and apache-2.0.49 on my solaris9
      >> server and written a php script for user login, it ran well until
      >> today...:-(
      >> today for some reasons I upgraded php to php-5.1.2, complied as[/color]
      >
      > well, you probably had register_global s On before, and php-5.1.2
      > changed it to off.
      >
      > http://es.php.net/register_globals
      >
      > just substitute $queryflag for $_POST['queryflag'] and everything
      > should work again[/color]

      Hi Juan,

      That was my first guess too, but futheron in the same script he is using the
      $_POST to retrieve variables from the posting.

      Maybe the coder changed his/her mind halfway the script. :-)

      Regards,
      Erwin Moller

      Comment

      • Toby Inkster

        #4
        Re: I'm crazy, why php doesn't transfer variable submitted by web form?

        Juan José Gutiérrez de Quevedo Pérez wrote:
        [color=blue]
        > well, you probably had register_global s On before, and php-5.1.2
        > changed it to off.[/color]

        I concur.

        --
        Toby A Inkster BSc (Hons) ARCS
        Contact Me ~ http://tobyinkster.co.uk/contact

        Comment

        Working...