|
@ -5,4 +5,63 @@ |
|
|
* @version $Id$ |
|
|
* @version $Id$ |
|
|
**/ |
|
|
**/ |
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
|
$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'); |
|
|
|
|
|
?>
|
|
|
|
|
|
<div style="background-color: lightgray">Wpisz dane administratora, aby się zalogować</div> |
|
|
|
|
|
|
|
|
|
|
|
<?php if ($msg!='') { ?>
|
|
|
|
|
|
<br /> |
|
|
|
|
|
<div style="background-color: #FFFF99"><span style="color: red">Wystąpiły błędy: <b><?php echo $msg; ?></b></span></div>
|
|
|
|
|
|
<?php } ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<form action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post"> |
|
|
|
|
|
<table> |
|
|
|
|
|
<tr> |
|
|
|
|
|
<td align="right">Nazwa użytkownika:</td> |
|
|
|
|
|
<td><input type="text" name="nick" /></td> |
|
|
|
|
|
</tr> |
|
|
|
|
|
<tr> |
|
|
|
|
|
<td align="right">Hasło:</td> |
|
|
|
|
|
<td><input type="password" name="passwd" /></td> |
|
|
|
|
|
</tr> |
|
|
|
|
|
<tr> |
|
|
|
|
|
<td colspan="2"> |
|
|
|
|
|
<input type="submit" value="Zaloguj" /> <input type="reset" value="Reset" /> |
|
|
|
|
|
</td> |
|
|
|
|
|
</tr> |
|
|
|
|
|
</table> |
|
|
|
|
|
</form> |