FreeSTAR-Status-Engine/subscriptions.php

30 lines
946 B
PHP
Raw Normal View History

2018-06-07 07:56:05 -04:00
<?php
require_once("template.php");
require_once("config.php");
require_once("classes/constellation.php");
Template::render_header("Subscriptions");
$tg_user = getTelegramUserData();
if($tg_user !== false){
$query = $mysqli->query("SELECT services.id, services.name, subscribers.subscriberID, subscribers.telegramID
FROM services
LEFT JOIN services_subscriber ON services_subscriber.serviceIDFK = services.id
LEFT JOIN subscribers ON services_subscriber.subscriberIDFK = subscribers.subscriberID
WHERE subscribers.telegramID =" . $tg_user['id']);
//$query = $mysqli->query("SELECT id, name FROM services");
if ($query->num_rows){
$timestamp = time();
echo '<h1>' . _("Your subscriptions") . "</h1>";
echo '<ul class="list-group">';
while($result = $query->fetch_assoc())
{
echo '<li class="list-group-item">' . $result['name'] . '</li>';
}
echo "</ul>";
}
} else{
header('Location: index.php');
}
Template::render_footer();