我一直在處理此PHP
代碼,但我無法使用帳戶類型將它們連接到它們的特定頁面院長,註冊員,帳戶出納和收銀員。根據用戶帳戶類型或使用用戶名和密碼重定向頁面
我的嘗試:
<?php include("header.php");
include("banner.php") ?>
<?php
if (isset($_POST['btnlogin'])) {
$uname = trim($_POST['uname']);
$upass = trim($_POST['pass']);
$h_upass = sha1($upass);
if ($uname == '' OR $upass == '') {
}
?>
?> <script type="text/javascript">
alert("Invalid Username and Password!");
</script>
<?php
} else {
$user = new User();
$res = $user::AuthenticateUser($uname, $h_upass);
?>
***您不應該使用[SHA1密碼哈希](https://konklone.com/post/why-google-is-hurrying-the-web-to-kill-sha-1) ***或*** [MD5密碼哈希](http://security.stackexchange.com/questions/19906/is-md5-considered-insecure)***,你真的應該使用PHP的[內置函數] (http://jayblanchard.net/proper_password_hashing_with_PHP.html)來處理密碼安全性。在散列之前,請確保你[不要越過密碼](http://stackoverflow.com/q/36628418/1011527)或使用其他任何清理機制。這樣做*更改密碼並導致不必要的附加編碼。 –
另外你的代碼有語法錯誤。否則條件不與花括號關閉。 –
也'IF'不會做任何事情,因爲這是'}' – RiggsFolly