Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/299.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP从不同的页面获取输入_Php_Html - Fatal编程技术网

PHP从不同的页面获取输入

PHP从不同的页面获取输入,php,html,Php,Html,因此,这不是从一个页面到另一个页面的典型get post 基本上,我在我的网站上有一个密码重置功能,所以用户将在一个页面上输入他们的电子邮件地址,他们收到一封带有重置链接的电子邮件,该链接末尾有一个令牌,当他们打开该链接时,它只要求他们输入新密码,确认新密码并提交,仅此而已,此页面上根本未使用/引用电子邮件。它可以很好地用于最初的目的,但现在我正在将一个XML服务端点集成到其中,因此当客户在新密码屏幕上重置密码时,它也会在XML服务端点上更新他们的密码,但需要他们的电子邮件登录到该帐户,以便更新

因此,这不是从一个页面到另一个页面的典型get post

基本上,我在我的网站上有一个密码重置功能,所以用户将在一个页面上输入他们的电子邮件地址,他们收到一封带有重置链接的电子邮件,该链接末尾有一个令牌,当他们打开该链接时,它只要求他们输入新密码,确认新密码并提交,仅此而已,此页面上根本未使用/引用电子邮件。它可以很好地用于最初的目的,但现在我正在将一个XML服务端点集成到其中,因此当客户在新密码屏幕上重置密码时,它也会在XML服务端点上更新他们的密码,但需要他们的电子邮件登录到该帐户,以便更新我无法使用的密码

我尝试过会话和Post以及Get,但似乎没有任何效果,因为它与“电子邮件”页面的会话与“新密码”、“确认新密码”页面的会话不完全相同

controller中有这两个被遗忘的.php的后端页面,基本上只引用预定义的语言(entry\u email引用另一个php文件,即$entry\u email=“请输入您的电子邮件地址:”

然后是模型的另一个页面,该页面指向MySQL数据库并对其进行更新/更改/查询

请求电子邮件页面:

<?php echo $header; ?>
<div id="content">
    <?php if ($error_warning) { ?>
    <div class="warning"><?php echo $error_warning; ?></div>
    <?php } ?>
  <div class="content-title">
    <h1><?php echo $content_title; ?></h1>
  </div>
  <form action="index.php?route=account/forgotten" method="post" enctype="multipart/form-data">
    <center><p><?php echo $text_email; ?></p></center>
    <div class="content">
    <h2><?php echo $text_your_email; ?></h2>
      <table class="form">
        <tr>
          <td><?php echo $entry_email; ?></td>
          <td><input type="text" name="email" value="<?php echo $email; ?>" /></td>
        </tr>
      </table>
        <div class="page_buttons">
          <a href="<?php echo $back; ?>" class="button b_left"><?php echo $button_back; ?></a>
          <input type="submit" value="<?php echo $button_submit; ?>" class="button b_right" />
        </div>
    </div>
  </form>
  <?php echo $content_bottom; ?></div>
  <div id="placeholder"></div>
<?php echo $footer; ?>
公共函数重置()代码:


在用户更改密码的页面中,当处理来自该页面的提交时,您肯定知道用户是谁吗?您不能基于知道他们是谁来确定他们的电子邮件地址吗?是的,所以当他们提交新密码并确认新密码时,它基本上会在MySQL中进行更新,其中令牌与客户匹配帐户。我尝试创建一个单独的MySQL查询来获取令牌匹配的电子邮件地址,但不起作用,当我执行回显时显示为空白,但当我在python中使用相同的方法时,它成功地提取了电子邮件地址。
“我尝试创建一个单独的MySQL查询,以获取令牌匹配的电子邮件地址,但不起作用,显示为空白“
-这听起来像是一个需要纠正的错误,我们可以用它来帮助提供有关问题的信息。但是我无法想象在不知道用户是谁的情况下如何更新用户的密码…我更新了原始帖子,添加了更多的代码,说明如何让该客户使用代币
<div id="content">
    <?php if ($error_warning) { ?>
        <div class="warning"><?php echo $error_warning; ?></div>
    <?php } else { ?>
      <div class="content-title">
        <h1><?php echo $reset_content_title; ?></h1>
      </div>
      <form action="index.php?route=account/forgotten/reset" method="post" enctype="multipart/form-data">
        <div class="content">
        <h2><?php echo $reset_content_title; ?></h2>
          <table class="form">
            <tr>
              <td><?php echo $entry_password; ?></td>
              <td><input type="password" name="password" value="" />
                <?php if ($error_password) { ?>
                <span class="error"><?php echo $error_password; ?></span>
                <?php } ?></td><input type="hidden" name="token" value="<?php echo $_GET['token'];?>" />
            </tr>
            <tr>
              <td><?php echo $entry_confirm; ?></td>
              <td><input type="password" name="confirm" value="" />
                <?php if ($error_confirm) { ?>
                <span class="error"><?php echo $error_confirm; ?></span>
                <?php } ?></td>
            </tr>
          </table>
          <div class="page_buttons">
            <input type="submit" value="<?php echo $button_reset; ?>" class="button b_right" />
          </div>
        </div>
      </form>
    <?php } ?>
  <?php echo $content_bottom; ?></div>
  <div id="placeholder"></div>
<?php echo $footer; ?>
    public function editPasswordByToken($token, $password) {
    $this->db->query("UPDATE " . DB_PREFIX . "customer SET cus_code ='',                        cus_password = '" . $this->db->escape(sha1($password)) . "' WHERE cus_code = '" . $this->db->escape($token) . "' LIMIT 1 ");
}
    public function getCustomerByToken($token) {
    $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE cus_code = '" . $this->db->escape($token) . "' LIMIT 1 ");

    return $query->row;
}
        if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->resetvalidate()) {

        $this->submitMiva();  

        $this->model_account_customer->editPasswordByToken($this->request->post['token'], $this->request->post['password']); 

        $this->session->data['success'] = $this->language->get('text_reset_success');

        //$this->redirect($this->url->link('account/login', '', 'SSL'));
    }