check2.php 622 B

12345678910111213141516171819202122
  1. <?php
  2. session_start();
  3. include "connect.php";
  4. $id = $_POST['id'];
  5. //搜尋資料庫資料
  6. $sql = "SELECT * FROM accounts where account = '$id'";
  7. $result = mysql_query($sql);
  8. $row = @mysql_fetch_row($result);
  9. //判斷帳號與密碼是否為空白
  10. //以及MySQL資料庫裡是否有這個會員
  11. if ($id != null && $row[1] == $id) {
  12. //將帳號寫入session,方便驗證使用者身份
  13. $_SESSION['id'] = $row[0];
  14. $_SESSION['name'] = $row[1];
  15. $_SESSION['type'] = $row[2];
  16. header('Location: 000.php');
  17. //header('Location: 001.html');
  18. exit;
  19. } else {
  20. header('Location: check.php');
  21. exit;
  22. }