From 2e2c66152d1c381498d834d9da3b5fcbbbe53b0b Mon Sep 17 00:00:00 2001 From: pioder Date: Sun, 16 Aug 2009 14:26:14 +0000 Subject: [PATCH] =?UTF-8?q?Logowanie=20ju=C5=BC=20dzia=C5=82a=20:)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn.pioder.pl/sg-svn@19 3ed2631f-fe0d-47e0-9194-a46bc0f18ee8 --- robocze/admin/index.php | 26 ++++++++++-------- robocze/admin/login.php | 61 ++++++++++++++++++++++++++++++++++++++++- robocze/functions.php | 20 ++++++++++++++ 3 files changed, 94 insertions(+), 13 deletions(-) diff --git a/robocze/admin/index.php b/robocze/admin/index.php index 35474bb..85591ed 100644 --- a/robocze/admin/index.php +++ b/robocze/admin/index.php @@ -22,6 +22,8 @@ if (empty($_GET['mode'])) Przekieruj('index.php?mode=admin_gallery'); } +//NaglowekXHTML(); + switch($_GET['mode']) { #logowanie @@ -76,20 +78,20 @@ switch($_GET['mode']) case 'add': { - require('./gallery_item_add.php'; - break + require('./gallery_item_add.php'); + break; } case 'edit': { - require('./gallery_item_edit.php'; - break + require('./gallery_item_edit.php'); + break; } case 'delete': { - require('./gallery_item_delete.php'; - break + require('./gallery_item_delete.php'); + break; } } @@ -117,20 +119,20 @@ switch($_GET['mode']) case 'add': { - require('./user_add.php'; - break + require('./user_add.php'); + break; } case 'edit': { - require('./user_edit.php'; - break + require('./user_edit.php'); + break; } case 'delete': { - require('./user_delete.php'; - break + require('./user_delete.php'); + break; } } diff --git a/robocze/admin/login.php b/robocze/admin/login.php index a2ef64d..0a45320 100644 --- a/robocze/admin/login.php +++ b/robocze/admin/login.php @@ -5,4 +5,63 @@ * @version $Id$ **/ -?> \ No newline at end of file +$msg = ''; +if (isset($_POST['nick'], $_POST['passwd']) && strlen(trim($_POST['nick']))>0 && strlen(trim($_POST['passwd']))>0 ) +{ + $sql = "SELECT * FROM `admins` WHERE `nick`='".strip_tags(addslashes($_POST['nick']))."'"; + if (!$result = $DB->query($sql)) + { + blad('Nie mozna sprawdzic tabeli administracyjnej!'); + } + if ($result->num_rows==0) + { + $msg = 'Podany użytkownik nie istnieje w bazie!'; + } + else + { + $row = $result->fetch_assoc(); + if ($row['password'] == md5($_POST['passwd'])) + { + $_SESSION['logged'] = true; + $sql = "UPDATE `admins` SET `IP`='".$_SERVER['REMOTE_ADDR']."' WHERE `id`='".$row['id']."'"; + if (!$DB->query($sql)) + { + blad('Nie mozna zaaktualizowac ostatniego IP!'); + } + + Przekieruj('index.php?mode=admin_gallery', 'Zostałeś poprawnie zalogowany! Przekierowywanie...'); + } + else + { + $msg = 'Hasło jest nieprawidłowe!'; + } + } +} + +NaglowekPA('Logowanie'); +?> +
Wpisz dane administratora, aby się zalogować
+ + +
+
Wystąpiły błędy:
+ + + +
+ + + + + + + + + + + + +
Nazwa użytkownika:
Hasło:
+    +
+
\ No newline at end of file diff --git a/robocze/functions.php b/robocze/functions.php index 3ace72f..b715aa1 100644 --- a/robocze/functions.php +++ b/robocze/functions.php @@ -93,4 +93,24 @@ function Przekieruj($url='index.php', $tresc='') die(''); } } + +function NaglowekPA($nazwapodstrony) +{ + global $xhtml; + echo ' + + + + ACP • '.$nazwapodstrony.' + + + + +
+
+

Panel Administracyjny Galerii Zdjęć

+'; +} ?>