function insertChoice($question, $text, $correct, $exclusive) { $text = str_value($text); $this->query("insert into oes_Choice values (null, {$question}, {$text}, {$correct}, {$exclusive})"); return $this->getLastInsertID(); }
<?php include_once "../config.php"; include_once "../lib/Database.php"; session_start(); unset($_SESSION['user']); if (isset($_POST['submit'])) { $id = str_value($_POST['id']); $pass = str_value($_POST['pass']); $db = new Database(DB_HOST, DB_USER, DB_PASS); $db->selectDatabase(DB_NAME); $user = $db->getValue("select ID from oes_User where ID = {$id} and Pass = sha1({$pass})"); if ($user != null) { $_SESSION['user'] = $user; if (isset($_SESSION['page'])) { $page = $_SESSION['page']; } else { $page = 'exam.php'; } header("Location: {$page}"); } else { ?> <head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head> <center>Đăng nhập thất bại!</center> <center>Xin hãy kiểm tra thông tin đã nhập.</center> <center><button onClick='history.back()'>Trở lại</button></center> <?php } return; } ?>