Mi a hiba :D? (lent)
index:
<html>
<head>
</head>
<body>
<form method="post" action="valami.php"
<input type="text" name="username"><br>
<input type="password" name="password"><br>
<input type="submit" value="mehet">
</form>
</body>
</html>
valami.php
<?php
$username = $_POST[username];
$password = $_POST[password];
if (username == "milan" and $password == "nemiromide:D")
{
header('Location: page.html');
}
else
{
print "sikertelen :)";
}
?>
azt akarom hogy page.html jusson el ha helyes a jelszuo de akkor is cska aztirja ki sikertelen:S :(










itt a hiba:
$username = $_POST[username];
$password = $_POST[password];
helyesen:
$username = $_POST['username'];
$password = $_POST['password'];





-if (username == "milan" and $password == "nemiromide:D")
meg ez a sor se stimmel igazan. $username-mel probald.





ajjaj most hogy átnéztem még egy dolog nem stimmel:
rossz:
if (username == "milan" and $password == "nemiromide:D")
jó:
if (($username == "milan") and ($password == "nemiromide:D"))





if (($username == "milan") and ($password == "nemiromide:D"))
akko mar inkabb:
if ($username=="milan" && $password=="nemiromide:D")





a prioritása más. nézz utána php könyvekben.
18:39es: tökmindegy mindegyik megoldás jó.
18:00
18:10
-es válaszoló voltam
Kapcsolódó kérdések:
Minden jog fenntartva © 2025, www.gyakorikerdesek.hu
GYIK | Szabályzat | Jogi nyilatkozat | Adatvédelem | Cookie beállítások | WebMinute Kft. | Facebook | Kapcsolat: info(kukac)gyakorikerdesek.hu
Ha kifogással szeretne élni valamely tartalommal kapcsolatban, kérjük jelezze e-mailes elérhetőségünkön!