blue-twilight/public/upload-license.php

41 lines
1.4 KiB
PHP
Raw Normal View History

<?php
$baseDirectory = dirname(__DIR__);
$error = null;
if (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST')
{
move_uploaded_file($_FILES['license-file']['tmp_name'], $baseDirectory . '/blue-twilight.lic');
try
{
$licenseInfo = (require $baseDirectory . '/verify-license.php');
if (!is_null($licenseInfo) && is_array($licenseInfo))
{
header('Location: ' . str_replace('/upload-license.php', '/', $_SERVER['REQUEST_URI']));
die();
}
}
catch (\Exception $e)
{
$error = $e->getMessage();
}
}
?>
<!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">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Blue Twilight - License Needed</title>
</head>
<body>
<h1>Blue Twilight - License Needed</h1>
<form action="upload-license.php" method="post" enctype="multipart/form-data">
<p><label for="license-file">Upload your <u>blue-twilight.lic</u> license file:</label></p>
<p><input type="file" id="license-file" name="license-file"></p>
<p><button type="submit" style="font-size: larger;">Upload</button></p>
</form>
</body>
</html>