Teraz będzie dobrze. Wystarczy uporządkować sobie kod:
<?php
include "conn.inc.php";
if (isset ($_POST['submit'])) {
if ($_POST['login'] != "" && $_POST['haslo'] != "" && $_POST['haslo2'] == $_POST['haslo'] && $_POST['regulamin'] != "" && $_POST['email'] !== "" )
{
$query = "SELECT login
FROM uzytkownicy
WHERE login = '".$_POST['login']."' ";
{
?>
Nazwa użytkownika
<?php echo $_POST['login']; ?> jest już zajęta, proszę wybrać inną!
<form action="rejestracja.php" method="post">
Login <input type="text" name="login" size="20" maxlength="40">
Hasło <input type="password" name="haslo" size="20" maxlength="40">
Powtórz hasło <input type="password" name="haslo_2" size="20" maxlength="40" >
Email <input type="text" name="email" size="20" maxlength="40" >
<input type="checkbox" name="regulamin" value="tak" > Akceptuję <a href="regulamin.php">regulamin</a>
<?php $today = date("Y-m-d"); ?> <input type="submit" name="submit" value="Zarejestruj" >
<input type="reset" value="Wyczyść"></form>
<?php
}
}
else
{
if ($_POST['haslo_2'] != $_POST['haslo'])
{
?>
Podane hasła są różne!
<?php
} else {
$query = "INSERT INTO `uzytkownicy` (login, haslo, haslo_2, email, today)
VALUES (
'".$_POST['login']."',
'".$_POST['haslo']."',
'".$_POST['haslo_2']."',
'".$_POST['email']."',
);";
{
$_SESSION['user_logged'] = $_POST['login'];
$_SESSION['user_password'] = $_POST['haslo'];
?>
Dziękujemy za zarejestrowanie sie
<?php echo $_POST['login']; ?> Kliknij <a href="index.php">tutaj</a> aby przejść do strony głównej.
<?php
} else {
?>
Wypełnij wszystkie pola.
<form action="rejestracja.php" method="post">
Login <input type="text" name="login" size="20" maxlength="40">
Hasło <input type="password" name="haslo" size="20" maxlength="40">
Powtórz hasło <input type="password" name="haslo_2" size="20" maxlength="40" >
Email <input type="text" name="email" size="20" maxlength="40" >
<input type="checkbox" name="regulamin" value="tak" > Akceptuję <a href="regulamin.php">regulamin</a>
<?php $today = date("Y-m-d"); ?> <input type="submit" name="submit" value="Zarejestruj" >
<input type="reset" value="Wyczyść"></form>
<?php
}
}
}
} else {
?>
Witamy na stronie rejestracji
<form action="rejestracja.php" method="post">
Login <input type="text" name="login" size="20" maxlength="40">
Hasło <input type="password" name="haslo" size="20" maxlength="40">
Powtórz hasło <input type="password" name="haslo_2" size="20" maxlength="40" >
Email <input type="text" name="email" size="20" maxlength="40" >
<input type="checkbox" name="regulamin" value="tak" > Akceptuję <a href="regulamin.php">regulamin</a>
<?php $today = date("Y-m-d"); ?> <input type="submit" name="submit" value="Zarejestruj" >
<input type="reset" value="Wyczyść"></form>
<?php
}
?>
Ten post edytował vtuner 7.03.2008, 20:06:26