注:php5.3之后的版本才有
int strcmp ( string $str1 , string $str2 )
参数 str1第一个字符串。str2第二个字符串。如果 str1 小于 str2 返回 < 0; 如果 str1 大于 str2 返回 > 0;如果两者相等,返回 0。
这个函数期望传入的变量为字符串类型,当传入其它类型的的时候比如数组,类会发生报错信息,同时也会return 0;虽然报错了,但是却返回了0,可等同于判断相等了
<?php
$password="***************"
if(isset($_POST['password'])){
if (strcmp($_POST['password'], $password) == 0) {
echo "Right!!!login success";n
exit();
} else {
echo "Wrong password..";
}
?>
可以利用以上代码来验证这个漏洞