Files
Wallos/includes/checkredirect.php
Miguel Ribeiro 3ecc160ccb fix: redirect from dashboard to subscriptions for new users
fix: wrong check for disabling password login
fix: missing apikey validation error on get_monthly_cost api endpoint
chore: update readme
2025-08-13 13:55:31 +02:00

16 lines
531 B
PHP

<?php
$currentPage = basename($_SERVER['PHP_SELF']);
if ($currentPage == 'index.php') {
// Redirect to subscriptions page if no subscriptions exist
$stmt = $db->prepare("SELECT COUNT(*) FROM subscriptions WHERE user_id = :userId");
$stmt->bindValue(':userId', $userId, SQLITE3_INTEGER);
$result = $stmt->execute();
$row = $result->fetchArray(SQLITE3_NUM);
$subscriptionCount = $row[0];
if ($subscriptionCount === 0) {
header('Location: subscriptions.php');
exit;
}
}