0) { $row = mysql_fetch_array($rs); $password = $row[user_pass]; $gid = $row[gid]; $pwdCrypt = crypt($txtPwd, $password); mysql_free_result($rs); // free user result if ($password == $pwdCrypt) { /****************************************************************************************************** *** Session Regist and Redirect to user page ******************************************************************************************************/ $_SESSION['gid'] = $gid; $_SESSION['login'] = "True"; print "Redirect to ..."; switch ($gid) { case 1: header("Location: main.php?user=$row[uid]"); break; case 2: header("Location: home.php?user=$row[uid]"); break; case 3: header("Location: guest.php"); break; default: msgbox_loc("ไม่พบกลุ่มผู้ใช้นี้ในระบบ","login.php"); session_destroy(); } } else { msgbox_loc("รหัสผ่านไม่ถูกเข้าระบบได้","login.php"); session_destroy(); } } else { msgbox_loc("ไม่สามารถเข้าระบบได้","login.php"); session_destroy(); } } // end if check logout page ?>