public function index($arguments) { $news = new news(ConnectionFactory::get('mongo')); $articles = new articles(ConnectionFactory::get('mongo')); $notices = new notices(ConnectionFactory::get('redis')); $irc = new irc(ConnectionFactory::get('redis')); $quotes = new quotes(ConnectionFactory::get('mongo')); $forums = new forums(ConnectionFactory::get('redis')); // Set all site-wide notices. foreach ($notices->getAll() as $notice) { Error::set($notice, true); } // Fetch the easy data. $this->view['news'] = $news->getNewPosts(); $this->view['shortNews'] = $news->getNewPosts(true); $this->view['newArticles'] = $articles->getNewPosts('new', 1, 5); $this->view['ircOnline'] = $irc->getOnline(); $this->view['randomQuote'] = $quotes->getRandom(); $this->view['fPosts'] = $forums->getNew(); // Get online users. $apc = new APCIterator('user', '/' . Cache::PREFIX . 'user_.*/'); $this->view['onlineUsers'] = array(); while ($apc->valid()) { $current = $apc->current(); array_push($this->view['onlineUsers'], substr($current['key'], strlen(Cache::PREFIX) + 5)); $apc->next(); } // Set title. Layout::set('title', 'Home'); }
public function search() { $word = '%' . $_GET['content'] . '%'; $db = new database(); $db->stmt->prepare('select id, name from forums where name like ?'); $db->stmt->bind_param('s', $word); $db->stmt->execute(); $db->stmt->bind_result($id, $name); $arr = array(); while ($db->stmt->fetch()) { $res['id'] = $id; $res['name'] = $name; $arr[] = $res; } $db->stmt->prepare('select id, forum_id, title, content from posts where title like ?'); $db->stmt->bind_param('s', $word); $db->stmt->execute(); $db->stmt->bind_result($id, $forum_id, $title, $content); $forum = new forums(); while ($db->stmt->fetch()) { $f = $forum->find($forum_id); $res['id'] = $id; $res['forum_name'] = $f['name']; $res['title'] = $title; $res['content'] = $content; $arr[] = $res; } echo json_encode($arr); return; }
public function new_forum() { if ($_POST['csrf'] != file_get_contents('temp/csrf.txt')) { echo 1; return; } $name = $_POST['name']; $forum = new forums(); if ($forum->has($name)) { echo 1; return; } $suc = $forum->insert($name); echo $suc ? 0 : 1; return; }
<?php require_once "forumUserDB.php"; require_once "forums.php"; require_once "rpc.php"; $viewpost = $_POST['submit']; $title = $_POST['title']; echo $title; $_SESSION['currentpost'] = $title; $response = "ayy lmao<p>"; $myId = $_SESSION['myId']; $myName = $_SESSION['myName']; $post = new forums("connect.ini"); $post->getComments($title); echo '<form action="addCommentPage.html"> <input type="submit" value="Add a Comment"> </form>';
<?php require_once "forumUserDB.php"; require_once "forums.php"; require_once "rpc.php"; $addPost = $_POST['add']; switch ($addPost) { case "add": $myId = $_SESSION['myId']; $name = $_POST['friend']; $friend = new forums("connect.ini"); $response = $friend->addFriend($name); if ($response['success'] === true) { echo "Friend added!"; } else { $response = $response['message'] . "<p>"; echo $response; } break; }
<?php require_once '../includes/initialize.php'; $target_dir = "../profile_pic/"; $target_file = $target_dir . basename($_FILES["abcd"]["name"]); $uploadOk = 1; $imageFileType = pathinfo($target_file, PATHINFO_EXTENSION); $u = forums::update_photo(basename($_FILES["abcd"]["name"]), $_SESSION['u_id']); // Check if image file is a actual image or fake image if (isset($_POST["submit"])) { $check = getimagesize($_FILES["abcd"]["tmp_name"]); if ($check !== false) { echo "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { echo "File is not an image."; $uploadOk = 0; } } // Check if file already exists if (file_exists($target_file)) { echo "Sorry, file already exists."; $uploadOk = 0; } // Check file size if ($_FILES["abcd"]["size"] > 500000) { echo "Sorry, your file is too large."; $uploadOk = 0; } // Allow certain file formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif") {
<!DOCTYPE html> <html lang="en-US"> <?php require_once '../includes/initialize.php'; //Load Session details... if (!$session->is_logged_in()) { session_start(); } if (!isset($_SESSION['u_id'])) { redirect_to('../homepage.php'); } $user = Users::find_by_id($_SESSION['u_id']); if (isset($_GET['id'])) { $frm = forums::find_by_id($_GET['id']); } if (isset($_POST['submit'])) { $c = new comments(); $c->c_o_ID = $_GET['id']; $c->c_authorID = $_SESSION['u_id']; $c->c_text = $_POST["text"]; $c->c_type = 0; $c->c_time = date('Y-m-d H:i:s'); $c->create(); redirect_to("forums2.php"); } if (isset($_POST['submit1'])) { $c = new comments(); $c->c_o_ID = $_GET['id']; $c->c_authorID = $_SESSION['u_id']; $c->c_text = $_POST["text"]; $c->c_type = 1;
<?php require_once "forumUserDB.php"; require_once "forums.php"; require_once "rpc.php"; $addPost = $_POST['submit']; $response = "ayy lmao<p>"; switch ($addPost) { case "post": //$login = new forumUserDB("connect.ini"); $myId = $_SESSION['myId']; $myName = $_SESSION['myName']; $title = $_POST['title']; $makepost = new forums("connect.ini"); $makepost->addForumTopic($title); echo "Post Created"; break; }
session_start(); require_once "forumUserDB.php"; require_once "forums.php"; $request = $_POST['request']; $response = "ayy lmao<p>"; switch ($request) { case "login": $username = $_POST['username']; $password = $_POST['password']; $login = new forumUserDB("connect.ini"); $response = $login->validateClient($username, $password); if ($response['success'] === true) { //$response = "Login Successful!<p>"; $_SESSION['myId'] = $login->getClientId($username); $_SESSION['myName'] = $username; $fo = new forums("connect.ini"); $fo->getForums(); echo '<form action="forumPostPage.html"> <input type="submit" value="Make a post"> </form>'; echo '<form action="viewPostPage.html"> <input type="submit" value="View a Post"> </form>'; echo '<form action="friendsPage.html"> <input type="submit" value="Add Friend"> </form>'; echo $fo->getFriends($login->getClientId($username)); } else { $response = "Login Failed:" . $response['message'] . "<p>"; echo $response; }
<?php require_once "forumUserDB.php"; require_once "forums.php"; require_once "rpc.php"; $comment = $_POST['comment']; $myId = $_SESSION['myId']; $title = $_SESSION['currentpost']; $addCom = new forums("connect.ini"); $addCom->addComment($title, $comment); echo "Comment added!";
<!DOCTYPE html> <html lang="en-US"> <?php require_once '../includes/initialize.php'; //Load Session details... if (!$session->is_logged_in()) { session_start(); } if (!isset($_SESSION['u_id'])) { redirect_to('../homepage.php'); } $user = Users::find_by_id($_SESSION['u_id']); $forum = forums::find_by_id(1); if (isset($_POST['submit'])) { $c = new comments(); //$c= comment::find_by_id($_SESSION['user_id']); $c->c_o_ID = 2; $c->c_authorID = 2; $c->c_text = $_POST["text"]; $c->c_type = 0; $c->c_time = date('Y-m-d H:i:s'); $c->create(); } $sql = "SELECT * FROM comment ORDER BY c_id desc limit 1"; $result_set = $database->execute_query($sql); $row = $database->fetch_array($result_set); $c_id = array_shift($row); ?> <meta http-equiv="content-type" content="text/html;charset=UTF-8" /><!-- /Added by HTTrack --> <head>