示例#1
0
<?php

require_once "database.php";
require_once "models/functions.php";
$link = db_connect();
$page_count = 5;
//количество переключателей страниц (нечетное!)
$page_length = 10;
//количество статей на странице
$total_pages = total_pages($link, $page_length);
//всего сформировано страниц
$page = check_page($_GET['page'], $total_pages);
$list_news = news_page($link, $page, $page_length);
include "views/all_news.php";
示例#2
0
         edit_quote($page[1], $page[2]);
     }
     break;
 case 'users':
     if (isset($_SESSION['logged_in']) && $_SESSION['level'] <= USER_SUPERUSER) {
         edit_users($page[1], $page[2]);
     }
     break;
 case 'vote':
     if (isset($CONFIG['login_required']) && $CONFIG['login_required'] == 1 && !isset($_SESSION['logged_in'])) {
         break;
     }
     vote($page[1], $page[2]);
     break;
 case 'news':
     news_page();
     break;
 default:
     if (preg_match('/^[0-9]+(&[0-9]+)*$/', $_SERVER['QUERY_STRING'])) {
         $idlist = explode('&', $_SERVER['QUERY_STRING']);
         if (count($idlist) < 11) {
             $ids = array();
             $order = array();
             $idx = 0;
             foreach ($idlist as $id) {
                 $ids[] = 'id=' . $db->quote((int) $id);
                 $order[] = 'WHEN ' . $db->quote((int) $id) . ' THEN ' . $idx . ' ';
                 $idx++;
             }
             $query = "SELECT * FROM " . db_tablename('quotes') . " WHERE queue=0 and (" . implode(' or ', $ids) . ") ORDER BY CASE id " . implode($order) . " END";
             if ($idx > 1) {