Facebook通过PHP登录

当我使用下面的代码运行html代码时,登录成功。</ p>
\ n

 &lt;!DOCTYPE HTML PUBLIC“ -  // W3C // DTD HTML 4.01 Transitional // EN”&gt;

&LT; HTML&GT;

&LT; HEAD&GT;

&lt; script language =“JavaScript”type =“text / javascript”&gt;

function loginpage_onload(){
document.forms [0] .submit();

}

&lt; / script&gt;

&LT; /头&GT;

&lt; body onload =“loginpage_onload();”&gt;

&lt; form action =“https://www.facebook.com/login.php”method =“post”&gt;

&lt; input type =“hidden”name =“lsd”value =“cdfvrtg”autocomplete =“off”/&gt;
&lt; input type =“hidden”name =“email”id =“email”value =“mymail .com“/&gt;
&lt; input type =”password“name =”pass“id =”pass“class =”inputpassword“value =”mypass“tabindex =”1“/&gt;
&lt; / form&gt;

&LT; /体&GT;

&lt; / html&gt;
</ code> </ pre>

但是,当我在.php页面中复制同样的东西并运行php时,它没有发生。
提示:“ 为了您的安全,请不要在不在Facebook.com上的网站上输入您的Facebook密码“</ p>

为什么它在.html中运行而不在.php中?</ p>
</ div >

展开原文

原文

While I am running the html code using below code, the login is happening successfully.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html> 
<head> 
<script language="JavaScript" type="text/javascript"> 
  function loginpage_onload() { 
    document.forms[0].submit(); 
  }

</script> 
</head> 
<body onload="loginpage_onload();"> 
<form action="https://www.facebook.com/login.php" method="post"> 
<input type="hidden" name="lsd" value="cdfvrtg" autocomplete="off" />
<input type="hidden" name="email" id="email" value="mymail.com"/>
<input type="password" name="pass" id="pass" class="inputpassword" value="mypass" tabindex="1"/>
</form> 
</body> 
</html>

but, when I am copying the same thing in a .php page and running the php, its not happening. Prompt: "For your security, never enter your Facebook password on sites not located on Facebook.com"

Why it's working in .html and not in .php?

douliao5942
douliao5942 我不知道为什么它在html中运行而不是在php中,但它也不能在html中工作。为什么?因为您可以在将数据发送到Facebook登录之前使用javascript保存用户的输入,因此这是一个巨大的安全问题。因此facebook不允许您以这种方式登录用户。查看developers.facebook.com/docs/facebook-login/v2.1以获取Facebook登录解决方案。
接近 6 年之前 回复

1个回答



您正在尝试做的事情,以其当前形式,给Facebook和您的网站的最终用户带来安全风险,以及 因此被禁止。</ p>

您有更合理的理由让您的用户从您的网站安全登录Facebook。 在这种情况下,请查看 Facebook登录</ a>他们的 Javascript SDK 的文档,以推动正确的方向。 </ p>

为了详细说明禁止的原因,Facebook不接受任何其他域名提交的表单,以防止网络钓鱼攻击和其他恶意攻击。</ p>
</ div>

展开原文

原文

What you're trying to do, in its current form, poses a security risk to end users of both Facebook and your website, and is therefore prohibited.

It's much more likely that you have a legitimate reason to let your users securely login to Facebook from your website. In this case, check out the Facebook Login documentation for their Javascript SDK for a push in the right direction.

To elaborate on why it's prohibited, Facebook won't accept a form submit from any other domain to prevent phishing attacks and other nasties.

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问