Advertisement
Guest User

test123

a guest
Oct 15th, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.26 KB | None | 0 0
  1. <?php
  2.  
  3. error_reporting(-1);
  4.  
  5. $check = mysqli_query($conn,"SELECT * FROM korisnici WHERE username ='".$username."'");
  6. $usercheck = mysqli_num_rows($check);
  7.  
  8. if($usercheck != 0)
  9. {
  10.  
  11.     if (isset($_POST["btnreg"]))
  12.     {
  13.  
  14.         if(strlen($username) > 25 || strlen($username) < 3)
  15.         {
  16.             $error[] = "Username limit 25";
  17.         }
  18.  
  19.         if(strlen($password)>64||strlen($password)<8)
  20.         {
  21.             $error[] = "PASS limit 25";
  22.         }
  23.  
  24.         if($password != $repassword)
  25.         {
  26.            $error[] = "pass don match";
  27.         }
  28.  
  29.         if($email != $reemail)
  30.         {
  31.             $error[] = "email dont match";
  32.         }
  33.  
  34.         if (empty($error))
  35.         {
  36.             $d = 'INSERT INTO korisnici (username, password, email, maincategory, subcategory) VALUES ("'.$username.'", "'.$password.'", "'.$email.'", "'.$maincategories.'", "'.$subcategories.'")';
  37.             $query = mysqli_query($conn, $d);
  38.  
  39.             if ($query)
  40.             {
  41.                 echo "Registration sucessfully.";
  42.             }
  43.             else
  44.             {
  45.                 echo "There was a problem registering user.";
  46.             }
  47.         }
  48.     }
  49.  
  50. }
  51.  
  52. // test
  53. foreach ($error as $key)
  54. {
  55.     echo "ERROR: " . $key;
  56. }
  57.  
  58. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement