Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once 'config.php';
- // If the values are posted, insert them into the database.
- if (isset($_POST['username']) && isset($_POST['password'])){
- $username = $_POST['username'];
- $email = $_POST['email'];
- $password = $_POST['password'];
- $address = $_POST['address'];
- $hashed_password = password_hash($password, PASSWORD_DEFAULT);
- $query = "INSERT INTO `users` (username, password, email, address) VALUES ('$username', '$hashed_password', '$email', '$address')";
- $result = mysqli_query($link, $query);
- if($result){
- $smsg = "User Created Successfully.";
- }else{
- $fmsg ="User Registration Failed";
- }
- }
- ?>
- <html>
- <head>
- <!-- Latest compiled and minified CSS -->
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" >
- <!-- Optional theme -->
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" >
- <link rel="stylesheet" href="styles.css" >
- <!-- Latest compiled and minified JavaScript -->
- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
- </head>
- <body>
- <div class="container">
- <form class="form-signin" method="POST">
- <h2 class="form-signin-heading">Please Register</h2>
- <div class="input-group">
- <span class="input-group-addon" id="basic-addon1">@</span>
- <input type="text" name="username" class="form-control" placeholder="Username" required>
- </div>
- <label for="inputEmail" class="sr-only">Email address</label>
- <input type="email" name="email" id="inputEmail" class="form-control" placeholder="Email address" required autofocus>
- <label for="inputPassword" class="sr-only">Password</label>
- <input type="password" name="password" id="inputPassword" class="form-control" placeholder="Password" required>
- <label for="inputAddress" class="sr-only">Address</label>
- <input type="address" name="address" id="inputAddress" class="form-control" placeholder="Address" required>
- <button class="btn btn-lg btn-primary btn-block" type="submit">Register</button>
- </form>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement