Dodaj 'rejestracja/index.php'
This commit is contained in:
parent
2cd6ec0601
commit
853255b952
49
rejestracja/index.php
Normal file
49
rejestracja/index.php
Normal file
@ -0,0 +1,49 @@
|
||||
<title>Rejestracja konta</title>
|
||||
|
||||
<form method="POST" action="index.php">
|
||||
<b>Login:</b> <input type="text" name="login"><br>
|
||||
<b>Hasło:</b> <input type="password" name="haslo1"><br>
|
||||
<b>Powtórz hasło:</b> <input type="password" name="haslo2"><br>
|
||||
<input type="submit" value="Zarejestruj" name="loguj">
|
||||
</form>
|
||||
|
||||
<?php
|
||||
$db_servername = 'localhost';
|
||||
$db_login = '';
|
||||
$db_password = '';
|
||||
$db_name = '';
|
||||
|
||||
mysql_connect("$servername","$dblogin","$db_password");
|
||||
mysql_select_db("$db_name");
|
||||
|
||||
function filter($variable)
|
||||
{
|
||||
if(get_magic_quotes_gpc())
|
||||
$variable = stripslashes($variable);
|
||||
|
||||
return mysql_real_escape_string(htmlspecialchars(trim($variable)));
|
||||
}
|
||||
|
||||
if (isset($_POST['loguj']))
|
||||
{
|
||||
$login = filter($_POST['login']);
|
||||
$haslo1 = filter($_POST['haslo1']);
|
||||
$haslo2 = filter($_POST['haslo2']);
|
||||
$ip = filter($_SERVER['REMOTE_ADDR']);
|
||||
|
||||
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`, `ip`)
|
||||
VALUES ('".$login."', '".$haslo1."', '".$ip."');");
|
||||
|
||||
echo "Konto zostało utworzone! Czekaj na akceptację.";
|
||||
}
|
||||
else echo "Hasła nie są takie same!";
|
||||
}
|
||||
else echo "Podany login jest już zajęty.";
|
||||
}
|
||||
|
||||
mysql_close();
|
||||
?>
|
Loading…
Reference in New Issue
Block a user