<?PHP
echo '<form method="post" action="skrypt.php?akcja=wykonaj">
<table><tr>
<td>Nazwa : </td><td><input type="text" name="nick" /></td></tr><br>
<tr><td>Hasło : </td><td><input type="password" name="haslo" /></td></tr><br>
<tr><td>Powtórz hasło : </td><td><input type="password" name="vhaslo" /></td></tr><br>
<tr><td>Email : </td><td><input type="text" name="email" /></td></tr><br>
<tr><td>Powtórz email : </td><td><input type="text" name="vemail" /></td></tr><br>
<tr><td></td><td><input type="submit" value="Zarejestruj"></td></tr></table>
</form> ';
$akcja = $_GET['akcja'];
if ($akcja == wykonaj) {
$vhaslo = substr($_POST['vhaslo'],0
,32
); $email = substr($_POST['email'],0
,32
); $vemail = substr($_POST['vemail'],0
,32
); //
$handle = mysql_connect('localhost', 'Moj_login', 'Moje_haslo') or
die ('Blad polaczenia z baza'); $vhaslo = substr($_POST['vhaslo'],0
,32
); $email = substr($_POST['email'],0
,32
); $vemail = substr($_POST['vemail'],0
,32
); //kilka sprawdzen co do nicku i maila
if ($emailx[1] == 'o2.pl') {
$emailx1 = $emailx[0].'@go2.pl';
$emailx2 = $emailx[0].'@tlen.pl';
}elseif ($emailx[1] == 'go2.pl') {
$emailx1 = $emailx[0].'@o2.pl';
$emailx2 = $emailx[0].'@tlen.pl';
}elseif ($emailx[1] == 'tlen.pl') {
$emailx1 = $emailx[0].'@go2.pl';
$emailx2 = $emailx[0].'@o2.pl';
}
$komunikaty = '';
//sprawdzenie co uzytkownik zle zrobil
if (!$nick || !$email || !$haslo || !$vhaslo || !$vemail ) {
$komunikaty .= "<font size='3'>Musisz wypelnic wszystkie pola!</font><br>"; }
if ($spr4 < 3) {
$komunikaty .= "<font size='3'>Login musi mieć przynajmniej 3 znaki</font><br>"; }
if ($spr5 < 4) {
$komunikaty .= "<font size='3'>Hasło musi mieć przynajmniej 4 znaki</font><br>"; }
if ($spr1[0] >= 1) {
$komunikaty .= "<font size='3'>Ten login jest zajęty!</font><br>"; }
if ($spr2[0] >= 1) {
$komunikaty .= "<font size='3'>Ten e-mail jest już używany!</font><br>"; }
if ($email != $vemail) {
$komunikaty .= "<font size='3'>E-maile się nie zgadzają ...</font><br>";}
if ($haslo != $vhaslo) {
$komunikaty .= "<font size='3'>Hasła się nie zgadzają ...</font><br>";}
if ($pos == false OR $pos2 == false) {
$komunikaty .= "<font size='3'>Nieprawidłowy adres e-mail</font><br>"; }
if ($spr3[0] >= 1) {
$komunikaty .= "<font size='3'>Nie można zarejestrować kilku kont na jedną poczte o2.</font><br>"; }
//jesli cos jest nie tak to blokuje rejestracje i wyswietla bledy
if ($komunikaty) {
<font size="3"><br><br>Popraw blędy :<br>
'.$komunikaty.'<br>';
} else {
//jesli wszystko jest ok dodaje użytkownika i wyswietla informacje
mysql_query("INSERT INTO `w324_czyli` (nick, haslo, email) VALUES('$nick','$haslo','$email')") or
die("Nie mogłem Cię zarejestrować!");
echo '<br><font size="3">Zostałeś zarejestrowany jako '.$nick.'.<br> Teraz możesz się zalogować. </font>'; }
}
?>