-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLogg_inn.php
More file actions
64 lines (58 loc) · 2.02 KB
/
Logg_inn.php
File metadata and controls
64 lines (58 loc) · 2.02 KB
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
<?php
session_start();
include "Tilkobling.php";
include 'Validering.php';
?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<link rel="stylesheet" href="css/app.css">
<meta charset="utf-8">
<title></title>
</head>
<body>
<div class="topnav">
<a class="active" href="index.php">Tilbake</a>
<div class="registert">
<a href="Register.php">Register</a>
</div>
</div>
<form class="myform" action="" method="post">
<p class="element">
<label for="bruker">Brukernavn</label><br>
<input id="brukerNavn" type="text" name="brukerNavn" value="" size="45">
<span class = 'validering'>Brukernavnet skal begynne med et bokstav og kan innholde bokstaver og tall.</span>
</p>
<p class="element">
<label for="passord">Passord</label><br>
<input id="passord" type="password" name="passord" value=""size="45">
<span class = 'validering'>Passordet skal begynne med et bokstav og kan innholde små og store bokstaver og tall.</span>
</p>
<input type="submit" name="logg-inn" value="Logg inn">
<?php
if (isset($_REQUEST["logg-inn"]))
{
$brukerNavn=$_REQUEST['brukerNavn'];
$passord= $_REQUEST['passord'];
$felter= array(
"brukerNavn"=> $brukerNavn,
"passord" => $passord
);
if(validering($felter)){
$foresporring= "select BrukerID ,BrukerNavn ,Passord from Bruker where BrukerNavn ='";
$foresporring .= "$brukerNavn" ."' And Passord=SHA('" . $passord . "');";
$res=$db->query($foresporring);
if ($res->num_rows >0){
$rad =$res->fetch_assoc();
$_SESSION["brukerNavn"] = $rad["BrukerNavn"];
$_SESSION["erInnlogget"] = true;
header("Location: index.php");
}
else echo "<p class='feil'>Brukernavn eller passord er feil! Prøv igjen. </p>";
}
}
?>
</form>
<script src="js/index.js"></script>
</body>
</html>