简体   繁体   English

使用跨域表单处理器的PHP会话

[英]PHP sessions using cross domain form processor

I have a download page on my site. 我的网站上有一个下载页面。 In order to reach it you have to fill out a form, unfortunately due to legacy coding beyond my control the form is processed via a script on another domain (where our crm lives). 为了达到此目的,您必须填写一张表格,不幸的是,由于我无法控制传统的编码,该表格是通过另一个域(我们的CRM所在的地方)上的脚本处理的。

I am having trouble passing the session value that is added when you successfully submit the form to the download page. 我无法传递成功将表单提交到下载页面时添加的会话值。 Again, the user fills out a form, form is processed and the session value added and they should be returned to the download page. 再次,用户填写表单,处理表单并添加会话值,然后应将其返回到下载页面。

The download page should be inacessible in any other situation. 在任何其他情况下,下载页面均不可访问。 Don't want people bypassing the form and going straight to the download. 不想让人们绕过表格直接进入下载。

processor script code 处理器脚本代码

<?PHP
  session_start();
  //lots of database stuff

  //successful insertion to database
  if (($row = mysql_fetch_assoc($result)))
    {
        $redirect .= '?sessionid=xvyXXXXX';
        header("Location: http://" . $redirect);
    }
?>

software download page code 软件下载页面代码

<?php
$code = $_GET['sessionid'];

if(strcmp( $code , 'xvyXXXXX'  ) != 0) {
    header("Location: http://kinetick.com/V3/download-registration.php");
} else {
       header("Location: http://kinetick.com/V3/download-software.php");
}
?>

I can't get this to work. 我无法使它正常工作。 Is there another way taking into account the processor script is on another domain? 还有其他方法可以考虑处理器脚本在另一个域中吗? currently when I remove the if/else and put a print its showing an empty array. 当前,当我删除if / else并打印时显示一个空数组。 Need some help big time! 需要一些帮助! thx all 全部

header("Location: http://" . $redirect); header(“ Location:http://”。$ redirect);

this line will eventually look like this... 这条线最终看起来像这样...

http://?sessionid=1234xxx http://?sessionid = 1234xxx

missing something? 遗漏了什么?

yes

should be http://domain.com/somepage.php?sessionid=1234xxx 应该是http://domain.com/somepage.php?sessionid=1234xxx

... I would rather check out the curl library as this will hide the session id and user would never know what session id was passed to that website unless they have read this post :) ...我宁愿签出curl库,因为它会隐藏会话ID,除非用户已阅读此帖子,否则用户将永远不知道将哪个会话ID传递给该网站:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM