Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- ob_start();
- session_start();
- //inkludujemy plik z hasłami
- include("conf.php");
- //Laczenie z baza
- mysql_connect ( 'tibiaice.xaa.pl:2082', 'tibiaice','3L3mDn')or die("Nie można się połączyć z bazą: ".mysql_error());
- mysql_select_db('tibiaice_01') or die(mysql_error());
- ?>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" />
- <title>Rejestracja</title>
- <script type="text/javascript">
- <!-- //
- function regulamin()
- {
- if(document.getElementById('reg').checked == true )
- {
- document.getElementById('dalej').disabled=false;
- }
- else
- {
- document.getElementById('dalej').disabled=true;
- }
- }
- // -->
- </script>
- </head>
- <form method="post" action="<? echo $PHP_SELF;?>" METHOD=POST enctype="multipart/form-data">
- <center>
- <center><b>Login:<b><br />
- <input type="text" name="login" style="font-size: 10pt; font-family: Tahoma; font-weight: bold" /><br />
- <b>Email:<b><br />
- <input type="text" name="email" style="font-size: 10pt; font-family: Tahoma; font-weight: bold" /><br />
- <b>Hasło:</b><br />
- <input type="password" name="haslo" style="font-size: 10pt; font-family: Tahoma; font-weight: bold" /><br />
- <b>O¶wiadczam iż zaakceptowałem regulamin</b>
- <input type="checkbox" id="reg" onclick="regulamin()" /><br />
- <input type="submit" name="submit" value="Rejestracja" id="dalej" disabled="disabled" style="font-size: 10pt; font-family: Tahoma; font-weight: bold" /></center>
- </form>
- <?
- //Jak wiadomo dobrze użyć funkcji trim aby usunąć zbędne znaki
- $login = trim($_POST['login']);
- $email = trim($_POST['email']);
- $pass_md5 = md5($_POST['haslo']);
- $pass = $_POST['haslo'];
- if($_POST['submit']) {
- $checkuser = mysql_query("SELECT login FROM users WHERE login='$login'");
- $username_exist = mysql_num_rows($checkuser);
- //Jezeli zarejestrowanych takich nazw jest wiecej niz 0
- if($username_exist > 0){
- echo '
- <h2><center><b>Ta nazwa jest już zajęta wybierz inn±</b></center></h2>
- ';
- unset($login);
- exit();
- }
- //Wysylamy zapytanie z logowaniem
- $zapytanie = "INSERT INTO `users` (`id`, `login`, `email`, `haslo`) VALUES (NULL, '$login', '$email', '$pass_md5')";
- $idzapytania = mysql_query($zapytanie);
- if(!$idzapytania)
- {
- echo 'blad!' . mysql_error();
- }
- else
- {
- echo '
- <h2><center><b>Poprawnie się zarejestrowałe¶, <a href="logowanie.php">możesz się zalogować</a></b></center></h2>
- ';
- }}
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement