0

從昨天我的網站從Facebook服務器端獲取500服務器錯誤,同時嘗試登錄到該網站,我確定我沒有做任何更新我的代碼,我搜索了一切,但沒有找到任何解決方案。 請檢查我的代碼並幫助我。Facebook驗證問題,500服務器erorr

<?php 
session_start(); 
require 'config/fbconfig.php'; 
require 'facebook/facebook.php'; 
include"core.php"; 
connectdb(); 

$facebook = new Facebook(array(
      'appId' => APP_ID, 
      'secret' => APP_SECRET, 
      )); 


    $user = $facebook->getUser(); 


if ($user) { 
    try { 
    // Proceed knowing you have a logged in user who's authenticated. 
    $user_profile = $facebook->api('/me'); 
    } catch (FacebookApiException $e) { 
    error_log($e); 
    $user = null; 
    } 






    if (!empty($user_profile)) { 
     # User info ok? Let's print it (Here we will be adding the login and registering routines) 

     $username = $user_profile['name']; 
      $uid2 = $user_profile['id']; 
     $email = $user_profile['email']; 
     $validated = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM users WHERE email='".$email."'")); 
     if($validated[0]== 1){ 
      $get_data = mysql_fetch_array(mysql_query("SELECT * FROM users WHERE email='".$email."'")); 
      $visits = $get_data['visits']; 
      $visits2 = $get_data['visits']+1; 
      $sid= keygen(30); 
      mysql_query("UPDATE users SET fbid='".$uid2."', visits= '".$visits2."', sid='".$sid."' WHERE email='".$email."'"); 


      $_SESSION['sid'] = $sid; 
      $expire=time()+60*60*24*30; 
      setcookie("sid", $_SESSION['sid'], $expire); 

      if($get_data['cat_sec']==0){ 
       header('Location: cat_select.php'); 
       exit(); 

      }else{ 
       if(isset($_SESSION['curl'])){ 
       header('Location:'.$_SESSION['curl']); 
      }else{ 
       header('Location: index.php'); 
      } 
       exit(); 

      } 
     }else{ 
     $sid= keygen(30); 
     $register = mysql_query("INSERT INTO users SET fname='".$username."', email='".$email."', fbid='".$uid2."', active='1' , sid='".$sid."'"); 

      include_once"reg_fb_mail.php"; 
      header('Location: cat_select.php'); 
       exit(); 

     } 

     $permissions = $facebook->api("/me/permissions"); 
    if (array_key_exists('publish_stream', $permissions['data'][0])) { 

     $attachment = array(
    'message' => 'my web site message', 
    'name' => 'www.mywebsite.com!', 
    'caption' => "caption.", 
    'link' => 'http://www.website.com', 
    'description' => 'website description gose here ', 
    'picture' => 'http://website.com/images/fb.png', 
    'actions' => array(
     array(
      'name' => 'www.website.com', 
      'link' => 'http://www.website.com' 
     ) 
    ) 
); 


$result = $facebook->api('/me/feed/', 'post', $attachment); 
} 

    } else { 
     # For testing purposes, if there was an error, let's kill the script 
     die("There was an error."); 
    } 
} else { 
    # There's no active session, let's generate one 
    $login_url = $facebook->getLoginUrl(array('scope' => 'email,publish_stream')); 
    header("Location: " . $login_url); 
} 
?> 

我附上了所有的代碼。請幫我分類這個問題。 謝謝。

+0

http://stackoverflow.com/questions/15651469/error-500-after-todays-push-at-821 – 2013-03-27 17:07:36

回答

0

錯誤數字輸出!問題不在於此代碼。在facebook設置頁面中,我發現APP ID之前有一個空格。它現在修復.. Facebook dosent修剪或刪除空白獲取身份驗證中的參數。 如果有一個無效字符,它會在facebook中獲得500服務器錯誤。 我認爲這是一個嚴重的安全問題。 Hal Rotholz - 謝謝你的線索..

相關問題