Created
September 29, 2012 15:49
-
-
Save tony1223/3804422 to your computer and use it in GitHub Desktop.
鐵人賽第六天說明資料
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//因為要使用 session,所以需要先讓 php 進行起始的動作。 | |
session_start(); | |
?><html> | |
<head> | |
<title>表單練習</title> | |
</head> | |
<body> | |
<?php | |
if (isset($_SESSION["login"] )){ | |
echo "歡迎登入, ".$_SESSION["login"]." !"; | |
}else if(isset($_POST["account"])){ | |
if( | |
$_POST["account"] == "test" | |
&& $_POST["password"] =="1234" | |
){ | |
echo "歡迎登入, test !"; | |
$_SESSION["login"] = "test"; | |
}else{ | |
echo "帳號或密碼輸入錯誤"; | |
} | |
}else{ ?> | |
<form method="POST"> | |
<p>請輸入帳號 <input type="text" name="account" /> </p> | |
<p>請輸入密碼 <input type="password" name="password" /> </p> | |
<p><input type="submit" value="送出" /></p> | |
</form> | |
<?php } ?> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment