![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/.cursor-server/data/User/History/-7cf403ed/ |
<?php
session_start();
require_once __DIR__ . '/../config/database.php';
require_once __DIR__ . '/includes/functions.php';
require_once __DIR__ . '/../includes/translations.php';
$error = '';
$success = '';
// Get tier from URL if provided
$default_tier = $_GET['tier'] ?? 'local';
if (!in_array($default_tier, ['local', 'regional', 'national', 'enterprise'])) {
$default_tier = 'local';
}
// Handle form submission
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$pdo = getDBConnection();
// Validate input
$station_name = trim($_POST['station_name'] ?? '');
$contact_name = trim($_POST['contact_name'] ?? '');
$contact_email = trim($_POST['contact_email'] ?? '');
$contact_phone = trim($_POST['contact_phone'] ?? '');
$license_tier = $_POST['license_tier'] ?? 'local';
if (empty($station_name) || empty($contact_name) || empty($contact_email)) {
$error = t('radio_register.error_required');
} elseif (!filter_var($contact_email, FILTER_VALIDATE_EMAIL)) {
$error = t('radio_register.error_email');
} else {
// Check if email already exists
$stmt = $pdo->prepare("SELECT id FROM radio_stations WHERE contact_email = ?");
$stmt->execute([$contact_email]);
if ($stmt->fetch()) {
$error = t('radio_register.error_exists');
} else {
// Generate API credentials
$credentials = generateAPICredentials();
// Create station record
$stmt = $pdo->prepare("
INSERT INTO radio_stations (
station_name, call_sign, station_type, license_tier,
contact_name, contact_email, contact_phone,
city, state, country, timezone,
subscription_status, monthly_play_limit,
api_key, api_secret, api_enabled
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
");
$result = $stmt->execute([
$station_name,
$_POST['call_sign'] ?? null,
$_POST['station_type'] ?? 'local',
$license_tier,
$contact_name,
$contact_email,
$contact_phone ?: null,
$_POST['city'] ?? null,
$_POST['state'] ?? null,
$_POST['country'] ?? 'US',
$_POST['timezone'] ?? 'America/New_York',
'trial',
getTierPlayLimit($license_tier),
$credentials['api_key'],
password_hash($credentials['api_secret'], PASSWORD_DEFAULT),
true
]);
if ($result) {
$station_id = $pdo->lastInsertId();
// Store credentials in session temporarily
$_SESSION['radio_station_id'] = $station_id;
$_SESSION['radio_api_key'] = $credentials['api_key'];
$_SESSION['radio_api_secret'] = $credentials['api_secret'];
// Redirect to subscription
header("Location: /radio/subscribe.php?station_id=" . $station_id);
exit;
} else {
$error = 'Registration failed. Please try again.';
}
}
}
}
$page_title = 'Radio Station Registration - SoundStudioPro';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?= htmlspecialchars($page_title) ?></title>
<link rel="stylesheet" href="/assets/css/main.css">
<style>
.radio-register {
max-width: 600px;
margin: 2rem auto;
padding: 2rem;
background: white;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.radio-register h1 {
margin-bottom: 1.5rem;
color: #667eea;
}
.form-group {
margin-bottom: 1.5rem;
}
.form-group label {
display: block;
margin-bottom: 0.5rem;
font-weight: 600;
}
.form-group input,
.form-group select {
width: 100%;
padding: 0.75rem;
border: 1px solid #ddd;
border-radius: 4px;
font-size: 1rem;
}
.tier-options {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
gap: 1rem;
margin-top: 1rem;
}
.tier-option {
border: 2px solid #ddd;
border-radius: 8px;
padding: 1rem;
cursor: pointer;
transition: all 0.3s;
}
.tier-option:hover {
border-color: #667eea;
}
.tier-option.selected {
border-color: #667eea;
background: #f0f4ff;
}
.tier-option input[type="radio"] {
width: auto;
}
.btn-primary {
background: #667eea;
color: white;
padding: 0.75rem 2rem;
border: none;
border-radius: 4px;
font-size: 1rem;
cursor: pointer;
width: 100%;
}
.btn-primary:hover {
background: #5568d3;
}
.error {
background: #fee;
color: #c33;
padding: 1rem;
border-radius: 4px;
margin-bottom: 1rem;
}
</style>
</head>
<body>
<?php include __DIR__ . '/../includes/header.php'; ?>
<div class="radio-register">
<h1>🎵 Radio Station Registration</h1>
<p>Sign up your radio station to access our music licensing platform.</p>
<?php if ($error): ?>
<div class="error"><?= htmlspecialchars($error) ?></div>
<?php endif; ?>
<form method="POST">
<div class="form-group">
<label>Station Name *</label>
<input type="text" name="station_name" required value="<?= htmlspecialchars($_POST['station_name'] ?? '') ?>">
</div>
<div class="form-group">
<label>Call Sign (e.g., KISS-FM)</label>
<input type="text" name="call_sign" value="<?= htmlspecialchars($_POST['call_sign'] ?? '') ?>">
</div>
<div class="form-group">
<label>Station Type</label>
<select name="station_type">
<option value="local">Local</option>
<option value="regional">Regional</option>
<option value="national">National</option>
<option value="internet">Internet Radio</option>
<option value="podcast">Podcast</option>
</select>
</div>
<div class="form-group">
<label>License Tier *</label>
<div class="tier-options">
<label class="tier-option <?= $default_tier === 'local' ? 'selected' : '' ?>">
<input type="radio" name="license_tier" value="local" <?= $default_tier === 'local' ? 'checked' : '' ?>>
<strong>Local</strong><br>
$99/month<br>
500 plays/month
</label>
<label class="tier-option <?= $default_tier === 'regional' ? 'selected' : '' ?>">
<input type="radio" name="license_tier" value="regional" <?= $default_tier === 'regional' ? 'checked' : '' ?>>
<strong>Regional</strong><br>
$299/month<br>
2,000 plays/month
</label>
<label class="tier-option <?= $default_tier === 'national' ? 'selected' : '' ?>">
<input type="radio" name="license_tier" value="national" <?= $default_tier === 'national' ? 'checked' : '' ?>>
<strong>National</strong><br>
$999/month<br>
Unlimited plays
</label>
</div>
</div>
<div class="form-group">
<label>Contact Name *</label>
<input type="text" name="contact_name" required value="<?= htmlspecialchars($_POST['contact_name'] ?? '') ?>">
</div>
<div class="form-group">
<label>Contact Email *</label>
<input type="email" name="contact_email" required value="<?= htmlspecialchars($_POST['contact_email'] ?? '') ?>">
</div>
<div class="form-group">
<label>Contact Phone</label>
<input type="tel" name="contact_phone" value="<?= htmlspecialchars($_POST['contact_phone'] ?? '') ?>">
</div>
<div class="form-group">
<label>City</label>
<input type="text" name="city" value="<?= htmlspecialchars($_POST['city'] ?? '') ?>">
</div>
<div class="form-group">
<label>State</label>
<input type="text" name="state" value="<?= htmlspecialchars($_POST['state'] ?? '') ?>">
</div>
<button type="submit" class="btn-primary">Continue to Subscription</button>
</form>
</div>
<?php include __DIR__ . '/../includes/footer.php'; ?>
</body>
</html>