Facebook php登录问题

时间:2019-06-01 00:50:29

标签: php facebook facebook-login

当我使用尚未在数据库中注册的用户登录Facebook时,它返回错误消息,有什么方法可以注册用户的电子邮件,而不返回“未注册的用户”消息?

我尝试了一些操作,例如插入一段注册码,但没有结果

try {
  // Returns a `Facebook\FacebookResponse` object
  $response = $fb->get('/me?fields=name, email');
  $user = $response->getGraphUser();
  //var_dump($user);
  $sql = "SELECT * FROM usuarios WHERE email='".$user['email']."' LIMIT 1";

  $resultado = @mysqli_query($conect, $sql);

  $linhas = mysqli_num_rows($resultado);

  if($linhas==0) {
  function myAlert($msg, $url){

    echo '<script language="javascript">alert("'.$msg.'");</script>';
    echo "<script>document.location = '$url'</script>";
}
myAlert("Email ou Senha incorretos! Verifique os dados inseridos!", "/SITE(TCC)/CADASTRO/index.html");
}
else{ 
$_SESSION["autenticado"]="rfc822_allowed";
$_SESSION["login"]=$email;
header("Location:/SITE(TCC)/LOGIN/profile.php");
}

0 个答案:

没有答案