<?php $statement = getAllPosts(); ?> <ul> <?php while ($post = $statement->fetchObject()) { ?> <li id="<?php echo $post->id; ?> "> <form method="post" class="form-ajax"> <input type="hidden" name="submit" value="read"/> <button class="btn btn-default"><?php echo $post->title; ?> </button> </form> </li> <?php } ?> </ul>
$sql4->execute(); } $last_manifesto_id = $connection1->lastInsertId(); if ($last_contestant_id > 0 && $last_manifesto_id > 0) { header("Location:viewprofile.php"); } } else { echo "An error occur while processing your registration. Try again."; } } } else { $registration_message = "You are already a contestant in this election."; } } //get the available posts and print in a select button $allPost = getAllPosts($contestant_election_id); $postString .= "<select class='form-control' name='contestant_post'>"; $postString .= "<option value=''>Select a post</option>"; for ($i = 0; $i < count($allPost); $i++) { $postString .= "<option value='" . $allPost[$i]['post'] . "'>" . ucwords($allPost[$i]['post']) . "</option>"; } $postString .= "</select>"; //function to store manifesto point in an array function manifesto_points($no_points) { $points = array(); if (isset($_POST["submit"])) { if ($no_points > 0 && $no_points <= 7) { for ($i = 1; $i <= $no_points; $i++) { $manifestoPoint = 'point' . $i; $points[$i] = ucfirst($_POST[$manifestoPoint]);
<?php //var_dump(__DIR__ . '/app/models/post.php'); require_once __DIR__ . '/app/init.php'; //require once поделючает файл. а __DIR__ возврашает путь где лежит сейчас файлик index_old.php с помощью __DIR__ $posts = getAllPosts(); //var_dump( // storageSaveItem('post', ['title' => 'post#1', 'content' => 'first']) //) require_once __DIR__ . '/app/views/list.php';
<br> <input type="submit" class="btn btn-primary" value="Update Post"> </form> </div> </div><!-- /row --> <div class="row mt centered "> <div class="col-lg-8 col-lg-offset-2 centered"> <h3>DELETE POST</h3> <hr><br> <div class="col-md-10 centered"> <form action="../controller/post_controller.php" method="POST"> <select class="form-control" name="id" id="id"> <?php $resp = getAllPosts(); if ($resp["response"]) { $optionList = $resp["allPosts"]; foreach ($optionList as $post) { echo '<option value="' . $post->getId() . '">' . $post->getTitle() . '</option>'; } } else { echo '<option value="">nessun post</option>'; } ?> </select></div><div class="col-md-2"><input type="submit" class="btn btn-danger" value="Delete Post"></div> <input class="form-control" type="hidden" name="action" id="action" value="delete_post"> </form> </div> </div><!-- /row -->
if ($success == "dbfault") { $reply['status'] = "fail"; } else { $result = getPointDetails($pdo, $success); if ($result != null) { $reply['status'] = "success"; $reply = array_merge($reply, $result); } else { $reply['status'] = "fail"; } } } //Get all activities (not used) if (isset($_REQUEST['action']) && $_REQUEST['action'] == "get") { $result = array(); $result = getAllPosts($pdo); if ($result != null) { $reply['status'] = "success"; $reply['post'] = $result; } else { if ($result == null) { $reply['status'] = "empty"; } else { $reply['status'] = "fail"; } } } //Get all activities if (isset($_REQUEST['action']) && $_REQUEST['action'] == "getallactivity") { if ($_REQUEST['stat'] == 1) { $result = array();
$mode = $_GET['page']; } include_once "views/head.html"; switch ($mode) { case 'register': register(); break; case 'login': login(); break; case "logout": $_SESSION = array(); session_destroy(); header("Location: ?"); // Pealehele break; case 'postit': postIt(); break; case "post": getPost(); break; case "usersPosts": getUsersPosts(); break; default: $allPosts = getAllPosts(); include "views/main.html"; break; } include_once "views/foot.html";
die; } /* MESSAGE POST-IT */ print '<div id="post_it"></div>'; require_once 'request.php'; /* DEFINE VARS */ $sess = getSessionUser($user, $user_id); $get = getUser($user); $post = getAllPosts(); $profile = 'all'; $fulltag = ''; /* WHICH POSTS TO SHOW*/ if (isset($_GET['profile'])) { $profile = preg_replace("/[^a-zA-Z0-9@#]/", "", $_GET['profile']); if ($profile == 'all') { $post = getAllPosts(); } elseif ($profile == 'at' . $sess['username']) { $post = findAt($sess['username']); } elseif (!$profile == getUser($profile)) { print '<div class="post_it"><h3>'; print "There's no user with that name..."; print '</h3><button type="button" id="hide_btn" class="button">close</button></div>'; } else { $post = getUserPosts($profile); $get = getUser($profile); } } /* CREATE TAGS */ if (isset($_GET['tag'])) { $tag = preg_replace('#[^a-z0-9_-å-ä-ö-Å-Ä-Ö-]#i', '', $_GET["tag"]); $fulltag = "#" . $tag;
function postIndexAction() { $posts = getAllPosts(); require_once __DIR__ . '/../views/list.php'; }
<?php // controller for home page // supporting data function file... include DATA . 'posts.php'; // variables for pagination... $numPosts = numberOfPosts(); $limit = 12; // number of posts to be displayed per page... $pages = ceil($numPosts / $limit); // if statement for pagination if (isset($_GET['subpage'])) { $subpage = $_GET['subpage']; } else { $subpage = 1; } // variable for page data... $posts = getAllPosts($subpage, $limit); // views... include VIEWS . 'header.php'; include VIEWS . 'contentHome.php'; include VIEWS . 'footer.php';
<head lang="en"> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/> <title>北美房</title> </head> <body style="overflow-x:auto; overflow-x: scroll"> <a href="/">返回首页</a>     <a href="/upload-page.php">上传问答</a><br /> <?php require_once 'console.php'; isset($_GET['type']) ? $type = $_GET['type'] : ($type = 'baike'); $cityarr = ['洛杉矶', '纽约', '奥克兰', '多伦多', '温哥华', '旧金山']; $basearr = ['经纪人', '购房基础', '短售房与法拍屋', '翻新房', '报价与合同', '房屋检测', '保险', '所有权', '房屋契约', '房屋维护', '其它问题']; if ($type == 'baike') { $baike = getAllPosts(); $i = 0; echo '<a href="/view/makequestion.php?type=baike">新建百科</a>     <a href="/bmf/console_page.php?type=qa">管理问答(置顶、设置热门等)</a>     '; echo '<div><table border="1" width=1800>'; foreach ($baike as $key => $value) { if ($i % 10 == 0) { $htmlhead = '<tr><th>postid</th><th>标题</th><th>内容</th><th>创建时间</th><th>修改时间</th><th width="80">城市分类</th>'; $htmlhead .= '<th width="160">城市信息</th><th width="180">基础/技巧</th><th width="150">基础/技巧 子类</th><th width="150">置顶</th><th width="150">设为热门</th><th width="40">更改</th></tr>'; echo $htmlhead; } $htmlcontent = '<tr><td><a href="/view/makequestion.php?postid=' . $value['postid'] . '&type=baike">' . $value['postid'] . '</a></td>'; //跳转百科详情页,修改百科标题和内容 $htmlcontent .= '<form action="create-update.php" method="post">'; $htmlcontent .= '<td><div style="overflow: hidden; text-overflow:ellipsis; width:160px">' . $value['title'] . '</div></td>'; $htmlcontent .= '<td><div style="overflow: hidden; text-overflow:ellipsis; height:150px; width:350px">' . $value['content'] . '<div></td>'; $htmlcontent .= '<td>' . $value['created'] . '  </td>';
} ?> <body> <main> <?php include "header.inc"; ?> <div class="half"> <form action="?action=newPost" method="post"> <label for="bulletin">Send Global Announcement</label> <input type="text" name="content" id="bulletin" placeholder="Enter Announcement Here"/> <input type="submit" value="Send"/> </form> <?php renderGroupPosts(getAllPosts($db), $db); ?> </div> <div class="half"> <?php $query = 'SELECT * FROM groups WHERE tutor = :teacherId'; $statement = $db->prepare($query); $statement->bindValue(':teacherId', $sessionId); if (!$statement->execute()) { print_r($statement->errorInfo()); return false; } else { $result = $statement->fetchAll(PDO::FETCH_ASSOC); } ?>
<?php require_once 'lib/common.php'; session_start(); //Content to db, run query, error handling $pdo = getPDO(); $posts = getAllPosts($pdo); $notFound = isset($_GET['not-found']); ?> <!DOCTYPE html> <html> <head> <title> A sample blog app</title> <?php require 'templates/head.php'; ?> </head> <body> <?php require 'templates/title.php'; ?> <?php if ($notFound) { ?> <div class="error box"> Error: cannot find the requested blog post </div> <?php } ?>
$result1 = $sql1->fetchAll(); $images_dir = "../images/contestants/"; $contestants_id = $picture_names = $contestants_user_ids = array(); $contestants_post_id = array(); if (!empty($result1)) { for ($i = 0; $i < count($result1); $i++) { $contestants_id[$i] = $result1[$i]["contestant_id"]; $picture_names[$i] = $images_dir . $result1[$i]["picture_name"]; $contestants_user_ids[$i] = $result1[$i]["user_id"]; $contestants_post_id[$i] = $result1[$i]["post_id"]; } } else { echo ""; } $contestant_list = ""; $allPosts = getAllPosts($election_id_here); //for each post,get contestant $postCon = $contestants_array = $string_result_array = array(); $superIndex = array(); $image_dir = "../images/contestants/"; for ($i = 0; $i < count($allPosts); $i++) { $postCon[$allPosts[$i]['post']] = getAllContestants($allPosts[$i]['post_id']); array_push($superIndex, $allPosts[$i]['post']); } //Store the contestants pictures in contestant_list array for ($japhet = 0; $japhet < count($postCon); $japhet++) { $post_name = $superIndex[$japhet]; if (!empty($postCon[$post_name])) { for ($length = 0; $length < count($postCon[$post_name]); $length++) { $display = $postCon[$post_name][$length]; //$display holds a contestant detail
$following = getFollowers($get['user_id']); if (count($following) == 0) { print "None, follow " . $get['username'] . "!"; } else { print '<div id="online_container">'; foreach ($following as $following) { print '<div class="whos_online">'; print '<a href="profile.php?profile=' . $following['username'] . '" title="' . $following['username'] . '">' . getProfilePic($following['user_id'], '50px') . '</a>'; print '</div>'; } print '</div>'; } print '</div>'; print '</div>'; if ($sess['user_id'] == $get['user_id']) { print '<br><a href="profile.php?profile=at' . $sess['username'] . '">See where you have been mentioned</a><br>'; print '<a href="edit.php">Edit your settings</a>'; } print '</div>'; print '<div id="wrapper">'; if ($post == getAllPosts() || $post == getUserPosts($profile)) { require_once 'post.php'; } else { if ($post == findAt($sess['username'])) { require_once 'atpost.php'; } else { require_once 'tagpost.php'; } } print '</div>'; require_once 'footer.php';
function getPostCount() { $arr = getAllPosts(); return count($arr); }
$user_id_result = $row["user_id"]; //querying to get the admin email $row = getAllMembers("users", ["*"], ["user_id", "=", $user_id_result])[0]; $election_admin_details .= "<div class='col-md-6'><label>Name:</label> " . $row['lname'] . " " . $row['fname'] . "\n <br><label>Username:</label> " . $row['username'] . "<br><label>Email:</label> " . $row['email'] . "<br>\n <label>Telephone:</label> " . $row['phone'] . "</div>"; $election_admin_detail .= "<div class='col-md-4'><img src=" . $images_dir . $row['picture_name'] . " width='120px'\n height='auto' style='border-radius:100%;max-height:200px;' class='preview' id='displayedPhoto'></div>"; //checking for the link vote $hasvoted = hasvoted(user_id($myemail), $election_id); //determining when to make the view profile link visible or not' $checkContestant1 = checkContestant(user_id($myemail), $election_id); if (!empty($checkContestant1)) { $profile1 = "<a href='viewprofile.php' class='active'>View Profile</a>"; } else { $profile1 = ""; } //get post table $all_posts = getAllPosts($election_id); $total_contestants = 0; $posts_table = '<div class="table-responsive contestants_table" style="max-height: 220px"> <table class="table table-striped"> <thead > <tr> <th>Post</th> <th>Pin</th> <th>Number of Contestants</th> </tr> </thead> <tbody>'; for ($i = 0; $i < count($all_posts); $i++) { $posts_table .= '<tr> <td>' . $all_posts[$i]["post"] . '</td> <td>' . $all_posts[$i]["post_key"] . '</td>