-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpassword.php
More file actions
57 lines (45 loc) · 1.26 KB
/
password.php
File metadata and controls
57 lines (45 loc) · 1.26 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
<?php
include('db.php');
if(isset($_POST['submit']))
{
$login = $_POST['login'];
$password = $_POST['password'];
$r_password = $_POST['r_password'];
if($password == $r_password)
{
$password = md5($password);
$query = mysql_query("INSERT INTO users VALUES('','$login','$password')") or die(mysql_error());
}
else
{
die( 'Пароль не совпадает' );
}
}
if(isset($_POST['input']))
{
$i_login = $_POST['i_login'];
$i_password = md5($_POST['i_password']);
$query = mysql_query("SELECT * FROM users WHERE login='$i_login'");
$user_input = mysql_fetch_array($query);
if($user_input['password'] == $i_password)
{
echo "OK";
$check = "true";
}
else
{
echo 'Неверный пароль';
}
}
?>
<form method="post" action="index.php">
Логин :<input type="text" name="login" required /><br>
Пароль: <input type="password" name="password" required /><br>
Повторите пароль: <input type="password" name="r_password" required /><br>
<input type="submit" name="submit" value="Регистрация"/>
</form>
<form method="post" action="index.php">
Логин :<input type="text" name="i_login" required /><br>
Пароль: <input type="password" name="i_password" required /><br>
<input type="submit" name="input" value="Вход"/>
</form>