Files
assetmgt/register.php
“VeLiTi” 884d2a3366 Enhance product links and translations; update styles and add registration modal
- Updated product links in rma.php and rma_manage.php to include icons for better UX.
- Improved German, Spanish, Dutch, Polish, Portuguese, and US translations with new phrases for software licenses and user information prompts.
- Refactored CSS to remove redundant styles and added new styles for a registration modal, enhancing the overall UI.
- Introduced JavaScript variables for user information prompts in softwaretool.php for better localization support.
2026-01-12 15:59:46 +01:00

652 lines
17 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
include './assets/functions.php';
include './settings/settings_redirector.php';
include './settings/config_redirector.php';
//GET BROWSER LANGUAGE
$lang = strtoupper(substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2));
$lang = in_array($lang, $supportedLanguages) ? $lang : 'US';
//INCLUDE THE TRANSLATION
include_once './settings/translations/translations_'.$lang.'.php';
//=========================================
//GET DOMAIN FOR CORRECT STYLING AND SETTINGS
//=========================================
$domain = getDomainName($_SERVER['SERVER_NAME']);
$custom_css = (file_exists(dirname(__FILE__).'/custom/'.$domain.'/style/'.$domain.'_login.css') ? './custom/'.$domain.'/style/'.$domain.'_login.css' : './style/admin_login.css');
// Default input values
$register = [
'sn' => '',
'organization' => '',
'email' => '',
'phone' => '',
'city' => '',
'country' => ''
];
if (isset($_POST['register'])){
//Update register ARRAY
$register = $_POST;
//GET USERKEY
$data = json_encode(array("username" => interface_user, "password" => interface_pw), JSON_UNESCAPED_UNICODE);
//Secure data
$payload = generate_payload($data);
//API call
$responses = ioServer('/v1/authorization', $payload);
//Decode Payload
if (!empty($responses)){$responses = decode_payload($responses);}else{$responses = '400';}
if ($responses === 'NOK' || $responses === '400'){
//Not allowed
exit;
}
else {
// Start a new session
session_start();
// Store data in session
$_SESSION['userkey'] = $responses->userkey;
// GET ALL POST DATA
$data = json_encode($register, JSON_UNESCAPED_UNICODE);
// Secure data
$payload = generate_payload($data);
// API call
$message_return = ioServer('/v1/application/register', $payload);
if (!empty($message_return)){
$message_return = decode_payload($message_return);
}
else{
$message_return = '400';
}
}
}
echo '
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width,minimum-scale=1">
<title>'.$register_title.'</title>
<link rel="shortcut icon" href="'.icon_image.'" type="image/x-icon" />
<style>
:root {
--color-white: #FFFFFF;
--color-light-green: #2FAC66;
--color-green: #005655c2;
--color-red: #a75151;
--text-color: #333333;
--error-background: #f3c3c3;
}
* {
padding: 0;
margin: 0;
box-sizing: border-box;
font-family: "Open Sans", Helvetica, sans-serif;
accent-color: var(--color-green);
}
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background-color: var(--color-white);
padding: 20px;
}
.login-container {
display: flex;
flex-direction: column;
width: 100%;
max-width: 1200px;
height: calc(100vh - 40px);
background-color: var(--color-white);
border-radius: 16px;
box-shadow: 0 10px 25px rgba(0,0,0,0.1);
overflow: hidden;
}
.top-header {
display: flex;
align-items: center;
gap: 20px;
padding: 30px 40px 20px 40px;
}
.content-wrapper {
display: flex;
flex: 1;
overflow: hidden;
}
.logo {
background-image: url(/assets/images/TSS-logo3.png);
background-repeat: no-repeat;
opacity: inherit;
width: 85px;
height: 120px;
flex-shrink: 0;
-webkit-filter: drop-shadow(5px 5px 5px #222);
filter: drop-shadow(5px 5px 5px #222);
}
.login-form {
width: 45%;
padding: 40px;
display: flex;
flex-direction: column;
justify-content: flex-start;
position: relative;
overflow-y: auto;
}
.login-visual {
width: 55%;
position: relative;
overflow-y: auto;
padding: 40px;
display: flex;
flex-direction: column;
justify-content: flex-start;
}
.header {
flex: 1;
}
.header h1 {
font-size: 24px;
margin: 0;
color: var(--text-color);
}
.back-to-login {
margin-left: auto;
padding: 8px 16px;
background-color: transparent;
color: var(--text-color);
text-decoration: none;
border: 1px solid var(--text-color);
border-radius: 4px;
font-size: 14px;
transition: all 0.3s ease;
}
.back-to-login:hover {
background-color: var(--text-color);
color: var(--color-white);
}
.left-registration {
width: 100%;
}
.left-registration .step-section {
padding: 25px;
border-radius: 8px;
margin-bottom: 20px;
}
.right-registration {
width: 100%;
padding: 30px;
border-radius: 8px;
}
.step-section {
margin-bottom: 25px;
}
.step-section h4 {
color: #333;
margin-bottom: 12px;
font-size: 16px;
font-weight: 600;
}
.right-registration .step-section h4 {
color: #333;
}
.step-section img {
width: 100%;
max-width: 180px;
display: block;
margin: 15px auto;
}
.form-label {
display: block;
margin-bottom: 6px;
color: #333;
font-size: 13px;
font-weight: 500;
}
.form-field {
width: 100%;
padding: 10px;
border: 1px solid #ddd;
border-radius: 4px;
margin-bottom: 12px;
background-color: #fff;
font-size: 14px;
}
.btn {
padding: 10px 20px;
background-color: var(--color-light-green);
color: var(--color-white);
border: none;
border-radius: 4px;
cursor: pointer;
transition: background-color 0.3s ease;
text-decoration: none;
display: inline-block;
font-size: 14px;
font-weight: 500;
}
.btn:hover {
background-color: var(--color-green);
}
small {
color: #666;
font-size: 12px;
}
input[type="checkbox"] {
margin-right: 8px;
}
.sn-fields-container {
margin-bottom: 15px;
}
.sn-field-row {
display: flex;
gap: 8px;
align-items: center;
margin-bottom: 10px;
}
.sn-field-row input {
flex: 1;
}
.btn-remove {
padding: 10px 15px;
background-color: var(--color-red);
color: var(--color-white);
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
font-weight: 500;
min-width: 40px;
}
.btn-remove:hover {
background-color: #8b3a3a;
}
.btn-add {
margin-top: 5px;
}
.modal {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.5);
z-index: 1000;
align-items: center;
justify-content: center;
}
.modal-content {
background: white;
border-radius: 12px;
max-width: 600px;
margin: 20px;
box-shadow: 0 10px 40px rgba(0,0,0,0.3);
position: relative;
max-height: 80vh;
overflow-y: auto;
}
.modal-header {
text-align: center;
padding: 30px 30px 20px 30px;
border-bottom: 1px solid #eee;
}
.modal-body {
padding: 25px 30px;
}
.modal-footer {
text-align: center;
padding: 20px 30px 30px 30px;
border-top: 1px solid #eee;
}
.close {
position: absolute;
top: 15px;
right: 20px;
font-size: 28px;
font-weight: bold;
color: #999;
cursor: pointer;
line-height: 1;
}
.close:hover {
color: #333;
}
.success-icon {
font-size: 64px;
color: var(--color-light-green);
margin-bottom: 15px;
}
.modal h2 {
color: var(--color-light-green);
margin-bottom: 10px;
font-size: 24px;
}
.modal h4 {
color: #333;
margin: 20px 0 10px 0;
font-size: 16px;
font-weight: 600;
}
.modal p {
color: #333;
margin-bottom: 10px;
line-height: 1.6;
}
.modal small {
color: #666;
font-size: 12px;
}
.collapsible-header {
cursor: pointer;
display: flex;
align-items: center;
gap: 10px;
padding: 10px 0;
user-select: none;
font-size:10px;
}
.collapsible-header:hover {
background-color: #f8f9fa;
margin: 0 -10px;
padding: 10px 10px;
border-radius: 4px;
}
.collapsible-indicator {
color: var(--color-light-green);
transition: transform 0.3s ease;
}
.collapsible-indicator.active {
transform: rotate(180deg);
}
.collapsible-content {
max-height: 0;
overflow: hidden;
transition: max-height 0.3s ease;
}
.collapsible-content.active {
max-height: 500px;
padding-top: 15px;
}
.trademark {
position: absolute;
bottom: 20px;
left: 20px;
color: var(--text-color);
font-size: 12px;
}
.language-selector {
position: absolute;
bottom: 20px;
right: 20px;
display: flex;
align-items: center;
color: var(--text-color);
}
.language-selector select {
margin-left: 10px;
border: none;
background: transparent;
}
@media screen and (max-width: 1024px) {
.login-container {
height: auto;
max-width: 1000px;
}
.content-wrapper {
flex-direction: column;
}
.login-form, .login-visual {
width: 100%;
height: auto;
}
.login-visual {
min-height: 400px;
}
.trademark, .language-selector {
position: static;
text-align: center;
margin: 20px 0;
}
}
@media screen and (max-width: 480px) {
.login-form, .login-visual {
padding: 20px;
}
.header h1 {
font-size: 20px;
}
.right-registration {
padding: 20px;
}
}
</style>
</head>
<body>
';
//Register view
echo'
<div class="login-container">
<div class="top-header">
<div class="logo"></div>
<div class="header">
<h1>'.$register_title.'</h1>
</div>
<a href="index.php" class="back-to-login">'.($button_back_to_login ?? 'Back to login').'</a>
</div>
<div class="content-wrapper">
<div class="login-form">
<div class="left-registration">
<div class="step-section">
<h4>'.$register_1_find.'</h4>
<img src="./assets/images/EP_register.gif" alt="Registration guide">
</div>
<div class="step-section">
<h4>'.$register_2_enter.'</h4>
<form action="" method="post" id="regForm">
<label for="sn" class="form-label">'.$register_2_label.' *</label>
<div class="sn-fields-container" id="snFieldsContainer">
<div class="sn-field-row">
<input type="text" name="sn[]" id="sn" placeholder="'.$register_2_placeholder.'" minlength="8" maxlength="8" required="" class="form-field">
</div>
</div>
<button type="button" class="btn btn-add" onclick="addField();">+</button><small> '.$register_2_add.'</small>
</form>
</div>
</div>
</div>
<div class="login-visual">
<div class="right-registration">
<div class="step-section">
<h4>'.$register_3_register.'</h4>
<label for="organization" class="form-label">'.$register_3_name.' *</label>
<input type="text" name="organization" form="regForm" placeholder="'.$register_3_name.'" value="'.$register['organization'].'" required="" class="form-field">
<label for="email" class="form-label">'.$register_3_mail.' *</label>
<input type="email" name="email" form="regForm" id="email" placeholder="info@example.com" value="'.$register['email'].'" required="" class="form-field">
<label for="phone" class="form-label">'.$register_3_phone.' *</label>
<input type="text" name="phone" form="regForm" placeholder="'.$register_3_phone.'" value="'.$register['phone'].'" required="" class="form-field">
<label for="city" class="form-label">'.$register_3_city.' *</label>
<input type="text" name="city" form="regForm" placeholder="'.$register_3_city.'" value="'.$register['city'].'" required="" class="form-field">
<label for="country" class="form-label">'.$register_3_country.' *</label>
<input type="text" name="country" form="regForm" placeholder="'.$register_3_country.'" value="'.$register['country'].'" required="" class="form-field">
<div style="margin-bottom: 15px;">
<input type="checkbox" name="email_consent" form="regForm" checked required/>'.$register_3_email_consent.'<br>
<input type="checkbox" name="terms_consent" form="regForm" required/>'.$register_3_term_consent_1.' <a href="" target="blank">'.$register_3_term_consent_2.'</a> *
</div>
<input name="register" form="regForm" type="submit" value="'.$register_button.'" class="btn">
<br><br>
<small>* '.$register_mandatory.'</small>
</div>
</div>
</div>
</div>
';
//IF MESSAGES ARE RETURN SHOW THEM IN MODAL
if (!empty($message_return)){
echo '
<div id="successModal" class="modal" style="display: flex;">
<div class="modal-content">
<span class="close" onclick="closeModal()">&times;</span>
<div class="modal-header">
<div class="success-icon">✓</div>
<h2>'.$register_4_completed.'</h2>
</div>
<div class="modal-body">
<p>'.$register_message_4.' <strong>'.software_update_user.'/'.software_update_pw.'</strong></p>
<div class="collapsible-header" onclick="toggleDetails()">
'.$register_5_details.'
<span class="collapsible-indicator" id="detailsIndicator">▼</span>
</div>
<div class="collapsible-content" id="detailsContent">';
foreach($message_return as $return_message){
echo'<p>'.$return_message.'</p>';
}
echo'
</div>
</div>
<div class="modal-footer">
<a href="register.php" class="btn">'.$register_6_button.'</a>
</div>
</div>
</div>';
}
echo'
</body>
<script>
function closeModal() {
document.getElementById("successModal").style.display = "none";
}
function toggleDetails() {
var content = document.getElementById("detailsContent");
var indicator = document.getElementById("detailsIndicator");
if (content.classList.contains("active")) {
content.classList.remove("active");
indicator.classList.remove("active");
} else {
content.classList.add("active");
indicator.classList.add("active");
}
}
function addField() {
var container = document.getElementById("snFieldsContainer");
var fieldRow = document.createElement("div");
fieldRow.className = "sn-field-row";
var input = document.createElement("INPUT");
input.setAttribute("type", "text");
input.setAttribute("name", "sn[]");
input.setAttribute("value", "");
input.setAttribute("placeholder", "'.$register_2_placeholder.'");
input.setAttribute("class", "form-field");
input.setAttribute("minlength", "8");
input.setAttribute("maxlength", "8");
input.setAttribute("required", "");
var removeBtn = document.createElement("button");
removeBtn.setAttribute("type", "button");
removeBtn.setAttribute("class", "btn-remove");
removeBtn.innerHTML = "×";
removeBtn.onclick = function() { removeField(this); };
fieldRow.appendChild(input);
fieldRow.appendChild(removeBtn);
container.appendChild(fieldRow);
// Focus on the new input
input.focus();
}
function removeField(btn) {
var container = document.getElementById("snFieldsContainer");
// Only allow removal if there is more than one field
if (container.children.length > 1) {
btn.parentElement.remove();
}
}
document.getElementById(\'language-selector\').addEventListener(\'change\', function() {
if (this.value) {
window.location.href = `register.php?language=${this.value}`;
}
});
</script>
</html>
';