mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-09 06:35:42 +12:00
annoying cases
This commit is contained in:
parent
97553456ce
commit
4e4001cf00
2 changed files with 27 additions and 9 deletions
|
@ -210,7 +210,7 @@ function get_fourm_threads($fourm)
|
||||||
{
|
{
|
||||||
include('config.php');
|
include('config.php');
|
||||||
$connect = mysqli_connect($dbhost, $dbuser, $dbpass,$dbname) or die("Unable to connect to '$dbhost'");
|
$connect = mysqli_connect($dbhost, $dbuser, $dbpass,$dbname) or die("Unable to connect to '$dbhost'");
|
||||||
$stmt = $connect->prepare("SELECT * FROM FourmThread WHERE Fourm=?");
|
$stmt = $connect->prepare("SELECT * FROM FourmThread WHERE Fourm=? ORDER BY CreationTime DESC");
|
||||||
$stmt->bind_param("s", $fourm);
|
$stmt->bind_param("s", $fourm);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$result = $stmt->get_result();
|
$result = $stmt->get_result();
|
||||||
|
|
|
@ -5,6 +5,7 @@ include("header.php");
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
$nope = 0;
|
||||||
if(!is_logged_in())
|
if(!is_logged_in())
|
||||||
goto ex;
|
goto ex;
|
||||||
if(isset($_POST['SUBJECT'], $_POST['TEXT'], $_POST['TEXT'], $_POST['FORUM']))
|
if(isset($_POST['SUBJECT'], $_POST['TEXT'], $_POST['TEXT'], $_POST['FORUM']))
|
||||||
|
@ -12,9 +13,19 @@ include("header.php");
|
||||||
$subject = $_POST['SUBJECT'];
|
$subject = $_POST['SUBJECT'];
|
||||||
$text = $_POST['TEXT'];
|
$text = $_POST['TEXT'];
|
||||||
$forum = strtoupper($_POST['FORUM']);
|
$forum = strtoupper($_POST['FORUM']);
|
||||||
|
|
||||||
|
if($text == "" && !isset($_POST['VIEWID'])){
|
||||||
|
$nope = 1;
|
||||||
|
goto ex;
|
||||||
|
}
|
||||||
|
if($text == "")
|
||||||
|
goto ex;
|
||||||
|
if($subject == "")
|
||||||
|
$subject = "No Subject";
|
||||||
|
|
||||||
if(!($forum === "SUPPORT" || $forum === "BUGS" || $forum === "GENERAL" || $forum === "HORSES" || $forum === "GAME" || $forum === "MOD"))
|
if(!($forum === "SUPPORT" || $forum === "BUGS" || $forum === "GENERAL" || $forum === "HORSES" || $forum === "GAME" || $forum === "MOD"))
|
||||||
goto ex;
|
goto ex;
|
||||||
|
|
||||||
$subject = substr($subject, 0, 100);
|
$subject = substr($subject, 0, 100);
|
||||||
$text = substr($text, 0, 65565);
|
$text = substr($text, 0, 65565);
|
||||||
|
|
||||||
|
@ -27,8 +38,8 @@ include("header.php");
|
||||||
$threadId = $_POST['VIEWID'];
|
$threadId = $_POST['VIEWID'];
|
||||||
if(count_replies($threadId) <= 0)
|
if(count_replies($threadId) <= 0)
|
||||||
{
|
{
|
||||||
echo('<HR>Forum thread not found!?');
|
$nope = 1;
|
||||||
exit();
|
goto ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
create_fourm_reply($threadId, $_SESSION['USERNAME'], $text, $forum, $_SESSION['ADMIN']);
|
create_fourm_reply($threadId, $_SESSION['USERNAME'], $text, $forum, $_SESSION['ADMIN']);
|
||||||
|
@ -49,6 +60,13 @@ if(!is_logged_in()){
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<TABLE WIDTH=100%><TR><TD class=forumlist><A HREF="?FORUM=SUPPORT">SUPPORT</A><BR>(<?php echo(count_topics("SUPPORT")); ?> topics)</TD><TD class=forumlist><A HREF="?FORUM=BUGS">BUGS</A><BR>(<?php echo(count_topics("BUGS")); ?> topics)</TD><TD class=forumlist><A HREF="?FORUM=GENERAL">GENERAL</A><BR>(<?php echo(count_topics("GENERAL")); ?> topics)</TD><TD class=forumlist><A HREF="?FORUM=HORSES">HORSES</A><BR>(<?php echo(count_topics("HORSES")); ?> topics)</TD><TD class=forumlist><A HREF="?FORUM=GAME">GAME</A><BR>(<?php echo(count_topics("GAME")); ?> topics)</TD></TABLE><?php
|
<TABLE WIDTH=100%><TR><TD class=forumlist><A HREF="?FORUM=SUPPORT">SUPPORT</A><BR>(<?php echo(count_topics("SUPPORT")); ?> topics)</TD><TD class=forumlist><A HREF="?FORUM=BUGS">BUGS</A><BR>(<?php echo(count_topics("BUGS")); ?> topics)</TD><TD class=forumlist><A HREF="?FORUM=GENERAL">GENERAL</A><BR>(<?php echo(count_topics("GENERAL")); ?> topics)</TD><TD class=forumlist><A HREF="?FORUM=HORSES">HORSES</A><BR>(<?php echo(count_topics("HORSES")); ?> topics)</TD><TD class=forumlist><A HREF="?FORUM=GAME">GAME</A><BR>(<?php echo(count_topics("GAME")); ?> topics)</TD></TABLE><?php
|
||||||
|
if($nope)
|
||||||
|
{
|
||||||
|
nope:
|
||||||
|
echo('<HR>Forum thread not found!?');
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
if(isset($_GET['FORUM']) && isset($_GET['VIEWID'])){
|
if(isset($_GET['FORUM']) && isset($_GET['VIEWID'])){
|
||||||
$forum = strtoupper($_GET['FORUM']);
|
$forum = strtoupper($_GET['FORUM']);
|
||||||
$threadId = $_GET['VIEWID'];
|
$threadId = $_GET['VIEWID'];
|
||||||
|
@ -57,11 +75,8 @@ if(isset($_GET['FORUM']) && isset($_GET['VIEWID'])){
|
||||||
echo('Unknown Forum');
|
echo('Unknown Forum');
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
if(count_replies($threadId) <= 0)
|
if(count_replies($threadId) <= 0 || $nope)
|
||||||
{
|
goto nope;
|
||||||
echo('<HR>Forum thread not found!?');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$thread = get_fourm_thread($threadId);
|
$thread = get_fourm_thread($threadId);
|
||||||
echo('<HR><B>VIEWING '.htmlspecialchars($forum).' FORUM THREAD: <FONT SIZE=+1>'.htmlspecialchars($thread['title']).'</FONT></B><BR><TABLE WIDTH=100%>');
|
echo('<HR><B>VIEWING '.htmlspecialchars($forum).' FORUM THREAD: <FONT SIZE=+1>'.htmlspecialchars($thread['title']).'</FONT></B><BR><TABLE WIDTH=100%>');
|
||||||
|
@ -103,10 +118,13 @@ if(isset($_GET['FORUM']) && !isset($_GET['VIEWID'])){
|
||||||
$minsAgo = 0;
|
$minsAgo = 0;
|
||||||
$current_time = time();
|
$current_time = time();
|
||||||
$difference = $current_time - $createTime;
|
$difference = $current_time - $createTime;
|
||||||
|
$secsAgo = $difference;
|
||||||
$minsAgo = $difference/60;
|
$minsAgo = $difference/60;
|
||||||
$daysAgo = $difference/86400;
|
$daysAgo = $difference/86400;
|
||||||
|
|
||||||
if($minsAgo <= 1440)
|
if($secsAgo <= 60)
|
||||||
|
echo('<FONT COLOR=880000><B>'.number_format((float)$minsAgo, 0, '.', '').' sec ago</B></FONT>');
|
||||||
|
else if($minsAgo <= 1440)
|
||||||
echo('<FONT COLOR=880000><B>'.number_format((float)$minsAgo, 0, '.', '').' min ago</B></FONT>');
|
echo('<FONT COLOR=880000><B>'.number_format((float)$minsAgo, 0, '.', '').' min ago</B></FONT>');
|
||||||
else
|
else
|
||||||
echo(number_format((float)$daysAgo, 0, '.', '').' days ago');
|
echo(number_format((float)$daysAgo, 0, '.', '').' days ago');
|
||||||
|
|
Loading…
Add table
Reference in a new issue