[英]php password, compare, return true or false
I have a file on my server called "pform.php", this is what it looks like: 我的服务器上有一个名为“ pform.php”的文件,看起来像这样:
<form action="password.php" method="get">
<input type="text" name="password13"/>
<input type="submit" value="Submit!"/>
</form>
I have it transfer to another file called "password.php", this is what it looks like: 我将其传输到另一个名为“ password.php”的文件,它看起来像这样:
<?php
$text=$_GET["password13"];
$right="You entered the right password!";
$wrong="You entered the wrong password!";
if($password13)=="test"
{
echo $right;
}
else
{
echo $wrong;
}
?>
What can I change on line 7 that makes it compare the password "test" and return true or false? 我可以在第7行上进行哪些更改,使其比较密码“ test”并返回true或false?
Thanks! 谢谢!
if($password13)=="test"
应该
if($text=="test")
That's very simple: 这很简单:
$trueOrFalse = ($password13=="test");
if ($trueOrFalse) {
...
Or put it into the if clause directly: 或直接将其放入if子句中:
if ("test" === $password13)
{
...
if ($text == "test")
不
if ($text) == "test"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.