예제 #1
0
     * Here, admin accepts or decilnes posts from users, before it will show on main page
     * */
    $check_session = factory::user();
    if ($check_session->check_session() == true) {
        if ($check_session->check_admin() == true) {
            $stmt = $pdo->query('SELECT id, Title, Text, Image FROM waiting_posts');
            echo '<ul>';
            while ($row = $stmt->fetch()) {
                echo '<div class="post-border well well-lg " style="background-color:rgba(16,16,16,0.95);border:15px solid #272727;">' . '<li style="list-style-type:none;text-align:center;font-weight:bold;color:white;">' . $row['Title'] . "<br />" . "<img src=" . $row['Image'] . " class=\"margin-auto img img-responsive\" ; /></a><br />" . $row['Text'] . "<br /><br />" . '</li></a>
					<a href="http://projects.e-kei.pl/inba/waiting.php?decision=accept&id=' . $row['id'] . ' "><button class="btn btn-success" type="button"><i class="fa fa-check fa-4x"></i></button></a>
					<a href="http://projects.e-kei.pl/inba/waiting.php?decision=decline&id=' . $row['id'] . ' "><button class=" btn btn-danger" type="button"><i class="fa fa-times fa-4x"></i></button></a>
					</div>';
            }
        }
    }
} catch (Exception $e) {
    echo "<h1 class=\"text-center\" style=\"color:grey;\">" . $e->getMessage() . "</h1>";
}
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
    try {
        if (isset($_GET['decision']) && isset($_GET['id'])) {
            $decision = factory::admin_factory();
            $decision->decision($_GET['decision'], $_GET['id']);
            header("refresh:1;url=http://projects.e-kei.pl/inba/waiting.php");
        }
    } catch (Exception $e) {
        echo 'Wystąpił błąd bazy danych: ' . $e->getMessage();
    }
}
ob_end_flush();
include 'footer.html';