203 lines
6.9 KiB
PHP
203 lines
6.9 KiB
PHP
<?php
|
|
session_start();
|
|
if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) {
|
|
header('Location: login.php');
|
|
exit;
|
|
}
|
|
|
|
if (!isset($_SESSION['csrf_token'])) {
|
|
$_SESSION['csrf_token'] = bin2hex(random_bytes(32));
|
|
}
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<title>VM Configurator</title>
|
|
<style>
|
|
body {
|
|
font-family: 'Roboto', Arial, sans-serif;
|
|
margin: 0;
|
|
padding: 0;
|
|
background-color: #f4f4f4; /* Light gray background */
|
|
color: #333333; /* Dark gray text */
|
|
}
|
|
.container {
|
|
max-width: 1200px;
|
|
margin: 40px auto;
|
|
padding: 30px;
|
|
background: #ffffff; /* White background */
|
|
border-radius: 15px;
|
|
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
|
|
text-align: center;
|
|
}
|
|
h2 {
|
|
font-size: 36px;
|
|
margin-bottom: 20px;
|
|
color: #007bff; /* Blue text */
|
|
}
|
|
.config-options {
|
|
display: flex;
|
|
justify-content: center;
|
|
gap: 30px;
|
|
margin-bottom: 30px;
|
|
}
|
|
.config-option {
|
|
flex: 1;
|
|
max-width: 300px;
|
|
text-align: center;
|
|
padding: 20px;
|
|
border: 2px solid #007bff; /* Blue border */
|
|
border-radius: 15px;
|
|
background-color: #f8f9fa; /* Light gray background */
|
|
cursor: pointer;
|
|
transition: background-color 0.3s, box-shadow 0.3s, transform 0.3s;
|
|
}
|
|
.config-option:hover {
|
|
background-color: #007bff; /* Blue hover effect */
|
|
color: #ffffff; /* White text on hover */
|
|
box-shadow: 0 4px 10px rgba(0, 123, 255, 0.3);
|
|
transform: scale(1.05); /* Slight zoom effect */
|
|
}
|
|
.config-option img {
|
|
width: 100px;
|
|
height: 100px;
|
|
margin-bottom: 10px;
|
|
}
|
|
.config-option label {
|
|
display: block;
|
|
font-size: 18px;
|
|
font-weight: bold;
|
|
margin-bottom: 5px;
|
|
}
|
|
.config-option p {
|
|
font-size: 14px;
|
|
color: #666666; /* Medium gray text */
|
|
}
|
|
.summary {
|
|
margin-top: 30px;
|
|
padding: 20px;
|
|
background: #f8f9fa; /* Light gray background */
|
|
border-radius: 15px;
|
|
border: 2px solid #007bff;
|
|
color: #333333;
|
|
}
|
|
.summary h3 {
|
|
margin: 0 0 15px;
|
|
font-size: 24px;
|
|
color: #007bff;
|
|
}
|
|
.summary p {
|
|
margin: 8px 0;
|
|
font-size: 16px;
|
|
}
|
|
button {
|
|
display: block;
|
|
width: 100%;
|
|
padding: 15px;
|
|
background-color: #007bff;
|
|
color: #ffffff;
|
|
border: none;
|
|
border-radius: 15px;
|
|
font-size: 18px;
|
|
font-weight: bold;
|
|
cursor: pointer;
|
|
transition: background-color 0.3s, box-shadow 0.3s;
|
|
}
|
|
button:hover {
|
|
background-color: #0056b3; /* Darker blue */
|
|
box-shadow: 0 4px 10px rgba(0, 123, 255, 0.3);
|
|
}
|
|
.logout {
|
|
margin-top: 20px;
|
|
}
|
|
.logout a {
|
|
color: #007bff;
|
|
text-decoration: none;
|
|
font-size: 16px;
|
|
}
|
|
.logout a:hover {
|
|
text-decoration: underline;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<h2>VM Configurator</h2>
|
|
<form action="send.php" method="post">
|
|
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token']; ?>">
|
|
|
|
<div>
|
|
<label for="VM_Name">VM Name:</label>
|
|
<input type="text" id="VM_Name" name="VM_Name" required placeholder="Enter VM Name">
|
|
</div>
|
|
|
|
<div>
|
|
<label for="domain">Select Domain:</label>
|
|
<div>
|
|
<input type="radio" id="domain1" name="domain" value="domain1" required>
|
|
<label for="domain1">Domain 1</label>
|
|
</div>
|
|
<div>
|
|
<input type="radio" id="domain2" name="domain" value="domain2">
|
|
<label for="domain2">Domain 2</label>
|
|
</div>
|
|
<div>
|
|
<input type="radio" id="domain3" name="domain" value="domain3">
|
|
<label for="domain3">Domain 3</label>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="config-options">
|
|
<div class="config-option" onclick="selectOption(this, 'small', 2, 4, 50)">
|
|
<input type="radio" id="small" name="size" value="small" required>
|
|
<img src="images/small-vm.png" alt="Small VM">
|
|
<label for="small">Small VM</label>
|
|
<p>2 vCPU, 4 GB RAM, 50 GB HDD</p>
|
|
</div>
|
|
<div class="config-option" onclick="selectOption(this, 'medium', 4, 8, 50)">
|
|
<input type="radio" id="medium" name="size" value="medium">
|
|
<img src="images/medium-vm.png" alt="Medium VM">
|
|
<label for="medium">Medium VM</label>
|
|
<p>4 vCPU, 8 GB RAM, 50 GB HDD</p>
|
|
</div>
|
|
<div class="config-option" onclick="selectOption(this, 'big', 8, 16, 50)">
|
|
<input type="radio" id="big" name="size" value="big">
|
|
<img src="images/big-vm.png" alt="Big VM">
|
|
<label for="big">Big VM</label>
|
|
<p>8 vCPU, 16 GB RAM, 50 GB HDD</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="summary">
|
|
<h3>Configuration Summary</h3>
|
|
<p><strong>vCPU:</strong> <span id="summary-vcpu">-</span></p>
|
|
<p><strong>RAM:</strong> <span id="summary-ram">-</span> GB</p>
|
|
<p><strong>HDD:</strong> <span id="summary-hdd">-</span> GB</p>
|
|
</div>
|
|
|
|
<button type="submit">Submit</button>
|
|
</form>
|
|
<div class="logout">
|
|
<a href="logout.php">Logout</a>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
function selectOption(option, size, vcpu, ram, hdd) {
|
|
// Deselect all options
|
|
document.querySelectorAll('.config-option').forEach(el => el.classList.remove('selected'));
|
|
// Select the clicked option
|
|
option.classList.add('selected');
|
|
// Update the summary
|
|
document.getElementById('summary-vcpu').textContent = vcpu;
|
|
document.getElementById('summary-ram').textContent = ram;
|
|
document.getElementById('summary-hdd').textContent = hdd;
|
|
// Select the associated radio button
|
|
const radioButton = option.querySelector('input[type="radio"]');
|
|
if (radioButton) {
|
|
radioButton.checked = true;
|
|
}
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|