<?php include("mumrik.php");
session_start(); ?>
<?php
if (isset($_GET['logout'])) {
unset($_SESSION['name']);
unset($_SESSION['id']);
}
if (isset($_SESSION['name'])) {
// inloggad
$data['menu'] = ' ▲ LOG OUT';
} else {
// inte inloggad
$data['menu'] = ' ▲ LOG IN';
}
if (isset($_GET['thread'])) {
if (isset($_SESSION['name'])) {
$thread = mysql_real_escape_string($_GET['thread']);
$tråd = d_getvalues($thread);
$forum = d_getvalues($tråd['forum'][0]);
$posts = d_getbonded("post", "thread", $_GET['thread'], 0);
$data['content'] = '' . $forum['namn'][0] . ' > ' . $tråd['namn'][0] . "";
$data['title'] = $tråd['namn'][0];
$data['content'] .= '';
$pt = count($posts);$i = 0;
foreach ($posts as $post) {
$i++;
$user = d_getvalues($post['user'][0]);
if ($user['id'] == $_SESSION['id']) {
// hey, its me!
if ($i == $pt) {
// sista posten
$zx = " ▲ edit";
} else $zx = "";
} else $zx = "";
if ($_SESSION['rank'] == 1) {
// we have an admin
if ($i == 1) {
// first post. thread functuions
$zx .= ' ▲ delete thread ▲ lock thread';
} else {
$zx .= ' ▲ delete';
}
}
$data['content'] .= '
BEGONIA MACULATA
cool plant, shield-like big and stiff leaves. red, and a darky green. maybe 20 cm high
this fella likes shadow, semi-shadow, or a pretty light environment but NOT direct sunlight. i should let the soil get slightly dry before i pour more water (this is once a week-ish).
'. $post['text'][0] .'
'. $user['namn'][0] .''. $user['class'][0] .'
';
}
if (!isset($tråd['lock'])) {
$data['content'] .= '
';
} else {
$data['content'] .= '
';
}
} else $data['content'] = '
the other plant is a...
OXALIS
and it has red leaves as well! hm, a preference?
';
} else if (isset($_GET['login'])) {
if (isset($_SESSION['name'])) {
$data['content'] = '
and what do you think youre doing?
';
} else {
if ($_GET['login'] == "error") {
$z = "wrong user/password";
} else if ($_GET['login'] == "y") {
$z = "YOUR ACCOUNT IS CREATED";
} else $z = "";
$data['content'] = '
';
}
} else if (isset($_GET['register'])) {
if ($_GET['register'] == "c") {
$z = '
';
} else if ($_GET['register'] == "p") {
$z = 'YOUR PASSWORDS DOES NOT MATCH
';
} else if ($_GET['register'] == "u") {
$z = 'THAT USER ALREADY EXISTS
';
} else {
$z = "";
}
$data['content'] = '
';
} else if (isset($_GET['forum'])) {
if (isset($_SESSION['name'])) {
// ok nu ska vi lista vika fora som finns
$data['content'] = "";
$f = d_gettype("forum");
foreach ($f as $forum) {
$k = d_getbonded("thread", "forum", $forum['id']);
$data['content'] .= "";
$data['content'] .= "
";
$data['content'] .= count($k) . ' threads ▲ latest:
'. $k[0]['namn'][0] .'';
$data['content'] .= "
";
}
if ($_SESSION['rank'] == 1) {
$data['content'] .= '';
}
} else $data['content'] = 'this is a closed forum AHAHAHA
you may register tho
';
} else if (isset($_GET['fora'])) {
if (isset($_SESSION['name'])) {
$forum = d_getvalues($_GET['fora']);
$threads = d_getbonded("thread", "forum", $_GET['fora'], 1);
$data['content'] = '";
if (is_array($threads)) {
foreach ($threads as $thread) {
$te = d_getbonded("post", "thread", $thread['id'], 0);
$data['content'] .= '";
}
}
} else $data['content'] = 'this is a closed forum AHAHAHA
you may register tho
';
} else if (isset($_GET['delete'])) {
if (isset($_SESSION['name'])) {
if (d_istype($_GET['delete'], 'post')) {
// yes, its a post
$post = d_getvalues($_GET['delete']);
$user = d_getvalues($post['user'][0]);
$data['content'] = '
'. bbfixi($post['text'][0]) .'
'. $post['text'][0] .'
'. $user['namn'][0] .''. $user['class'][0] .'
';
$data['content'] .= '';
} else {
$data['content'] = '';
}
} else $data['content'] = 'this is a closed forum AHAHAHA
you may register tho
';
} else if (isset($_GET['new'])) {
if (isset($_SESSION['name'])) {
$data['content'] = '
';
} else $data['content'] = 'this is a closed forum AHAHAHA
you may register tho
';
}
?>
<?php if (isset($data['content'])) { echo $data['content']; } else { ?>
WELCUM to default startpage
om man inte är inloggad: NYASTE NYHETEN + login form
om man är inloggad: två nyaste nyheten
<?php } ?>