Ik wil een site maken maar dan moet er een wachtwoord ingevoerd worden voor je erin kan.
Wie heeft zon script?
Wie heeft zon script?
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]POST[/COLOR] [COLOR= #007700]) {[/COLOR]
[COLOR= #0000BB]$md5pwd[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/md5"]md5[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]hoi[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$password[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$md5pwd[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$pass[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/md5"]md5[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]password[/COLOR][COLOR= #007700]]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]password[/COLOR][COLOR= #007700]])) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]U heeft geen wachtwoord ingevoerd[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/elseif"]elseif[/URL] [COLOR= #007700](![/COLOR][URL="http://www.php.net/in_array"]in_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$pass[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$password[/COLOR][COLOR= #007700])) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]U heeft een verkeerd wachtwoord ingevoerd[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]logged_in[/COLOR][COLOR= #007700]] =[/COLOR] true[COLOR= #007700];[/COLOR]
[URL="http://www.php.net/header"]header[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]location: beveiligdepagina.php[/COLOR][COLOR= #007700]);
}
}[/COLOR]
?>
<html>
<head>
<title>Login</title>
</head>
<body>
<form action="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]PHP_SELF[/COLOR][COLOR= #007700]];[/COLOR] ?>" method="post">
<input type="password" name="password" /><input type="submit" value="Login" />
</form>
</body>
</html> 
Luukvdo schreef:ik heb hem ook niet getestDat script werkt niet eens
Wil alleen weten wat hij precies wil dus had alleen voorbeeld snel hier getyped
hij doet het nu ook.

als ik beveiligdepagina.php aanmaak stuurt hij niet door 
$_SESSION[logged_in] = true;
.