prepare('SELECT user_id, name FROM users WHERE name = :na AND password = :pw'); $stmt->execute(array( ':na' => $_POST['name'], ':pw' => $_POST['password'])); $row = $stmt->fetch(PDO::FETCH_ASSOC); if ( $row !== false ) { $_SESSION['name'] = $row['name']; $_SESSION['user_id'] = $row['user_id']; $_SESSION['success']="登陆成功"; header( 'Location: index.php' ) ; return; } else { $_SESSION["error"] = "密码错误"; header( 'Location: login.php' ) ; return; } } } elseif (isset($_REQUEST['cancel'] ) ) { header( 'Location: index.php' ) ; } ?>

NEW JOURNEY...