迁移后PHP会话不起作用

时间:2012-09-25 16:11:04

标签: php facebook session hosting get-request

我有一个小型动态facebook标签,它使用Facebook PHP SDK。它有一个fangate函数,脚本使用session来存储getRequest,因此fangate也可以在tab中的子页面上工作。

它工作得很好,但是现在我们将脚本移动到其他托管服务器并使用SSL,看起来会话不再存储在新服务器上。

有谁知道问题出在哪里?

这是index.php脚本:

<?php
session_start();
require 'src/facebook.php';

// Create our Application instance (replace this with your appId and secret).
$facebook = new Facebook(array(
  'appId' => '419696674760950',
  'secret' => 'THE SECRET',
));

$user = $facebook->getUser();

if ($user) {
  try {
    $likes = $facebook->api("/me/likes/145577828869070");
    if( !empty($likes['data']) )
        echo "I like!";
    else
        echo "not a fan!";
  } catch (FacebookApiException $e) {
    error_log($e);
    $user = null;
  }
}

if ($user) {
  $logoutUrl = $facebook->getLogoutUrl();
} else {
  $loginUrl = $facebook->getLoginUrl(array(
    'scope' => 'user_likes'
  ));
}


$signed_request = $facebook->getSignedRequest();
$signedRequest = $facebook->getSignedRequest();
if(isset($signed_request)) $_SESSION['signedRequest'] = $signed_request;
else $signed_request = $_SESSION['signedRequest'];


$page_id = $signed_request["page"]["id"];
$page_admin = $signed_request["page"]["admin"];
$like_status = $signed_request["page"]["liked"];
$country = $signed_request["user"]["country"];
$locale = $signed_request["user"]["locale"];



include ("header.php");
if(!isset($_GET['page'])) $_GET['page']="";
switch($_GET['page']) {

case "1":
$_SESSION['signedRequest'];
// If a fan is on your page
if ($like_status) {
include('leftside.html'); include('informace.html');
} else {
// If a non-fan is on your page
include ("nonfan2.html");}
break;

case "2": include('reference.html'); break;
case "3": include('clanky.html'); ;break;

case "4":
$_SESSION['signedRequest'];
// If a fan is on your page
if ($like_status) {
include ("formular.html");
} else {
// If a non-fan is on your page
include ("nonfan.html");}
;break;

case "5": include('clanok1.html'); break;
case "6": include('clanok2.html'); break;
case "7": include('clanok3.html'); break;
case "8": include('clanok4.html'); break;

default:
$_SESSION['signedRequest'];
// If a fan is on your page
if ($like_status) {
include('leftside.html'); include('informace.html');
} else {
// If a non-fan is on your page
include ("nonfan2.html");}
}
include ("footer.html");
?>

0 个答案:

没有答案