douguan3470 2015-04-04 10:15
浏览 4

哪个在facebook popup关闭时更安全?

a quick simple question , my intention is $user run 1st before isset $user , what i am doing isit risky? will it cause any error by possible. so far no problem.

my code

session start();

$user = $facebook->getUser();

if($user){ // i want it to run this script 1st
try{
    $user_profile = $facebook->api('/me');
    $_SESSION['User'] = $user_profile;
}catch(FacebookApiException $f){
    echo '<pre>'.htmlspecialchars(print_r($f, true)).'</pre>';
    $user = null;
}
}

$loginUrl = $facebook->getLoginUrl(array(
'scope'=> 'email,user_education_history',
'display'=>'popup',
));

if(isset($user)){ //this come up after 
    echo "<script>
    window.close();
    window.opener.location.href = 'index.php';
    </script>";
}

Myway: i load and close the window at the same script , with closing the window if $user is set(isset) but will be too risky ??? will it cause any problem ??

Someone way: some one do redirect to other empty page just to close the window , only window.close(); inside ,it looks more safety but seem loading a other page with no reason.

so which one is more safe ???

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥50 三种调度算法报错 有实例
    • ¥15 关于#python#的问题,请各位专家解答!
    • ¥200 询问:python实现大地主题正反算的程序设计,有偿
    • ¥15 smptlib使用465端口发送邮件失败
    • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
    • ¥15 对于squad数据集的基于bert模型的微调
    • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
    • ¥20 steam下载游戏占用内存
    • ¥15 CST保存项目时失败
    • ¥20 java在应用程序里获取不到扬声器设备