![]() 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/18345e7f/ |
<?php
session_start();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Create Debug Test</title>
<style>
body { font-family: Arial, sans-serif; margin: 20px; }
.form-group { margin-bottom: 15px; }
label { display: block; margin-bottom: 5px; }
input, textarea, select { width: 100%; padding: 8px; margin-bottom: 10px; }
button { padding: 10px 20px; background: #007bff; color: white; border: none; cursor: pointer; }
.debug { background: #f8f9fa; padding: 10px; margin: 10px 0; border-radius: 5px; }
.error { color: red; }
.success { color: green; }
</style>
</head>
<body>
<h1>🎵 Create Debug Test</h1>
<div class="debug">
<h3>Session Info:</h3>
<p>User ID: <?= $_SESSION['user_id'] ?? 'Not logged in' ?></p>
<p>Credits: <?= $_SESSION['credits'] ?? 'Unknown' ?></p>
<p>Session ID: <?= session_id() ?></p>
</div>
<?php if (!isset($_SESSION['user_id'])): ?>
<div class="error">
<h3>⚠️ Login Required</h3>
<p>You need to be logged in to test the create functionality.</p>
<a href="auth/login.php">Login</a>
</div>
<?php else: ?>
<form id="testForm">
<div class="form-group">
<label for="prompt">Music Description:</label>
<textarea id="prompt" rows="3" placeholder="A happy electronic dance track with heavy bass and synth melodies">A happy electronic dance track with heavy bass and synth melodies</textarea>
</div>
<div class="form-group">
<label for="title">Title:</label>
<input type="text" id="title" value="Test Track" />
</div>
<div class="form-group">
<label for="duration">Duration:</label>
<select id="duration">
<option value="15">15 seconds</option>
<option value="30" selected>30 seconds</option>
<option value="60">1 minute</option>
</select>
</div>
<button type="submit">Test Create</button>
</form>
<div id="result" class="debug" style="display: none;">
<h3>Result:</h3>
<pre id="resultText"></pre>
</div>
<?php endif; ?>
<script>
const API_ENDPOINT = window.location.protocol + '//' + window.location.host + '/api.php';
document.getElementById('testForm')?.addEventListener('submit', async (e) => {
e.preventDefault();
const prompt = document.getElementById('prompt').value;
const title = document.getElementById('title').value;
const duration = parseInt(document.getElementById('duration').value);
const requestData = {
type: 'music',
title: title,
prompt: prompt,
model_name: 'V3_5',
duration: duration,
customMode: false
};
console.log('Sending request:', requestData);
try {
const response = await fetch(API_ENDPOINT, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(requestData)
});
console.log('Response status:', response.status);
console.log('Response headers:', response.headers);
const responseText = await response.text();
console.log('Raw response:', responseText);
let result;
try {
result = JSON.parse(responseText);
} catch (parseError) {
console.error('JSON parse error:', parseError);
document.getElementById('resultText').textContent = 'JSON Parse Error: ' + parseError.message + '\n\nResponse: ' + responseText;
document.getElementById('result').style.display = 'block';
return;
}
console.log('Parsed result:', result);
document.getElementById('resultText').textContent = JSON.stringify(result, null, 2);
document.getElementById('result').style.display = 'block';
} catch (error) {
console.error('Error:', error);
document.getElementById('resultText').textContent = 'Error: ' + error.message;
document.getElementById('result').style.display = 'block';
}
});
</script>
</body>
</html>