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