Webbserverprogrammering 1

Show sourcecode

The following files exists in this folder. Click to view.

webbserverprogrammering/exercises/cookies-session/

ovning_1.php
ovning_2.php
ovning_3.php
ovning_3_mottagare.php
ovning_4.php

ovning_3.php

30 lines UTF-8 Windows (CRLF)
<?php
  session_start
();

  if(isset(
$_SESSION["losenord"]) && $_SESSION["losenord"] != "Tobias!") {
    echo 
"Du gav fel lösenord😂";
    
session_destroy();
  }
?>  
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/dark.css">
  <title>Övning 3</title>
</head>
<body>

  <h1>Logga in</h1>
  <form action="ovning_3_mottagare.php" method="post">
    <label for="namn">Ange ditt namn</label>
    <input name="namn" id="namn" type="text" placeholder="t.ex. Tobias">

    <label for="losenord">Ange lösenordet (Tobias!)</label>
    <input name="losenord" id="losenord" type="password">

    <button type="submit">Logga in</button>
  </form>
</body>
</html>