-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkokeileKirjautua.php
More file actions
29 lines (20 loc) · 849 Bytes
/
kokeileKirjautua.php
File metadata and controls
29 lines (20 loc) · 849 Bytes
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
<?php
require 'models/Kayttaja.php';
require_once 'libs/Tietokantayhteys.php';
$yhteys = Tietokantayhteys::getTietokantayhteys();
$tunnus = $_POST['ktunnus'];
$password = $_POST['salasana'];
$sql = "SELECT Salasana from Kayttaja where KayttajaNimi = '$tunnus';" ;
$kysely = Tietokantayhteys::getTietokantayhteys()->prepare($sql);
$kysely->execute();
$ssanatesti = $kysely->fetchColumn();
if ($ssanatesti === $password) {
session_start();
//$kayttaja = $tunnus;
$user = new Kayttaja($tunnus, $password);
$_SESSION['kirjautunut'] = $user;
header('location:muistilista.php');
}
else {
header('location:index.php');
}