-
Notifications
You must be signed in to change notification settings - Fork 1
/
reg.php
executable file
·74 lines (66 loc) · 1.99 KB
/
reg.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
69
70
71
72
73
74
<?php
session_start();
require_once('Db.php');
Db::connect('sql.endora.cz:3314','code','code','code1234');
$s = "" ;
if($_POST){
if($_POST['rok'] != date('Y'))
$s = "Zle vyplnený antispam" ;
else if($_POST['pass'] != $_POST['pass2'])
$s = "heslá sa nezhodujú";
else{
$existuje = Db::querySingle('
SELECT COUNT(*)
FROM us
WHERE meno=?
Limit 1',$_POST['meno']
);
if($existuje)
$s ="použivateľ s touto prezívkou už existuje";
else{
Db::query('INSERT INTO us (meno,pass)
VALUES (?,SHA1(?))
', $_POST['meno'],$_POST['pass']. "#kj9df5jsh2hj4");
$_SESSION['meno'] = $_POST['meno'];
$_SESSION['prihlaseny'] = 1;
header('Location: admin.php');
}
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Registrace | Blog</title>
<meta charset="utf-8"/>
<link rel="stylesheet" href="log.css" type="text/css"/>
</head>
<body>
<div class="container text-center mt-3">
<form method="POST">
<table>
<tr>
<td> Uživatelské jméno: </td>
<td> <input type="text" name="meno"><br/></td>
</tr>
<tr>
<td> Heslo: </td>
<td> <input type="password" name="pass"><br/></td>
</tr>
<tr>
<td> Heslo (znovu): </td>
<td> <input type="password" name="pass2"><br/></td>
</tr>
<tr>
<td> Aktuální rok (anti-spam): </td>
<td> <input type="number" name="rok"><br/></td>
</tr>
<tr>
<td> <input type="submit" value="Registrovat" > <td>
</tr>
</table>
</form>
<p>Máš už účet? <a href="log.php">Přihlaš se! </a></p>
</div>
</body>
</html>