plik functions.php
<?php function connection ( ) { if ( $conn ) { return $conn ; } else { { return 0 ; } else { return $conn ; } } } function sql ( $query ) { if ( ! ( $conn = connection ( ) ) ) { return 0 ; } else { if ( ! $result ) { } else { return $result ; } } } ?>
Zaś plik register.php
<html> <body> <script TYPE="text/javascript" LANGUAGE="JavaScript"> <!-- function sprawdz(formularz) { for (i = 0; i < formularz.length; i++) { var pole = formularz.elements[i]; if ((pole.type == "text" || pole.type == "pass" || pole.type == "mail") && pole.value == "") { alert("Proszę wypełnić wszystkie pola!"); return false; } } return true; } //--> </SCRIPT> <?php function register_form ( ) { <form style="margin:0" action="rejestracja.php?step=2" method="post" onsubmit="if (sprawdz(this)) return true; return false"> <table cellspacing="2" cellpadding="0" border="0"> <tr> <td>Login:</td> <td><input type="text" style="background-image:url('login.jpg');border-width:0;width:78px" name="login"></td> </tr> <tr> <td>E-mail:</td> <td><input type="text" style="background-image:url('login.jpg');border-width:0;width:78px" name="email"></td> </tr> <tr> <td>Hasło:</td> <td><input type="password" style="background-image:url('login.jpg');border-width:0;width:78px" name="pass"></td> </tr> <tr> <td>Powtórz hasło:</td> <td><input type="password" name="pass2" style="background-image:url('login.jpg');border-width:0;width:78px"></td> </tr> <tr> <td align="center" colspan="2"><input type="submit" value="Zarejestruj"></td> </tr> </table> </form> " ) ; } function register ( ) { if ( $_POST [ 'pass' ] != $_POST [ 'pass2' ] ) { } else { $result = sql ( "SELECT login FROM users WHERE login = ". $_POST [ 'login' ] ) ; { } else { if ( sql ( "INSERT INTO users VALUES ( "", "". $_POST [ 'login' ] ."", "". md5 ( $_POST [ 'pass' ] ) ."", "". $_POST [ 'email' ] ."" )" ) ) { echo ( "Rejestracja zakończona pomyślnie. Możesz się zalogować za pomocą podanego w
cześniej loginu i hasła." ) ; } else { } } } } if ( ! $_GET [ 'step' ] ) { register_form ( ) ; } elseif ( $_GET [ 'step' ] == 2 ) { rejestracja ( ) ; } ?>