Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.11 KB | None | 0 0
  1. <?php
  2. require_once('connect.php');
  3. if(isset($_POST) & !empty($_POST)){
  4.     $username = mysqli_real_escape_string($connection, $_POST['username']);
  5.     $email = mysqli_real_escape_string($connection, $_POST['email']);
  6.     $password = md5($_POST['password']);
  7.  
  8.     $sql = "INSERT INTO `login` (username, email, password) VALUES ('$username', '$email', '$password')";
  9.     $result = mysqli_query($connection, $sql);
  10.     if($result){
  11.         $smsg = "User Registration successfull";
  12.     }else{
  13.         $fmsg = "User registration failed";
  14.     }
  15. }
  16.  
  17.  
  18. ?>
  19. <!DOCTYPE html>
  20. <html>
  21. <head>
  22.     <title>User Registration in PHP & MySQL</title>
  23.     <!-- Latest compiled and minified CSS -->
  24.     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" >
  25.  
  26.     <!-- Latest compiled and minified JavaScript -->
  27.     <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" ></script>
  28.  
  29.     <link rel="stylesheet" type="text/css" href="styles.css">
  30. </head>
  31. <body>
  32. <div class="container">
  33.       <?php if(isset($smsg)){ ?><div class="alert alert-success" role="alert"> <?php echo $smsg; ?> </div><?php } ?>
  34.       <?php if(isset($fmsg)){ ?><div class="alert alert-danger" role="alert"> <?php echo $fmsg; ?> </div><?php } ?>
  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.         <button class="btn btn-lg btn-primary btn-block" type="submit">Register</button>
  46.         <a class="btn btn-lg btn-primary btn-block" href="login.php">Login</a>
  47.       </form>
  48. </div>
  49. </body>
  50. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement