Browse Source

Poprawki w paginacji zdjęć.

Zmiana funkcji z imagecopyresized() na imagecopyresampled() do zmiany rozmiaru obrazków.
Inne drobne poprawki

git-svn-id: https://svn.pioder.pl/sg-svn@24 3ed2631f-fe0d-47e0-9194-a46bc0f18ee8
master
pioder 13 years ago
parent
commit
e32992fa40
49 changed files with 171 additions and 75 deletions
  1. +12
    -5
      robocze/download.php
  2. +36
    -15
      robocze/dump.txt
  3. +71
    -10
      robocze/functions.php
  4. +2
    -2
      robocze/gallery.php
  5. +0
    -0
      robocze/images/haslo.png
  6. BIN
      robocze/images/upload/07062009544.jpg
  7. BIN
      robocze/images/upload/07062009544_m.jpg
  8. BIN
      robocze/images/upload/07062009548.jpg
  9. BIN
      robocze/images/upload/07062009548_m.jpg
  10. BIN
      robocze/images/upload/07062009549.jpg
  11. BIN
      robocze/images/upload/07062009549_m.jpg
  12. BIN
      robocze/images/upload/07062009550.jpg
  13. BIN
      robocze/images/upload/07062009550_m.jpg
  14. BIN
      robocze/images/upload/07062009553.jpg
  15. BIN
      robocze/images/upload/07062009553_m.jpg
  16. BIN
      robocze/images/upload/07062009557.jpg
  17. BIN
      robocze/images/upload/07062009557_m.jpg
  18. BIN
      robocze/images/upload/07062009560.jpg
  19. BIN
      robocze/images/upload/07062009560_m.jpg
  20. BIN
      robocze/images/upload/07062009561.jpg
  21. BIN
      robocze/images/upload/07062009561_m.jpg
  22. BIN
      robocze/images/upload/07062009563.jpg
  23. BIN
      robocze/images/upload/07062009563_m.jpg
  24. BIN
      robocze/images/upload/07062009565.jpg
  25. BIN
      robocze/images/upload/07062009565_m.jpg
  26. BIN
      robocze/images/upload/07062009566.jpg
  27. BIN
      robocze/images/upload/07062009566_m.jpg
  28. BIN
      robocze/images/upload/07062009567.jpg
  29. BIN
      robocze/images/upload/07062009567_m.jpg
  30. BIN
      robocze/images/upload/07062009569.jpg
  31. BIN
      robocze/images/upload/07062009569_m.jpg
  32. BIN
      robocze/images/upload/07062009570.jpg
  33. BIN
      robocze/images/upload/07062009570_m.jpg
  34. BIN
      robocze/images/upload/07062009571.jpg
  35. BIN
      robocze/images/upload/07062009571_m.jpg
  36. BIN
      robocze/images/upload/08062009624.jpg
  37. BIN
      robocze/images/upload/08062009624_m.jpg
  38. BIN
      robocze/images/upload/08062009625.jpg
  39. BIN
      robocze/images/upload/08062009625_m.jpg
  40. BIN
      robocze/images/upload/08062009629.jpg
  41. BIN
      robocze/images/upload/08062009629_m.jpg
  42. BIN
      robocze/images/upload/08062009630.jpg
  43. BIN
      robocze/images/upload/08062009630_m.jpg
  44. BIN
      robocze/images/upload/08062009632.jpg
  45. BIN
      robocze/images/upload/08062009632_m.jpg
  46. BIN
      robocze/images/upload/dsc_0006.jpg
  47. BIN
      robocze/images/upload/dsc_0006_m.jpg
  48. +31
    -31
      robocze/index.php
  49. +19
    -12
      robocze/init.php

+ 12
- 5
robocze/download.php View File

@ -1,5 +1,12 @@
<?php
NaglowekXHTML();
/**
* @package Galeria Suczawa 2009
* @file download.php
* @version $Id$
**/
require_once('./init.php'); #init stuff
NaglowekXHTML();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
@ -26,17 +33,17 @@
<a class="link" href="http://rapidshare.com/files/243914577/ZDJECIA.7z.007">http://rapidshare.com/files/243914577/ZDJECIA.7z.007</a> <br/>
<a class="link" href="http://rapidshare.com/files/243926118/ZDJECIA.7z.008">http://rapidshare.com/files/243926118/ZDJECIA.7z.008</a> <br/>
</div>
<img src="images/has__o.png" alt="Has__o:" />
<img src="images/haslo.png" alt="Hasło:" />
<div class="dframe">
<b>Has__o: </b> Sucava2009
<b>Hasło: </b> Sucava2009
</div>
</div>
</div>
</div>
<div id="footer">
<a id="copyright">Copyright © 2009 ...</a><br />
<a id="copyright">Copyright © 2009 Various Authors</a><br />
<div id="links">
<a href="index.php">Strona g____wna</a> | <a href="gallery.php">Fotogaleria</a> | <a href="download.php">Download</a> | <a href="http://suczawa.ath.cx">Forum</a>
<a href="index.php">Strona główna</a> | <a href="gallery.php">Fotogaleria</a> | <a href="download.php">Download</a> | <a href="http://suczawa.ath.cx">Forum</a>
</div>
</div>
</div>

+ 36
- 15
robocze/dump.txt View File

