Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?PHP
- include_once("connection.php");
- if(isset($_POST['txtUsername']) && isset($_POST['txtPassword']) && isset($_POST['txtAgain'])) {
- $username = $_POST['txtUsername'];
- $password = $_POST['txtPassword'];
- $again = $_POST['txtAgain'];
- $duplicates = "SELECT username FROM registracije WHERE username='$username'";
- $duplicate = mysqli_query($duplicates);
- if (mysqli_num_rows($duplicate) > 0) {
- echo "username_exists";
- exit();
- } else {
- $insertRegistration = "INSERT INTO registracije (username, password)
- VALUES ('$username', '$password')";
- $result = mysqli_query($conn, $insertRegistration);
- if ($result) {
- echo "registration_successful";
- exit();
- }
- }
- }
- ?>
- <html>
- <head><title>Register</title></head>
- <body>
- <h1>Register</h1>
- <form action="<?PHP $_PHP_SELF ?>" method="POST">
- Username <input type="text" name="txtUsername" value="" /><br/>
- Password <input type="password" name="txtPassword" value="" /><br/>
- Password again<input type="password" name="txtAgain" value="" /><br/>
- <input type="submit" name="btnSubmit" value="Login"/>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement