0

First I apologize if this has already been asked; I used the SO search & advanced search and even an hours' worth of GoogleFu, all to no avail.

The issue I'm having is that any time I try and use a query in my URL it causes a 404.

127.0.0.1/login.php throws an error saying the required query (&asdfasdf=?) doesn't exist, but otherwise works fine... http://puu.sh/2SIyc.png

127.0.0.1/login.php&asdfasdf=5 causes 404... http://puu.sh/2SIxF.png

What I've tried: Through my extensive searching, a lot of results turned up that certain query names "aren't allowed" if they're already used by the CMS in question. This isn't using a CMS, and even if there's something funky in the PHP back-end which claims some query names, I doubt they're called "asdfasdf" like mine.

Any ideas?

My code:

<?php include('header.php') ?>

<!-- Primary Content -->
<div class="row">
  <div class="span12" style="border: 1px solid #000;">

    <div class="row">
      <div class="span12">
        <?php 
        $error = $_GET["asdfasdf"]; 
        if(is_null($error)){
          echo "<h1> THE &asdfasdf=X RESOLVED TO NULL </h1>";
        } else {
          echo "<h1> Your passwords did not match </h1>";
        }
        ?>
      </div>
    </div>

    <div class="row" id="login-container">

      <!-- Left-hand-side; login form-->
      <div class="span6">
        <form class="form-horizontal">
          <div class="control-group">
            <label class="control-label" for="inputEmail">Email</label>
            <div class="controls">
              <input type="text" id="inputEmail" placeholder="Email">
            </div>
          </div>
          <div class="control-group">
            <label class="control-label" for="inputPassword">Password</label>
            <div class="controls">
              <input type="password" id="inputPassword" placeholder="Password">
            </div>
          </div>
          <div class="control-group" id="sign-in">
            <label class="checkbox">
              <input type="checkbox"> Remember Me </input>
            </label>
            <button type="submit" class="btn">Sign in</button>
          </div>
        </form>
      </div>

      <!-- Right-hand-side; register form-->
      <div class="span6" id="register-container">
        <form class="form-horizontal" id="register-container" method="post" action="register_validate.php">
          <div class="control-group">
            <label class="control-label" for="inputEmail">Email Address</label>
            <div class="controls">
              <input type="text" id="email" name="email" placeholder="Email">
            </div>
            <span class="help-block indented-help-block">This will be your username.</span>
          </div>
          <div class="control-group">
            <label class="control-label" for="inputPassword">Password</label>
            <div class="controls">
              <input type="password" id="password" name="password" placeholder="Password">
            </div>
          </div>
          <div class="control-group">
            <label class="control-label" for="inputPasswordConfirmation">Confirm password</label>
            <div class="controls">
              <input type="password" id="passwordConfirmation" name="passwordConfirmation" placeholder="Password">
            </div>
          </div>
          <div class="control-group" id="register">
            <label class="checkbox">
              <input type="checkbox">Log in immediately</input>
            </label>
            <button type="submit" class="btn">Register</button>
          </div>
        </form>
      </div>

    </div>
  </div>
</div>

<?php include('footer.php') ?>
4

4 回答 4

4

尝试使用 a?而不是&第一个参数。 127.0.0.1/login.php?asdfasdf=5 代替 127.0.0.1/login.php&asdfasdf=5

于 2013-05-13T17:26:13.413 回答
1

查询字符串应以以下格式开始。

SOME-SITE/SOME-PAGE.php?param1=value1¶m2=value2&...

当然不需要参数..主要应该是页面和查询字符串之间的问号。和参数之间的和号。

于 2013-05-13T17:27:07.023 回答
1

将 替换&?。你需要告诉 PHP 你有一个查询字符串。问号是这样做的方法。

于 2013-05-13T17:27:15.013 回答
0

您应该使用isset()检查 GET 参数,因为 is_null() 将断言 var 等于NULL

于 2013-05-13T17:34:29.517 回答