hajime/public/mio_index.php
2023-08-12 00:16:32 +02:00

140 lines
7.9 KiB
PHP

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Flashii</title>
<meta name="description" content="Personal site/Project dumping ground of Flashwave No.10032 with a chat 'n shiet.">
<link rel="shortcut icon" href="/favicon.ico">
<link rel="stylesheet" type="text/css" href="/assets/global.css" />
<link rel="stylesheet" type="text/css" href="/assets/css/mio.css" />
<script type="text/javascript" src="/assets/jquery.js"></script>
<script type="text/javascript" src="/assets/js/flashii.js"></script>
<script type="text/javascript" src="/assets/js/ybabstat.js"></script>
</head>
<body>
<?php include(FII_SRC_DIR . '/mio_bar.php'); ?>
<a href="/">
<img class="logo" src="/assets/pixel.png" alt="Flashii" />
</a>
<br />
<h3 class="miotitle" style="font-style: italic; display: inline-block; padding: 5px 10px">Fixing things incorrectly since 2013!</h3>
<?php if($flashii->loggedIn()) { ?>
<div class="mioboards" id="userheadsup">
<h3 class="miotitle" style="margin:0px;">Hi, <?=$_SESSION['user'];?>!<span class="windowbutton-container" onclick="hidePageSection('userheadsup',1);"><img class="minbutton" src="/assets/pixel.png" alt="_" /></span></h3>
<div class="mioboxcontent sub">
<br />
You have no new messages because the Private Messaging system doesn't exist, have a nice day.<br />
Your rank is <span style="<?=$flashii->getRankdata($flashii->getUserdata($_SESSION['uid'])['userrole'])['style'];?>"><?=$flashii->getRankdata($flashii->getUserdata($_SESSION['uid'])['userrole'])['name'];?></span>
<br /><br />
</div>
</div>
<?php } else { ?>
<div class="mioboards" id="userheadsup">
<h3 class="miotitle" style="margin:0px;">Welcome!</h3>
<br />
Welcome to Flashii! This is a site for a bunch of friends to hang out, nothing special.<br />Anyone is pretty much welcome to register so why not have a go?
<br /><br />
<a class="registerbutton" href="/register">Register!</a>
<a class="loginbutton" href="/login">Login</a>
</div>
<?php
}
if($flashii->loggedIn()) {
$getBirthdays = $database->query("SELECT * FROM `flashii_users` WHERE `userrole` != '0' ORDER BY `id`");
$getBirthdays = $getBirthdays->fetch_all(MYSQLI_ASSOC);
$birthdayCount = 0;
$birthdays = array();
foreach($getBirthdays as $userData) {
if(!empty($userData['birthdate'])) {
if(date('m-d') == substr(date('Y-m-d', $userData['birthdate']), 5, 5) || (date('y')%4 <> 0 && substr(date('Y-m-d', $userData['birthdate']), 5, 5) == '02-29' && date('m-d') == '02-28')) {
++$birthdayCount;
$birthdays[$birthdayCount] = array();
$birthdays[$birthdayCount]['id'] = $birthdayCount;
$birthdays[$birthdayCount]['uid'] = $userData['id'];
$birthdays[$birthdayCount]['uname'] = $userData['username'];
}
}
}
if($birthdayCount) {
print '<div class="mioboards" id="birthdays">';
print '<h3 class="miotitle" style="margin:0px;">Birthdays<span class="windowbutton-container" onclick="hidePageSection(\'birthdays\', 1);"><img class="minbutton" src="/assets/pixel.png" alt="_" /></span></h3>';
print '<div class="mioboxcontent sub" style="margin:0px;"><br />';
print 'Congratulations to ';
foreach($birthdays as $userData) {
print '<b><a href="/u/';
print $userData['uid'];
print '" class="default" target="_blank">';
print $userData['uname'];
print '</a></b>';
if($userData['id'] + 1 === count($birthdays))
print ' and ';
elseif($userData['id'] === count($birthdays))
print '!';
else
print ', ';
}
print '<br /><br /></div>';
print '</div>';
}
}
?>
<div class="mioblog" id="latestnewsposts">
<h3 class="miotitle" style="margin:0px;">Latest News Post<span class="windowbutton-container" onclick="hidePageSection('latestnewsposts',1);"><img class="minbutton" src="/assets/pixel.png" alt="_" /></span></h3>
<div class="mioboxcontent sub" style="margin: 0px;">
<?php
$getNews = $database->query("SELECT * FROM `flashii_news` ORDER BY `id` DESC LIMIT 1");
$getNews = $getNews->fetch_all(MYSQLI_ASSOC);
foreach($getNews as $newsPost) {
print '<div class="content">';
print '<h3 class="miotitle" id="'.$newsPost['id'].'">';
print $newsPost['title'];
print ' by <a style="text-decoration:none!important;color:#FFF;" href="/u/';
print $newsPost['uid'];
print '" target="_blank"><span style="';
print $flashii->getRankdata($flashii->getUserdata($newsPost['uid'])['userrole'])['style'];
print '">';
print $flashii->getUserdata($newsPost['uid'])['username'];
print '</span></a> - ';
print date('d/m/Y @ g:iA T',$newsPost['date']);
print ' <span class="permalink"><a href="/news#';
print $newsPost['id'];
print '" title="Permalink">#</a> <a href="/news/';
print $newsPost['id'];
print '" title="Direct Link">@</a></span></h3><div class="postcontent">';
print $mdparser->text($newsPost['content']);
print '</div><br /></div>';
}
?>
</div>
</div>
<div class="mioblog" id="sitestatistics">
<h3 class="miotitle" style="margin:0px;">Statistics<span class="windowbutton-container" onclick="hidePageSection('sitestatistics',1);"><img class="minbutton" src="/assets/pixel.png" alt="_" /></span></h3>
<div class="mioboxcontent sub" style="margin:0px;">
<?php
$getUsers = $database->query("SELECT * FROM `flashii_users` WHERE `userrole`!='0' ORDER BY `id`");
$countUsers = $getUsers->num_rows;
$getNewestUser = @end($getUsers->fetch_all(MYSQLI_ASSOC));
$getChatUsers = $database->query("SELECT * FROM `flashii_chat_online_users`")->num_rows;
?>
<table class="miotable" style="text-align:center;">
<tr><td style="width:50%;">We have <?=$countUsers;?> registered users.</td><td>Our newest member is <a href="/u/<?=$getNewestUser['id'];?>"><?=$getNewestUser['username'];?></a>.</td></tr>
<tr><td>It has been <?=date_diff(date_create(date('Y-m-d',$getNewestUser['join_date'])),date_create(date('Y-m-d')))->format('%a');?> days since the last user registered.</td><td><?=$getChatUsers;?> user(s) in chat right now.</td></tr>
</table>
</div>
</div>
<div class="navbar">
<?php include(FII_SRC_DIR . '/mio_menu.php'); ?>
</div>
<?php include(FII_SRC_DIR . '/mio_copyright.php'); ?>
</body>
</html>