-
Notifications
You must be signed in to change notification settings - Fork 0
/
registruotis.php
47 lines (47 loc) · 1.36 KB
/
registruotis.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
<?php
/**
* Created by PhpStorm.
* User: Linas
* Date: 14.3.16
* Time: 14.27
*/
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Registracijos puslapis</title>
</head>
<body>
<form method="post" action="registruotis.php">
Įveskite vardą:
<input type="text" name="vardas"/>
<br/>
<br/>
Įveskite slaptažodį:
<input type="password" name="slaptazodis"/>
<br/>
<br/>
<input type="submit" value="Registruotis" name="patvirtinti"/>
<a href="/index.php" ><input type="button" value="Pagrindinis" /></a>
</form>
</body>
</html>
<?php
if (isset($_POST['patvirtinti'])) {
$vardas = $_POST['vardas'];
$slaptazodis = crypt($_POST['slaptazodis'], '$5$sl4pt444418lk#@4');
$byla = file_get_contents("Duomenys/Vartotojai.txt");
$duomenys = "$vardas||$slaptazodis";
if (!strstr($byla, "$duomenys")) {
$byla = "Duomenys/Vartotojai.txt";
$fh = fopen($byla, 'a') or die("negalima atverti bylos");
fwrite($fh, "$duomenys\n");
echo "Jūsų duomenys sėkmingai įvesti.";
fclose($fh);
mkdir("Admin/Tekstai/$vardas", 0777, true);
umask(0);
} else {
echo "Atleiskite bet: $vardas vardas jau egzistuoja. Prašau naudikite kitą vardą.";
}
}
?>