find_many();
foreach ($config as $c) {
$config[$c['setting']] = $c['value'];
}
echo "
Registration SMS Debug Information
";
// Check configuration
echo "Configuration Check:
";
echo "user_notification_payment: " . ($config['user_notification_payment'] ?? 'Not set') . "
";
echo "SMS URL configured: " . (!empty($config['sms_url']) ? 'Yes' : 'No') . "
";
echo "Company Name: " . ($config['CompanyName'] ?? 'Not set') . "
";
// Check template
echo "Template Check:
";
$template = Lang::getNotifText('user_registration');
if ($template) {
echo "Template loaded: Yes
";
echo "Template preview:
";
echo "" . htmlspecialchars(substr($template, 0, 200)) . "...
";
} else {
echo "Template loaded: No
";
}
// Test SMS function
echo "Test SMS Function:
";
if (isset($_POST['test_sms'])) {
$test_phone = $_POST['test_phone'];
$test_name = $_POST['test_name'];
if (!empty($test_phone) && !empty($test_name)) {
$testCustomerData = [
'fullname' => $test_name,
'username' => 'testuser',
'password' => 'testpass',
'phonenumber' => $test_phone,
'service_type' => 'Hotspot'
];
echo "Testing SMS for: " . $test_name . " (" . $test_phone . ")
";
$result = Message::sendRegistrationNotification($testCustomerData);
if ($result) {
echo "Result: SMS sent successfully
";
echo "Message:
";
echo "" . htmlspecialchars($result) . "
";
} else {
echo "Result: SMS failed or no result returned
";
}
} else {
echo "Error: Please fill in both phone number and name
";
}
}
// Test form
echo "Test SMS Form:
";
echo "";
// Check recent logs
echo "Recent Logs:
";
$logFile = $root_path . 'system/logs/Registration SMS.log';
if (file_exists($logFile)) {
$logs = file_get_contents($logFile);
$recentLogs = array_slice(explode("\n", $logs), -10);
echo "" . htmlspecialchars(implode("\n", $recentLogs)) . "";
} else {
echo "No log file found at: " . $logFile;
}
echo "
Go to Add Customer";
?>