Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.22 KB | None | 0 0
  1. <?php
  2. require_once 'config.php';
  3. // If the values are posted, insert them into the database.
  4.    if (isset($_POST['username']) && isset($_POST['password'])){
  5.        $username = $_POST['username'];
  6.        $email = $_POST['email'];
  7.        $password = $_POST['password'];
  8.        $address = $_POST['address'];
  9.        $hashed_password = password_hash($password, PASSWORD_DEFAULT);
  10.  
  11.        $query = "INSERT INTO `users` (username, password, email, address) VALUES ('$username', '$hashed_password', '$email', '$address')";
  12.        $result = mysqli_query($link, $query);
  13.        if($result){
  14.            $smsg = "User Created Successfully.";
  15.        }else{
  16.            $fmsg ="User Registration Failed";
  17.        }
  18.    }
  19.  ?>
  20. <html>
  21. <head>
  22.   <!-- Latest compiled and minified CSS -->
  23. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" >
  24.  
  25. <!-- Optional theme -->
  26. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" >
  27.  
  28. <link rel="stylesheet" href="styles.css" >
  29.  
  30. <!-- Latest compiled and minified JavaScript -->
  31. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  32. </head>
  33. <body>
  34. <div class="container">
  35.       <form class="form-signin" method="POST">
  36.         <h2 class="form-signin-heading">Please Register</h2>
  37.         <div class="input-group">
  38.       <span class="input-group-addon" id="basic-addon1">@</span>
  39.       <input type="text" name="username" class="form-control" placeholder="Username" required>
  40.     </div>
  41.         <label for="inputEmail" class="sr-only">Email address</label>
  42.         <input type="email" name="email" id="inputEmail" class="form-control" placeholder="Email address" required autofocus>
  43.         <label for="inputPassword" class="sr-only">Password</label>
  44.         <input type="password" name="password" id="inputPassword" class="form-control" placeholder="Password" required>
  45.         <label for="inputAddress" class="sr-only">Address</label>
  46.         <input type="address" name="address" id="inputAddress" class="form-control" placeholder="Address" required>
  47.         <button class="btn btn-lg btn-primary btn-block" type="submit">Register</button>
  48.       </form>
  49. </div>
  50. </body>
  51. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement