請高手幫忙看看我的"登入系統"哪有問題?

edited 十月 2013 in PHP新手區
我的登入系統
我用PHP寫的登入畫面沒有問題,但是我想要在"帳號欄位"判別英文字母。(註:資料庫都已經完成了)
判別英文字母如下:
"n"登入nursing.php畫面;"s"登入Social.php畫面;"e"登入education畫面;(以上"字元"判別)
"admini"登入admini.php畫面;"user"登入user.php畫面;(以上以"字串"判別)
登入的帳號EX:n01、n123、n456類似這樣的。重點是判別第一個字元"n"進入nursing.php畫面

請幫我看看chk.php我執行出來都是在
$modified_userid = "_".$POST_;
出問題不能執行,請幫我解答一下!!

登入畫面Login.php
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=big5">
<title>會員登入系統範例</title>
</head>
<body bgcolor="white" text="black" link="blue" vlink="purple" alink="red">
<h1 align="center">會員登入系統範例</h1>
<form name="form2" action=chk.php method=post>
<p align="center">請輸入帳號:<input type="text" name="user_id"></p>
<p align="center">請輸入密碼:<input type="password" name="user_passwd"></p>
<p align="center"><input type="submit" name="送出"><input type="reset" name="重設"></p>
</form>
</body>
</html>

資料庫判別使用者chk.php
<?

$link = mysql_connect("localhost","root","123456");
mysql_query("use movedb");
$sqlstr="select * from user where id ='".$_POST."' and passwd = '".$_POST."'";
$result = mysql_query($sqlstr,$link);
if(mysql_num_rows ($result)==1){
echo "<center>會員登入成功</center>";
}else{
echo "<center>會員登入失敗</center>";
}
$modified_userid = "_".$POST_;
if (strpos($modified_userid, "n" == 1)) {
$url = "nursing.php";
}elseif (strpos($modified_userid, "s" == 1)) {
$url = "Social.php";
} elseif (strpos($modified_userid, "e" == 1)) {
$url = "education.php";
}elseif (strpos($modified_userid, "admini" == 1)) {
$url = "admini.php";
}elseif (strpos($modified_userid, "user" == 1)) {
$url = "user.php";
}

mysql_free_result($result);
mysql_close($link);
?>


原始討論: http://twpug.net/x/modules/newbb/viewtopic.php?topic_id=4310

評論

Sign In or Register to comment.