header('Location: main/get.php'); exit; } else { header('Location: administrator/get.php'); exit; } } else { $error = '用户名和密码出错'; include 'error.html.php'; exit; } } if (isset($_GET['addMessage'])) { $messageArray = array('message' => $_POST['message'], 'author' => $_SESSION['user_name']); $Model = new Model(); $Model->addMessage($messageArray); } if (isset($_GET['editMessage'])) { try { $sql = 'update messageinfo set message = :message where id=:id'; $s = $pdo->prepare($sql); $s->bindValue(':id', $_POST['id']); $s->bindValue(':message', $_POST['message']); $s->execute(); } catch (PDOException $e) { $error = '编辑出错,请重新尝试,错误原因:' . $e->getMessage(); include 'error.html.php'; exit; } header('Location: administrator/get.php'); exit;