<?php
session_start(); require 'config.php';
if(isset($_POST['id'])){
 if(isset($users[$_POST['id']])&&$users[$_POST['id']]==$_POST['pw']){
  session_regenerate_id(true);
  $_SESSION['id']=$_POST['id'];
  header('Location:webhook.php');exit;
 }
 $err='IDまたはパスワードが違います';
}
?><!doctype html><html lang="ja"><head><meta charset="utf-8">
<link rel="stylesheet" href="style.css"><title>Webhook</title></head><body>
<div class="box"><h2>IoT実験 Webhook保存システム</h2>
<p>Discordで作成したWebhook URLを保存してください。<br>授業終了後にデータは削除されます。</p>
<?php if(isset($err)) echo "<p class='err'>$err</p>";?>
<form method="post">
<label>ID</label><input name="id"><label>パスワード</label><input type="password" name="pw">
<input type="submit" value="ログイン"></form></div></body></html>