Exemplo n.º 1
0
<?php

include_once "connect.php";
include_once "structure.php";
include_once "database.php";
include_once "things.php";
$thread = database_getThread($_GET["thread_id"]);
$row = mysqli_fetch_assoc($thread);
structure_insertHeader($row["thread_subject"], true);
$forum = mysqli_fetch_assoc(database_getForum($row["thread_forum"]));
if (!things_checkLevel($forum["forum_view_level"], true)) {
    die("you must be at least level " . $row["forum_view_level"] . " to be allowed here :)");
}
?>


<div>
	<?php 
echo "<a href='viewForum.php?forum_id=" . $row["thread_forum"] . "'>Return to forum overview</a>";
?>

	<table>
		<?php 
$posts = database_getPosts($_GET["thread_id"]);
while ($row = mysqli_fetch_assoc($posts)) {
    echo "<tr><td class='avatar'>";
    echo "<a href='viewUser.php?user_id=" . $row["post_author"] . "'>" . database_getUsername($row["post_author"]) . "</a>";
    echo "<br />" . $row["post_date"];
    echo "</td><td>";
    echo "<p>" . $row["post_content"] . "</p>";
    echo "</td></tr>";
Exemplo n.º 2
0
<?php

include_once "connect.php";
include_once "structure.php";
include_once "database.php";
structure_insertHeader("Add Thread", false);
//if the user's data has not yet been posted
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
    /*the form hasn't been posted yet, display it
      note that the action="" will cause the form to post to the same page it is on */
    echo '<form method="post" action="addThread.php?forum_id=' . $_GET["forum_id"] . '">
        Thread Subject: <input type="text" name="thread_subject" />
		first post content: <textarea name="post_content"></textarea>
        <input type="submit" value="Add Thread" />
     </form>';
} else {
    $errors = array();
    //if subject is not set
    if (!isset($_POST['thread_subject'])) {
        $errors[] = 'thread must have subject';
    }
    //if content is not set
    if (!isset($_POST['post_content'])) {
        $errors[] = 'thread must have content';
    }
    //if there are errors to report
    if (!empty($errors)) {
        echo 'Uh-oh.. a couple of fields are not filled in correctly..';
        echo '<ul>';
        foreach ($errors as $key => $value) {
            echo '<li>' . $value . '</li>';
Exemplo n.º 3
0
<?php

include_once "connect.php";
include_once "structure.php";
include_once "database.php";
structure_insertHeader("scumbagr", true);
?>


<div>
	Welcome to Scumbagr, the premier online bulletin board for scumbags. Enjoy, my
	friends. See below for which forums you would like to observe and to post in.
	<h2>Forums</h2>
		<ul>

			<?php 
$forums = database_getForums();
while ($row = mysqli_fetch_assoc($forums)) {
    echo "<li><a href='viewForum.php?forum_id=" . $row["forum_id"] . "'>" . $row["forum_name"] . "</a></li>";
}
?>
		</ul>

</div>

<?php 
structure_insertFooter();
Exemplo n.º 4
0
<?php

include "connect.php";
include "structure.php";
include "database.php";
structure_insertHeader("Sign In", false);
//if there is already someone signed in
if (isset($_SESSION['signed_in']) && $_SESSION['signed_in'] == true) {
    echo 'You are already signed in, you can <a href="signout.php">sign out</a>
		  if you want.';
} else {
    //if no data has been posted
    if ($_SERVER['REQUEST_METHOD'] != 'POST') {
        echo '<form method="post" action="">
            Username: <input type="text" name="user_name" />
            Password: <input type="password" name="user_pass">
            <input type="submit" value="Sign in" />
         </form>';
    } else {
        $errors = array();
        //if user name is not set
        if (!isset($_POST['user_name'])) {
            $errors[] = 'The username field must not be empty.';
        }
        //if password is not set
        if (!isset($_POST['user_pass'])) {
            $errors[] = 'The password field must not be empty.';
        }
        //if there are errors of some description
        if (!empty($errors)) {
            echo 'Uh-oh.. a couple of fields are not filled in correctly..';
Exemplo n.º 5
0
<?php

include_once "connect.php";
include_once "structure.php";
include_once "database.php";
structure_insertHeader("Add User", false);
//if the user's data has not yet been posted
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
    /*the form hasn't been posted yet, display it
      note that the action="" will cause the form to post to the same page it is on */
    echo '<form method="post" action="">
        Username: <input type="text" name="user_name" />
        Password: <input type="password" name="user_pass">
        Password again: <input type="password" name="user_pass_check">
        E-mail: <input type="email" name="user_email">
        <input type="submit" value="Add category" />
     </form>';
} else {
    $errors = array();
    //if user name is set
    if (isset($_POST['user_name'])) {
        //the user name exists
        if (!ctype_alnum($_POST['user_name'])) {
            $errors[] = 'The username can only contain letters and digits.';
        }
        //if the user name is too long
        if (strlen($_POST['user_name']) > 30) {
            $errors[] = 'The username cannot be longer than 30 characters.';
        }
    } else {
        $errors[] = 'The username field must not be empty.';
Exemplo n.º 6
0
<?php

include_once "connect.php";
include_once "structure.php";
include_once "database.php";
include_once "things.php";
$forum = database_getForum($_GET["forum_id"]);
$row = mysqli_fetch_assoc($forum);
if (!things_checkLevel($row["forum_view_level"], true)) {
    die("you must be at least level " . $row["forum_view_level"] . " to be allowed here :)");
}
structure_insertHeader($row["forum_name"], true);
?>


<div>
	<p>
		<a href="index.php">Return to Index</a>
	</p>
	<?php 
echo $row["forum_description"];
echo "<p><small>you must be at least level " . $row["forum_post_level"] . " to post threads here</small></p>";
echo "<p><small>you must be at least level " . $row["forum_reply_level"] . " to reply to threads here</small></p>";
echo "<p><small>you must be at least level " . $row["forum_view_level"] . " to view threads here</small></p>";
if (things_checkLevel($row["forum_post_level"])) {
    echo "<a href='addThread.php?forum_id=" . $_GET["forum_id"] . "'>add a thread</a>";
}
echo "<h2>Threads</h2>";
$threads = database_getThreads($_GET["forum_id"]);
while ($row = mysqli_fetch_assoc($threads)) {
    echo "<a href='viewThread.php?thread_id=" . $row["thread_id"] . "'><h2>" . $row["thread_subject"] . "</h2></a>";
Exemplo n.º 7
0
<?php

include_once "connect.php";
include_once "structure.php";
include_once "database.php";
$user = database_getUser($_GET["user_id"]);
$row = mysqli_fetch_assoc($user);
structure_insertHeader($row["user_name"], true);
?>


<div>
	<a href="index.php">Return to Index</a>

	<?php 
echo "<h2>Level " . $row["user_level"] . "</h2>";
echo "<h2>Joined on " . $row["user_date"] . "</h2>";
echo "<p>" . $row["user_bio"] . "</p>";
?>



</div>


<?php 
structure_insertFooter();
Exemplo n.º 8
0
<?php

include_once "connect.php";
include_once "structure.php";
include_once "database.php";
include_once "things.php";
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    database_addPost($_POST["post_content"], $_SESSION["user_id"], $_GET["thread_id"]);
}
structure_insertHeader("post added", true);
?>


<div>
	post added.
	<p>
		<?php 
echo "<a href=viewThread.php?thread_id=" . $_GET["thread_id"] . ">return</a>";
?>
	</p>
</div>


<?php 
structure_insertFooter();
Exemplo n.º 9
0
<?php

include "connect.php";
include "structure.php";
include "database.php";
structure_insertHeader("log out", false);
session_unset();
session_destroy();
?>

<div>
	<a href="index.php">Back to index</a>
	<a href="login.php">Log back in</a>
</div>

<?php 
structure_insertFooter();