Advertisement
Guest User

Untitled

a guest
May 13th, 2016
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.59 KB | None | 0 0
  1.  
  2. <?php
  3. $polaczenie = mysql_connect('localhost', 'studentw_ustaw', 'Zo7GNa9521');
  4. if (!$polaczenie) {
  5.     die('Błąd połączenia: ' . mysql_error());
  6. } else {
  7.     echo '<p class="error">Połączenie niby działa! </p>';
  8. }
  9.  
  10. if (isset($_POST['submit'])) {
  11.     $username = mysqli_real_escape_string($polaczenie, trim($_POST['username']));
  12.     $password = mysqli_real_escape_string($polaczenie, trim($_POST['password']));
  13.     $password2 = mysqli_real_escape_string($polaczenie, trim($_POST['password2']));
  14.     echo '<p class="error"> Przed ifem z warunkami </p>';
  15.  
  16.     if (!empty($username)) {
  17.         echo ' Jest username';
  18.     }
  19.     if (!empty($password)) {
  20.         echo 'Jest haslo';
  21.     }
  22.     if (!empty($password2)) {
  23.         echo 'Jest drugie haslo ';
  24.     }
  25.     if (($password == $password2)) {
  26.         echo 'Hasła są te same';
  27.     }
  28. }
  29. mysqli_close($polaczenie);
  30. ?>
  31. <p> Wpisz nazwę i hasło, aby zarejestrować się na naszej stronie</p>
  32. <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
  33.     <fieldset>
  34.         <legend> Dane do rejestracji</legend>
  35.         <label for="username">Nazwa użytwkownika:</label>
  36.         <input type="text" id="username" name="username" value="<?php if (!empty($username)) echo $username; ?>"/> <br />
  37.         <label for="password">Hasło:</label>
  38.         <input type="password" id="password" name="password"/> <br />
  39.         <label for="password2">Powtórz hasło:</label>
  40.         <input type="password" id="password2" name="password2"/> <br />
  41.     </fieldset>
  42.     <input type="submit" value="Zarejestruj się" name="submit"/>
  43. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement