OR Statement in PHP Causing issue [closed]
OR Statement in PHP Causing issue [closed]
I am trying to compare md5 value for my files using this condition:
if (md5_file("src/protocol_config.php")!="e5468e87cafe56b79ba232a3a82c051b" ||("src/protocol_func.php")!="04b8dec66a678fd3328b0ddbec7e3f60")
echo "Unauthorized modification detected";
exit();
Both file values are true, but I am still getting this error:
Unauthorized modification detected
If I only use one file without OR condition, it works like charm, so I think there is something wrong in my OR statement, but I am not able to get it. Let me know if someone can help me solve it.
Thanks
This question appears to be off-topic. The users who voted to close gave this specific reason:
md5_file
2 Answers
2
Try
if (md5_file("src/protocol_config.php") !="e5468e87cafe56b79ba232a3a82c051b" || md5_file ("src/protocol_func.php" )!="04b8dec66a678fd3328b0ddbec7e3f60")
echo "Unauthorized modification detected";
exit();
you are missing the md5_file function in the second part of the check.
This should just be closed as a typo, it's not worth a real answer.
– Barmar
Sep 4 '18 at 8:11
You miss md5_file
after the or:
md5_file
if (md5_file("src/protocol_config.php")!="e5468e87cafe56b79ba232a3a82c051b" ||
md5_file("src/protocol_func.php")!="04b8dec66a678fd3328b0ddbec7e3f60")
This should just be closed as a typo, it's not worth a real answer.
– Barmar
Sep 4 '18 at 8:10
you are comparing two strings in the 2nd part of the OR, you missed
md5_file
– ᴄʀᴏᴢᴇᴛ
Sep 4 '18 at 8:00