2018-12-30 23:54:00 +01:00
|
|
|
<html>
|
|
|
|
<head>
|
2018-12-30 16:27:53 +01:00
|
|
|
<title>Rejestracja konta</title>
|
2018-12-30 17:44:06 +01:00
|
|
|
<link rel="stylesheet" type="text/css" href="style.css">
|
2018-12-30 23:54:00 +01:00
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
|
</head>
|
2018-12-30 17:44:06 +01:00
|
|
|
|
2018-12-30 16:27:53 +01:00
|
|
|
<?php
|
2018-12-30 23:54:00 +01:00
|
|
|
$eerror = "";
|
2018-12-30 16:27:53 +01:00
|
|
|
include 'sql/db_login.php';
|
|
|
|
|
|
|
|
mysql_connect("$db_servername", "$db_login", "$db_password");
|
|
|
|
mysql_select_db("$db_name");
|
|
|
|
|
|
|
|
$db = mysqli_connect("$db_servername", "$db_login_tasks", "$db_password_tasks", "$db_name_tasks");
|
|
|
|
|
|
|
|
function filter($variable)
|
|
|
|
{
|
|
|
|
if(get_magic_quotes_gpc())
|
|
|
|
$variable = stripslashes($variable);
|
|
|
|
|
|
|
|
return mysql_real_escape_string(htmlspecialchars(trim($variable)));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($_POST['register']))
|
|
|
|
{
|
|
|
|
$login = filter($_POST['login']);
|
|
|
|
$haslo1 = filter($_POST['haslo1']);
|
|
|
|
$haslo2 = filter($_POST['haslo2']);
|
|
|
|
|
|
|
|
if (mysql_num_rows(mysql_query("SELECT user_login FROM users WHERE user_login = '".$login."';")) == 0)
|
|
|
|
{
|
|
|
|
if ($haslo1 == $haslo2)
|
|
|
|
{
|
|
|
|
mysql_query("INSERT INTO `users` (`user_login`, `user_pass`)
|
|
|
|
VALUES ('".$login."', '".$haslo1."');");
|
|
|
|
|
|
|
|
$login = strtolower($login);
|
|
|
|
mysqli_query($db, "CREATE TABLE IF NOT EXISTS `tasks_$login` (
|
|
|
|
`ID` int(10) NOT NULL AUTO_INCREMENT,
|
|
|
|
`task` varchar(180) NOT NULL,
|
|
|
|
`done` tinyint(1) NOT NULL DEFAULT '0',
|
|
|
|
PRIMARY KEY (`ID`)
|
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin2 AUTO_INCREMENT=0");
|
|
|
|
|
2018-12-30 23:54:00 +01:00
|
|
|
$error = "Konto zostało utworzone! Czekaj na akceptację.";
|
2018-12-30 16:27:53 +01:00
|
|
|
}
|
2018-12-30 20:51:16 +01:00
|
|
|
else { $error = "Hasła nie są takie same!"; }
|
|
|
|
} else { $error = "Podany login jest już zajęty."; }
|
2018-12-30 16:27:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
mysql_close();
|
2018-12-30 20:51:16 +01:00
|
|
|
?>
|
|
|
|
|
|
|
|
<div class="registerbox">
|
|
|
|
<img src="img/avatar.png" class="avatar">
|
|
|
|
<h1>Rejestracja</h1>
|
|
|
|
<form method="POST" action="nowe_konto.php">
|
|
|
|
<p>Login</p>
|
|
|
|
<input type="text" name="login" placeholder="Wpisz swój login" required>
|
|
|
|
<p>Hasło</p>
|
|
|
|
<input type="password" name="haslo1" placeholder="Wpisz swoje hasło" required>
|
|
|
|
<p>Powtórz hasło</p>
|
|
|
|
<input type="password" name="haslo2" placeholder="Powtórz hasło" required>
|
|
|
|
<input type="submit" name="register" value="Rejestruj się">
|
|
|
|
</form>
|
|
|
|
<h2><?php echo $error; ?></h2>
|
2018-12-30 23:54:00 +01:00
|
|
|
</div>
|
|
|
|
</html>
|