urmi_downloader_converter/settings/index.php

586 lines
20 KiB
PHP
Executable File

<?php
// settings/index.php
// Start session to store settings
session_start();
// Define settings file path - save in same directory as this file
$settings_file = __DIR__ . '/settings.json';
// Default settings
$default_settings = [
'video_format' => 'h264',
'audio_format' => 'mp3',
'video_bitrate' => '1000k',
'audio_bitrate' => '128k',
'resolution' => '1280x720',
'frame_rate' => '30',
'gop' => '30',
];
// Initialize settings from JSON file or use defaults
if (file_exists($settings_file)) {
$settings_json = file_get_contents($settings_file);
$settings = json_decode($settings_json, true);
// Merge with defaults if any keys are missing
foreach ($default_settings as $key => $value) {
if (!isset($settings[$key])) {
$settings[$key] = $value;
}
}
} else {
$settings = $default_settings;
}
// Handle form submission
$message = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Validate video format
$allowed_video_formats = ['mpeg2', 'h264', 'h265', 'vp9', 'av1'];
if (isset($_POST['video_format']) && in_array($_POST['video_format'], $allowed_video_formats)) {
$settings['video_format'] = $_POST['video_format'];
}
// Validate audio format
$allowed_audio_formats = ['mp2', 'mp3', 'aac'];
if (isset($_POST['audio_format']) && in_array($_POST['audio_format'], $allowed_audio_formats)) {
$settings['audio_format'] = $_POST['audio_format'];
}
// Update other settings
$settings['video_bitrate'] = $_POST['video_bitrate'] ?? $settings['video_bitrate'];
$settings['audio_bitrate'] = $_POST['audio_bitrate'] ?? $settings['audio_bitrate'];
$settings['resolution'] = $_POST['resolution'] ?? $settings['resolution'];
$settings['frame_rate'] = $_POST['frame_rate'] ?? $settings['frame_rate'];
$settings['gop'] = $_POST['gop'] ?? $settings['gop'];
// Save settings to JSON file
$settings_json = json_encode($settings, JSON_PRETTY_PRINT);
if (file_put_contents($settings_file, $settings_json) !== false) {
$message = "Settings saved successfully!";
} else {
$message = "Error saving settings!";
}
}
// Save settings to session as backup
$_SESSION['settings'] = $settings;
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Video Settings</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
body {
background: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
color: #fff;
min-height: 100vh;
padding: 20px;
display: flex;
justify-content: center;
align-items: center;
}
.container {
max-width: 800px;
width: 100%;
background: rgba(13, 19, 33, 0.85);
backdrop-filter: blur(12px);
border-radius: 20px;
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
overflow: hidden;
border: 1px solid rgba(92, 107, 192, 0.3);
transform: translateZ(0);
position: relative;
}
.container::before {
content: '';
position: absolute;
top: -2px;
left: -2px;
right: -2px;
bottom: -2px;
background: linear-gradient(45deg, #1a2a6c, #2a5298, #4facfe, #00f2fe, #1a2a6c);
z-index: -1;
border-radius: 22px;
animation: gradient 15s ease infinite;
background-size: 400% 400%;
}
@keyframes gradient {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
.header {
background: linear-gradient(90deg, #1a2a6c, #2a5298);
padding: 30px;
text-align: center;
position: relative;
border-bottom: 2px solid rgba(92, 107, 192, 0.5);
transform: translateZ(0);
}
.header h1 {
font-size: 2.5rem;
margin-bottom: 10px;
text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
background: linear-gradient(to right, #4facfe, #00f2fe);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
position: relative;
display: inline-block;
}
.header h1::after {
content: '';
position: absolute;
bottom: -5px;
left: 50%;
transform: translateX(-50%);
width: 80%;
height: 2px;
background: linear-gradient(to right, transparent, #4facfe, #00f2fe, transparent);
border-radius: 50%;
}
.header p {
font-size: 1.1rem;
opacity: 0.9;
margin-top: 10px;
}
.content {
padding: 30px;
}
.form-group {
margin-bottom: 25px;
position: relative;
transform: translateZ(0);
}
.form-group label {
display: block;
margin-bottom: 10px;
font-weight: 600;
font-size: 1.1rem;
color: #4facfe;
display: flex;
align-items: center;
gap: 10px;
position: relative;
/* Fix for label visibility */
z-index: 2;
}
.form-group label::before {
content: '';
position: absolute;
left: -25px;
top: 50%;
transform: translateY(-50%);
width: 12px;
height: 12px;
border-radius: 50%;
background: #4facfe;
box-shadow: 0 0 10px rgba(79, 172, 254, 0.7);
z-index: 1;
}
input, select {
width: 100%;
padding: 15px;
border: 2px solid rgba(92, 107, 192, 0.5);
border-radius: 12px;
background: rgba(13, 19, 33, 0.7);
color: #fff;
font-size: 1rem;
transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
backdrop-filter: blur(5px);
position: relative;
z-index: 1;
}
input:focus, select:focus {
outline: none;
border-color: #4facfe;
box-shadow: 0 0 20px rgba(79, 172, 254, 0.6);
transform: translateY(-2px);
}
input:focus {
box-shadow: 0 0 20px rgba(79, 172, 254, 0.6), 0 0 0 3px rgba(79, 172, 254, 0.2);
}
.btn {
background: linear-gradient(90deg, #1a2a6c, #2a5298);
color: white;
padding: 16px 30px;
border: none;
border-radius: 12px;
cursor: pointer;
font-size: 1.1rem;
font-weight: 600;
width: 100%;
transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
letter-spacing: 1px;
text-transform: uppercase;
position: relative;
overflow: hidden;
z-index: 1;
transform: translateZ(0);
}
.btn::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
transition: 0.5s;
z-index: -1;
}
.btn:hover {
transform: translateY(-3px);
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
background: linear-gradient(90deg, #2a5298, #1a2a6c);
}
.btn:hover::before {
left: 100%;
}
.btn:active {
transform: translateY(0);
}
.message {
padding: 15px;
margin: 20px 0;
border-radius: 12px;
text-align: center;
font-weight: 500;
animation: fadeIn 0.5s ease;
backdrop-filter: blur(5px);
border: 1px solid;
transform: translateZ(0);
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(-10px); }
to { opacity: 1; transform: translateY(0); }
}
.success {
background: rgba(46, 204, 113, 0.2);
border: 1px solid rgba(46, 204, 113, 0.5);
color: #2ecc71;
}
.error {
background: rgba(231, 76, 60, 0.2);
border: 1px solid rgba(231, 76, 60, 0.5);
color: #e74c3c;
}
.format-note {
background: rgba(92, 107, 192, 0.2);
border: 1px solid rgba(92, 107, 192, 0.4);
border-radius: 12px;
padding: 20px;
margin: 25px 0;
font-size: 0.95rem;
transform: translateZ(0);
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}
.format-note h3 {
color: #4facfe;
margin-bottom: 15px;
display: flex;
align-items: center;
gap: 10px;
}
.format-note h3 i {
margin-right: 10px;
}
.format-note p {
margin: 8px 0;
display: flex;
align-items: center;
gap: 10px;
}
.format-note p i {
margin-right: 10px;
color: #4facfe;
}
.footer {
text-align: center;
padding: 25px;
background: rgba(13, 19, 33, 0.9);
border-top: 1px solid rgba(92, 107, 192, 0.3);
font-size: 1.1rem;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
transform: translateZ(0);
}
.footer i {
color: #e74c3c;
margin: 0 5px;
font-size: 1.3rem;
animation: heartbeat 1.5s infinite;
}
@keyframes heartbeat {
0% { transform: scale(1); }
50% { transform: scale(1.2); }
100% { transform: scale(1); }
}
.footer p {
margin: 5px 0;
}
.settings-info {
background: rgba(13, 19, 33, 0.7);
border: 1px solid rgba(92, 107, 192, 0.3);
border-radius: 12px;
padding: 20px;
margin-bottom: 25px;
font-size: 0.9rem;
transform: translateZ(0);
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}
.settings-info p {
margin: 8px 0;
display: flex;
justify-content: space-between;
}
.settings-info strong {
color: #4facfe;
}
.pulse {
animation: pulse 2s infinite;
}
@keyframes pulse {
0% { box-shadow: 0 0 0 0 rgba(79, 172, 254, 0.4); }
70% { box-shadow: 0 0 0 10px rgba(79, 172, 254, 0); }
100% { box-shadow: 0 0 0 0 rgba(79, 172, 254, 0); }
}
.floating {
animation: floating 3s ease-in-out infinite;
}
@keyframes floating {
0% { transform: translateY(0px); }
50% { transform: translateY(-10px); }
100% { transform: translateY(0px); }
}
.glow {
text-shadow: 0 0 10px rgba(79, 172, 254, 0.7);
}
.input-group {
display: flex;
gap: 10px;
}
.input-group input {
flex: 1;
}
.input-group input:first-child {
border-radius: 12px 0 0 12px;
}
.input-group input:last-child {
border-radius: 0 12px 12px 0;
}
@media (max-width: 768px) {
.container {
margin: 10px;
border-radius: 15px;
}
.header h1 {
font-size: 2rem;
}
.content {
padding: 20px;
}
.input-group {
flex-direction: column;
}
.input-group input {
border-radius: 12px;
}
}
.animate-on-load {
animation: slideIn 0.8s ease-out;
}
@keyframes slideIn {
from {
opacity: 0;
transform: translateY(30px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.form-group:nth-child(1) { animation-delay: 0.1s; }
.form-group:nth-child(2) { animation-delay: 0.2s; }
.form-group:nth-child(3) { animation-delay: 0.3s; }
.form-group:nth-child(4) { animation-delay: 0.4s; }
.form-group:nth-child(5) { animation-delay: 0.5s; }
.form-group:nth-child(6) { animation-delay: 0.6s; }
.form-group:nth-child(7) { animation-delay: 0.7s; }
.form-group {
animation: slideIn 0.5s ease-out forwards;
opacity: 0;
transform: translateY(20px);
}
.form-group.animate {
animation: slideIn 0.5s ease-out forwards;
}
.btn-container {
margin-top: 20px;
}
</style>
</head>
<body>
<div class="container animate-on-load">
<div class="header">
<h1 class="glow"><i class="fas fa-cog"></i> Video Settings</h1>
<p>Configure your video processing parameters</p>
</div>
<div class="content">
<?php if ($message): ?>
<div class="message <?php echo (strpos($message, 'Error') !== false) ? 'error' : 'success'; ?>">
<?php echo $message; ?>
</div>
<?php endif; ?>
<div class="settings-info">
<p><strong>Current Settings:</strong>
<span>Video: <?php echo htmlspecialchars($settings['video_format']); ?></span> |
<span>Audio: <?php echo htmlspecialchars($settings['audio_format']); ?></span>
</p>
</div>
<div class="format-note">
<h3><i class="fas fa-info-circle"></i> Format Restrictions</h3>
<p><i class="fas fa-video"></i> Video format is limited to: MPEG-2, H.264, H.265, VP9, and AV1</p>
<p><i class="fas fa-music"></i> Audio format is limited to: MP2, MP3, and AAC</p>
</div>
<form method="POST" action="">
<div class="form-group">
<label for="video_format"><i class="fas fa-film"></i> Video Format</label>
<select name="video_format" id="video_format">
<option value="mpeg2" <?php echo ($settings['video_format'] === 'mpeg2') ? 'selected' : ''; ?>>MPEG-2</option>
<option value="h264" <?php echo ($settings['video_format'] === 'h264') ? 'selected' : ''; ?>>H.264</option>
<option value="h265" <?php echo ($settings['video_format'] === 'h265') ? 'selected' : ''; ?>>H.265</option>
<option value="vp9" <?php echo ($settings['video_format'] === 'vp9') ? 'selected' : ''; ?>>VP9</option>
<option value="av1" <?php echo ($settings['video_format'] === 'av1') ? 'selected' : ''; ?>>AV1</option>
</select>
</div>
<div class="form-group">
<label for="audio_format"><i class="fas fa-music"></i> Audio Format</label>
<select name="audio_format" id="audio_format">
<option value="mp2" <?php echo ($settings['audio_format'] === 'mp2') ? 'selected' : ''; ?>>MP2</option>
<option value="mp3" <?php echo ($settings['audio_format'] === 'mp3') ? 'selected' : ''; ?>>MP3</option>
<option value="aac" <?php echo ($settings['audio_format'] === 'aac') ? 'selected' : ''; ?>>AAC</option>
</select>
</div>
<div class="form-group">
<label for="video_bitrate"><i class="fas fa-tachometer-alt"></i> Video Bitrate</label>
<input type="text" name="video_bitrate" id="video_bitrate" value="<?php echo htmlspecialchars($settings['video_bitrate']); ?>">
</div>
<div class="form-group">
<label for="audio_bitrate"><i class="fas fa-volume-up"></i> Audio Bitrate</label>
<input type="text" name="audio_bitrate" id="audio_bitrate" value="<?php echo htmlspecialchars($settings['audio_bitrate']); ?>">
</div>
<div class="form-group">
<label for="resolution"><i class="fas fa-expand"></i> Resolution</label>
<select name="resolution" id="resolution">
<option value="720x576" <?php echo ($settings['resolution'] === '720x576') ? 'selected' : ''; ?>>720x576 (PAL)</option>
<option value="720x480" <?php echo ($settings['resolution'] === '720x480') ? 'selected' : ''; ?>>720x480 (NTSC)</option>
<option value="1280x720" <?php echo ($settings['resolution'] === '1280x720') ? 'selected' : ''; ?>>1280x720 (HD 720p)</option>
<option value="1920x1080" <?php echo ($settings['resolution'] === '1920x1080') ? 'selected' : ''; ?>>1920x1080 (HD 1080p)</option>
<option value="2560x1440" <?php echo ($settings['resolution'] === '2560x1440') ? 'selected' : ''; ?>>2560x1440 (QHD 1440p)</option>
<option value="3840x2160" <?php echo ($settings['resolution'] === '3840x2160') ? 'selected' : ''; ?>>3840x2160 (4K UHD)</option>
<option value="4096x2160" <?php echo ($settings['resolution'] === '4096x2160') ? 'selected' : ''; ?>>4096x2160 (4K DCI)</option>
</select>
</div>
<div class="form-group">
<label for="frame_rate"><i class="fas fa-play-circle"></i> Frame Rate (fps)</label>
<input type="text" name="frame_rate" id="frame_rate" value="<?php echo htmlspecialchars($settings['frame_rate']); ?>">
</div>
<div class="form-group">
<label for="gop"><i class="fas fa-layer-group"></i> GOP (Group of Pictures)</label>
<input type="text" name="gop" id="gop" value="<?php echo htmlspecialchars($settings['gop']); ?>">
</div>
<div class="btn-container">
<button type="submit" class="btn pulse"><i class="fas fa-save"></i> Save Settings</button>
</div>
</form>
</div>
<div class="footer">
<p>Made with <i class="fas fa-heart"></i> from ShreeBhattJi</p>
</div>
</div>
</body>
</html>