0

大家好,我正在创建一个 TOS 弹出窗口,如果用户拒绝 .ajax 函数,则会调用一个 .php 文件,该文件会破坏他们的会话并将它们发送回登录页面。

这是一个受 SSL 锁保护的站点,所以我收到一条错误消息:

where the ajax function is that gets the other page with the destroy session and redirect显示不安全内容的页面来自the login page which is suppose to be sent to, the user.

功能:

function decline(){

 $("#dialog-container").dialog( 'close' );
 /*****run ajax to kill session of current user and return to login page ******/
  $.ajax({ url: 'termsofservice/declinedkill.php',
         data: {},
         type: 'get',
         success: function(output) {
                  }
});
}

这是被拒绝的kill.php:

session_start();
session_destroy();

header("location:/PCG/mainlogin.php");

我确保我没有使用任何包含其他文件等的链接......所以不确定出了什么问题。

谢谢,大卫:)

编辑:

这是我正在使用的更新链接:

$.ajax({ url: '//mysite.com/PCG/termsofservice/declinedkill.php',
         data: {},
         type: 'post',
         success: function(output) {
                  }
});

拒绝kill.php

header("location:https://mysite.com/PCG/mainlogin.php");

所以现在我没有收到该消息,但我没有被重定向?

4

1 回答 1

1

如果您的站点在 SSL 上,您还需要调用脚本的 SSL URL。

所以像这样:

function decline(){

 $("#dialog-container").dialog( 'close' );
 /*****run ajax to kill session of current user and return to login page ******/
  $.ajax({ url: '//yoursite.com/termsofservice/declinedkill.php',
         data: {},
         type: 'get',
         success: function(output) {
                  }
});
}

// 代替 https:// 或 http:// 它用于自动选择正确的 URI 方案。它们被称为相对于协议的 URL。检查此链接以了解有关它们的更多信息。

于 2013-01-16T21:13:05.780 回答