Exemplo n.º 1
0
     }
     echo "錯誤?";
     exit;
     break;
     #臉書登入
 #臉書登入
 case 'facebook_callback':
     $results = Api::doSnsLogin(SNS_FACEBOOK, $_GET);
     $_SESSION['is_new_user'] = isset($results['is_new_user']) ? $results['is_new_user'] : 0;
     $com_key = '';
     if (!empty($_SESSION['com_key'])) {
         $com_key = $_SESSION['com_key'];
     }
     if ($results['success'] == 1) {
         dbconn::insert_new_comkey($_SESSION['user']['id'], $com_key);
         dbconn::insert_login_makekey($_SESSION['user']['id'], $com_key, $_SESSION['is_new_user']);
     }
     if ($results['success'] == 0) {
         $next_url = '/event/2015Anniversary/login.php';
         header("content-type: text/html; charset=utf-8");
         echo '<script>alert("登入失敗,請確認帳號密碼是否正確");if(window.opener==null){location.href="' . $next_url . '"}else{window.opener.location.href="' . $next_url . '";self.close()}</script>';
         exit;
     } else {
         User::om2callback();
         if (!empty($_SESSION['com_key'])) {
             $next_url = '/event/2015Anniversary/';
         } else {
             $next_url = '/event/2015Anniversary/final.php';
         }
         $alert_text = '登入成功!';
         if (!empty($_SESSION['com_key'])) {