doushi1473 2017-04-03 22:13
浏览 81

POST数据存储在我们的页面中? [重复]

This question already has an answer here:

Sorry, this is a bit of a noob question, but...

I am creating a login page and I am having difficulty getting the login page to send me back to the web page that prompted the login redirect...

Can the previous page be stored via POST variable and accessed on the next page (login.php)?...I am having trouble just keeping that webpage url...if someone could show me how and explain why that would be amazing!

If I could just see how it looks to store variables to post so they can be viewed on the next page that would solve all my problems

original webpage:

<?php //how do I post current url so it can be accessed on login require_once('./../User_Auth/includes/authenticate.php'); ?>

login webpage:

`header("Location:");`
</div>
  • 写回答

4条回答 默认 最新

  • doudun1029 2017-04-03 22:20
    关注

    Use this code on the landing page to redirect to the login page, passing the landing page URL as a $_GET variable.

    if ( USER_NEEDS_TO_LOGIN ) {
      $login = "/path/to/login/page";
      $login = $login . '?tgturl=' . $_SERVER[ "REQUEST_URI" ];
      header("Location: $login");
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值