Webbserverprogrammering 1

Show sourcecode

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

Webserver1/Ovningar/Strings/

ovning_strings1.php
ovning_strings1_mot.php
ovning_strings2.php
ovning_strings2_mot.php
ovning_strings3.php
ovning_strings3_mot.php
ovning_strings4.php
ovning_strings4_mot.php
ovning_strings5.php
ovning_strings5_mot.php
ovning_strings6.php
ovning_strings6_mot.php

ovning_strings5_mot.php

30 lines UTF-8 Windows (CRLF)
  <?php
  $username 
$_GET["username"];
  
$password $_GET["password"];

  echo 
"
    <!DOCTYPE html>
    <html lang='sv'>
    <head>
      <meta charset='UTF-8'>
      <meta name='viewport' content='width=device-width, initial-scale=1.0'>
      <title>Hej igen</title>
    </head>
    <body>"
;
  
  
$OK true;

  if (!
preg_match("/php/"$username)) {
    echo 
"Ditt användarnamn måste innehålla 'php' <br>";
    
$OK false;
  }
  if (
strlen($password) < || !preg_match("/[0-9]/"$password)) {
    echo 
"Ditt lösenord måste vara minst 6 tecken och innehålla en siffra! <br>";
    
$OK false;
  }
  if (
$OK) {
    echo 
"Välkommen, $username. Du gjorde allt rätt.";
  }
  
?>
</body>
</html>