通过php运行错误500
我正在尝试向我的根服务器发送数据的特定方式通过php运行错误500,php,html,server,Php,Html,Server,我正在尝试向我的根服务器发送数据的特定方式 所以我做了一个表格: <form action="upload.php" id="s2" style="display: block;" method="post" enctype="multipart/form-data"> <p> <input type="file" name="fileToUpload" id="fileToUpload"></p> <p&g
所以我做了一个表格:
<form action="upload.php" id="s2" style="display: block;" method="post" enctype="multipart/form-data">
<p>
<input type="file" name="fileToUpload" id="fileToUpload"></p>
<p><input style="margin:0px" onchange="document.getElementById('adm11').disabled = !this.checked;document.getElementById('adm12').disabled = !this.checked;" class="w3-check" type="checkbox" name="option1">
<label class="w3-validate">Admin</label><input id="adm11" style="margin:0 0 0 20px;" class="w3-check" type="checkbox" name="option2" disabled="">
<label class="w3-validate">OverWrite</label></p>
<p>
<button class="w3-btn w3-blue">Submit</button><input id="adm12" class="w3-input" name="pass1" type="password" style="display:inline-block;width:60%;margin-left:15px;" disabled=""></p>
</form>
有人有办法解决这个问题吗 您没有
在echo$pass2
之后,除了您在echo$pass2
中遗漏了结束分号之外,还有一些错误,您在这里用一个等号进行赋值(一方面):
而不是使用以下两种方法进行比较:
if ($pass2 == $_POST["pass1"])
此处的分号也放错了位置:
if ($pass2 = $_POST["pass1"]) {echo "yes"};
^ right there
应该读为
if ($pass2 == $_POST["pass1"]) { echo "yes"; }
参考资料:
另外,请检查您试图读取的文件的权限是否正确,以及文件的路径是否正确。将HTML替换为以下行:
<button class="w3-btn w3-blue">Submit</button><input id="adm12" class="w3-input" name="pass1" type="password" style="display:inline-block;width:60%;margin-left:15px;" disabled=""></p>
</form>
当然,但你错过了一些东西。@fred ii错过了一些特别的东西
if ($pass2 == $_POST["pass1"]) { echo "yes"; }
<button class="w3-btn w3-blue">Submit</button><input id="adm12" class="w3-input" name="pass1" type="password" style="display:inline-block;width:60%;margin-left:15px;" disabled=""></p>
</form>
<input id="adm12" class="w3-input" name="pass1" type="password" style="display:inline-block;width:60%;margin-left:15px;" value="something" disabled/>
<input type="submit" class="w3-btn w3-blue" value="Submit" />
</p>
</form>
$myfile = fopen("pass3.ini", "r") or die("Unable to open file!");
$pass2 = fread($myfile,filesize("pass3.ini"));
fclose($myfile);
echo $pass2;
echo $_POST["pass1"]; //it will paste "something"
if ($pass2 === $_POST["pass1"]) {echo "yes"};//idk whats in your $pass2 but if its something same you are sending from html then it will print "yes"