-
Notifications
You must be signed in to change notification settings - Fork 0
/
strona.php
42 lines (32 loc) · 1.01 KB
/
strona.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
<?php
session_start();
if (isset($_POST['login']) and isset($_POST['haslo'])) {
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "baza";
// Create connection
//$conn = new mysqli($servername, $username, $password);
$conn = new mysqli($servername, $username, $password, $dbname);
$sql = "INSERT INTO `ksiazki` (`id`, `tytul`, `opis`, `stan`) VALUES (NULL, 'aaa', 'vbb', '');";
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
echo $_POST['login'];
$sql = "SELECT * FROM uczen where `imie`='" . $_POST['login'] . "'";
// echo $sql;
$result = $conn->query($sql);
if ($result->num_rows > 0) {
$_SESSION['zalogowany'] = 1;
include("index.php");
} else {
include("logowanie.php");
}
$conn->close();
} else if ($_SESSION['zalogowany'] == 1) {
include("index.php");
} else {
include("logowanie.php");
}