prepare("SELECT count(0) FROM Bruker;"); $stmt->execute(); $result = $stmt->fetchAll(); } catch (PDOException $e){ if($e->getCode() == "42S02"){ echo "Tabellen finnes ikke.
"; } else { echo "SQL-feil:
\n".var_dump($e); } } if(Auth::checkLogin()){ $msg[] = "Du er allerede logget inn."; } if(!empty($_POST)){ try { Auth::doLogin($_POST['brukernavn'], $_POST['passord']); header("Location: Hjem.php"); } catch (LoginException $e){ $err[] = $e->getMessage(); } } ?> <?=title();?>

Modul 7 - Autentisering

Login

".$e."

\n"; } } if(!empty($msg)){ foreach ($msg as $m){ echo "

".$m."

\n"; } } ?>