-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
76 lines (55 loc) · 2.16 KB
/
Copy pathindex.php
File metadata and controls
76 lines (55 loc) · 2.16 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
65
66
67
68
69
70
71
72
73
74
75
76
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div id = "frm">
<h1>Login</h1>
<form name="f1" action="" method="POST">
<p>
<label> UserName: </label>
<input type = "text" id ="user" name="user"/>
</p>
<p>
<label> Password: </label>
<input type = "password" id ="pass" name= "pass"/>
</p>
<p>
<input type="submit" id="btn" value="Login"/>
<input type="reset" id="btn" value ="reset"/>
</p>
<?php
//ini_set('display_errors', true);
//error_reporting(E_ALL);
include('connect.php');
//var_dump(isset($_POST['user']));
//var_dump(isset($_POST['pass']));
@$username = $_POST["user"];
@$password = $_POST["pass"];
if(isset($username) && isset($password)){
$username = stripcslashes($username);
$password = stripcslashes($password);
//vyberanie z databazy ci uzivatel existuje
$sql = "select * from users where username = '$username' and passwords = '$password'";
$result = mysqli_query($con, $sql);
$row = mysqli_fetch_array($result, MYSQLI_ASSOC);
$succes = mysqli_num_rows($result);
if($succes > 0){
//echo "<h1> Prihlasenie uspesne</h1>";
mysqli_close($con);
header('Location: home.php');
exit;
}
else{
echo "<p> prihlasovanie zlyhalo zle prihlasove meno alebo heslo.</p>";
}
}
?>
</form>
<a href="register_form.php">
<button id="rgstr" >register</button>
</a>
</div>
</body>
</html>