Webbserverprogrammering 1

Show sourcecode

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

webbsrvprg/exercises/cookie-session/

ovn_cook1.php
ovn_cook2.php
ovn_cook3.php
ovn_cook3hem.php
ovn_cook4.php
ovn_cook5.php

ovn_cook3hem.php

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

if (
$_SERVER["REQUEST_METHOD"] == "POST") {
  
session_unset();
  
session_destroy();
  
header('Location: ovn_cook3.php');
}

?>

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Hämligheter</title>
</head>
<body>
  
  <?php
  
if($_SESSION["användarnamn"] == "banan1" && $_SESSION["lösenord"] == "123"){
    
$hämligheter "Hämligheter";
  }
  else {
    
header('Location: ovn_cook3.php');
  }
  echo 
$hämligheter;
    
  
?>
  
  <form action="" method="post">
    <input type="submit" value="Logga ut">
  </form>
  
</body>
</html>