@ -3,10 +3,9 @@
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Czas wygenerowania: 16 Cze 2009, 12:36
-- Wersja serwera: 5.1.33
-- Wersja PHP: 5.2.9
-- test
-- Czas wygenerowania: 23 Paź 2009, 22:01
-- Wersja serwera: 5.1.37
-- Wersja PHP: 5.2.10-2.2
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
@ -21,18 +20,20 @@ SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--
CREATE TABLE IF NOT EXISTS `admins` (
`id` smallint(1) NOT NULL,
`id` smallint(1) NOT NULL AUTO_INCREMENT,
`nick` varchar(20) NOT NULL,
`password` varchar(200) NOT NULL,
`email` varchar(20) NOT NULL,
`IP` varchar(14) NOT NULL,
`IP` varchar(80) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;
--
-- Zrzut danych tabeli `admins`
--
INSERT INTO `admins` (`id`, `nick`, `password`, `email`, `IP`) VALUES
(1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 'root@localhost', '::ffff:127.0.0.1');
-- --------------------------------------------------------
@ -41,25 +42,45 @@ CREATE TABLE IF NOT EXISTS `admins` (
--
CREATE TABLE IF NOT EXISTS `photos` (
`id` smallint(4) NOT NULL,
`id` smallint(4) NOT NULL AUTO_INCREMENT,
`thumb_name` varchar(20) NOT NULL,
`photo_name` varchar(20) NOT NULL,
`author` varchar(30) NOT NULL,
`description` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=10;
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=30 ;
--
-- Zrzut danych tabeli `photos`
--
INSERT INTO `photos` (`id`, `thumb_name`, `photo_name`, `author`, `description`) VALUES
(1, 'DSC_0026_m.png', 'DSC_0026.png', '', 'Pod zamkiem - grupowo'),
(2, 'DSC_0132_m.png', 'DSC_0132.png', '', 'Pod szkołą'),
(1, 'DSC_0026_m.png', 'DSC_0026.png', '', 'Pod zamkiem - grupowo.'),
(2, 'DSC_0132_m.png', 'DSC_0132.png', '', 'Pod szkołą.'),
(3, 'DSC_0169_m.png', 'DSC_0169.png', '', 'Widoki na Monastyr'),
(4, 'DSC_0294_m.png', 'DSC_0294.png', '', 'Bukowina Południowa'),
(5, 'DSC_0378_m.png', 'DSC_0378.png', '', 'Pani Monika :)'),
(6, 'DSC_0080_m.png', 'DSC_0080.png', '', 'Nasz Geniusz podczas rozdawania nagród ;)'),
(7, 'DSC_0672_m.png', 'DSC_0672.png', '', 'Wąwóz...'),
(8, 'DSCF0372_m.png', 'DSCF0372.png', '', 'Świątynia w Monastyrze'),
(9, 'DSCF0452_m.png', 'DSCF0452.png', '', 'Kolejna fotka z wąwozu.');
(6, 'DSC_0080_m.png', 'DSC_0080.png', '', 'Nasz Geniusz podczas rozdawania nagród'),
(7, 'DSC_0672_m.png', 'DSC_0672.png', '', 'Wąwóz - jakaś góra.'),
(8, 'DSCF0372_m.png', 'DSCF0372.png', '', ''),
(9, 'dsc_0006_m.jpg', 'dsc_0006.jpg', '', 'W pracowni - tam pisaliśmy konkurs.'),
(10, '07062009544_m.jpg', '07062009544.jpg', '', ''),
(11, '07062009548_m.jpg', '07062009548.jpg', '', ''),
(12, '07062009549_m.jpg', '07062009549.jpg', '', ''),
(13, '07062009550_m.jpg', '07062009550.jpg', '', ''),
(14, '07062009553_m.jpg', '07062009553.jpg', '', ''),
(15, '07062009557_m.jpg', '07062009557.jpg', '', ''),
(16, '07062009560_m.jpg', '07062009560.jpg', '', ''),
(17, '07062009561_m.jpg', '07062009561.jpg', '', ''),
(18, '07062009563_m.jpg', '07062009563.jpg', '', ''),
(19, '07062009565_m.jpg', '07062009565.jpg', '', ''),
(20, '07062009566_m.jpg', '07062009566.jpg', '', ''),
(21, '07062009567_m.jpg', '07062009567.jpg', '', ''),
(22, '07062009569_m.jpg', '07062009569.jpg', '', ''),
(23, '07062009570_m.jpg', '07062009570.jpg', '', ''),
(24, '07062009571_m.jpg', '07062009571.jpg', '', ''),
(25, '08062009624_m.jpg', '08062009624.jpg', '', ''),
(26, '08062009625_m.jpg', '08062009625.jpg', '', ''),
(27, '08062009629_m.jpg', '08062009629.jpg', '', ''),
(28, '08062009630_m.jpg', '08062009630.jpg', '', ''),
(29, '08062009632_m.jpg', '08062009632.jpg', '', '');

+ 71
- 10
robocze/functions.php View File

@ -30,7 +30,7 @@ function NaglowekXHTML()
echo '<?xml version="1.0" encoding="utf-8"?>';
}
function GenerujListeStron()
function GenerujListeStron($adm = false)
{
global $cnt;
global $page;
@ -38,8 +38,16 @@ function GenerujListeStron()
if ($page>1)
{
$content .= '<a href="?page=1" title="Pierwsza strona">&laquo;</a>';
$content .= '&nbsp;&nbsp;<a href="?page='.($page-1).'" title="Poprzednia strona">&lt;</a> ';
if ($adm)
{
$content .= '<a href="?mode=admin_gallery&amp;submode=view&amp;page=1" title="Pierwsza strona">&laquo;</a>';
$content .= '&nbsp;&nbsp;<a href="?mode=admin_gallery&amp;submode=view&amp;page='.($page-1).'" title="Poprzednia strona">&lt;</a> ';
}
else
{
$content .= '<a href="?page=1" title="Pierwsza strona">&laquo;</a>';
$content .= '&nbsp;&nbsp;<a href="?page='.($page-1).'" title="Poprzednia strona">&lt;</a> ';
}
}
#wygeneruj strony
@ -60,19 +68,41 @@ function GenerujListeStron()
{
if ($i == $cnt)
{
$content .= '<a href="?page='.$i.'">'.$i.'</a> ';
if ($adm)
{
$content .= '<a href="?mode=admin_gallery&amp;submode=view&amp;page='.$i.'">'.$i.'</a> ';
}
else
{
$content .= '<a href="?page='.$i.'">'.$i.'</a> ';
}
}
else
{
$content .= '<a href="?page='.$i.'">'.$i.'</a> | ';
if ($adm)
{
$content .= '<a href="?mode=admin_gallery&amp;submode=view&amp;page='.$i.'">'.$i.'</a> | ';
}
else
{
$content .= '<a href="?page='.$i.'">'.$i.'</a> | ';
}
}
}
}
#dodaj linka "+1 strona" oraz do ostatniej
if ($page<$cnt)
{
$content .= '<a href="?page='.($page+1).'" title="Następna strona">&gt;</a>';
$content .= '&nbsp;&nbsp;<a href="?page='.$cnt.'" title="Ostatnia strona">&raquo;</a>';
if ($adm)
{
$content .= '<a href="?mode=admin_gallery&amp;submode=view&amp;page='.($page+1).'" title="Następna strona">&gt;</a>';
$content .= '&nbsp;&nbsp;<a href="?mode=admin_gallery&amp;submode=view&amp;page='.$cnt.'" title="Ostatnia strona">&raquo;</a>';
}
else
{
$content .= '<a href="?page='.($page+1).'" title="Następna strona">&gt;</a>';
$content .= '&nbsp;&nbsp;<a href="?page='.$cnt.'" title="Ostatnia strona">&raquo;</a>';
}
}
#dodaj linka do ostatniej strony
@ -110,7 +140,7 @@ function NaglowekPA($nazwapodstrony)
.b { background-color: #666666; color: white; border: 1px; }
</style>
</head>
<body>
<body>
<center>
<div align="center" style="width: 900px">
<h1>Panel Administracyjny Galerii Zdjęć</h1>
@ -126,12 +156,43 @@ function NaglowekPA($nazwapodstrony)
}
function StopkaPA()
{
echo '
<span style="font-size: 8pt">ACP by <a href="http://pioder.gim2przemysl.int.pl" target="_blank">PioDer</a> &copy; 2009</span>
echo '<br /><br />
<span style="font-size: 8pt">ACP by <a href="http://www.pioder.pl" target="_blank">PioDer</a> &copy; 2009-2012</span>
</div>
</center>
</body>
</html>
';
}
function ZmniejszObraz($wejscie, $szer_wys, $wyjscie)
{
#otwieramy oryginal
$obraz = imagecreatefromjpeg($wejscie);
# sprawdz, czy obrazek nie jest wyzszy niz szerszy
if (imagesy($obraz) > imagesx($obraz))
{
$wysokosc = $szer_wys;
$st = imagesy($obraz) / $szer_wys;
$szerokosc = imagesx($obraz) / $st;
}
else
{
$szerokosc = $szer_wys;
#musimy obliczyc stosunek wiekszego obrazu do mniejszego - liczymy wysokosc
$st = imagesx($obraz) / $szer_wys;
$wysokosc = imagesy($obraz) / $st;
}
#do dziela - zmniejszamy
$mniejszy = imagecreatetruecolor($szerokosc,$wysokosc);
imagecopyresampled($mniejszy,$obraz,0,0,0,0,$szerokosc,$wysokosc,imagesx($obraz),imagesy($obraz));
#i zapisujemy...
imagejpeg($mniejszy, $wyjscie, 99);
#zwalniamy pamiec
imagedestroy($obraz);
imagedestroy($mniejszy);
}
?>

+ 2
- 2
robocze/gallery.php View File

@ -5,7 +5,7 @@
* @version $Id$
**/
$page = (isset($_GET['page'])) ? intval($_GET['page']) : 0;
require_once('./init.php'); #init stuff
NaglowekXHTML();
@ -49,7 +49,7 @@ NaglowekXHTML();
</div>
</div>
<div id="footer">
<a id="copyright">Copyright © 2009 ...</a><br />
<a id="copyright">Copyright © 2009 Various Authors</a><br />
<div id="links">
<a href="index.php">Strona Główna</a> | <a href="gallery.php">Fotogaleria</a> | <a href="download.php">Download</a> | <a href="http://suczawa.ath.cx">Forum</a> | <a href="admin/">Administracja</a>
</div>

robocze/images/hasło.png → robocze/images/haslo.png View File


BIN
robocze/images/upload/07062009544.jpg View File

Before After
Width: 600  |  Height: 449  |  Size: 191 KiB

BIN
robocze/images/upload/07062009544_m.jpg View File

Before After
Width: 180  |  Height: 134  |  Size: 22 KiB

BIN
robocze/images/upload/07062009548.jpg View File

Before After
Width: 600  |  Height: 449  |  Size: 250 KiB

BIN
robocze/images/upload/07062009548_m.jpg View File

Before After
Width: 180  |  Height: 134  |  Size: 25 KiB

BIN
robocze/images/upload/07062009549.jpg View File

Before After
Width: 600  |  Height: 449  |  Size: 245 KiB

BIN
robocze/images/upload/07062009549_m.jpg View File

Before After
Width: 180  |  Height: 134  |  Size: 26 KiB

BIN
robocze/images/upload/07062009550.jpg View File

Before After
Width: 600  |  Height: 449  |  Size: 210 KiB

BIN
robocze/images/upload/07062009550_m.jpg View File

Before After
Width: 180  |  Height: 134  |  Size: 25 KiB

BIN
robocze/images/upload/07062009553.jpg View File

Before After
Width: 600  |  Height: 449  |  Size: 206 KiB

BIN
robocze/images/upload/07062009553_m.jpg View File

Before After
Width: 180  |  Height: 134  |  Size: 24 KiB

BIN
robocze/images/upload/07062009557.jpg View File

Before After
Width: 600  |  Height: 449  |  Size: 238 KiB

BIN
robocze/images/upload/07062009557_m.jpg View File

Before After
Width: 180  |  Height: 134  |  Size: 26 KiB

BIN
robocze/images/upload/07062009560.jpg View File

Before After
Width: 600  |  Height: 449  |  Size: 283 KiB

BIN
robocze/images/upload/07062009560_m.jpg View File

Before After
Width: 180  |  Height: 134  |  Size: 29 KiB

BIN
robocze/images/upload/07062009561.jpg View File

Before After
Width: 600  |  Height: 449  |  Size: 205 KiB

BIN
robocze/images/upload/07062009561_m.jpg View File

Before After
Width: 180  |  Height: 134  |  Size: 23 KiB

BIN
robocze/images/upload/07062009563.jpg View File

Before After
Width: 600  |  Height: 449  |  Size: 228 KiB

BIN
robocze/images/upload/07062009563_m.jpg View File

Before After
Width: 180  |  Height: 134  |  Size: 24 KiB

BIN
robocze/images/upload/07062009565.jpg View File

Before After
Width: 600  |  Height: 449  |  Size: 260 KiB

BIN
robocze/images/upload/07062009565_m.jpg View File

Before After
Width: 180  |  Height: 134  |  Size: 29 KiB

BIN
robocze/images/upload/07062009566.jpg View File

Before After
Width: 600  |  Height: 449  |  Size: 224 KiB

BIN
robocze/images/upload/07062009566_m.jpg View File

Before After
Width: 180  |  Height: 134  |  Size: 25 KiB

BIN
robocze/images/upload/07062009567.jpg View File

Before After
Width: 600  |  Height: 449  |  Size: 209 KiB

BIN
robocze/images/upload/07062009567_m.jpg View File

Before After
Width: 180  |  Height: 134  |  Size: 26 KiB

BIN
robocze/images/upload/07062009569.jpg View File

Before After
Width: 600  |  Height: 449  |  Size: 198 KiB

BIN
robocze/images/upload/07062009569_m.jpg View File

Before After
Width: 180  |  Height: 134  |  Size: 21 KiB

BIN
robocze/images/upload/07062009570.jpg View File

Before After
Width: 600  |  Height: 449  |  Size: 192 KiB

BIN
robocze/images/upload/07062009570_m.jpg View File

Before After
Width: 180  |  Height: 134  |  Size: 21 KiB

BIN
robocze/images/upload/07062009571.jpg View File

Before After
Width: 600  |  Height: 449  |  Size: 187 KiB

BIN
robocze/images/upload/07062009571_m.jpg View File

Before After
Width: 180  |  Height: 134  |  Size: 21 KiB

BIN
robocze/images/upload/08062009624.jpg View File

Before After
Width: 600  |  Height: 449  |  Size: 266 KiB

BIN
robocze/images/upload/08062009624_m.jpg View File

Before After
Width: 180  |  Height: 134  |  Size: 30 KiB

BIN
robocze/images/upload/08062009625.jpg View File

Before After
Width: 600  |  Height: 449  |  Size: 269 KiB

BIN
robocze/images/upload/08062009625_m.jpg View File

Before After
Width: 180  |  Height: 134  |  Size: 30 KiB

BIN
robocze/images/upload/08062009629.jpg View File

Before After
Width: 600  |  Height: 449  |  Size: 199 KiB

BIN
robocze/images/upload/08062009629_m.jpg View File

Before After
Width: 180  |  Height: 134  |  Size: 21 KiB

BIN
robocze/images/upload/08062009630.jpg View File

Before After
Width: 600  |  Height: 449  |  Size: 331 KiB

BIN
robocze/images/upload/08062009630_m.jpg View File

Before After
Width: 180  |  Height: 134  |  Size: 34 KiB

BIN
robocze/images/upload/08062009632.jpg View File

Before After
Width: 600  |  Height: 449  |  Size: 292 KiB

BIN
robocze/images/upload/08062009632_m.jpg View File

Before After
Width: 180  |  Height: 134  |  Size: 30 KiB

BIN
robocze/images/upload/dsc_0006.jpg View File

Before After
Width: 600  |  Height: 398  |  Size: 192 KiB

BIN
robocze/images/upload/dsc_0006_m.jpg View File

Before After
Width: 180  |  Height: 119  |  Size: 26 KiB

+ 31
- 31
robocze/index.php View File

@ -1,32 +1,32 @@
<?php
require_once('./functions.php');
NaglowekXHTML();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl">
<head>
<title>Strona Główna</title>
<?php
require_once('./functions.php');
NaglowekXHTML();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl">
<head>
<title>Strona Główna</title>
<link type="text/css" href="style.css" rel="stylesheet" />
<meta http-equiv="Content-Type" content="<?=$xhtml?'application/xhtml+x':'text/ht'?>ml; charset=utf-8" />
</head>
<body>
<div id="page">
<img src="images/logo.png" width="800px" alt="Logo strony" />
<div id="content">
<div id="dlinks">
<a href="gallery.php"><img src="images/galeria.png" alt="Galeria Zdjęć" /></a> <br/>
<a href="download.php"><img src="images/download.png" alt="Download" /></a> <br/>
<a href="http://suczawa.ath.cx"><img src="images/forum.png" alt="Forum" /></a>
</div>
</div>
<div id="footer">
<a id="copyright">Copyright © 2009 ...</a><br />
<div id="links">
<a href="index.php">Strona główna</a> | <a href="gallery.php">Fotogaleria</a> | <a href="download.php">Download</a> | <a href="http://suczawa.ath.cx">Forum</a>
</div>
</div>
</div>
</body>
</html>
<meta http-equiv="Content-Type" content="<?=$xhtml?'application/xhtml+x':'text/ht'?>ml; charset=utf-8" />
</head>
<body>
<div id="page">
<img src="images/logo.png" width="800px" alt="Logo strony" />
<div id="content">
<div id="dlinks">
<a href="gallery.php"><img src="images/galeria.png" alt="Galeria Zdjęć" /></a> <br/>
<a href="download.php"><img src="images/download.png" alt="Download" /></a> <br/>
<a href="http://suczawa.ath.cx"><img src="images/forum.png" alt="Forum" /></a>
</div>
</div>
<div id="footer">
<a id="copyright">Copyright © 2009 Various Authors</a><br />
<div id="links">
<a href="index.php">Strona główna</a> | <a href="gallery.php">Fotogaleria</a> | <a href="download.php">Download</a> | <a href="http://suczawa.ath.cx">Forum</a>
</div>
</div>
</div>
</body>
</html>

+ 19
- 12
robocze/init.php View File

@ -37,7 +37,7 @@ ini_set('session.cookie_lifetime', 259200); #expire time - 1 month
session_start(); #starting session
if (empty($_SESSION['logged']))
{
$_SESSSION['logged'] = false;
$_SESSION['logged'] = false;
}
$DB = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME); #connect with the database
@ -51,7 +51,7 @@ if (!$DB->query("SET NAMES 'utf8'")) #użyj utf-8
{
blad('Could not set character to UTF-8');
}
$page = (isset($_GET['page'])) ? intval($_GET['page']) : 1;
#pobierz liczbę zdjęć w galerii
$sql = "SELECT COUNT(`id`) AS `count` FROM `photos`";
@ -63,28 +63,35 @@ if (!$result = $DB->query($sql))
$row = $result->fetch_assoc();
$count = $row['count'];
$result->free; //zwolnij pamięć
$result->free(); //zwolnij pamięć
if (!is_numeric($page))
{
blad('Podana strona nie istnieje!');
}
if ($page < 1)
{
blad('Podana strona nie istnieje!');
}
//
//wygeneruj strone
//
if (isset($_GET['page'])&&($_GET['page']!=1))
if ($page != 1)
{
if (!is_numeric($_GET['page']))
{
die('Hacking attempt');
}
$value = ($_GET['page']-1)*PERPAGE;
$value = ($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))
$cnt = ($cnt == 0) ? 1 : $cnt;
if($page > $cnt)
{
blad('Podana strona nie istnieje!');
}

Loading…
Cancel
Save