Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.89 KB | None | 0 0
  1. <html>
  2.  
  3. <head>
  4.  
  5. </head>
  6.  
  7. <body>
  8.  
  9. <?php
  10.  
  11. if ($_POST["submit"])
  12.  
  13.     {
  14.  
  15.         if(!$_POST['name'] || !$_POST['email'] || !$_POST['username'] || !$_POST['password'])
  16.  
  17.         {
  18.  
  19.             echo "Nie wypełniono wszystkich pól!";
  20.  
  21.         } else {
  22.  
  23.             $name = addslashes($_POST['name']);
  24.  
  25.             $email = addslashes($_POST['email']);
  26.  
  27.             $username = addslashes($_POST['username']);
  28.  
  29.             $password = addslashes($_POST['password']);
  30.  
  31.            
  32.  
  33.         $conn = @mysql_connect ('localhost' , 'root', '') or die ("Błąd podczas łączenia.");
  34.  
  35.         mysql_select_db('form') or die ("Nie można połączyć z bazą.");
  36.  
  37.         $query = "INSERT INTO users('name', 'email', 'username', 'password') VALUES ('$name', '$email', '$username', md5('$password'))";
  38.  
  39.         $exec = mysql_query ($query) or die (mysql_error());
  40.  
  41.         echo "<h3> Rejestracja przebiegła prawidłowo! Witaj " .$name. " </h3>";
  42.  
  43.         }
  44.  
  45.     }
  46.  
  47. ?>
  48.  
  49. </body>
  50.  
  51. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement