Webbserverprogrammering 1

Show sourcecode

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

Webserver1/Ovningar/Slutprojekt/

.env
DEBUG/
Media/
account.js
account.php
callback_log.txt
change_account_details.php
composer.json
composer.lock
forgot_pass.php
forgot_pass_new_pass.php
header.php
index.php
login.php
mediaplayer.php
node_modules/
package-lock.json
package.json
signup.php
style.css
upload.js
upload_callback.php
upload_callback_simulated.php
upload_chunk.php
upload_errors.log
upload_form.php
upload_handler.php
upload_success.log
vendor/
verify_file.php
verifypage.php

forgot_pass.php

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

  
/**
   * @var PDO $dbconn
   * @var bool $local
   * @var class DBManager
   */
  
include('../../incl/dbconnection.php');

  
$dbmanager = new DBManager();

  
$email $_POST['account-email'] ?? null;

  if (
$email) {
    
// Kolla om email tillhör något konto
    
if (count($dbmanager->fetch_from_table(["email"], "bay_users", ["email" => $email])) > 0) {
      
$verificationCode substr(md5(uniqid(rand())),06);
      
$_SESSION['verificationCode'] = $verificationCode;
      
$_SESSION['email'] = $email;
      
$_SESSION['verifyType'] = "FORGOT";
      
header("Location: verifypage.php");
      exit;
    }
  }
?>

<!DOCTYPE html>
<html lang="sv">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Ändra kontouppgifter</title>
  <link rel="stylesheet" href="style.css">
  <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
  <style>
    form {
      display: grid;
      justify-items: center;
    }
    form .row {
      margin: 1rem;
    }
  </style>
</head>
<body>
  <?php include("./header.php"?>

  <form method="post">
    <h1>Glömt lösenord</h1>
    <label for="account-email">Epost för kontot:</label>
    <input type="email" name="account-email" id="account-email">

    <input type="submit" value="Skicka">
  </form>
</body>
</html>