<?php
include "conn.inc.php";
?>
<html>
<head>
<title>Witaj w Stronie</title>
</head>
<body>
<?php
if (isset($_POST['submit']) && $_POST['submit'] == "Zarejestruj") { if ($_POST['username'] !="" &&
$_POST['password'] !="" &&
$_POST['first_name'] !="" &&
$_POST['last_name'] !="" &&
$_POST['email' !="") {
$query = "SELECT username FROM user_info".
"WHERE username='" . $_POST['username']. "';";
?>
<p>
<font color="#FF0000">
<b>Nazwa użytkownika
<?php echo $_POST['username']; ?> jest już używana. Wybierz inną !
</b>
</font>
<form action="register.php" method="post">
Login: <input type="text" name="username"><br>
Hasło: <input type="password" name="password">
Adres E-mail: <input type="text" name="email"
value="
<?php echo $_POST['email']; ?>"><br>
Imię: <input type="text" name="first_name"
value="
<?php echo $_POST['first_name']; ?>"><br>
Nazwisko: <input type="test" name="last_name"
value="
<?php echo $_POST['last_name']; ?>"><br>
<input type="submit" name="submit" value="Zarejestruj">
<input type="reset" value="Wyczyść">
</form>
</p>
<?php
} else {
$query = "INSRT INTO user_info (username, password, email, " .
"first_name, last_name) " .
"VALUES ('" . $_POST['username'] . "', " .
"(PASSWORD('" . $_POST['password'] . "')), '" .
"', '" . $_POST['email'] . "', '" . $_POST['first_name'] .
"', '" . $_POST['last_name]);";
$result = mysql_query($query)
or die(mysql_error());
$_SESSION['user_logged'] = $_POST['username'];
$_SESSION['user_password'] = $_POST['password'];
?>
<p>
Dziękujemy, <?php>echo $_POST['first_name'] . " " .
$_POST['last_name']; ?>, za zarejestrowanie się!<br>
<?php
header("Refresh: 5; URL=index.php");
echo "Zakończono proces rejestracji ! " .
"Zostaniesz przeniesiony do Strony Głównej.<br>";
echo "(Jeżeli Twoja przeglądarka nie obsługuje przekierowań, " .
<a href=\"index.php\">kliknij tutaj</a>)";
die();
}
} else {
?>
<p>
<font color="#FF000"><b>Pola wymagane: Login, hasło, e-mail, Imię i Nazwisko</b></font>
<form action="register.php" method="post>
Login: <input type="text" name="username"><br>
Hasło: <input type="password" name="password">
Adres E-mail: <input type="text" name="email"
value="<?php echo $_POST['email']; ?>"><br>
Imię: <input type="text" name="first_name"
value="<?php echo $_POST['first_name']; ?>"><br>
Nazwisko: <input type="test" name="last_name"
value="<?php echo $_POST['last_name]; ?>"><br>
<input type="submit" name="submit" value="Zarejestruj">
<input type="reset" value="Wyczyść">
</form>
</p>
<?php
}
} else {
?>
<p>
Witamy na stronie rejestracji!<br>
Pola wymagazne: Login, hasło, e-mail, Imię i Nazwisko
<form action="register.php" method="post>
Login: <input type="text" name="username"><br>
Hasło: <input type="password" name="password">
Adres E-mail: <input type="text" name="email"<br>
Imię: <input type="text" name="first_name"<br>
Nazwisko: <input type="test" name="last_name"<br>
<input type="submit" name="submit" value="Zarejestruj">
<input type="reset" value="Wyczyść">
</form>
</p>
<?php
}
?>
</body>
</html>