connect_error) { #check if there were any errors connecting blad('Could not connect do database server ('.$DB->connect_errno.'): '.$DB->connect_error); } if (!$DB->query("SET NAMES 'utf8'")) #użyj utf-8 { blad('Could not set character to UTF-8'); } #pobierz liczbę zdjęć w galerii $sql = "SELECT COUNT(`id`) AS `count` FROM `photos`"; if (!$result = $DB->query($sql)) { blad('Nie mozna odczytac liczby zdjec!'); } $row = $result->fetch_assoc(); $count = $row['count']; $result->free; //zwolnij pamięć // //wygeneruj strone // if (isset($_GET['page'])&&($_GET['page']!=1)) { if (!is_numeric($_GET['page'])) { die('Hacking attempt'); } $value = ($_GET['page']-1)*PERPAGE; $limit = 'LIMIT '.$value . ', '.PERPAGE; $page = $_GET['page']; } else { $limit = 'LIMIT 0, '.PERPAGE; $page=1; } $cnt = ceil($count / PERPAGE); if(isset($_GET['page']) && ($_GET['page']>$cnt)) { blad('Podana strona nie istnieje!'); } // //koniec generowania stron // ?>