melder/admin/alter_table.php
Walter Hupfeld c1c4151300 Admin User
2024-02-21 19:42:20 +01:00

31 lines
749 B
PHP

<?php
exit();
session_start();
$strLoginName=(isset($_SESSION['user'])) ? $_SESSION['user'] : "" ;
$boolLogin = (!empty($strLoginName));
if (!$boolLogin) {
header("Location: login.php");
}
date_default_timezone_set('UTC');
$strSQL="ALTER TABLE location ADD COLUMN defect INTEGER";
$db->exec($strSQL);
$db->exec("CREATE TABLE IF NOT EXISTS user(
id INTEGER PRIMARY KEY AUTOINCREMENT,
username TEXT,
passwordhash TEXT,
lastlogin TEXT DEFAULT CURRENT_TIMESTAMP,
created_at TEXT DEFAULT CURRENT_TIMESTAMP
)");
header("Location: configuration.php");
INSERT INTO user (username, passwordhash, district)
SELECT district, "$2y$10$W9CE8IOOfnfi3XTMEVByZeDIrZo1VPxCHz2CfCe.sOH87V/AdaUG2", district
FROM district;