コード例 #1
0
ファイル: index.php プロジェクト: avatias0/Hahachan
 if (isset($_GET['delete'])) {
     if ($_POST['delete'] && isset($_GET['delete'])) {
         $pass = $_POST['dpass'];
         if ($_GET['w'] != 'r') {
             $p = $posts->selectAt('id', $_GET['delete']);
             if ($p['pass'] == md5(sha1($pass)) && $p['pass'] != md5(sha1("")) || isAdmin()) {
                 $rep = $replies->selectWhereAt('post_id', $p['id']);
                 if (!empty($rep[0]['id'])) {
                     foreach ($rep as $r) {
                         if (!empty($r['image'])) {
                             @unlink($r['image']);
                         }
                         if (!empty($r['thumb']) && $r['image'] != $r['thumb']) {
                             @unlink($r['thumb']);
                         }
                         $replies->deleteAt('id', $r['id']);
                     }
                 }
                 if (!empty($p['image'])) {
                     @unlink($p['image']);
                 }
                 if (!empty($p['thumb']) && $p['image'] != $p['thumb']) {
                     @unlink($p['thumb']);
                 }
                 $posts->deleteAt('id', $p['id']);
                 echo 'Post deleted.';
             } else {
                 error('Invalid password.');
             }
         } else {
             $rep = $replies->selectAt('id', $_GET['delete']);
コード例 #2
0
ファイル: admin.php プロジェクト: avatias0/Hahachan
<div id="forumListContainer">
<h1>Admin Panel </h1>
<?php 
include_once 'lib/phlat.class.php';
include_once 'config.php';
if (isAdmin()) {
    $reported = new phlat('reported', array('post_id', 'reply_id', 'reason', 'board'));
    echo '<div style="padding: 5px;" />';
    if (isset($_GET['logout'])) {
        $_SESSION['user'] = '';
        $_SESSION['pass'] = '';
        echo 'You are now logged out.';
        header('refresh:2;url=?main');
    } else {
        if (isset($_GET['delete'])) {
            $reported->deleteAt('id', $_GET['id']);
        } elseif (isset($_GET['reported'])) {
            $rep = $reported->get();
            echo '<ul>';
            if (empty($rep[0]['id'])) {
                echo '<li>No reports</li>';
            } else {
                foreach ($rep as $entry) {
                    $type = empty($entry['reply_id']) ? 'post' : 'reply';
                    $id = empty($entry['reply_id']) ? $entry['post_id'] : $entry['reply_id'];
                    echo '<li id="' . $entry['id'] . '"><a href="#" name="' . $entry['id'] . '" class="delLink">Delete</a> - ' . $type . ' n&ordm; <a href="' . config::$url . $entry['board'] . 'index.php?reply=' . $entry['post_id'] . '#' . $id . '">' . $id . '</a>: ' . $entry['reason'] . '</li>';
                }
            }
            echo '</ul><br /><div align="right">[<a href="?admin&amp;readall">Mark all as read</a>] [<a href="?admin">Admin menu</a>] </div>';
        } elseif (isset($_GET['readall'])) {
            $reported->clear();