在我的情况下,我应该使用!=如下所示,还是更合适!有什么区别。!=和!之间的区别==
private function authenticateApi($ip,$sentKey) {
$mediaServerIp = '62.80.198.226';
$mediaServerKey = '45d6ft7y8u8rf';
if ($ip != $mediaServerIp) {
return false
}
elseif ($sentKey != $mediaServerKey) {
return false
}
else {
return true;
}
}
public function setVideoDeletedAction(Request $request)
{
//Authenticate sender
if ($this->authenticateApi($request->server->get("REMOTE_ADDR"),$request->headers->get('keyFile')) != true) {
new response("Din IP [$ip] eller nyckel [********] är inte godkänd för denna åtgärd.");
}
松散的平等是你的一个安全漏洞:http://codepad.org/0j4T3iCl。 – Blender
@Blender你是错的,你能不能至少为自己测试一下代码?链接的页面很蠢 –
因此,由于我完全控制了返回值(来自authenticateApi()),它对我来说不是一个安全漏洞?但可能是authenticateApi()内部的问题,因为我从请求对象中提取值? –