function showNewsWComments($id)
{
    require 'database.php';
    $stmt = $mysqli->prepare("SELECT * FROM news where id=?");
    if (!$stmt) {
        printf("Query Prep Failed: %s\n", $mysqli->error);
        exit;
    }
    $stmt->bind_param('i', $id);
    $stmt->execute();
    $result = $stmt->get_result();
    echo "<table>\n\t\t\t<tr>\n\t\t\t<th>News:</th>\n\t\t\t<th>Link:</th>\n\t\t\t<th>Comment:</th>\n\t\t\t</tr>";
    while ($row = $result->fetch_assoc()) {
        echo "<tr>";
        echo "<td>" . htmlentities($row['title']) . "</td>";
        echo "</tr>";
        echo "<tr>";
        echo "<td>" . htmlentities($row['newsstory']) . "</td>";
        echo "<td>" . '<a href="' . "http://" . htmlentities($row['links']) . '">' . htmlentities($row['links']) . ' </a>' . "</td>";
        echo "<td>";
        if (isset($_SESSION['loggedIn']) && $_SESSION['loggedIn']) {
            commentPost($_SESSION['userAccount'], $id);
        } else {
            echo "Please log in to gain comment abilities";
        }
        echo "</td>";
        echo "</tr>";
    }
    $stmt->close();
    echo "</table>";
    showComments($id);
}
示例#2
0
require_once 'include.php';
$act = $_REQUEST['act'];
if ($act === 'signup') {
    $msg = signup();
} elseif ($act === 'login') {
    $msg = login();
} elseif ($act === 'logout') {
    $msg = logout();
} elseif ($act === 'post') {
    $msg = post();
} elseif ($act === 'deletePost') {
    $msg = deletePost();
} elseif ($act === 'likePost') {
    $msg = likePost();
} elseif ($act === 'commentPost') {
    $msg = commentPost();
} elseif ($act === 'deleteComment') {
    $msg = deleteComment();
} elseif ($act === 'changeInfo') {
    $msg = changeInfo();
} elseif ($act === 'readNotify') {
    $msg = readNotify();
} elseif ($act === 'markAllRead') {
    $msg = markAllRead();
}
?>
 <!DOCTYPE HTML>
 <html>
 <head>
 <meta charset="utf-8">
 <meta name="description" content="">
示例#3
0
    if ($srkEnv->reqURL[2] == 'query' && $srkEnv->reqMethod == 'POST') {
        if ($srkEnv->reqURLLength == 3 && ($srkEnv->reqURL[3] = 'recent')) {
            srkSend((object) array('list' => commentLoadRecent(8)));
        } elseif ($srkEnv->reqURLLength == 4 && ($srkEnv->reqURL[3] = 'pen')) {
            $penId = $srkEnv->reqURL[4];
            $retList = commentLoadAll($penId);
            srkSend((object) array('list' => $retList));
        } elseif ($srkEnv->reqURLLength == 5 && $srkEnv->reqURL[3] == 'content') {
            $penId = $srkEnv->reqURL[4];
            $commentId = $srkEnv->reqURL[5];
            $contentFileName = $srkEnv->penPath . '/' . $penId . '/comment/' . $commentId . '/content.html';
            srkSend((object) array('content' => commentLoadContent($penId, $commentId), 'commentId' => $commentId));
        }
    } elseif ($srkEnv->reqURLLength == 2 && $srkEnv->reqURL[2] == 'post' && $srkEnv->reqMethod == 'POST') {
        $user = new UserData();
        $user->readUser($_SESSION['userId']);
        if ($user->status != 'normal') {
            srkSend((object) array('error' => 'Please log in first'));
        } else {
            if ($err = commentPost($user)) {
                if (is_string($err)) {
                    srkSend((object) array('error' => $err));
                } else {
                    srkSend((object) array('error' => "System error"));
                }
            } else {
                srkSend((object) array('error' => false));
            }
        }
    }
}
示例#4
0
//AddCSSToHead( '<style type="text/css">.sub-album,.sub-pic,.thumb-target{max-width:'. ( $thumbSize + 10 ) .'px;}</style>','inline' );
/* Set some variables widely used all over the module */
$op = isset($_GET['op']) ? $_GET['op'] : 'galIndex';
$pag = isset($_GET['pag']) ? $_GET['pag'] : 1;
$ofsppg = $iConfig['show_columns'] * $iConfig['show_rows'];
$ofsbgn = $pag * $ofsppg - $ofsppg;
/* Do some URL formatting */
switch ($op) {
    case 'addPics':
        addPics();
        break;
    case 'addPicsSimple':
        addPicsSimple();
        break;
    case 'commentPost':
        commentPost();
        break;
    case 'galIndex':
        galIndex();
        break;
    case 'getImg':
        getImg();
        break;
    case 'getThumb':
        getThumb();
        break;
    case 'ratePic':
        ratePic();
        break;
    case 'recentMoves':
        recentMoves();