-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogowanie.php
68 lines (58 loc) · 2.13 KB
/
logowanie.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
session_start();
$login = NULL;
$haslo = NULL;
if (isset($_POST["login"]) && isset($_POST["haslo"]))
{
$login = addslashes($_POST["login"]);
$haslo = addslashes($_POST["haslo"]);
$szukaj = array(';',"'",'"','=','+','-','<','>','[',']','{','}','?','$');
$odsiew = array('/','/','/','/','/','/','/','/','/','/','/','/','/','/');
$login = str_replace($szukaj, $odsiew, $login);
$haslo = str_replace($szukaj, $odsiew, $haslo);
include("db.php");
$sql = "SELECT Nazwa, Haslo FROM uzytkownicy WHERE Nazwa='$login' and Haslo='$haslo';";
$data = $conn->query($sql);
if ($data->num_rows > 0) {
echo '<h3>Witaj: ';
$dat = mysqli_fetch_assoc($data);
$_SESSION["PASS"] = "TAK";
$_SESSION["Login"] = $dat["Nazwa"];
echo $_SESSION["Login"];
mysqli_close($conn);
{header("Location: admin.php");}
echo '</h3>';
}
else if(empty($login) || empty($haslo))
{echo '<script>alert("Podaj login i hasło.")</script>';}
else
{
echo '<script>alert("Złe dane, spróbuj jeszcze raz.")</script>';
}
}
else
{echo "brak danych";}
if (empty($_SESSION["PASS"]))
{
echo
'
<link href="css/adminek.css" type="text/css" rel="stylesheet">
<link href="css/sunshinestyle.css" type="text/css" rel="stylesheet">
<div class="backfrom">
<form action="" method="post">
<center>
<div class="TXT-HED">Logowanie do panelu admina (https://www.strzyzowpelczara.pl).</div>
</center>
<label>Login</label>
<input type="text" name="login" placeholder="...">
<label>Hasło</label>
<input type="text" name="haslo" placeholder="...">
<input class="box dodaj" type="reset" value="Reset">
<input class="box dodaj" type="submit" name="dodaj" value="Zaloguj" />
</form>
</div>
'
;}
else
{header("Location: admin.php");}
?>